videoparseutils: Minor improvements to _parse_bar
Use the enum type for the argument and loudly complain when not passing a place to output. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5450>
This commit is contained in:
parent
c0dc65d40a
commit
5c0cad5f02
@ -34,7 +34,7 @@ GST_DEBUG_CATEGORY_EXTERN (videoparseutils_debug);
|
|||||||
#define GST_CAT_DEFAULT videoparseutils_debug
|
#define GST_CAT_DEFAULT videoparseutils_debug
|
||||||
|
|
||||||
static gboolean gst_video_parse_utils_parse_bar (const guint8 * data,
|
static gboolean gst_video_parse_utils_parse_bar (const guint8 * data,
|
||||||
gsize size, guint field, GstVideoBarData * bar);
|
gsize size, GstVideoParseUtilsField field, GstVideoBarData * bar);
|
||||||
|
|
||||||
static gboolean gst_video_parse_utils_parse_afd (const guint8 data,
|
static gboolean gst_video_parse_utils_parse_afd (const guint8 data,
|
||||||
GstVideoAFD * afd, GstVideoAFDSpec spec);
|
GstVideoAFD * afd, GstVideoAFDSpec spec);
|
||||||
@ -309,11 +309,11 @@ gst_video_push_user_data (GstElement * elt, GstVideoParseUserData * user_data,
|
|||||||
user_data->has_bar_data = FALSE;
|
user_data->has_bar_data = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gst_video_parse_utils_parse_bar:
|
* gst_video_parse_utils_parse_bar:
|
||||||
* @data: bar data array
|
* @data: bar data array
|
||||||
* @size:size of bar data array
|
* @size: size of bar data array
|
||||||
|
* @field: #GstVideoParseUtilsField we're parsing for
|
||||||
* @bar: #GstVideoBarData structure
|
* @bar: #GstVideoBarData structure
|
||||||
*
|
*
|
||||||
* Parse bar data bytes into #GstVideoBarData structure
|
* Parse bar data bytes into #GstVideoBarData structure
|
||||||
@ -324,7 +324,7 @@ gst_video_push_user_data (GstElement * elt, GstVideoParseUserData * user_data,
|
|||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_video_parse_utils_parse_bar (const guint8 * data, gsize size,
|
gst_video_parse_utils_parse_bar (const guint8 * data, gsize size,
|
||||||
guint field, GstVideoBarData * bar)
|
GstVideoParseUtilsField field, GstVideoBarData * bar)
|
||||||
{
|
{
|
||||||
guint8 temp;
|
guint8 temp;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -332,13 +332,13 @@ gst_video_parse_utils_parse_bar (const guint8 * data, gsize size,
|
|||||||
guint16 bar_vals[4] = { 0, 0, 0, 0 };
|
guint16 bar_vals[4] = { 0, 0, 0, 0 };
|
||||||
GstBitReader bar_tender;
|
GstBitReader bar_tender;
|
||||||
|
|
||||||
/* there must be at least one byte, and not more than GST_VIDEO_BAR_MAX_BYTES bytes */
|
g_return_val_if_fail (bar != NULL, FALSE);
|
||||||
if (!bar || size == 0 || size > GST_VIDEO_BAR_MAX_BYTES)
|
|
||||||
|
if (size == 0 || size > GST_VIDEO_BAR_MAX_BYTES)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
gst_bit_reader_init (&bar_tender, data, size);
|
gst_bit_reader_init (&bar_tender, data, size);
|
||||||
|
|
||||||
|
|
||||||
/* parse bar flags */
|
/* parse bar flags */
|
||||||
for (i = 0; i < 4; ++i) {
|
for (i = 0; i < 4; ++i) {
|
||||||
if (!gst_bit_reader_get_bits_uint8 (&bar_tender, bar_flags + i, 1))
|
if (!gst_bit_reader_get_bits_uint8 (&bar_tender, bar_flags + i, 1))
|
||||||
@ -367,6 +367,7 @@ gst_video_parse_utils_parse_bar (const guint8 * data, gsize size,
|
|||||||
if (bar_flags[0] && bar_flags[2])
|
if (bar_flags[0] && bar_flags[2])
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
bar->field = field;
|
||||||
bar->is_letterbox = bar_flags[0];
|
bar->is_letterbox = bar_flags[0];
|
||||||
if (bar->is_letterbox) {
|
if (bar->is_letterbox) {
|
||||||
bar->bar_data[0] = bar_vals[0];
|
bar->bar_data[0] = bar_vals[0];
|
||||||
@ -375,8 +376,6 @@ gst_video_parse_utils_parse_bar (const guint8 * data, gsize size,
|
|||||||
bar->bar_data[0] = bar_vals[2];
|
bar->bar_data[0] = bar_vals[2];
|
||||||
bar->bar_data[1] = bar_vals[3];
|
bar->bar_data[1] = bar_vals[3];
|
||||||
}
|
}
|
||||||
bar->field = field;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user