[FFmpeg-devel] hls: Fix the failure to write out non-default metadata into segment(<-) header
Paul B Mahol
onemda at gmail.com
Fri Feb 22 10:40:33 CET 2013
On 2/22/13, Colin NG <colin_ng at hotmail.com> wrote:
>
>
> Dear all,
>
> I attached a patch for bug (ticket #2230). Would you review if they are
> good?
>
> Thanks.
>
> Colin
> From a23cfd938cfac4fc68cf84b06d9b29555775624f Mon Sep 17 00:00:00 2001
> From: Colin Ng <colin_ng at hotmail.com>
> Date: Thu, 21 Feb 2013 16:33:47 -0800
> Subject: hls: Fix the failure to write out non-default metadata into segment
> header
>
> ---
> libavformat/segment.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
> mode change 100644 => 100755 libavformat/segment.c
>
> diff --git a/libavformat/segment.c b/libavformat/segment.c
> old mode 100644
> new mode 100755
> index 13d8c43..f6f397c
> --- a/libavformat/segment.c
> +++ b/libavformat/segment.c
> @@ -174,11 +174,23 @@ static int segment_start(AVFormatContext *s, int write_header)
> int err = 0;
>
> if (write_header) {
> +
> + AVDictionary *tmp = NULL;
> +
> + if (av_dict_count(s->metadata) > 0) {
> + av_dict_copy(&tmp, s->metadata, 0);
> + } else if (av_dict_count(oc->metadata) > 0) {
> + av_dict_copy(&tmp, oc->metadata, 0);
> + }
> +
> avformat_free_context(oc);
> seg->avf = NULL;
> if ((err = segment_mux_init(s)) < 0)
> return err;
> +
> oc = seg->avf;
> +
> + av_dict_copy(&oc->metadata, tmp, 0);
memory leak
> }
>
> seg->segment_idx++;
> @@ -595,6 +607,8 @@ static int seg_write_header(AVFormatContext *s)
> goto fail;
> }
>
> + av_dict_copy(&oc->metadata, s->metadata, 0);
> +
> if ((ret = avformat_write_header(oc, NULL)) < 0) {
> avio_close(oc->pb);
> goto fail;
> --
> 1.7.10.4
>
More information about the ffmpeg-devel
mailing list