[FFmpeg-devel] [PATCH] oggenc: Write stream metadata if available

Paul B Mahol onemda at gmail.com
Thu Jul 18 12:59:09 CEST 2013


On 7/18/13, James Almer <jamrial at gmail.com> wrote:
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavformat/oggenc.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
> index 1255364..a0bc1cf 100644
> --- a/libavformat/oggenc.c
> +++ b/libavformat/oggenc.c
> @@ -447,11 +447,13 @@ static int ogg_write_header(AVFormatContext *s)
>              } while (j < i);
>          oggstream->serial_num = serial_num;
>
> +        av_dict_copy(&st->metadata, s->metadata, 0);
> +

Why?

>          st->priv_data = oggstream;
>          if (st->codec->codec_id == AV_CODEC_ID_FLAC) {
>              int err = ogg_build_flac_headers(st->codec, oggstream,
>                                               st->codec->flags &
> CODEC_FLAG_BITEXACT,
> -                                             &s->metadata);
> +                                             &st->metadata);
>              if (err) {
>                  av_log(s, AV_LOG_ERROR, "Error writing FLAC headers\n");
>                  av_freep(&st->priv_data);
> @@ -460,7 +462,7 @@ static int ogg_write_header(AVFormatContext *s)
>          } else if (st->codec->codec_id == AV_CODEC_ID_SPEEX) {
>              int err = ogg_build_speex_headers(st->codec, oggstream,
>                                                st->codec->flags &
> CODEC_FLAG_BITEXACT,
> -                                              &s->metadata);
> +                                              &st->metadata);
>              if (err) {
>                  av_log(s, AV_LOG_ERROR, "Error writing Speex headers\n");
>                  av_freep(&st->priv_data);
> @@ -469,7 +471,7 @@ static int ogg_write_header(AVFormatContext *s)
>          } else if (st->codec->codec_id == AV_CODEC_ID_OPUS) {
>              int err = ogg_build_opus_headers(st->codec, oggstream,
>                                               st->codec->flags &
> CODEC_FLAG_BITEXACT,
> -                                             &s->metadata);
> +                                             &st->metadata);
>              if (err) {
>                  av_log(s, AV_LOG_ERROR, "Error writing Opus headers\n");
>                  av_freep(&st->priv_data);
> @@ -490,7 +492,7 @@ static int ogg_write_header(AVFormatContext *s)
>              }
>
>              p = ogg_write_vorbiscomment(7, st->codec->flags &
> CODEC_FLAG_BITEXACT,
> -                                        &oggstream->header_len[1],
> &s->metadata,
> +                                        &oggstream->header_len[1],
> &st->metadata,
>                                          framing_bit);
>              oggstream->header[1] = p;
>              if (!p)
> --
> 1.8.1.5
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list