Showing the changes to libavdevice/decklink_dec.cpp (1 of 2 files). Show all
Unified · Split
| @@ -486,21 +486,21 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 485 unmodified lines | ||
| 486 | 486 | if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != S_OK) { |
| 487 | 487 | av_log(avctx, AV_LOG_ERROR, "Could not open output device from '%s'\n", |
| 488 | 488 | avctx->filename); |
| 489 | − ctx->dl->Release(); | |
| 490 | − return AVERROR(EIO); | |
| 489 | + ret = AVERROR(EIO); | |
| 490 | + goto error; | |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | /* List supported formats. */ |
| 494 | 494 | if (ctx->list_formats) { |
| 495 | 495 | ff_decklink_list_formats(avctx, DIRECTION_IN); |
| 496 | − ctx->dli->Release(); | |
| 497 | − ctx->dl->Release(); | |
| 498 | − return AVERROR_EXIT; | |
| 496 | + ret = AVERROR_EXIT; | |
| 497 | + goto error; | |
| 499 | 498 | } |
| 500 | 499 | |
| 501 | 500 | if (mode_num > 0) { |
| 502 | 501 | if (ff_decklink_set_format(avctx, DIRECTION_IN, mode_num) < 0) { |
| 503 | 502 | av_log(avctx, AV_LOG_ERROR, "Could not set mode %d for %s\n", mode_num, fname); |
| 503 | + ret = AVERROR(EIO); | |
| 504 | 504 | goto error; |
| 505 | 505 | } |
| 506 | 506 | } |
| @@ -509,6 +509,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 2 unmodified lines | ||
| 509 | 509 | st = avformat_new_stream(avctx, NULL); |
| 510 | 510 | if (!st) { |
| 511 | 511 | av_log(avctx, AV_LOG_ERROR, "Cannot add stream\n"); |
| 512 | + ret = AVERROR(ENOMEM); | |
| 512 | 513 | goto error; |
| 513 | 514 | } |
| 514 | 515 | st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; |
| @@ -521,6 +522,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 6 unmodified lines | ||
| 521 | 522 | st = avformat_new_stream(avctx, NULL); |
| 522 | 523 | if (!st) { |
| 523 | 524 | av_log(avctx, AV_LOG_ERROR, "Cannot add stream\n"); |
| 525 | + ret = AVERROR(ENOMEM); | |
| 524 | 526 | goto error; |
| 525 | 527 | } |
| 526 | 528 | st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; |
| @@ -549,6 +551,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 22 unmodified lines | ||
| 549 | 551 | st = avformat_new_stream(avctx, NULL); |
| 550 | 552 | if (!st) { |
| 551 | 553 | av_log(avctx, AV_LOG_ERROR, "Cannot add stream\n"); |
| 554 | + ret = AVERROR(ENOMEM); | |
| 552 | 555 | goto error; |
| 553 | 556 | } |
| 554 | 557 | st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; |
| @@ -564,6 +567,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 9 unmodified lines | ||
| 564 | 567 | |
| 565 | 568 | if (result != S_OK) { |
| 566 | 569 | av_log(avctx, AV_LOG_ERROR, "Cannot enable audio input\n"); |
| 570 | + ret = AVERROR(EIO); | |
| 567 | 571 | goto error; |
| 568 | 572 | } |
| 569 | 573 | |
| @@ -573,6 +577,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 3 unmodified lines | ||
| 573 | 577 | |
| 574 | 578 | if (result != S_OK) { |
| 575 | 579 | av_log(avctx, AV_LOG_ERROR, "Cannot enable video input\n"); |
| 580 | + ret = AVERROR(EIO); | |
| 576 | 581 | goto error; |
| 577 | 582 | } |
| 578 | 583 | |
| @@ -580,6 +585,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 1 unmodified line | ||
| 580 | 585 | |
| 581 | 586 | if (decklink_start_input (avctx) != S_OK) { |
| 582 | 587 | av_log(avctx, AV_LOG_ERROR, "Cannot start input stream\n"); |
| 588 | + ret = AVERROR(EIO); | |
| 583 | 589 | goto error; |
| 584 | 590 | } |
| 585 | 591 | |
| @@ -587,7 +593,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 1 unmodified line | ||
| 587 | 593 | |
| 588 | 594 | error: |
| 589 | 595 | ff_decklink_cleanup(avctx); |
| 590 | − return AVERROR(EIO); | |
| 596 | + return ret; | |
| 591 | 597 | } |
| 592 | 598 | |
| 593 | 599 | int ff_decklink_read_packet(AVFormatContext *avctx, AVPacket *pkt) |