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 | 432 | struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data; |
| 433 | 433 | struct decklink_ctx *ctx; |
| 434 | − IDeckLinkIterator *iter; | |
| 435 | − IDeckLink *dl = NULL; | |
| 436 | 434 | AVStream *st; |
| 437 | 435 | HRESULT result; |
| 438 | 436 | char fname[1024]; |
| 439 | 437 | char *tmp; |
| 440 | 438 | int mode_num = 0; |
| 439 | + int ret; | |
| 441 | 440 | |
| 442 | 441 | ctx = (struct decklink_ctx *) av_mallocz(sizeof(struct decklink_ctx)); |
| 443 | 442 | if (!ctx) |
| @@ -466,12 +465,6 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 22 unmodified lines | ||
| 466 | 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 | 468 | /* List available devices. */ |
| 476 | 469 | if (ctx->list_devices) { |
| 477 | 470 | ff_decklink_list_devices(avctx); |
| @@ -485,23 +478,9 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 7 unmodified lines | ||
| 485 | 478 | *tmp = 0; |
| 486 | 479 | } |
| 487 | 480 | |
| 488 | − /* Open device. */ | |
| 489 | − while (iter->Next(&dl) == S_OK) { | |
| 490 | − const char *displayName; | |
| 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 | − } | |
| 481 | + ret = ff_decklink_init_device(avctx, fname); | |
| 482 | + if (ret < 0) | |
| 483 | + return ret; | |
| 505 | 484 | |
| 506 | 485 | /* Get input device. */ |
| 507 | 486 | if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != S_OK) { |