From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- mpeglib/lib/input/cddaInputStream.cpp | 225 ++++++++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 mpeglib/lib/input/cddaInputStream.cpp (limited to 'mpeglib/lib/input/cddaInputStream.cpp') diff --git a/mpeglib/lib/input/cddaInputStream.cpp b/mpeglib/lib/input/cddaInputStream.cpp new file mode 100644 index 00000000..9bc8f5f2 --- /dev/null +++ b/mpeglib/lib/input/cddaInputStream.cpp @@ -0,0 +1,225 @@ +/* + cdda input class based on cdparanoia + Copyright (C) 2000 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file COPYRIGHT in this package + + */ + + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef CDDA_PARANOIA + +#include + +using namespace std; + +#include "cddaInputStream.h" +#include "inputDetector.h" + + +void paranoiaCallback(long, int) { + //cout << "long:"<tracks; + for (int i = 1; i <= trackCount; i++) { + if (IS_AUDIO(drive, i)) { + printf("track%02d.cda\n", i); + } else { + printf("no audio:%d\n",i); + } + } + + paranoia = paranoia_init(drive); + if (paranoia == NULL) { + cout << "paranoia init failed"< initialized! + + int paranoiaLevel = PARANOIA_MODE_FULL ^ PARANOIA_MODE_NEVERSKIP; + paranoia_modeset(paranoia, paranoiaLevel); + cdda_verbose_set(drive, CDDA_MESSAGE_PRINTIT, CDDA_MESSAGE_PRINTIT); + paranoia_seek(paranoia, firstSector, SEEK_SET); + + return true; +} + + +void CDDAInputStream::close() { + if (isOpen() == false) { + return; + } + cdda_close(drive); + drive=NULL; + if (paranoia != NULL) { + paranoia_free(paranoia); + paranoia = 0; + } + if (device != NULL) { + delete device; + device=NULL; + } +} + + +int CDDAInputStream::isOpen() { + return (drive != NULL); +} + + +int CDDAInputStream::eof() { + if (isOpen()==false) { + return true; + } + if (currentSector >= lastSector) { + return true; + } + return false; +} + + +int CDDAInputStream::read(char* dest,int len) { + if (len != 2*CD_FRAMESIZE_RAW) { + cout << "len must be 2*CD_FRAMESIZE_RAW"<