History

doc/examples/transcode: stop using avfilter_graph_create_filter() incorrectly

See previous commits for details.

Anton Khirnov committed 2 years ago

Commit d18d1191 parent 87faa8a1 file · +18 −6Browse files

Unified · Split

doc/examples/transcode.c+18−6
@@ -283,10 +283,10 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx, · 282 unmodified lines
283 goto end;283 goto end;
284 }284 }
285 285
286 ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out",286 buffersink_ctx = avfilter_graph_alloc_filter(filter_graph, buffersink, "out");
287 NULL, NULL, filter_graph);287 if (!buffersink_ctx) {
288 if (ret < 0) {
289 av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n");288 av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n");
289 ret = AVERROR(ENOMEM);
290 goto end;290 goto end;
291 }291 }
292 292
@@ -297,6 +297,12 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx, · 4 unmodified lines
297 av_log(NULL, AV_LOG_ERROR, "Cannot set output pixel format\n");297 av_log(NULL, AV_LOG_ERROR, "Cannot set output pixel format\n");
298 goto end;298 goto end;
299 }299 }
300
301 ret = avfilter_init_dict(buffersink_ctx, NULL);
302 if (ret < 0) {
303 av_log(NULL, AV_LOG_ERROR, "Cannot initialize buffer sink\n");
304 goto end;
305 }
300 } else if (dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {306 } else if (dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
301 char buf[64];307 char buf[64];
302 buffersrc = avfilter_get_by_name("abuffer");308 buffersrc = avfilter_get_by_name("abuffer");
@@ -322,10 +328,10 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx, · 19 unmodified lines
322 goto end;328 goto end;
323 }329 }
324 330
325 ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out",331 buffersink_ctx = avfilter_graph_alloc_filter(filter_graph, buffersink, "out");
326 NULL, NULL, filter_graph);332 if (!buffersink_ctx) {
327 if (ret < 0) {
328 av_log(NULL, AV_LOG_ERROR, "Cannot create audio buffer sink\n");333 av_log(NULL, AV_LOG_ERROR, "Cannot create audio buffer sink\n");
334 ret = AVERROR(ENOMEM);
329 goto end;335 goto end;
330 }336 }
331 337
@@ -352,6 +358,12 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx, · 20 unmodified lines
352 av_log(NULL, AV_LOG_ERROR, "Cannot set output sample rate\n");358 av_log(NULL, AV_LOG_ERROR, "Cannot set output sample rate\n");
353 goto end;359 goto end;
354 }360 }
361
362 ret = avfilter_init_dict(buffersink_ctx, NULL);
363 if (ret < 0) {
364 av_log(NULL, AV_LOG_ERROR, "Cannot initialize audio buffer sink\n");
365 goto end;
366 }
355 } else {367 } else {
356 ret = AVERROR_UNKNOWN;368 ret = AVERROR_UNKNOWN;
357 goto end;369 goto end;

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