On Thu, 16 Nov 2017, Jeyapal, Karthick wrote:
On 11/16/17, 1:11 AM, "Marton Balint" <c...@passwd.hu> wrote:
Thanks for the reply.
For the first patch, I think you forgot to call ff_decklink_set_configs in
decklink_enc.
ff_decklink_set_configs is not doing anything related to decklink_enc
In any case I have added the same and have attached the new patch
For the second patch here are some comments:
I have done all suggested modifications and the new patch is attached.
Thanks, there is one more thing I still don't get:
[...]
-static HRESULT decklink_start_input(AVFormatContext *avctx)
-{
- struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
+static int decklink_autodetect(struct decklink_cctx *cctx) {
struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
+ DECKLINK_BOOL autodetect_supported = false;
+ int i;
+
+ if (ctx->attr->GetFlag(BMDDeckLinkSupportsInputFormatDetection,
&autodetect_supported) != S_OK)
+ return -1;
+ if (autodetect_supported == false)
+ return -1;
+
+ ctx->autodetect = 1;
+ ctx->bmd_mode = bmdModeUnknown;
+ if (ctx->dli->EnableVideoInput(AUTODETECT_DEFAULT_MODE,
+ bmdFormat8BitYUV,
+ bmdVideoInputEnableFormatDetection) !=
S_OK) {
+ return -1;
+ }
+
+ if (ctx->dli->StartStreams() != S_OK) {
+ return -1;
+ }
+
+ // 1 second timeout
+ for (i = 0; i < 10; i++) {
+ av_usleep(100000);
+ // Sometimes VideoInputFrameArrived is called before
VideoInputFormatChanged
+ // So don't break for bmd_mode == AUTODETECT_DEFAULT_MODE
Even if you get a frame for the default mode, and
VideoInputFrameArrived is called early, the bmdFrameHasNoInputSource
flag should be set, so ctx->bmd_mode remains unknown, therefore you don't
have to handle it specially.
Are you saying that the Decklink drivers are buggy, and there are cases
where you get a frame without the bmdFrameHasNoInputSource flag, and then
a VideoInputFormatChanged callback later?
+ if (ctx->bmd_mode != bmdModeUnknown &&
+ ctx->bmd_mode != AUTODETECT_DEFAULT_MODE)
+ break;
+ }
+
[...]
Regards,
Marton
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel