mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
decklink: Add more modes
This commit is contained in:
parent
e9f0e27596
commit
ae49fa1f78
3 changed files with 129 additions and 46 deletions
|
@ -34,11 +34,29 @@ gst_decklink_mode_get_type (void)
|
|||
if (!type) {
|
||||
static const GEnumValue modes[] = {
|
||||
{GST_DECKLINK_MODE_NTSC, "ntsc", "NTSC SD 60i"},
|
||||
{GST_DECKLINK_MODE_NTSC2398, "ntsc2398", "NTSC SD 60i (24 fps)"},
|
||||
{GST_DECKLINK_MODE_PAL, "pal", "PAL SD 50i"},
|
||||
{GST_DECKLINK_MODE_NTSC_P, "ntsc-p", "NTSC SD 60p"},
|
||||
{GST_DECKLINK_MODE_PAL_P, "pal-p", "PAL SD 50p"},
|
||||
|
||||
{GST_DECKLINK_MODE_1080p2398, "1080p2398", "HD1080 23.98p"},
|
||||
{GST_DECKLINK_MODE_1080p24, "1080p24", "HD1080 24p"},
|
||||
{GST_DECKLINK_MODE_1080p25, "1080p25", "HD1080 25p"},
|
||||
{GST_DECKLINK_MODE_1080p2997, "1080p2997", "HD1080 29.97p"},
|
||||
{GST_DECKLINK_MODE_1080p30, "1080p30", "HD1080 30p"},
|
||||
|
||||
{GST_DECKLINK_MODE_1080i50, "1080i50", "HD1080 50i"},
|
||||
{GST_DECKLINK_MODE_1080i5994, "1080i5994", "HD1080 59.94i"},
|
||||
{GST_DECKLINK_MODE_1080i60, "1080i60", "HD1080 60i"},
|
||||
|
||||
{GST_DECKLINK_MODE_1080p50, "1080p50", "HD1080 50p"},
|
||||
{GST_DECKLINK_MODE_1080p5994, "1080p5994", "HD1080 59.94p"},
|
||||
{GST_DECKLINK_MODE_1080p60, "1080p60", "HD1080 60p"},
|
||||
|
||||
{GST_DECKLINK_MODE_720p50, "720p50", "HD720 50p"},
|
||||
{GST_DECKLINK_MODE_720p5994, "720p5994", "HD720 59.94p"},
|
||||
{GST_DECKLINK_MODE_720p60, "720p60", "HD720 60p"},
|
||||
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -68,25 +86,36 @@ gst_decklink_connection_get_type (void)
|
|||
return type;
|
||||
}
|
||||
|
||||
static const GstDecklinkMode modes[] = {
|
||||
{bmdModeNTSC, 720, 486, 30000, 1001, true},
|
||||
{bmdModePAL, 720, 576, 25, 1, true},
|
||||
{bmdModeHD1080i50, 1920, 1080, 25, 1, true},
|
||||
{bmdModeHD1080i5994, 1920, 1080, 30000, 1001, true},
|
||||
{bmdModeHD720p50, 1280, 720, 50, 1, true},
|
||||
{bmdModeHD720p5994, 1280, 720, 60000, 1001, true}
|
||||
};
|
||||
#define NTSC 10, 11, false, false
|
||||
#define PAL 12, 11, true, false
|
||||
#define HD 12, 11, false, true
|
||||
|
||||
#if 0
|
||||
//{ bmdModeNTSC2398, 720,486,24000,1001,true },
|
||||
//{ bmdModeHD1080p2398, 1920,1080,24000,1001,false },
|
||||
//{ bmdModeHD1080p24, 1920,1080,24,1,false },
|
||||
//{ bmdModeHD1080p25, 1920,1080,25,1,false },
|
||||
//{ bmdModeHD1080p2997, 1920,1080,30000,1001,false },
|
||||
//{ bmdModeHD1080p30, 1920,1080,30,1,false },
|
||||
//{ bmdModeHD1080i6000, 1920,1080,30,1,true },
|
||||
//{ bmdModeHD720p60, 1280,720,60,1,true }
|
||||
#endif
|
||||
static const GstDecklinkMode modes[] = {
|
||||
{bmdModeNTSC, 720, 486, 30000, 1001, true, NTSC },
|
||||
{bmdModeNTSC2398, 720, 486, 24000, 1001, true, NTSC },
|
||||
{bmdModePAL, 720, 576, 25, 1, true, PAL },
|
||||
{bmdModeNTSCp, 720, 486, 30000, 1001, false, NTSC },
|
||||
{bmdModePALp, 720, 576, 25, 1, false, PAL },
|
||||
|
||||
{bmdModeHD1080p2398, 1920, 1080, 24000, 1001, false, HD },
|
||||
{bmdModeHD1080p24, 1920, 1080, 24, 1, false, HD },
|
||||
{bmdModeHD1080p25, 1920, 1080, 25, 1, false, HD },
|
||||
{bmdModeHD1080p2997, 1920, 1080, 30000, 1001, false, HD },
|
||||
{bmdModeHD1080p30, 1920, 1080, 30, 1, false, HD },
|
||||
|
||||
{bmdModeHD1080i50, 1920, 1080, 25, 1, true, HD },
|
||||
{bmdModeHD1080i5994, 1920, 1080, 30000, 1001, true, HD },
|
||||
{bmdModeHD1080i6000, 1920, 1080, 30, 1, true, HD },
|
||||
|
||||
{bmdModeHD1080p50, 1920, 1080, 50, 1, false, HD },
|
||||
{bmdModeHD1080p5994, 1920, 1080, 30000, 1001, false, HD },
|
||||
{bmdModeHD1080p6000, 1920, 1080, 60, 1, false, HD },
|
||||
|
||||
{bmdModeHD720p50, 1280, 720, 50, 1, false, HD },
|
||||
{bmdModeHD720p5994, 1280, 720, 60000, 1001, false, HD },
|
||||
{bmdModeHD720p60, 1280, 720, 60, 1, false, HD }
|
||||
|
||||
};
|
||||
|
||||
const GstDecklinkMode *
|
||||
gst_decklink_get_mode (GstDecklinkModeEnum e)
|
||||
|
@ -94,20 +123,49 @@ gst_decklink_get_mode (GstDecklinkModeEnum e)
|
|||
return &modes[e];
|
||||
}
|
||||
|
||||
GstCaps *
|
||||
gst_decklink_mode_get_caps (GstDecklinkModeEnum e)
|
||||
static GstStructure *
|
||||
gst_decklink_mode_get_structure (GstDecklinkModeEnum e)
|
||||
{
|
||||
const GstDecklinkMode *mode = &modes[e];
|
||||
|
||||
return gst_caps_new_simple ("video/x-raw-yuv",
|
||||
return gst_structure_new ("video/x-raw-yuv",
|
||||
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'),
|
||||
"width", G_TYPE_INT, mode->width,
|
||||
"height", G_TYPE_INT, mode->height,
|
||||
"framerate", GST_TYPE_FRACTION,
|
||||
mode->fps_n, mode->fps_d,
|
||||
"interlaced", G_TYPE_BOOLEAN, mode->interlaced, NULL);
|
||||
"framerate", GST_TYPE_FRACTION, mode->fps_n, mode->fps_d,
|
||||
"interlaced", G_TYPE_BOOLEAN, mode->interlaced,
|
||||
"pixel-aspect-ratio", GST_TYPE_FRACTION, mode->par_n, mode->par_d,
|
||||
"color-matrix", G_TYPE_STRING, mode->is_hdtv ? "hdtv" : "sdtv",
|
||||
"chroma-site", G_TYPE_STRING, "mpeg2",
|
||||
NULL);
|
||||
}
|
||||
|
||||
GstCaps *
|
||||
gst_decklink_mode_get_caps (GstDecklinkModeEnum e)
|
||||
{
|
||||
GstCaps *caps;
|
||||
|
||||
caps = gst_caps_new_empty ();
|
||||
gst_caps_append_structure (caps, gst_decklink_mode_get_structure (e));
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
GstCaps *
|
||||
gst_decklink_mode_get_template_caps (void)
|
||||
{
|
||||
int i;
|
||||
GstCaps *caps;
|
||||
GstStructure *s;
|
||||
|
||||
caps = gst_caps_new_empty ();
|
||||
for(i=0;i<(int)G_N_ELEMENTS(modes);i++) {
|
||||
s = gst_decklink_mode_get_structure ((GstDecklinkModeEnum)i);
|
||||
gst_caps_append_structure (caps, s);
|
||||
}
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
|
|
|
@ -26,10 +26,27 @@
|
|||
|
||||
typedef enum {
|
||||
GST_DECKLINK_MODE_NTSC,
|
||||
GST_DECKLINK_MODE_NTSC2398,
|
||||
GST_DECKLINK_MODE_PAL,
|
||||
GST_DECKLINK_MODE_NTSC_P,
|
||||
GST_DECKLINK_MODE_PAL_P,
|
||||
|
||||
GST_DECKLINK_MODE_1080p2398,
|
||||
GST_DECKLINK_MODE_1080p24,
|
||||
GST_DECKLINK_MODE_1080p25,
|
||||
GST_DECKLINK_MODE_1080p2997,
|
||||
GST_DECKLINK_MODE_1080p30,
|
||||
|
||||
GST_DECKLINK_MODE_1080i50,
|
||||
GST_DECKLINK_MODE_1080i5994,
|
||||
GST_DECKLINK_MODE_1080i60,
|
||||
|
||||
GST_DECKLINK_MODE_1080p50,
|
||||
GST_DECKLINK_MODE_1080p5994,
|
||||
GST_DECKLINK_MODE_1080p60,
|
||||
|
||||
GST_DECKLINK_MODE_720p50,
|
||||
GST_DECKLINK_MODE_720p5994,
|
||||
GST_DECKLINK_MODE_720p60
|
||||
} GstDecklinkModeEnum;
|
||||
#define GST_TYPE_DECKLINK_MODE (gst_decklink_mode_get_type ())
|
||||
|
@ -54,10 +71,15 @@ struct _GstDecklinkMode {
|
|||
int fps_n;
|
||||
int fps_d;
|
||||
gboolean interlaced;
|
||||
int par_n;
|
||||
int par_d;
|
||||
gboolean tff;
|
||||
gboolean is_hdtv;
|
||||
};
|
||||
|
||||
const GstDecklinkMode * gst_decklink_get_mode (GstDecklinkModeEnum e);
|
||||
GstCaps * gst_decklink_mode_get_caps (GstDecklinkModeEnum e);
|
||||
GstCaps * gst_decklink_mode_get_template_caps (void);
|
||||
|
||||
#define GST_DECKLINK_MODE_CAPS(w,h,n,d,i) \
|
||||
"video/x-raw-yuv,format=(fourcc)UYVY,width=" #w ",height=" #h \
|
||||
|
@ -65,22 +87,28 @@ GstCaps * gst_decklink_mode_get_caps (GstDecklinkModeEnum e);
|
|||
|
||||
#define GST_DECKLINK_CAPS \
|
||||
GST_DECKLINK_MODE_CAPS(720,486,30000,1001,true) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(720,486,24000,1001,true) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(720,576,25,1,true) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(720,486,30000,1001,false) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(720,576,25,1,false) ";" \
|
||||
\
|
||||
GST_DECKLINK_MODE_CAPS(1920,1080,24000,1001,false) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(1920,1080,24,1,false) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(1920,1080,25,1,false) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(1920,1080,30000,1001,false) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(1920,1080,30,1,false) ";" \
|
||||
\
|
||||
GST_DECKLINK_MODE_CAPS(1920,1080,25,1,true) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(1920,1080,30000,1001,true) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(1280,720,50,1,true) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(1280,720,60000,1001,true)
|
||||
|
||||
#if 0
|
||||
MODE(720,486,24000,1001,true) ";" \
|
||||
MODE(1920,1080,24000,1001,false) ";" \
|
||||
MODE(1920,1080,24,1,false) ";" \
|
||||
MODE(1920,1080,25,1,false) ";" \
|
||||
MODE(1920,1080,30000,1001,false) ";" \
|
||||
MODE(1920,1080,30,1,false) ";" \
|
||||
MODE(1920,1080,30,1,true) ";" \
|
||||
MODE(1280,720,60,1,true)
|
||||
#endif
|
||||
GST_DECKLINK_MODE_CAPS(1920,1080,30,1,true) ";" \
|
||||
\
|
||||
GST_DECKLINK_MODE_CAPS(1920,1080,50,1,false) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(1920,1080,60000,1001,false) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(1920,1080,60,1,false) ";" \
|
||||
\
|
||||
GST_DECKLINK_MODE_CAPS(1280,720,50,1,false) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(1280,720,60000,1001,false) ";" \
|
||||
GST_DECKLINK_MODE_CAPS(1280,720,60,1,false)
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -131,11 +131,7 @@ GST_STATIC_PAD_TEMPLATE ("audiosrc",
|
|||
GST_STATIC_CAPS ("audio/x-raw-int,width=16,depth=16,channels=2,rate=48000")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_decklink_src_video_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("videosrc",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_DECKLINK_CAPS));
|
||||
/* the video source pad template is created on the fly */
|
||||
|
||||
/* class initialization */
|
||||
|
||||
|
@ -154,7 +150,8 @@ gst_decklink_src_base_init (gpointer g_class)
|
|||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_decklink_src_audio_src_template));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_decklink_src_video_src_template));
|
||||
gst_pad_template_new ("videosrc", GST_PAD_SRC, GST_PAD_ALWAYS,
|
||||
gst_decklink_mode_get_template_caps ()));
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "Decklink source",
|
||||
"Source/Video", "DeckLink Source", "David Schleef <ds@entropywave.com>");
|
||||
|
@ -235,9 +232,9 @@ gst_decklink_src_init (GstDecklinkSrc * decklinksrc,
|
|||
|
||||
|
||||
|
||||
decklinksrc->videosrcpad =
|
||||
gst_pad_new_from_static_template (&gst_decklink_src_video_src_template,
|
||||
"videosrc");
|
||||
decklinksrc->videosrcpad = gst_pad_new_from_template (
|
||||
gst_element_class_get_pad_template(GST_ELEMENT_CLASS(decklinksrc_class),
|
||||
"videosrc"), "videosrc");
|
||||
gst_pad_set_getcaps_function (decklinksrc->videosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_getcaps));
|
||||
gst_pad_set_setcaps_function (decklinksrc->videosrcpad,
|
||||
|
|
Loading…
Reference in a new issue