History

doc/examples/transcoding: check encoder before using it

Fixes null pointer exception

Michael Niedermayer committed 11 years ago

Commit bde27e11 parent cbf09541 file · +4 −0Browse files

Unified · Split

doc/examples/transcoding.c+4−0
@@ -116,6 +116,10 @@ static int open_output_file(const char *filename) · 115 unmodified lines
116 || dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {116 || dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
117 /* in this example, we choose transcoding to same codec */117 /* in this example, we choose transcoding to same codec */
118 encoder = avcodec_find_encoder(dec_ctx->codec_id);118 encoder = avcodec_find_encoder(dec_ctx->codec_id);
119 if (!encoder) {
120 av_log(NULL, AV_LOG_FATAL, "Neccessary encoder not found\n");
121 return AVERROR_INVALIDDATA;
122 }
119 123
120 /* In this example, we transcode to same properties (picture size,124 /* In this example, we transcode to same properties (picture size,
121 * sample rate etc.). These properties can be changed for output125 * sample rate etc.). These properties can be changed for output

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t