[mythtv] [mythtv-commits] mythtv/master commit: 2b3de68dc by Mark Kendall (mark-kendall)
Jean-Yves Avenard
jyavenard at gmail.com
Mon Apr 18 00:23:49 UTC 2011
On 18 April 2011 09:35, Jean-Yves Avenard <jyavenard at gmail.com> wrote:
> On 18 April 2011 05:56, Michael T. Dean <mtdean at thirdcontact.com> wrote:
>
>> Saying to revert the commit is saying it has absolutely no value and is
>> completely wrong and that MythTV was--and will be--better off without
>> any part of the changes. Having seen Mark's work in general, I find
>> that hard to believe--hard enough to believe that I would expect someone
>> who understands exactly what's wrong with the current code would be able
More background..
from FFmpeg:
"Some decoders may support multiple frames in a single AVPacket, such
decoders would then just decode the first frame. In this case,
avcodec_decode_audio3 has to be called again with an AVPacket that
contains the remaining data in order to decode the second frame etc.
If no frame could be outputted, frame_size_ptr is zero. Otherwise, it
is the decompressed frame size in bytes."
so here is the patch that's a replacement of the earlier code:
diff --git a/mythplugins/mythmusic/mythmusic/avfdecoder.cpp
b/mythplugins/mythmusic/mythmusic/avfdecoder.cpp
index 8ac4e01..bf1fd42 100644
--- a/mythplugins/mythmusic/mythmusic/avfdecoder.cpp
+++ b/mythplugins/mythmusic/mythmusic/avfdecoder.cpp
@@ -371,11 +371,9 @@ void avfDecoder::run()
if (!inited)
return;
- AVPacket pkt;
+ AVPacket pkt, tmp_pkt;
char *s;
int data_size, dec_len;
- long len;
- const uint8_t *ptr;
uint fill, total;
// account for possible frame expansion in aobase (upmix, float conv)
uint thresh = bks * 12 / AudioOutputSettings::SampleSize(m_sampleFmt);
@@ -418,19 +416,19 @@ void avfDecoder::run()
break;
}
- ptr = pkt.data;
- len = pkt.size;
+ tmp_pkt.data = pkt.data;
+ tmp_pkt.size = pkt.size;
- while (len > 0 && !finish && !user_stop && seekTime <= 0.0)
+ while (tmp_pkt.size > 0 && !finish &&
+ !user_stop && seekTime <= 0.0)
{
// Decode the stream to the output codec
// m_samples is the output buffer
// data_size is the size in bytes of the frame
- // ptr is the input buffer
- // len is the size of the input buffer
+ // tmp_pkt is the input buffer
data_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
dec_len = avcodec_decode_audio3(m_audioDec, m_samples,
- &data_size, &pkt);
+ &data_size, &tmp_pkt);
if (dec_len < 0)
break;
@@ -440,8 +438,8 @@ void avfDecoder::run()
// Increment the output pointer and count
output_at += data_size;
- len -= dec_len;
- ptr += dec_len;
+ tmp_pkt.size -= dec_len;
+ tmp_pkt.data += dec_len;
}
av_free_packet(&pkt);
More information about the mythtv-dev
mailing list