Commit eac38b47 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵 Committed by Nicolas Dufresne

video-anc: Add invalid-argument guards to public GstVideoVBIParser API

parent 11b9695b
......@@ -34,7 +34,6 @@
* present in Vertical Blanking Interval as well as Closed Caption.
*/
#ifndef GST_DISABLE_GST_DEBUG
#define GST_CAT_DEFAULT ensure_debug_category()
static GstDebugCategory *
......@@ -75,6 +74,8 @@ gst_video_vbi_parser_copy (const GstVideoVBIParser * parser)
{
GstVideoVBIParser *res;
g_return_val_if_fail (parser != NULL, NULL);
res = gst_video_vbi_parser_new (GST_VIDEO_INFO_FORMAT (&parser->info),
parser->info.width);
if (res) {
......@@ -219,6 +220,9 @@ GstVideoVBIParserResult
gst_video_vbi_parser_get_ancillary (GstVideoVBIParser * parser,
GstVideoAncillary * anc)
{
g_return_val_if_fail (parser != NULL, GST_VIDEO_VBI_PARSER_RESULT_ERROR);
g_return_val_if_fail (anc != NULL, GST_VIDEO_VBI_PARSER_RESULT_ERROR);
if (parser->bit16)
return get_ancillary_16 (parser, anc);
return get_ancillary_8 (parser, anc);
......@@ -241,6 +245,8 @@ gst_video_vbi_parser_new (GstVideoFormat format, guint32 pixel_width)
{
GstVideoVBIParser *parser;
g_return_val_if_fail (pixel_width > 0, NULL);
switch (format) {
case GST_VIDEO_FORMAT_v210:
parser = g_new0 (GstVideoVBIParser, 1);
......@@ -287,11 +293,12 @@ gst_video_vbi_parser_new (GstVideoFormat format, guint32 pixel_width)
void
gst_video_vbi_parser_free (GstVideoVBIParser * parser)
{
g_return_if_fail (parser != NULL);
g_free (parser->work_data);
g_free (parser);
}
static void
convert_line_uyvy (GstVideoVBIParser * parser, const guint8 * data)
{
......@@ -399,6 +406,9 @@ convert_line_v210 (GstVideoVBIParser * parser, const guint8 * data)
void
gst_video_vbi_parser_add_line (GstVideoVBIParser * parser, const guint8 * data)
{
g_return_if_fail (parser != NULL);
g_return_if_fail (data != NULL);
/* Reset offset */
parser->offset = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment