---
doc/examples/transcode.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c
index 9af5674953..1ec4a3c230 100644
--- a/doc/examples/transcode.c
+++ b/doc/examples/transcode.c
@@ -82,6 +82,7 @@ static int open_input_file(const char *filename)
AVStream *stream = ifmt_ctx->streams[i];
const AVCodec *dec = avcodec_find_decoder(stream->codecpar->codec_id);
AVCodecContext *codec_ctx;
+ enum AVMediaType codec_type;
if (!dec) {
av_log(NULL, AV_LOG_ERROR, "Failed to find decoder for stream
#%u\n", i);
@@ -105,11 +106,13 @@ static int open_input_file(const char *filename)
/* Inform the decoder about the timebase for the packet timestamps.
* This is highly recommended, but not mandatory. */
codec_ctx->pkt_timebase = stream->time_base;
+ codec_type = codec_ctx->codec_type;
/* Reencode video & audio and remux subtitles etc. */
- if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
codec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
- if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
+ if (codec_type == AVMEDIA_TYPE_VIDEO || codec_type ==
AVMEDIA_TYPE_AUDIO) {
+ if (codec_type == AVMEDIA_TYPE_VIDEO)
codec_ctx->framerate = av_guess_frame_rate(ifmt_ctx, stream,
NULL);
+
/* Open decoder */
ret = avcodec_open2(codec_ctx, dec, NULL);
if (ret < 0) {
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".