[FFmpeg-devel] [PATCH] Detect DNET/byte-swapped AC-3 and support decoding it directly.
Michael Niedermayer
michaelni
Sat Mar 5 22:10:52 CET 2011
On Sat, Mar 05, 2011 at 05:20:23PM +0100, Reimar D?ffinger wrote:
> On Sat, Mar 05, 2011 at 11:10:24AM -0500, Justin Ruggles wrote:
> > This will only work if avctx->error_recognition >= FF_ER_CAREFUL because
> > otherwise s->input_buffer is not allocated and the original buffer is
> > used directly.
> >
> > We could move the allocation from ac3_decode_init() to
> > ac3_decode_frame() based on both error_recognition and detection of
> > byte-swapped header.
>
> I'll send an updated patch, however I think that code is completely
> broken.
yep its broken in many ways, for example it should be changed like this
independant of any oppinion on error_recognition
- if (avctx->error_recognition >= FF_ER_CAREFUL) {
- s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!s->input_buffer)
- return AVERROR(ENOMEM);
- }
[...]
+ if (avctx->error_recognition >= FF_ER_CAREFUL) {
if (s->input_buffer) {
+ s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!s->input_buffer)
+ return AVERROR(ENOMEM);
+ }
because it is the error_recognition and soon the bytes_swaped condition that
decides the path, not the input buffer existence
error_recognition might be changed at runtime and the buffer wont disapear
when it does
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110305/5e5fbce3/attachment.pgp>
More information about the ffmpeg-devel
mailing list