See previous commits for details.
Unified · Split
| @@ -283,10 +283,10 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx, · 282 unmodified lines | ||
| 283 | 283 | goto end; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | − ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out", | |
| 287 | − NULL, NULL, filter_graph); | |
| 288 | − if (ret < 0) { | |
| 286 | + buffersink_ctx = avfilter_graph_alloc_filter(filter_graph, buffersink, "out"); | |
| 287 | + if (!buffersink_ctx) { | |
| 289 | 288 | av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n"); |
| 289 | + ret = AVERROR(ENOMEM); | |
| 290 | 290 | goto end; |
| 291 | 291 | } |
| 292 | 292 | |
| @@ -297,6 +297,12 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx, · 4 unmodified lines | ||
| 297 | 297 | av_log(NULL, AV_LOG_ERROR, "Cannot set output pixel format\n"); |
| 298 | 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 | 306 | } else if (dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) { |
| 301 | 307 | char buf[64]; |
| 302 | 308 | buffersrc = avfilter_get_by_name("abuffer"); |
| @@ -322,10 +328,10 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx, · 19 unmodified lines | ||
| 322 | 328 | goto end; |
| 323 | 329 | } |
| 324 | 330 | |
| 325 | − ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out", | |
| 326 | − NULL, NULL, filter_graph); | |
| 327 | − if (ret < 0) { | |
| 331 | + buffersink_ctx = avfilter_graph_alloc_filter(filter_graph, buffersink, "out"); | |
| 332 | + if (!buffersink_ctx) { | |
| 328 | 333 | av_log(NULL, AV_LOG_ERROR, "Cannot create audio buffer sink\n"); |
| 334 | + ret = AVERROR(ENOMEM); | |
| 329 | 335 | goto end; |
| 330 | 336 | } |
| 331 | 337 | |
| @@ -352,6 +358,12 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx, · 20 unmodified lines | ||
| 352 | 358 | av_log(NULL, AV_LOG_ERROR, "Cannot set output sample rate\n"); |
| 353 | 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 | 367 | } else { |
| 356 | 368 | ret = AVERROR_UNKNOWN; |
| 357 | 369 | goto end; |