[FFmpeg-devel] [PATCH 1/3] 10 Bit support for Decklink input device

Michael Niedermayer michaelni at gmx.at
Sat Jan 17 04:05:00 CET 2015


On Sun, Jan 11, 2015 at 09:01:20PM +0530, Anshul wrote:
> On 01/11/2015 08:08 PM, Georg Lippitsch wrote:
> > ---
> >  libavdevice/decklink_common_c.h |  1 +
> >  libavdevice/decklink_dec.cpp    | 18 ++++++++++++++----
> >  libavdevice/decklink_dec_c.c    |  1 +
> >  3 files changed, 16 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
> > index 861a51a..fb2b788 100644
> > --- a/libavdevice/decklink_common_c.h
> > +++ b/libavdevice/decklink_common_c.h
> > @@ -28,5 +28,6 @@ struct decklink_cctx {
> >      int list_devices;
> >      int list_formats;
> >      double preroll;
> > +    int v210;
> >  };
> >  
> > diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
> > index 77a0fe5..747f47e 100644
> > --- a/libavdevice/decklink_dec.cpp
> > +++ b/libavdevice/decklink_dec.cpp
> > @@ -233,6 +233,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
> >                                    ctx->video_st->time_base.den);
> >  
> >          if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) {
> > +            if (videoFrame->GetPixelFormat() == bmdFormat8BitYUV) {
> >              unsigned bars[8] = {
> >                  0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035,
> >                  0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 };
> > @@ -244,6 +245,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
> >                  for (int x = 0; x < width; x += 2)
> >                      *p++ = bars[(x * 8) / width];
> >              }
> > +            }
> >  
> >              if (!no_video) {
> >                  av_log(avctx, AV_LOG_WARNING, "Frame received (#%lu) - No input signal detected "
> > @@ -466,15 +468,21 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
> >          goto error;
> >      }
> >      st->codec->codec_type  = AVMEDIA_TYPE_VIDEO;
> > -    st->codec->codec_id    = AV_CODEC_ID_RAWVIDEO;
> >      st->codec->width       = ctx->bmd_width;
> >      st->codec->height      = ctx->bmd_height;
> >  
> > -    st->codec->pix_fmt     = AV_PIX_FMT_UYVY422;
> >      st->codec->time_base.den      = ctx->bmd_tb_den;
> >      st->codec->time_base.num      = ctx->bmd_tb_num;
> >      st->codec->bit_rate    = avpicture_get_size(st->codec->pix_fmt, ctx->bmd_width, ctx->bmd_height) * 1/av_q2d(st->codec->time_base) * 8;
> > -    st->codec->codec_tag   = MKTAG('U', 'Y', 'V', 'Y');
> > +
> > +    if (cctx->v210) {
> > +        st->codec->codec_id    = AV_CODEC_ID_V210;
> > +        st->codec->codec_tag   = MKTAG('V', '2', '1', '0');
> > +    } else {
> > +        st->codec->codec_id    = AV_CODEC_ID_RAWVIDEO;
> > +        st->codec->pix_fmt     = AV_PIX_FMT_UYVY422;
> > +        st->codec->codec_tag   = MKTAG('U', 'Y', 'V', 'Y');
> > +    }
> >  
> >      avpriv_set_pts_info(st, 64, 1, 1000000);  /* 64 bits pts in us */
> >  
> > @@ -487,7 +495,9 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
> >          goto error;
> >      }
> >  
> > -    result = ctx->dli->EnableVideoInput(ctx->bmd_mode, bmdFormat8BitYUV, bmdVideoInputFlagDefault);
> > +    result = ctx->dli->EnableVideoInput(ctx->bmd_mode,
> > +                                        cctx->v210 ? bmdFormat10BitYUV : bmdFormat8BitYUV,
> > +                                        bmdVideoInputFlagDefault);
> >  
> Why not save bmdFormat10BitYUV in cctx instead of 1 or 0 in cctx->v210 flag?

maybe AV_OPT_TYPE_PIXEL_FMT in the AVOption array could be used
if the intent is to make it more generic, i would avoid using
the libs internal types though


> >      if (result != S_OK) {
> >          av_log(avctx, AV_LOG_ERROR, "Cannot enable video input\n");
> > diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
> > index 2aea277..b1a65e6 100644
> > --- a/libavdevice/decklink_dec_c.c
> > +++ b/libavdevice/decklink_dec_c.c
> > @@ -31,6 +31,7 @@
> >  static const AVOption options[] = {
> >      { "list_devices", "list available devices"  , OFFSET(list_devices), AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
> >      { "list_formats", "list supported formats"  , OFFSET(list_formats), AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
> > +    { "bm_v210",      "v210 10 bit per channel" , OFFSET(v210),         AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
> >      { NULL },
> >  };
> >  
> can you please add in commit message how should I test it. it would be
> easier for me.
> I do have a bmdcard on my linux pc.
> It would give me a link to add closed caption, because that comes only
> in 10bit yuv bmdcapture
> card.
> 
> -Anshul
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150117/5a7420a4/attachment.asc>


More information about the ffmpeg-devel mailing list