if (packed_metadata) {
if (av_packet_add_side_data(&pkt, AV_PKT_DATA_STRINGS_METADATA, packed_metadata, metadata_len) < 0)
av_freep(&packed_metadata);
+ else if (!ctx->tc_seen)
+ ctx->tc_seen = ctx->frameCount;
}
}
}
}
}
+ if (ctx->tc_format && cctx->wait_for_tc && !ctx->tc_seen) {
+
+ av_log(avctx, AV_LOG_WARNING, "No TC detected yet. wait_for_tc set. Dropping. \n");
+ av_log(avctx, AV_LOG_WARNING, "Frame received (#%lu) - "
+ "- Frames dropped %u\n", ctx->frameCount, ++ctx->dropped);
+ return S_OK;
+ }
+
pkt.pts = get_pkt_pts(videoFrame, audioFrame, wallclock, abs_wallclock, ctx->video_pts_source, ctx->video_st->time_base, &initial_video_pts, cctx->copyts);
pkt.dts = pkt.pts;
struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
- if (ctx->capture_started) {
+ if (ctx->dli) {
ctx->dli->StopStreams();
ctx->dli->DisableVideoInput();
ctx->dli->DisableAudioInput();
class decklink_input_callback *input_callback;
AVStream *st;
HRESULT result;
- char fname[1024];
- char *tmp;
- int mode_num = 0;
int ret;
ctx = (struct decklink_ctx *) av_mallocz(sizeof(struct decklink_ctx));
/* List available devices. */
if (ctx->list_devices) {
+ av_log(avctx, AV_LOG_WARNING, "The -list_devices option is deprecated and will be removed. Please use ffmpeg -sources decklink instead.\n");
ff_decklink_list_devices_legacy(avctx, 1, 0);
return AVERROR_EXIT;
}
- if (cctx->v210) {
- av_log(avctx, AV_LOG_WARNING, "The bm_v210 option is deprecated and will be removed. Please use the -raw_format yuv422p10.\n");
- cctx->raw_format = MKBETAG('v','2','1','0');
- }
-
- av_strlcpy(fname, avctx->url, sizeof(fname));
- tmp=strchr (fname, '@');
- if (tmp != NULL) {
- av_log(avctx, AV_LOG_WARNING, "The @mode syntax is deprecated and will be removed. Please use the -format_code option.\n");
- mode_num = atoi (tmp+1);
- *tmp = 0;
- }
-
- ret = ff_decklink_init_device(avctx, fname);
+ ret = ff_decklink_init_device(avctx, avctx->url);
if (ret < 0)
return ret;
goto error;
}
+ if (ff_decklink_set_configs(avctx, DIRECTION_IN) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Could not set input configuration\n");
+ ret = AVERROR(EIO);
+ goto error;
+ }
+
/* List supported formats. */
if (ctx->list_formats) {
ff_decklink_list_formats(avctx, DIRECTION_IN);
goto error;
}
- if (ff_decklink_set_configs(avctx, DIRECTION_IN) < 0) {
- av_log(avctx, AV_LOG_ERROR, "Could not set input configuration\n");
- ret = AVERROR(EIO);
- goto error;
- }
-
input_callback = new decklink_input_callback(avctx);
ret = (ctx->dli->SetCallback(input_callback) == S_OK ? 0 : AVERROR_EXTERNAL);
input_callback->Release();
goto error;
}
- if (mode_num == 0 && !cctx->format_code) {
+ if (!cctx->format_code) {
if (decklink_autodetect(cctx) < 0) {
av_log(avctx, AV_LOG_ERROR, "Cannot Autodetect input stream or No signal\n");
ret = AVERROR(EIO);
}
av_log(avctx, AV_LOG_INFO, "Autodetected the input mode\n");
}
- if (ff_decklink_set_format(avctx, DIRECTION_IN, mode_num) < 0) {
- av_log(avctx, AV_LOG_ERROR, "Could not set mode number %d or format code %s for %s\n",
- mode_num, (cctx->format_code) ? cctx->format_code : "(unset)", fname);
+ if (ff_decklink_set_format(avctx, DIRECTION_IN) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Could not set format code %s for %s\n",
+ cctx->format_code ? cctx->format_code : "(unset)", avctx->url);
ret = AVERROR(EIO);
goto error;
}