[FFmpeg-devel] [PATCHv5 1/3] ogg: allow streams to update metadata

Clément Bœsch u at pkh.me
Mon Jan 13 07:52:11 CET 2014


On Sun, Jan 12, 2014 at 10:19:26PM -0500, Ben Boeckel wrote:
> Signed-off-by: Ben Boeckel <mathstuf at gmail.com>
> ---
>  libavformat/oggdec.c | 26 +++++++++++++++++++++-----
>  libavformat/oggdec.h |  2 ++
>  2 files changed, 23 insertions(+), 5 deletions(-)
> 
> diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
> index efb8f04..9cfbe7a 100644
> --- a/libavformat/oggdec.c
> +++ b/libavformat/oggdec.c
> @@ -78,6 +78,8 @@ static int ogg_save(AVFormatContext *s)
>          struct ogg_stream *os = ogg->streams + i;
>          os->buf = av_mallocz(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
>          memcpy(os->buf, ost->streams[i].buf, os->bufpos);
> +        os->new_metadata      = NULL;
> +        os->new_metadata_size = 0;
>      }
>  
>      ogg->state = ost;
> @@ -144,6 +146,8 @@ static int ogg_reset(AVFormatContext *s)
>              os->lastpts = 0;
>          }
>          os->end_trimming = 0;
> +        av_freep(&os->new_metadata);
> +        os->new_metadata_size = 0;
>      }
>  
>      ogg->page_pos = -1;
> @@ -245,11 +249,13 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial)
>      ogg->streams = os;
>      os           = ogg->streams + idx;
>      memset(os, 0, sizeof(*os));
> -    os->serial        = serial;
> -    os->bufsize       = DECODER_BUFFER_SIZE;
> -    os->buf           = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
> -    os->header        = -1;
> -    os->start_granule = OGG_NOGRANULE_VALUE;
> +    os->serial            = serial;
> +    os->bufsize           = DECODER_BUFFER_SIZE;
> +    os->buf               = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
> +    os->header            = -1;
> +    os->start_granule     = OGG_NOGRANULE_VALUE;
> +    os->new_metadata      = NULL;
> +    os->new_metadata_size = 0;

This chunk is not needed, it's handled my the memset above

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140113/8ba39028/attachment.asc>


More information about the ffmpeg-devel mailing list