Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMichael Bunk <bunk@iat.uni-leipzig.de>2018-08-30 09:56:19 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2018-10-07 22:34:00 +0300
commit84ab680624e8082900012234cb500c850c4919dd (patch)
treee8375088bfce2225789e2312fd84dfd913286e02 /doc
parent8327559fe80d710d8f62cc68d4103b9eabb06103 (diff)
examples: Fix use of AV_CODEC_FLAG_GLOBAL_HEADER
AV_CODEC_FLAG_GLOBAL_HEADER should be set before calling avcodec_open2() to have any effect. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit a82e4fb8c6f26e75506df6818fee1b61f940cbeb) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/transcoding.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c
index a83fa3a185..e48837cbd2 100644
--- a/doc/examples/transcoding.c
+++ b/doc/examples/transcoding.c
@@ -172,6 +172,9 @@ static int open_output_file(const char *filename)
enc_ctx->time_base = (AVRational){1, enc_ctx->sample_rate};
}
+ if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
+ enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+
/* Third parameter can be used to pass settings to encoder */
ret = avcodec_open2(enc_ctx, encoder, NULL);
if (ret < 0) {
@@ -183,8 +186,6 @@ static int open_output_file(const char *filename)
av_log(NULL, AV_LOG_ERROR, "Failed to copy encoder parameters to output stream #%u\n", i);
return ret;
}
- if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
- enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
out_stream->time_base = enc_ctx->time_base;
stream_ctx[i].enc_ctx = enc_ctx;