diff options
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | mg_db.c | 1 | ||||
-rw-r--r-- | vdr_decoder.c | 101 | ||||
-rw-r--r-- | vdr_decoder_flac.c | 34 | ||||
-rw-r--r-- | vdr_decoder_mp3.c | 5 | ||||
-rw-r--r-- | vdr_decoder_ogg.c | 11 | ||||
-rw-r--r-- | vdr_player.c | 26 |
7 files changed, 84 insertions, 101 deletions
@@ -47,10 +47,11 @@ but your mileage may vary. In addition, the following pieces of software are req - libtag (for ID3 tag reading/writing) (Debian package libtag1-dev or http://developer.kde.org/~wheeler/taglib.html) - - optionally libvorbis and libvorbisfile - (Debian packages or + - optionally libvorbis and libvorbisfile to replay OGG Vorbis files + (Debian packages libvorbis-dev or http://www.xiph.org/ogg/vorbis/) - + - optionally libFLAC++ to replay FLAC files + (Debian package libflac++-dev or sources from flac.sourceforge.net) The developer versions are needed because their headers are required for compilation. The server need not be on the same machine as the VDR. Also, music tracks can reside somewhere else, if they are available through a remote filesystem (NFS, Samba). However, in this case you should @@ -985,6 +985,7 @@ bool mgSelection::leave () { if (m_level < 1) return false; + order[m_level]->set ("",EMPTY); order[--m_level]->set ("",EMPTY); clearCache(); if (!m_fall_through) diff --git a/vdr_decoder.c b/vdr_decoder.c index 9a7bb7c..d5e8004 100644 --- a/vdr_decoder.c +++ b/vdr_decoder.c @@ -21,6 +21,7 @@ #include <sys/stat.h> #include <sys/vfs.h> +#include "vdr_setup.h" #include "vdr_decoder.h" #include "vdr_decoder_mp3.h" @@ -43,34 +44,33 @@ mgMediaType mgDecoders::getMediaType (std::string s) { mgMediaType mt = MT_UNKNOWN; -// TODO: currently handles only mp3. LVW - char * - f = (char *) s.c_str (); - char * - p = f + strlen (f) - 1; // point to the end + char * + f = (char *) s.c_str (); + char * + p = f + strlen (f) - 1; // point to the end - while (p >= f && *p != '.') - --p; + while (p >= f && *p != '.') + --p; - if (!strcmp (p, ".mp3")) + if (!strcmp (p, ".mp3")) { - mt = MT_MP3; + mt = MT_MP3; } - else + else { - if (!strcmp (p, ".ogg")) + if (!strcmp (p, ".ogg")) { - mt = MT_OGG; + mt = MT_OGG; } - else - { - if (!strcmp (p, ".flac")) - { - mt = MT_FLAC; - } - } + else + { + if (!strcmp (p, ".flac")) + { + mt = MT_FLAC; + } + } } - return mt; + return mt; } @@ -79,54 +79,55 @@ mgDecoders::findDecoder (mgContentItem * item) { mgDecoder *decoder = 0; - std::string filename = item->getSourceFile (); + std::string filename = the_setup.getFilename( item->getSourceFile () ); struct stat st; if (stat (filename.c_str (), &st)) { - esyslog ("ERROR: no valid decoder found for %s", filename.c_str ()); + esyslog ("ERROR: cannot stat %s. Meaning not found, not a valid file, or no access rights", filename.c_str ()); return 0; } + switch (getMediaType (filename)) - { - case MT_MP3: { - decoder = new mgMP3Decoder (item); - } break; + case MT_MP3: + { + decoder = new mgMP3Decoder (item); + } break; #ifdef HAVE_VORBISFILE - case MT_OGG: - { - decoder = new mgOggDecoder (item); - } break; + case MT_OGG: + { + decoder = new mgOggDecoder (item); + } break; #endif #ifdef HAVE_FLAC - case MT_FLAC: - { - decoder = new mgFlacDecoder( item ); - } break; + case MT_FLAC: + { + decoder = new mgFlacDecoder( item ); + } break; #endif -/* - case MT_MP3_STREAM: decoder = new mgMP3StreamDecoder(full); break; - #ifdef HAVE_SNDFILE - case MT_SND: decoder = new cSndDecoder(full); break; - #endif - */ - default: + /* + case MT_MP3_STREAM: decoder = new mgMP3StreamDecoder(full); break; + #ifdef HAVE_SNDFILE + case MT_SND: decoder = new cSndDecoder(full); break; + #endif + */ + default: { - esyslog ("ERROR: unknown media type"); + esyslog ("ERROR: unknown media type "); } break; - } - + } + if (decoder && !decoder->valid ()) - { -// no decoder found or decoder doesn't match - - delete decoder; // might be carried out on NULL pointer! + { + // no decoder found or decoder doesn't match + + delete decoder; // might be carried out on NULL pointer decoder = 0; - + esyslog ("ERROR: no valid decoder found for %s", filename.c_str ()); - } + } return decoder; } diff --git a/vdr_decoder_flac.c b/vdr_decoder_flac.c index 1a66e8d..c640205 100644 --- a/vdr_decoder_flac.c +++ b/vdr_decoder_flac.c @@ -11,7 +11,9 @@ #ifdef HAVE_FLAC #define DEBUG +#include "vdr_setup.h" #include "vdr_decoder_flac.h" + #include "mg_tools.h" #include "mg_db.h" @@ -32,8 +34,8 @@ mgFlacDecoder::mgFlacDecoder( mgContentItem *item ) { mgLog lg( "mgFlacDecoder::mgFlacDecoder" ); - m_filename = item->getSourceFile(); - // m_filename = "/test.flac"; + m_filename = the_setup.getFilename( item->getSourceFile () ); + // m_filename = item->getSourceFile(); m_pcm = 0; m_reservoir = 0; @@ -81,14 +83,7 @@ bool mgFlacDecoder::initialize() m_reservoir[0] = new FLAC__int32[MAX_RES_SIZE]; m_reservoir[1] = new FLAC__int32[MAX_RES_SIZE]; - FLAC::Decoder::File::State d = init(); // TODO check this? - - cout << "Status of decoder: " << string( d.as_cstring() ) << endl; - FLAC::Decoder::SeekableStream::State ssd = get_seekable_stream_decoder_state(); - cout << "Status of seekable stream decoder: " << string( ssd.as_cstring() ) << endl; - FLAC::Decoder::Stream::State sd = get_stream_decoder_state(); - cout << "Status of stream decoder: " << string( sd.as_cstring() ) << endl; - // set state accordingly + FLAC::Decoder::File::State d = init(); // TODO: check this process_until_end_of_metadata(); // basically just skip metadata @@ -120,15 +115,6 @@ bool mgFlacDecoder::start() bool res = false; lock(true); - /* - FLAC::Decoder::File::State d = get_state(); - cout << "Status of decoder: " << string( d.as_cstring() ) << endl; - FLAC::Decoder::SeekableStream::State ssd = get_seekable_stream_decoder_state(); - cout << "Status of seekable stream decoder: " << string( ssd.as_cstring() ) << endl; - FLAC::Decoder::Stream::State sd = get_stream_decoder_state(); - cout << "Status of stream decoder: " << string( sd.as_cstring() ) << endl; - */ - // can FLAC handle more than 2 channels anyway? if( m_item->getChannels() <= 2 ) { @@ -255,11 +241,6 @@ struct mgDecode *mgFlacDecoder::decode() } m_reservoir_count -= n; - FLAC::Decoder::File::State d = get_state(); - FLAC::Decoder::SeekableStream::State ssd = get_seekable_stream_decoder_state(); - FLAC::Decoder::Stream::State sd = get_stream_decoder_state(); - // if any states are not okay, abort and override m_decode_state - // and return, indicating that playing will continue (unless an error has occurred) return done( m_decode_status ); } @@ -271,8 +252,7 @@ struct mgDecode *mgFlacDecoder::decode() mgFlacDecoder::write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) { - mgLog lg( "mgFlacDecoder::write_callback" ); - ::FLAC__StreamDecoderWriteStatus retval; + // mgLog lg( "mgFlacDecoder::write_callback" ); // add decoded buffer to reservoir m_len_decoded = frame->header.blocksize; @@ -352,7 +332,7 @@ void mgFlacDecoder::error_callback( ::FLAC__StreamDecoderErrorStatus status ) } } - cout << "Error occured: " << m_error << endl; + // cout << "Error occured: " << m_error << endl; m_decode_status = dsError; } diff --git a/vdr_decoder_mp3.c b/vdr_decoder_mp3.c index d914dcd..754ab39 100644 --- a/vdr_decoder_mp3.c +++ b/vdr_decoder_mp3.c @@ -26,6 +26,7 @@ #include "vdr_config.h" #include "vdr_decoder_mp3.h" #include "vdr_stream.h" +#include "vdr_setup.h" #include "mg_tools.h" #include "mg_db.h" @@ -58,7 +59,9 @@ mgMP3Decoder::mgMP3Decoder (mgContentItem * item, bool preinit):mgDecoder { m_stream = 0; m_isStream = false; - m_filename = item->getSourceFile (); + + m_filename = the_setup.getFilename( item->getSourceFile () ); + // m_filename = item->getSourceFile (); if (preinit) { diff --git a/vdr_decoder_ogg.c b/vdr_decoder_ogg.c index d720c81..24d253d 100644 --- a/vdr_decoder_ogg.c +++ b/vdr_decoder_ogg.c @@ -19,6 +19,8 @@ #include <stdlib.h> #include <stdio.h> +#include "vdr_setup.h" + #include "mg_db.h" // --- mgOggFile ---------------------------------------------------------------- @@ -237,10 +239,11 @@ mgOggFile::stream (short *buffer, int samples) mgOggDecoder::mgOggDecoder (mgContentItem * item):mgDecoder (item) { - m_filename = item->getSourceFile (); - m_file = new mgOggFile (m_filename); - m_pcm = 0; - init (); + // m_filename = item->getSourceFile (); + m_filename = the_setup.getFilename( item->getSourceFile () ); + m_file = new mgOggFile (m_filename); + m_pcm = 0; + init (); } diff --git a/vdr_player.c b/vdr_player.c index 56828ca..232e0e5 100644 --- a/vdr_player.c +++ b/vdr_player.c @@ -412,24 +412,18 @@ mgPCMPlayer::Action (void) if (m_playing) { - std::string filename = the_setup.getFilename( m_playing->getSourceFile () ); - mgDebug( 1, "mgPCMPlayer::Action: music file is %s", filename.c_str() ); - if ((m_decoder = mgDecoders::findDecoder (m_playing)) - && m_decoder->start ()) + if ((m_decoder = mgDecoders::findDecoder (m_playing)) + && m_decoder->start ()) { - levelgood = true; - haslevel = false; - - scale.Init (); - level.Init (); - - m_state = msDecode; - mgDebug(1,"found a decoder for %s",filename.c_str()); - - break; + levelgood = true; + haslevel = false; + + scale.Init (); + level.Init (); + + m_state = msDecode; + break; } - else - mgWarning("Cannot find a decoder for %s",filename.c_str()); } m_state = msEof; } |