mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
video-anc: add support for Bar and AFD meta-data
This commit is contained in:
parent
3c4bef46b7
commit
8759c36851
3 changed files with 351 additions and 0 deletions
|
@ -3622,6 +3622,15 @@ gst_video_vbi_encoder_free
|
|||
gst_video_vbi_encoder_add_ancillary
|
||||
gst_video_vbi_encoder_write_line
|
||||
gst_video_vbi_encoder_copy
|
||||
<SUBSECTION bardata>
|
||||
GstVideoBarMeta
|
||||
gst_buffer_get_video_bar_meta
|
||||
gst_buffer_add_video_bar_meta
|
||||
<SUBSECTION afd>
|
||||
GstVideoAfd
|
||||
GstVideoAfdMeta
|
||||
gst_buffer_get_video_afd_meta
|
||||
gst_buffer_add_video_afd_meta
|
||||
<SUBSECTION closedcaption>
|
||||
GstVideoCaptionType
|
||||
GstVideoCaptionMeta
|
||||
|
|
|
@ -1048,3 +1048,140 @@ gst_video_caption_type_to_caps (GstVideoCaptionType type)
|
|||
|
||||
return caption_caps;
|
||||
}
|
||||
|
||||
/* Active Format Description (AFD) Meta implementation *****************************/
|
||||
|
||||
GType
|
||||
gst_video_afd_meta_api_get_type (void)
|
||||
{
|
||||
static volatile GType type;
|
||||
|
||||
if (g_once_init_enter (&type)) {
|
||||
static const gchar *tags[] = { NULL };
|
||||
GType _type = gst_meta_api_type_register ("GstVideoAfdMetaAPI", tags);
|
||||
g_once_init_leave (&type, _type);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gst_video_afd_meta_init (GstMeta * meta, gpointer params, GstBuffer * buffer)
|
||||
{
|
||||
GstVideoAfdMeta *emeta = (GstVideoAfdMeta *) meta;
|
||||
|
||||
emeta->afd = GST_VIDEO_AFD_ATSC_UNAVAILABLE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
const GstMetaInfo *
|
||||
gst_video_afd_meta_get_info (void)
|
||||
{
|
||||
static const GstMetaInfo *meta_info = NULL;
|
||||
|
||||
if (g_once_init_enter ((GstMetaInfo **) & meta_info)) {
|
||||
const GstMetaInfo *mi = gst_meta_register (GST_VIDEO_AFD_META_API_TYPE,
|
||||
"GstVideoAfdMeta",
|
||||
sizeof (GstVideoAfdMeta),
|
||||
gst_video_afd_meta_init,
|
||||
NULL,
|
||||
NULL);
|
||||
g_once_init_leave ((GstMetaInfo **) & meta_info, (GstMetaInfo *) mi);
|
||||
}
|
||||
return meta_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_add_video_afd_meta:
|
||||
* @buffer: a #GstBuffer
|
||||
* @afd: #GstVideoAfd struct
|
||||
*
|
||||
* Attaches #GstVideoAfdMeta metadata to @buffer with the given
|
||||
* parameters.
|
||||
*
|
||||
* Returns: (transfer none): the #GstVideoAfdMeta on @buffer.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
GstVideoAfdMeta *
|
||||
gst_buffer_add_video_afd_meta (GstBuffer * buffer, GstVideoAfd afd)
|
||||
{
|
||||
GstVideoAfdMeta *meta;
|
||||
g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
|
||||
|
||||
meta = (GstVideoAfdMeta *) gst_buffer_add_meta (buffer,
|
||||
GST_VIDEO_AFD_META_INFO, NULL);
|
||||
g_assert (meta != NULL);
|
||||
|
||||
meta->afd = afd;
|
||||
|
||||
return meta;
|
||||
}
|
||||
|
||||
/* Bar Meta implementation *******************************************/
|
||||
|
||||
GType
|
||||
gst_video_bar_meta_api_get_type (void)
|
||||
{
|
||||
static volatile GType type;
|
||||
|
||||
if (g_once_init_enter (&type)) {
|
||||
static const gchar *tags[] = { NULL };
|
||||
GType _type = gst_meta_api_type_register ("GstVideoBarMetaAPI", tags);
|
||||
g_once_init_leave (&type, _type);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
const GstMetaInfo *
|
||||
gst_video_bar_meta_get_info (void)
|
||||
{
|
||||
static const GstMetaInfo *meta_info = NULL;
|
||||
|
||||
if (g_once_init_enter ((GstMetaInfo **) & meta_info)) {
|
||||
const GstMetaInfo *mi = gst_meta_register (GST_VIDEO_BAR_META_API_TYPE,
|
||||
"GstVideoBarMeta",
|
||||
sizeof (GstVideoBarMeta),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
g_once_init_leave ((GstMetaInfo **) & meta_info, (GstMetaInfo *) mi);
|
||||
}
|
||||
return meta_info;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gst_buffer_add_video_bar_meta:
|
||||
* @buffer: a #GstBuffer
|
||||
* @bar_data: #GstVideoBarData structure
|
||||
*
|
||||
* Attaches #GstVideoBarMeta metadata to @buffer with the given
|
||||
* parameters.
|
||||
*
|
||||
* Returns: (transfer none): the #GstVideoBarMeta on @buffer.
|
||||
*
|
||||
* See Table 6.11 Bar Data Syntax
|
||||
*
|
||||
* https://www.atsc.org/wp-content/uploads/2015/03/a_53-Part-4-2009.pdf
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
GstVideoBarMeta *
|
||||
gst_buffer_add_video_bar_meta (GstBuffer * buffer, GstVideoBarData * bar_data)
|
||||
{
|
||||
GstVideoBarMeta *meta;
|
||||
|
||||
g_return_val_if_fail (bar_data != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
|
||||
|
||||
meta = (GstVideoBarMeta *) gst_buffer_add_meta (buffer,
|
||||
GST_VIDEO_BAR_META_INFO, NULL);
|
||||
g_assert (meta != NULL);
|
||||
|
||||
meta->bar_data = *bar_data;
|
||||
return meta;
|
||||
}
|
||||
|
|
|
@ -96,6 +96,211 @@ typedef enum {
|
|||
GST_VIDEO_ANCILLARY_DID16_S334_EIA_608 = 0x6102,
|
||||
} GstVideoAncillaryDID16;
|
||||
|
||||
/**
|
||||
* Active Format Description (AFD) support
|
||||
*
|
||||
* A/53 ATSC Digital Television Standard
|
||||
*
|
||||
* Active Format Description (AFD) should be included in video user data whenever the rectangular
|
||||
* picture area containing useful information does not extend to the full height or width of the coded
|
||||
* frame. AFD data may also be included in user data when the rectangular picture area containing
|
||||
* useful information extends to the full height and width of the coded frame.
|
||||
*
|
||||
*
|
||||
* For more details, please see
|
||||
*
|
||||
* https://www.atsc.org/wp-content/uploads/2015/03/a_53-Part-4-2009.pdf
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* GstVideoAfd:
|
||||
*
|
||||
*
|
||||
* The various active format descriptions
|
||||
*
|
||||
*
|
||||
* For details, see Table 6.14 Active Format in:
|
||||
*
|
||||
* ATSC Digital Television Standard:
|
||||
* Part 4 – MPEG-2 Video System Characteristics
|
||||
*
|
||||
* https://www.atsc.org/wp-content/uploads/2015/03/a_53-Part-4-2009.pdf
|
||||
*
|
||||
*
|
||||
* and Active Format Description in
|
||||
*
|
||||
* Complete list of AFD codes
|
||||
*
|
||||
* https://en.wikipedia.org/wiki/Active_Format_Description#Complete_list_of_AFD_codes
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
* 0) value 0 is undefined for ATSC, indicating that AFD data is not available,
|
||||
* while 0 is reserved for DVB/ETSI
|
||||
* 1) values 1, 5, 6, 7, and 12 are reserved for both ATSC and DVB/ETSI
|
||||
* 2) values 2 and 3 are not recommended for ATSC, but are valid for DVB/ETSI
|
||||
*
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GST_VIDEO_AFD_ATSC_UNAVAILABLE = 0,
|
||||
GST_VIDEO_AFD_ETSI_16_9_ACTIVE_PICTURE = 2,
|
||||
GST_VIDEO_AFD_ETSI_14_9_ACTIVE_PICTURE = 3,
|
||||
GST_VIDEO_AFD_GREATER_THAN_16_9 = 4,
|
||||
GST_VIDEO_AFD_4_3_FULL_16_9_FULL = 8,
|
||||
GST_VIDEO_AFD_4_3_FULL_4_3_PILLAR = 9,
|
||||
GST_VIDEO_AFD_16_9_LETTER_16_9_FULL = 10,
|
||||
GST_VIDEO_AFD_14_9_LETTER_14_9_PILLAR = 11,
|
||||
GST_VIDEO_AFD_4_3_FULL_14_9_CENTER = 13,
|
||||
GST_VIDEO_AFD_16_9_LETTER_14_9_CENTER = 14,
|
||||
GST_VIDEO_AFD_16_9_LETTER_4_3_CENTER = 15
|
||||
} GstVideoAfd;
|
||||
|
||||
|
||||
/**
|
||||
* GstVideoAfdMeta:
|
||||
* @meta: parent #GstMeta
|
||||
* @afd: #GstVideoAfd
|
||||
*
|
||||
* Metadata providing active format description (AFD)
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
GstMeta meta;
|
||||
|
||||
GstVideoAfd afd;
|
||||
} GstVideoAfdMeta;
|
||||
|
||||
|
||||
GST_VIDEO_API GType gst_video_afd_meta_api_get_type (void);
|
||||
#define GST_VIDEO_AFD_META_API_TYPE (gst_video_afd_meta_api_get_type())
|
||||
|
||||
GST_VIDEO_API const GstMetaInfo *gst_video_afd_meta_get_info (void);
|
||||
#define GST_VIDEO_AFD_META_INFO (gst_video_afd_meta_get_info())
|
||||
|
||||
/**
|
||||
* gst_buffer_get_video_afd_meta:
|
||||
* @b: A #GstBuffer
|
||||
*
|
||||
* Gets the #GstVideoAfdMeta that might be present on @b.
|
||||
*
|
||||
* Since: 1.16
|
||||
*
|
||||
* Returns: The first #GstVideoAfdMeta present on @b, or %NULL if
|
||||
* no #GstVideoAfdMeta are present
|
||||
*/
|
||||
#define gst_buffer_get_video_afd_meta(b) \
|
||||
((GstVideoAfdMeta*)gst_buffer_get_meta((b)))
|
||||
|
||||
GST_VIDEO_API
|
||||
GstVideoAfdMeta * gst_buffer_add_video_afd_meta (GstBuffer * buffer,
|
||||
GstVideoAfd afd);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Bar data support
|
||||
*
|
||||
*
|
||||
* A/53 ATSC Digital Television Standard
|
||||
*
|
||||
*
|
||||
* Bar data should be included in video user data
|
||||
* whenever the rectangular picture area containing useful information
|
||||
* does not extend to the full height or width of the coded frame
|
||||
* and AFD alone is insufficient to describe the extent of the image.
|
||||
*
|
||||
* For more details, see:
|
||||
*
|
||||
* https://www.atsc.org/wp-content/uploads/2015/03/a_53-Part-4-2009.pdf
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* GstVideoBarData
|
||||
*
|
||||
* @top_bar_flag : flag indicating presence of top bar field
|
||||
* @bottom_bar_flag : flag indicating presence of bottom bar field
|
||||
* @left_bar_flag : flag indicating presence of left bar field
|
||||
* @right_bar_flag : flag indicating presence of right bar field
|
||||
* @top_bar: last line of a horizontal letterbox bar area at top of
|
||||
* reconstructed frame
|
||||
* @bottom_bar: first line of a horizontal letterbox bar area at
|
||||
* bottom of reconstructed frame
|
||||
* @left_bar: last horizontal luminance sample of a vertical pillarbox
|
||||
* bar area at the left side of the reconstructed frame
|
||||
* @right_bar: first horizontal luminance sample of a vertical pillarbox
|
||||
* bar area at the right side of the reconstructed frame
|
||||
*
|
||||
* Since: 1.16
|
||||
*
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
gboolean top_bar_flag;
|
||||
gboolean bottom_bar_flag;
|
||||
gboolean left_bar_flag;
|
||||
gboolean right_bar_flag;
|
||||
|
||||
guint16 top_bar;
|
||||
guint16 bottom_bar;
|
||||
guint16 left_bar;
|
||||
guint16 right_bar;
|
||||
|
||||
} GstVideoBarData;
|
||||
|
||||
|
||||
/**
|
||||
* GstVideoBarMeta:
|
||||
* @meta: parent #GstMeta
|
||||
* @bar_data: #GstVideoBarData
|
||||
*
|
||||
* Metadata providing bar data
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
GstMeta meta;
|
||||
|
||||
GstVideoBarData bar_data;
|
||||
} GstVideoBarMeta;
|
||||
|
||||
|
||||
|
||||
GST_VIDEO_API GType gst_video_bar_meta_api_get_type (void);
|
||||
#define GST_VIDEO_BAR_META_API_TYPE (gst_video_bar_meta_api_get_type())
|
||||
|
||||
GST_VIDEO_API const GstMetaInfo *gst_video_bar_meta_get_info (void);
|
||||
#define GST_VIDEO_BAR_META_INFO (gst_video_bar_meta_get_info())
|
||||
|
||||
/**
|
||||
* gst_buffer_get_video_bar_meta:
|
||||
* @b: A #GstBuffer
|
||||
*
|
||||
* Gets the #GstVideoBarMeta that might be present on @b.
|
||||
*
|
||||
* Since: 1.16
|
||||
*
|
||||
* Returns: The first #GstVideoBarMeta present on @b, or %NULL if
|
||||
* no #GstVideoBarMeta are present
|
||||
*/
|
||||
#define gst_buffer_get_video_bar_meta(b) \
|
||||
((GstVideoBarMeta*)gst_buffer_get_meta((b)))
|
||||
|
||||
GST_VIDEO_API
|
||||
GstVideoBarMeta * gst_buffer_add_video_bar_meta (GstBuffer * buffer,
|
||||
GstVideoBarData * bar_data);
|
||||
|
||||
|
||||
|
||||
/* Closed Caption support */
|
||||
/**
|
||||
* GstVideoCaptionType:
|
||||
|
|
Loading…
Reference in a new issue