[FFmpeg-devel] [PATCH] fix raw FLAC muxer extradata handling

Michael Niedermayer michaelni
Fri Feb 13 01:44:02 CET 2009


On Thu, Feb 12, 2009 at 07:26:33PM -0500, Justin Ruggles wrote:
> Hi,
> 
> This patch makes it so the raw FLAC muxer supports either full header or
> STREAMINFO-only extradata.  It fixes support for converting FLAC-in-MKV
> to raw FLAC using -acodec copy.
> 
> -Justin
> 

> Index: libavformat/raw.c
> ===================================================================
> --- libavformat/raw.c	(revision 17188)
> +++ libavformat/raw.c	(working copy)
> @@ -24,6 +24,7 @@
>  #include "libavcodec/ac3_parser.h"
>  #include "libavcodec/bitstream.h"
>  #include "libavcodec/bytestream.h"
> +#include "libavcodec/flac.h"
>  #include "avformat.h"
>  #include "raw.h"
>  #include "id3v2.h"
> @@ -37,8 +38,12 @@
>      };
>      uint8_t *streaminfo = s->streams[0]->codec->extradata;
>      int len = s->streams[0]->codec->extradata_size;
> -    if(streaminfo != NULL && len > 0) {
> -        put_buffer(s->pb, header, 8);
> +    if (streaminfo != NULL && len >= FLAC_STREAMINFO_SIZE) {
> +        if (len == FLAC_STREAMINFO_SIZE) {
> +            put_buffer(s->pb, header, 8);

> +        } else if (AV_RL32(streaminfo) != MKTAG('f','L','a','C') || len < 8+FLAC_STREAMINFO_SIZE) {
> +            return 0;

for which case is this?

also the whole does not look particularely robust, i mean an extra byte at the
end will make it fail silently, it would be different if there was an error
message ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090213/f6f35d23/attachment.pgp>



More information about the ffmpeg-devel mailing list