From 5e8d2b5a9509adaae3e6a2ebc6145e45d69770db Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sun, 25 May 2008 19:58:57 +0000 Subject: id3v2 support for streams git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@384 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/mad/decoder_mad.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/plugins/Input/mad/decoder_mad.cpp') diff --git a/src/plugins/Input/mad/decoder_mad.cpp b/src/plugins/Input/mad/decoder_mad.cpp index ef3b73b4e..1a58dc1c5 100644 --- a/src/plugins/Input/mad/decoder_mad.cpp +++ b/src/plugins/Input/mad/decoder_mad.cpp @@ -1,6 +1,7 @@ #include #include "decoder_mad.h" +#include "tagextractor.h" #include #include #include @@ -8,7 +9,7 @@ #include #include -# define XING_MAGIC (('X' << 24) | ('i' << 16) | ('n' << 8) | 'g') +# define XING_MAGIC (('X' << 24) | ('i' << 16) | ('n' << 8) | 'g') DecoderMAD::DecoderMAD(QObject *parent, DecoderFactory *d, QIODevice *i, Output *o) @@ -100,6 +101,14 @@ bool DecoderMAD::initialize() } } + if (input()->isSequential ()) //for streams only + { + TagExtractor extractor(input()); + FileTag tag = extractor.id3v2tag(); + if (!tag.isEmpty()) + dispatch(extractor.id3v2tag()); + } + mad_stream_init(&stream); mad_frame_init(&frame); mad_synth_init(&synth); @@ -118,7 +127,7 @@ bool DecoderMAD::initialize() void DecoderMAD::deinit() { - if(!inited) + if (!inited) return; mad_synth_finish(&synth); @@ -232,10 +241,10 @@ bool DecoderMAD::findHeader() if (mad_frame_decode(&frame, &stream) != -1) done = true; else if (!MAD_RECOVERABLE(stream.error)) - { - qWarning("DecoderMAD: Can't decode frame"); - break; - } + { + qWarning("DecoderMAD: Can't decode frame"); + break; + } count++; } @@ -344,7 +353,7 @@ void DecoderMAD::run() mutex()->unlock(); return; } - + DecoderState::Type stat = DecoderState::Decoding; @@ -433,7 +442,7 @@ void DecoderMAD::run() break; } - if(skip_frames) + if (skip_frames) { skip_frames-- ; mutex()->unlock(); -- cgit v1.2.3-13-gbd6f