[FFmpeg-devel] [patch][GSoC]WTV muxer (2_wtvenc.patch, 3_add_wtv_muxer.patch)

Michael Niedermayer michaelni at gmx.at
Fri Sep 9 04:38:12 CEST 2011


Hi

On Tue, Aug 23, 2011 at 09:37:35PM +0800, zhentan feng wrote:
[...]
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index a9fa117..c11d744 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -224,7 +224,7 @@ void av_register_all(void)
>      REGISTER_MUXER    (WEBM, webm);
>      REGISTER_DEMUXER  (WSAUD, wsaud);
>      REGISTER_DEMUXER  (WSVQA, wsvqa);
> -    REGISTER_DEMUXER  (WTV, wtv);
> +    REGISTER_MUXDEMUX (WTV, wtv);    

trailing whitespace

[...]
> +typedef struct {
> +    int64_t timeline_start_pos;
> +    WtvFile file[WTV_FILES];
> +    int64_t serial;         // chunk serial number
> +    int64_t last_chunk_pos; // last chunk position

not doxygen compatible comments


[...]
> +/**
> + * Write chunk header. If header chunk (0x80000000 set) then add to list of header chunks
> + */
> +static void write_chunk_header(AVFormatContext *s, const ff_asf_guid *guid, int length, int stream_id)
> +{
> +    WtvContext *wctx = s->priv_data;
> +    AVIOContext *pb = s->pb;
> +
> +    wctx->last_chunk_pos = avio_tell(pb) - wctx->timeline_start_pos;
> +    put_guid(pb, guid);
> +    avio_wl32(pb, 32 + length);
> +    avio_wl32(pb, stream_id);
> +    avio_wl64(pb, wctx->serial);
> +
> +    if ((stream_id & 0x80000000) && guid != &index_guid) {

please add a check here that makes sure nb_index is not too large
i dont know if it can become too large but i think its safer to
check than to risk overwriting memory


> +        WtvChunkEntry *t = wctx->index + wctx->nb_index;
> +        t->pos       = wctx->last_chunk_pos;
> +        t->serial    = wctx->serial;
> +        t->guid      = guid;
> +        t->stream_id = stream_id & 0x3FFFFFFF;
> +        wctx->nb_index++;
> +    }
> +}
> +
> +static void write_chunk_header2(AVFormatContext *s, const ff_asf_guid *guid, int stream_id)
> +{
> +    WtvContext *wctx = s->priv_data;
> +    AVIOContext *pb = s->pb;
> +
> +    int64_t last_chunk_pos = wctx->last_chunk_pos;
> +    write_chunk_header(s, guid, 0, stream_id); // lenth updated later

length


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110909/6dbd25f6/attachment.asc>


More information about the ffmpeg-devel mailing list