00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <iostream>
00004 #include <string>
00005 #include <qobject.h>
00006 #include <qiodevice.h>
00007 #include <qdir.h>
00008 #include <qfile.h>
00009 using namespace std;
00010
00011 #include <mythtv/mythconfig.h>
00012 #include "cddecoder.h"
00013 #include "constants.h"
00014 #include <mythtv/audiooutput.h>
00015 #include "metadata.h"
00016
00017 #include <mythtv/mythcontext.h>
00018 #include <mythtv/mythmediamonitor.h>
00019 #include <mythtv/httpcomms.h>
00020
00021 CdDecoder::CdDecoder(const QString &file, DecoderFactory *d, QIODevice *i,
00022 AudioOutput *o)
00023 : Decoder(d, i, o)
00024 {
00025 filename = file;
00026 inited = FALSE;
00027 }
00028
00029 CdDecoder::~CdDecoder(void)
00030 {
00031 if (inited)
00032 deinit();
00033 }
00034
00035 bool CdDecoder::initialize()
00036 {
00037 inited = true;
00038 return true;
00039 }
00040
00041 void CdDecoder::seek(double pos)
00042 {
00043 (void)pos;
00044 }
00045
00046 void CdDecoder::stop()
00047 {
00048 }
00049
00050 void CdDecoder::run()
00051 {
00052 }
00053
00054 void CdDecoder::flush(bool final)
00055 {
00056 (void)final;
00057 }
00058
00059 void CdDecoder::deinit()
00060 {
00061 inited = false;
00062 }
00063
00064 int CdDecoder::getNumTracks(void)
00065 {
00066 return 0;
00067 }
00068
00069 int CdDecoder::getNumCDAudioTracks(void)
00070 {
00071 return 0;
00072 }
00073
00074 Metadata* CdDecoder::getMetadata(int track)
00075 {
00076 return new Metadata();
00077 }
00078
00079 Metadata *CdDecoder::getLastMetadata()
00080 {
00081 return new Metadata();
00082 }
00083
00084 Metadata *CdDecoder::getMetadata()
00085 {
00086 return new Metadata();
00087 }
00088
00089 void CdDecoder::commitMetadata(Metadata *mdata)
00090 {
00091 (void)mdata;
00092 }
00093
00094 bool CdDecoderFactory::supports(const QString &source) const
00095 {
00096 return (source.right(extension().length()).lower() == extension());
00097 }
00098
00099 const QString &CdDecoderFactory::extension() const
00100 {
00101 static QString ext(".cda");
00102 return ext;
00103 }
00104
00105
00106 const QString &CdDecoderFactory::description() const
00107 {
00108 static QString desc(QObject::tr("Windows CD parser"));
00109 return desc;
00110 }
00111
00112 Decoder *CdDecoderFactory::create(const QString &file, QIODevice *input,
00113 AudioOutput *output, bool deletable)
00114 {
00115 if (deletable)
00116 return new CdDecoder(file, this, input, output);
00117
00118 static CdDecoder *decoder = 0;
00119 if (! decoder) {
00120 decoder = new CdDecoder(file, this, input, output);
00121 } else {
00122 decoder->setInput(input);
00123 decoder->setFilename(file);
00124 decoder->setOutput(output);
00125 }
00126
00127 return decoder;
00128 }