diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-05-18 21:26:29 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-05-18 21:31:51 +0200 |
commit | 1e49439f04f4aeb45344e8753094d00ac4b1a5d6 (patch) | |
tree | 621f7e9cdf461b997ef614f6c9c4c5657089e471 /ffmpeg.c | |
parent | c01bcce4959a208a4f6b66fd527760ed45cd29bb (diff) | |
parent | 6656370b858329ca07a60a2de954d5e90daa0206 (diff) | |
download | ffmpeg-1e49439f04f4aeb45344e8753094d00ac4b1a5d6.tar.gz |
Merge commit '6656370b858329ca07a60a2de954d5e90daa0206'
* commit '6656370b858329ca07a60a2de954d5e90daa0206':
avconv: set the "encoder" tag when transcoding
Conflicts:
ffmpeg.c
tests/ref/lavf/mkv
tests/ref/seek/lavf-mkv
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -2363,6 +2363,34 @@ static void report_new_stream(int input_index, AVPacket *pkt) file->nb_streams_warn = pkt->stream_index + 1; } +static void set_encoder_id(OutputFile *of, OutputStream *ost) +{ + AVDictionaryEntry *e; + + uint8_t *encoder_string; + int encoder_string_len; + int format_flags = 0; + + e = av_dict_get(of->opts, "fflags", NULL, 0); + if (e) { + const AVOption *o = av_opt_find(of->ctx, "fflags", NULL, 0, 0); + if (!o) + return; + av_opt_eval_flags(of->ctx, o, e->value, &format_flags); + } + + encoder_string_len = sizeof(LIBAVCODEC_IDENT) + strlen(ost->enc->name) + 2; + encoder_string = av_mallocz(encoder_string_len); + if (!encoder_string) + exit_program(1); + + if (!(format_flags & AVFMT_FLAG_BITEXACT)) + av_strlcpy(encoder_string, LIBAVCODEC_IDENT " ", encoder_string_len); + av_strlcat(encoder_string, ost->enc->name, encoder_string_len); + av_dict_set(&ost->st->metadata, "encoder", encoder_string, + AV_DICT_DONT_STRDUP_VAL | AV_DICT_DONT_OVERWRITE); +} + static int transcode_init(void) { int ret = 0, i, j, k; @@ -2591,6 +2619,8 @@ static int transcode_init(void) ist->decoding_needed++; ost->encoding_needed = 1; + set_encoder_id(output_files[ost->file_index], ost); + if (!ost->filter && (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO || enc_ctx->codec_type == AVMEDIA_TYPE_AUDIO)) { |