Commit ac8e70d7 authored by James Almer's avatar James Almer Committed by Michael Niedermayer

oggenc: Write stream metadata if available

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 7651c0e4
...@@ -447,11 +447,13 @@ static int ogg_write_header(AVFormatContext *s) ...@@ -447,11 +447,13 @@ static int ogg_write_header(AVFormatContext *s)
} while (j < i); } while (j < i);
oggstream->serial_num = serial_num; oggstream->serial_num = serial_num;
av_dict_copy(&st->metadata, s->metadata, AV_DICT_DONT_OVERWRITE);
st->priv_data = oggstream; st->priv_data = oggstream;
if (st->codec->codec_id == AV_CODEC_ID_FLAC) { if (st->codec->codec_id == AV_CODEC_ID_FLAC) {
int err = ogg_build_flac_headers(st->codec, oggstream, int err = ogg_build_flac_headers(st->codec, oggstream,
st->codec->flags & CODEC_FLAG_BITEXACT, st->codec->flags & CODEC_FLAG_BITEXACT,
&s->metadata); &st->metadata);
if (err) { if (err) {
av_log(s, AV_LOG_ERROR, "Error writing FLAC headers\n"); av_log(s, AV_LOG_ERROR, "Error writing FLAC headers\n");
av_freep(&st->priv_data); av_freep(&st->priv_data);
...@@ -460,7 +462,7 @@ static int ogg_write_header(AVFormatContext *s) ...@@ -460,7 +462,7 @@ static int ogg_write_header(AVFormatContext *s)
} else if (st->codec->codec_id == AV_CODEC_ID_SPEEX) { } else if (st->codec->codec_id == AV_CODEC_ID_SPEEX) {
int err = ogg_build_speex_headers(st->codec, oggstream, int err = ogg_build_speex_headers(st->codec, oggstream,
st->codec->flags & CODEC_FLAG_BITEXACT, st->codec->flags & CODEC_FLAG_BITEXACT,
&s->metadata); &st->metadata);
if (err) { if (err) {
av_log(s, AV_LOG_ERROR, "Error writing Speex headers\n"); av_log(s, AV_LOG_ERROR, "Error writing Speex headers\n");
av_freep(&st->priv_data); av_freep(&st->priv_data);
...@@ -469,7 +471,7 @@ static int ogg_write_header(AVFormatContext *s) ...@@ -469,7 +471,7 @@ static int ogg_write_header(AVFormatContext *s)
} else if (st->codec->codec_id == AV_CODEC_ID_OPUS) { } else if (st->codec->codec_id == AV_CODEC_ID_OPUS) {
int err = ogg_build_opus_headers(st->codec, oggstream, int err = ogg_build_opus_headers(st->codec, oggstream,
st->codec->flags & CODEC_FLAG_BITEXACT, st->codec->flags & CODEC_FLAG_BITEXACT,
&s->metadata); &st->metadata);
if (err) { if (err) {
av_log(s, AV_LOG_ERROR, "Error writing Opus headers\n"); av_log(s, AV_LOG_ERROR, "Error writing Opus headers\n");
av_freep(&st->priv_data); av_freep(&st->priv_data);
...@@ -490,7 +492,7 @@ static int ogg_write_header(AVFormatContext *s) ...@@ -490,7 +492,7 @@ static int ogg_write_header(AVFormatContext *s)
} }
p = ogg_write_vorbiscomment(7, st->codec->flags & CODEC_FLAG_BITEXACT, 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); framing_bit);
oggstream->header[1] = p; oggstream->header[1] = p;
if (!p) if (!p)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment