mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-13 02:45:35 +00:00
video.c: use a break and a final warning instead of early returns
Use breaks for case branches instead of return 0. We don't expect these to happen anyway. Thus have a warning before the final return to make it easier to see when things go out of sync.
This commit is contained in:
parent
40273cf2d3
commit
6e12954c68
1 changed files with 25 additions and 19 deletions
|
@ -1744,7 +1744,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
|
||||
(GST_ROUND_UP_2 (height) / 2);
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_YV12: /* same as I420, but components 1+2 swapped */
|
||||
if (component == 0)
|
||||
return 0;
|
||||
|
@ -1755,7 +1755,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
|
||||
(GST_ROUND_UP_2 (height) / 2);
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
if (component == 0)
|
||||
return 0;
|
||||
|
@ -1763,7 +1763,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 1;
|
||||
if (component == 2)
|
||||
return 3;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_YVYU:
|
||||
if (component == 0)
|
||||
return 0;
|
||||
|
@ -1771,7 +1771,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 3;
|
||||
if (component == 2)
|
||||
return 1;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_UYVY:
|
||||
if (component == 0)
|
||||
return 1;
|
||||
|
@ -1779,7 +1779,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 0;
|
||||
if (component == 2)
|
||||
return 2;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_AYUV:
|
||||
if (component == 0)
|
||||
return 1;
|
||||
|
@ -1789,7 +1789,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 3;
|
||||
if (component == 3)
|
||||
return 0;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_RGBx:
|
||||
case GST_VIDEO_FORMAT_RGBA:
|
||||
if (component == 0)
|
||||
|
@ -1800,7 +1800,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 2;
|
||||
if (component == 3)
|
||||
return 3;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_BGRx:
|
||||
case GST_VIDEO_FORMAT_BGRA:
|
||||
if (component == 0)
|
||||
|
@ -1811,7 +1811,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 0;
|
||||
if (component == 3)
|
||||
return 3;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_xRGB:
|
||||
case GST_VIDEO_FORMAT_ARGB:
|
||||
if (component == 0)
|
||||
|
@ -1822,7 +1822,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 3;
|
||||
if (component == 3)
|
||||
return 0;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_xBGR:
|
||||
case GST_VIDEO_FORMAT_ABGR:
|
||||
if (component == 0)
|
||||
|
@ -1833,7 +1833,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 1;
|
||||
if (component == 3)
|
||||
return 0;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_RGB:
|
||||
case GST_VIDEO_FORMAT_v308:
|
||||
if (component == 0)
|
||||
|
@ -1842,7 +1842,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 1;
|
||||
if (component == 2)
|
||||
return 2;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_BGR:
|
||||
if (component == 0)
|
||||
return 2;
|
||||
|
@ -1850,7 +1850,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 1;
|
||||
if (component == 2)
|
||||
return 0;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_Y41B:
|
||||
if (component == 0)
|
||||
return 0;
|
||||
|
@ -1859,7 +1859,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
if (component == 2)
|
||||
return (GST_ROUND_UP_4 (width) +
|
||||
(GST_ROUND_UP_16 (width) / 4)) * height;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_Y42B:
|
||||
if (component == 0)
|
||||
return 0;
|
||||
|
@ -1867,7 +1867,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return GST_ROUND_UP_4 (width) * height;
|
||||
if (component == 2)
|
||||
return (GST_ROUND_UP_4 (width) + (GST_ROUND_UP_8 (width) / 2)) * height;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_Y444:
|
||||
return GST_ROUND_UP_4 (width) * height * component;
|
||||
case GST_VIDEO_FORMAT_v210:
|
||||
|
@ -1881,7 +1881,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 2;
|
||||
if (component == 2)
|
||||
return 6;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_NV12:
|
||||
if (component == 0)
|
||||
return 0;
|
||||
|
@ -1889,6 +1889,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
|
||||
if (component == 2)
|
||||
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) + 1;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_NV21:
|
||||
if (component == 0)
|
||||
return 0;
|
||||
|
@ -1896,6 +1897,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) + 1;
|
||||
if (component == 2)
|
||||
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_GRAY8:
|
||||
case GST_VIDEO_FORMAT_GRAY16_BE:
|
||||
case GST_VIDEO_FORMAT_GRAY16_LE:
|
||||
|
@ -1920,6 +1922,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
2 * GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
|
||||
(GST_ROUND_UP_2 (height) / 2);
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_RGB8_PALETTED:
|
||||
return 0;
|
||||
case GST_VIDEO_FORMAT_YUV9:
|
||||
|
@ -1932,7 +1935,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4) *
|
||||
(GST_ROUND_UP_4 (height) / 4);
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_YVU9:
|
||||
if (component == 0)
|
||||
return 0;
|
||||
|
@ -1943,7 +1946,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
}
|
||||
if (component == 2)
|
||||
return GST_ROUND_UP_4 (width) * height;
|
||||
return 0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_IYU1:
|
||||
if (component == 0)
|
||||
return 1;
|
||||
|
@ -1951,6 +1954,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 0;
|
||||
if (component == 2)
|
||||
return 4;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_ARGB64:
|
||||
case GST_VIDEO_FORMAT_AYUV64:
|
||||
if (component == 0)
|
||||
|
@ -1961,10 +1965,12 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
return 6;
|
||||
if (component == 3)
|
||||
return 0;
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
GST_WARNING ("unhandled format %d or component %d", format, component);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue