Showing the changes to libavdevice/decklink_dec.cpp (1 of 4 files). Show all
Unified · Split
| @@ -431,13 +431,12 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 430 unmodified lines | |||
| 431 | { | 431 | { |
| 432 | struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data; | 432 | struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data; |
| 433 | struct decklink_ctx *ctx; | 433 | struct decklink_ctx *ctx; |
| 434 | IDeckLinkIterator *iter; | ||
| 435 | IDeckLink *dl = NULL; | ||
| 436 | AVStream *st; | 434 | AVStream *st; |
| 437 | HRESULT result; | 435 | HRESULT result; |
| 438 | char fname[1024]; | 436 | char fname[1024]; |
| 439 | char *tmp; | 437 | char *tmp; |
| 440 | int mode_num = 0; | 438 | int mode_num = 0; |
| 439 | int ret; | ||
| 441 | 440 | ||
| 442 | ctx = (struct decklink_ctx *) av_mallocz(sizeof(struct decklink_ctx)); | 441 | ctx = (struct decklink_ctx *) av_mallocz(sizeof(struct decklink_ctx)); |
| 443 | if (!ctx) | 442 | if (!ctx) |
| @@ -466,12 +465,6 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 22 unmodified lines | |||
| 466 | return AVERROR(EINVAL); | 465 | return AVERROR(EINVAL); |
| 467 | } | 466 | } |
| 468 | 467 | ||
| 469 | iter = CreateDeckLinkIteratorInstance(); | ||
| 470 | if (!iter) { | ||
| 471 | av_log(avctx, AV_LOG_ERROR, "Could not create DeckLink iterator\n"); | ||
| 472 | return AVERROR(EIO); | ||
| 473 | } | ||
| 474 | |||
| 475 | /* List available devices. */ | 468 | /* List available devices. */ |
| 476 | if (ctx->list_devices) { | 469 | if (ctx->list_devices) { |
| 477 | ff_decklink_list_devices(avctx); | 470 | ff_decklink_list_devices(avctx); |
| @@ -485,23 +478,9 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 7 unmodified lines | |||
| 485 | *tmp = 0; | 478 | *tmp = 0; |
| 486 | } | 479 | } |
| 487 | 480 | ||
| 488 | /* Open device. */ | 481 | ret = ff_decklink_init_device(avctx, fname); |
| 489 | while (iter->Next(&dl) == S_OK) { | 482 | if (ret < 0) |
| 490 | const char *displayName; | 483 | return ret; |
| 491 | ff_decklink_get_display_name(dl, &displayName); | ||
| 492 | if (!strcmp(fname, displayName)) { | ||
| 493 | av_free((void *) displayName); | ||
| 494 | ctx->dl = dl; | ||
| 495 | break; | ||
| 496 | } | ||
| 497 | av_free((void *) displayName); | ||
| 498 | dl->Release(); | ||
| 499 | } | ||
| 500 | iter->Release(); | ||
| 501 | if (!ctx->dl) { | ||
| 502 | av_log(avctx, AV_LOG_ERROR, "Could not open '%s'\n", fname); | ||
| 503 | return AVERROR(EIO); | ||
| 504 | } | ||
| 505 | 484 | ||
| 506 | /* Get input device. */ | 485 | /* Get input device. */ |
| 507 | if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != S_OK) { | 486 | if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != S_OK) { |