mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
videoflip: added GstVideoDirection interface
It implements now this interface with its video-direction property. Values are changed to GstVideoOrientationMethod but they have the same value than the originals. https://bugzilla.gnome.org/show_bug.cgi?id=768687
This commit is contained in:
parent
1ef896b29d
commit
569820598f
2 changed files with 113 additions and 77 deletions
|
@ -52,7 +52,8 @@
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_METHOD
|
PROP_METHOD,
|
||||||
|
PROP_VIDEO_DIRECTION
|
||||||
/* FILL ME */
|
/* FILL ME */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,8 +113,17 @@ gst_video_flip_method_get_type (void)
|
||||||
return video_flip_method_type;
|
return video_flip_method_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_video_flip_video_direction_interface_init (GstVideoDirectionInterface *
|
||||||
|
iface)
|
||||||
|
{
|
||||||
|
/* We implement the video-direction property */
|
||||||
|
}
|
||||||
|
|
||||||
#define gst_video_flip_parent_class parent_class
|
#define gst_video_flip_parent_class parent_class
|
||||||
G_DEFINE_TYPE (GstVideoFlip, gst_video_flip, GST_TYPE_VIDEO_FILTER);
|
G_DEFINE_TYPE_WITH_CODE (GstVideoFlip, gst_video_flip, GST_TYPE_VIDEO_FILTER,
|
||||||
|
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_DIRECTION,
|
||||||
|
gst_video_flip_video_direction_interface_init))
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
gst_video_flip_transform_caps (GstBaseTransform * trans,
|
gst_video_flip_transform_caps (GstBaseTransform * trans,
|
||||||
|
@ -133,10 +143,10 @@ gst_video_flip_transform_caps (GstBaseTransform * trans,
|
||||||
gst_structure_get_int (structure, "height", &height)) {
|
gst_structure_get_int (structure, "height", &height)) {
|
||||||
|
|
||||||
switch (videoflip->active_method) {
|
switch (videoflip->active_method) {
|
||||||
case GST_VIDEO_FLIP_METHOD_90R:
|
case GST_VIDEO_ORIENTATION_90R:
|
||||||
case GST_VIDEO_FLIP_METHOD_90L:
|
case GST_VIDEO_ORIENTATION_90L:
|
||||||
case GST_VIDEO_FLIP_METHOD_TRANS:
|
case GST_VIDEO_ORIENTATION_UL_LR:
|
||||||
case GST_VIDEO_FLIP_METHOD_OTHER:
|
case GST_VIDEO_ORIENTATION_UR_LL:
|
||||||
gst_structure_set (structure, "width", G_TYPE_INT, height,
|
gst_structure_set (structure, "width", G_TYPE_INT, height,
|
||||||
"height", G_TYPE_INT, width, NULL);
|
"height", G_TYPE_INT, width, NULL);
|
||||||
if (gst_structure_get_fraction (structure, "pixel-aspect-ratio",
|
if (gst_structure_get_fraction (structure, "pixel-aspect-ratio",
|
||||||
|
@ -151,13 +161,16 @@ gst_video_flip_transform_caps (GstBaseTransform * trans,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_IDENTITY:
|
case GST_VIDEO_ORIENTATION_IDENTITY:
|
||||||
case GST_VIDEO_FLIP_METHOD_180:
|
case GST_VIDEO_ORIENTATION_180:
|
||||||
case GST_VIDEO_FLIP_METHOD_HORIZ:
|
case GST_VIDEO_ORIENTATION_HORIZ:
|
||||||
case GST_VIDEO_FLIP_METHOD_VERT:
|
case GST_VIDEO_ORIENTATION_VERT:
|
||||||
gst_structure_set (structure, "width", G_TYPE_INT, width,
|
gst_structure_set (structure, "width", G_TYPE_INT, width,
|
||||||
"height", G_TYPE_INT, height, NULL);
|
"height", G_TYPE_INT, height, NULL);
|
||||||
break;
|
break;
|
||||||
|
case GST_VIDEO_ORIENTATION_CUSTOM:
|
||||||
|
GST_WARNING_OBJECT (videoflip, "unsuported custom orientation");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
|
@ -221,7 +234,7 @@ gst_video_flip_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
dest_v_height = GST_VIDEO_FRAME_COMP_HEIGHT (dest, 2);
|
dest_v_height = GST_VIDEO_FRAME_COMP_HEIGHT (dest, 2);
|
||||||
|
|
||||||
switch (videoflip->active_method) {
|
switch (videoflip->active_method) {
|
||||||
case GST_VIDEO_FLIP_METHOD_90R:
|
case GST_VIDEO_ORIENTATION_90R:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -250,7 +263,7 @@ gst_video_flip_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_90L:
|
case GST_VIDEO_ORIENTATION_90L:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -279,7 +292,7 @@ gst_video_flip_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_180:
|
case GST_VIDEO_ORIENTATION_180:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -308,7 +321,7 @@ gst_video_flip_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_HORIZ:
|
case GST_VIDEO_ORIENTATION_HORIZ:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -337,7 +350,7 @@ gst_video_flip_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_VERT:
|
case GST_VIDEO_ORIENTATION_VERT:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -366,7 +379,7 @@ gst_video_flip_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_TRANS:
|
case GST_VIDEO_ORIENTATION_UL_LR:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -392,7 +405,7 @@ gst_video_flip_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_OTHER:
|
case GST_VIDEO_ORIENTATION_UR_LL:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -421,7 +434,7 @@ gst_video_flip_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_IDENTITY:
|
case GST_VIDEO_ORIENTATION_IDENTITY:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -465,7 +478,7 @@ gst_video_flip_semi_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
dest_uv_height = GST_VIDEO_FRAME_COMP_HEIGHT (dest, 1);
|
dest_uv_height = GST_VIDEO_FRAME_COMP_HEIGHT (dest, 1);
|
||||||
|
|
||||||
switch (videoflip->active_method) {
|
switch (videoflip->active_method) {
|
||||||
case GST_VIDEO_FLIP_METHOD_90R:
|
case GST_VIDEO_ORIENTATION_90R:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -487,7 +500,7 @@ gst_video_flip_semi_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_90L:
|
case GST_VIDEO_ORIENTATION_90L:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -509,7 +522,7 @@ gst_video_flip_semi_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_180:
|
case GST_VIDEO_ORIENTATION_180:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -532,7 +545,7 @@ gst_video_flip_semi_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_HORIZ:
|
case GST_VIDEO_ORIENTATION_HORIZ:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -554,7 +567,7 @@ gst_video_flip_semi_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_VERT:
|
case GST_VIDEO_ORIENTATION_VERT:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -576,7 +589,7 @@ gst_video_flip_semi_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_TRANS:
|
case GST_VIDEO_ORIENTATION_UL_LR:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -597,7 +610,7 @@ gst_video_flip_semi_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_OTHER:
|
case GST_VIDEO_ORIENTATION_UR_LL:
|
||||||
/* Flip Y */
|
/* Flip Y */
|
||||||
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
s = GST_VIDEO_FRAME_PLANE_DATA (src, 0);
|
||||||
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
d = GST_VIDEO_FRAME_PLANE_DATA (dest, 0);
|
||||||
|
@ -620,7 +633,7 @@ gst_video_flip_semi_planar_yuv (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_IDENTITY:
|
case GST_VIDEO_ORIENTATION_IDENTITY:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -652,7 +665,7 @@ gst_video_flip_packed_simple (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
bpp = GST_VIDEO_FRAME_COMP_PSTRIDE (src, 0);
|
bpp = GST_VIDEO_FRAME_COMP_PSTRIDE (src, 0);
|
||||||
|
|
||||||
switch (videoflip->active_method) {
|
switch (videoflip->active_method) {
|
||||||
case GST_VIDEO_FLIP_METHOD_90R:
|
case GST_VIDEO_ORIENTATION_90R:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x++) {
|
for (x = 0; x < dw; x++) {
|
||||||
for (z = 0; z < bpp; z++) {
|
for (z = 0; z < bpp; z++) {
|
||||||
|
@ -662,7 +675,7 @@ gst_video_flip_packed_simple (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_90L:
|
case GST_VIDEO_ORIENTATION_90L:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x++) {
|
for (x = 0; x < dw; x++) {
|
||||||
for (z = 0; z < bpp; z++) {
|
for (z = 0; z < bpp; z++) {
|
||||||
|
@ -672,7 +685,7 @@ gst_video_flip_packed_simple (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_180:
|
case GST_VIDEO_ORIENTATION_180:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x++) {
|
for (x = 0; x < dw; x++) {
|
||||||
for (z = 0; z < bpp; z++) {
|
for (z = 0; z < bpp; z++) {
|
||||||
|
@ -682,7 +695,7 @@ gst_video_flip_packed_simple (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_HORIZ:
|
case GST_VIDEO_ORIENTATION_HORIZ:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x++) {
|
for (x = 0; x < dw; x++) {
|
||||||
for (z = 0; z < bpp; z++) {
|
for (z = 0; z < bpp; z++) {
|
||||||
|
@ -692,7 +705,7 @@ gst_video_flip_packed_simple (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_VERT:
|
case GST_VIDEO_ORIENTATION_VERT:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x++) {
|
for (x = 0; x < dw; x++) {
|
||||||
for (z = 0; z < bpp; z++) {
|
for (z = 0; z < bpp; z++) {
|
||||||
|
@ -702,7 +715,7 @@ gst_video_flip_packed_simple (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_TRANS:
|
case GST_VIDEO_ORIENTATION_UL_LR:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x++) {
|
for (x = 0; x < dw; x++) {
|
||||||
for (z = 0; z < bpp; z++) {
|
for (z = 0; z < bpp; z++) {
|
||||||
|
@ -711,7 +724,7 @@ gst_video_flip_packed_simple (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_OTHER:
|
case GST_VIDEO_ORIENTATION_UR_LL:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x++) {
|
for (x = 0; x < dw; x++) {
|
||||||
for (z = 0; z < bpp; z++) {
|
for (z = 0; z < bpp; z++) {
|
||||||
|
@ -721,7 +734,7 @@ gst_video_flip_packed_simple (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_IDENTITY:
|
case GST_VIDEO_ORIENTATION_IDENTITY:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -762,7 +775,7 @@ gst_video_flip_y422 (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
bpp = y_stride;
|
bpp = y_stride;
|
||||||
|
|
||||||
switch (videoflip->active_method) {
|
switch (videoflip->active_method) {
|
||||||
case GST_VIDEO_FLIP_METHOD_90R:
|
case GST_VIDEO_ORIENTATION_90R:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x += 2) {
|
for (x = 0; x < dw; x += 2) {
|
||||||
guint8 u;
|
guint8 u;
|
||||||
|
@ -789,7 +802,7 @@ gst_video_flip_y422 (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_90L:
|
case GST_VIDEO_ORIENTATION_90L:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x += 2) {
|
for (x = 0; x < dw; x += 2) {
|
||||||
guint8 u;
|
guint8 u;
|
||||||
|
@ -814,7 +827,7 @@ gst_video_flip_y422 (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_180:
|
case GST_VIDEO_ORIENTATION_180:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x += 2) {
|
for (x = 0; x < dw; x += 2) {
|
||||||
guint8 u;
|
guint8 u;
|
||||||
|
@ -838,7 +851,7 @@ gst_video_flip_y422 (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_HORIZ:
|
case GST_VIDEO_ORIENTATION_HORIZ:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x += 2) {
|
for (x = 0; x < dw; x += 2) {
|
||||||
guint8 u;
|
guint8 u;
|
||||||
|
@ -861,7 +874,7 @@ gst_video_flip_y422 (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_VERT:
|
case GST_VIDEO_ORIENTATION_VERT:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x += 2) {
|
for (x = 0; x < dw; x += 2) {
|
||||||
guint8 u;
|
guint8 u;
|
||||||
|
@ -884,7 +897,7 @@ gst_video_flip_y422 (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_TRANS:
|
case GST_VIDEO_ORIENTATION_UL_LR:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x += 2) {
|
for (x = 0; x < dw; x += 2) {
|
||||||
guint8 u;
|
guint8 u;
|
||||||
|
@ -909,7 +922,7 @@ gst_video_flip_y422 (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_OTHER:
|
case GST_VIDEO_ORIENTATION_UR_LL:
|
||||||
for (y = 0; y < dh; y++) {
|
for (y = 0; y < dh; y++) {
|
||||||
for (x = 0; x < dw; x += 2) {
|
for (x = 0; x < dw; x += 2) {
|
||||||
guint8 u;
|
guint8 u;
|
||||||
|
@ -937,7 +950,7 @@ gst_video_flip_y422 (GstVideoFlip * videoflip, GstVideoFrame * dest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_IDENTITY:
|
case GST_VIDEO_ORIENTATION_IDENTITY:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -961,10 +974,10 @@ gst_video_flip_set_info (GstVideoFilter * vfilter, GstCaps * incaps,
|
||||||
|
|
||||||
/* Check that they are correct */
|
/* Check that they are correct */
|
||||||
switch (vf->active_method) {
|
switch (vf->active_method) {
|
||||||
case GST_VIDEO_FLIP_METHOD_90R:
|
case GST_VIDEO_ORIENTATION_90R:
|
||||||
case GST_VIDEO_FLIP_METHOD_90L:
|
case GST_VIDEO_ORIENTATION_90L:
|
||||||
case GST_VIDEO_FLIP_METHOD_TRANS:
|
case GST_VIDEO_ORIENTATION_UL_LR:
|
||||||
case GST_VIDEO_FLIP_METHOD_OTHER:
|
case GST_VIDEO_ORIENTATION_UR_LL:
|
||||||
if ((in_info->width != out_info->height) ||
|
if ((in_info->width != out_info->height) ||
|
||||||
(in_info->height != out_info->width)) {
|
(in_info->height != out_info->width)) {
|
||||||
GST_ERROR_OBJECT (vf, "we are inverting width and height but caps "
|
GST_ERROR_OBJECT (vf, "we are inverting width and height but caps "
|
||||||
|
@ -973,12 +986,12 @@ gst_video_flip_set_info (GstVideoFilter * vfilter, GstCaps * incaps,
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_IDENTITY:
|
case GST_VIDEO_ORIENTATION_IDENTITY:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_180:
|
case GST_VIDEO_ORIENTATION_180:
|
||||||
case GST_VIDEO_FLIP_METHOD_HORIZ:
|
case GST_VIDEO_ORIENTATION_HORIZ:
|
||||||
case GST_VIDEO_FLIP_METHOD_VERT:
|
case GST_VIDEO_ORIENTATION_VERT:
|
||||||
if ((in_info->width != out_info->width) ||
|
if ((in_info->width != out_info->width) ||
|
||||||
(in_info->height != out_info->height)) {
|
(in_info->height != out_info->height)) {
|
||||||
GST_ERROR_OBJECT (vf, "we are keeping width and height but caps "
|
GST_ERROR_OBJECT (vf, "we are keeping width and height but caps "
|
||||||
|
@ -1039,11 +1052,17 @@ invalid_caps:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_video_flip_set_method (GstVideoFlip * videoflip, GstVideoFlipMethod method,
|
gst_video_flip_set_method (GstVideoFlip * videoflip,
|
||||||
gboolean from_tag)
|
GstVideoOrientationMethod method, gboolean from_tag)
|
||||||
{
|
{
|
||||||
GST_OBJECT_LOCK (videoflip);
|
GST_OBJECT_LOCK (videoflip);
|
||||||
|
|
||||||
|
if (method == GST_VIDEO_ORIENTATION_CUSTOM) {
|
||||||
|
GST_WARNING_OBJECT (videoflip, "unsupported custom orientation");
|
||||||
|
GST_OBJECT_UNLOCK (videoflip);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Store updated method */
|
/* Store updated method */
|
||||||
if (from_tag)
|
if (from_tag)
|
||||||
videoflip->tag_method = method;
|
videoflip->tag_method = method;
|
||||||
|
@ -1051,24 +1070,31 @@ gst_video_flip_set_method (GstVideoFlip * videoflip, GstVideoFlipMethod method,
|
||||||
videoflip->method = method;
|
videoflip->method = method;
|
||||||
|
|
||||||
/* Get the new method */
|
/* Get the new method */
|
||||||
if (videoflip->method == GST_VIDEO_FLIP_METHOD_AUTO)
|
if (videoflip->method == GST_VIDEO_ORIENTATION_AUTO)
|
||||||
method = videoflip->tag_method;
|
method = videoflip->tag_method;
|
||||||
else
|
else
|
||||||
method = videoflip->method;
|
method = videoflip->method;
|
||||||
|
|
||||||
if (method != videoflip->active_method) {
|
if (method != videoflip->active_method) {
|
||||||
|
GEnumValue *active_method_enum, *method_enum;
|
||||||
GstBaseTransform *btrans = GST_BASE_TRANSFORM (videoflip);
|
GstBaseTransform *btrans = GST_BASE_TRANSFORM (videoflip);
|
||||||
|
GEnumClass *enum_class =
|
||||||
|
g_type_class_ref (GST_TYPE_VIDEO_ORIENTATION_METHOD);
|
||||||
|
|
||||||
|
active_method_enum =
|
||||||
|
g_enum_get_value (enum_class, videoflip->active_method);
|
||||||
|
method_enum = g_enum_get_value (enum_class, method);
|
||||||
GST_DEBUG_OBJECT (videoflip, "Changing method from %s to %s",
|
GST_DEBUG_OBJECT (videoflip, "Changing method from %s to %s",
|
||||||
video_flip_methods[videoflip->active_method].value_nick,
|
active_method_enum ? active_method_enum->value_nick : "(nil)",
|
||||||
video_flip_methods[method].value_nick);
|
method_enum ? method_enum->value_nick : "(nil)");
|
||||||
|
g_type_class_unref (enum_class);
|
||||||
|
|
||||||
videoflip->active_method = method;
|
videoflip->active_method = method;
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (videoflip);
|
GST_OBJECT_UNLOCK (videoflip);
|
||||||
|
|
||||||
gst_base_transform_set_passthrough (btrans,
|
gst_base_transform_set_passthrough (btrans,
|
||||||
method == GST_VIDEO_FLIP_METHOD_IDENTITY);
|
method == GST_VIDEO_ORIENTATION_IDENTITY);
|
||||||
gst_base_transform_reconfigure_src (btrans);
|
gst_base_transform_reconfigure_src (btrans);
|
||||||
} else {
|
} else {
|
||||||
GST_OBJECT_UNLOCK (videoflip);
|
GST_OBJECT_UNLOCK (videoflip);
|
||||||
|
@ -1096,13 +1122,18 @@ static GstFlowReturn
|
||||||
gst_video_flip_transform_frame (GstVideoFilter * vfilter,
|
gst_video_flip_transform_frame (GstVideoFilter * vfilter,
|
||||||
GstVideoFrame * in_frame, GstVideoFrame * out_frame)
|
GstVideoFrame * in_frame, GstVideoFrame * out_frame)
|
||||||
{
|
{
|
||||||
|
GEnumClass *enum_class;
|
||||||
|
GEnumValue *active_method_enum;
|
||||||
GstVideoFlip *videoflip = GST_VIDEO_FLIP (vfilter);
|
GstVideoFlip *videoflip = GST_VIDEO_FLIP (vfilter);
|
||||||
|
|
||||||
if (G_UNLIKELY (videoflip->process == NULL))
|
if (G_UNLIKELY (videoflip->process == NULL))
|
||||||
goto not_negotiated;
|
goto not_negotiated;
|
||||||
|
|
||||||
|
enum_class = g_type_class_ref (GST_TYPE_VIDEO_ORIENTATION_METHOD);
|
||||||
|
active_method_enum = g_enum_get_value (enum_class, videoflip->active_method);
|
||||||
GST_LOG_OBJECT (videoflip, "videoflip: flipping (%s)",
|
GST_LOG_OBJECT (videoflip, "videoflip: flipping (%s)",
|
||||||
video_flip_methods[videoflip->active_method].value_nick);
|
active_method_enum ? active_method_enum->value_nick : "(nil)");
|
||||||
|
g_type_class_unref (enum_class);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (videoflip);
|
GST_OBJECT_LOCK (videoflip);
|
||||||
videoflip->process (videoflip, out_frame, in_frame);
|
videoflip->process (videoflip, out_frame, in_frame);
|
||||||
|
@ -1138,31 +1169,31 @@ gst_video_flip_src_event (GstBaseTransform * trans, GstEvent * event)
|
||||||
gst_structure_get_double (structure, "pointer_y", &y)) {
|
gst_structure_get_double (structure, "pointer_y", &y)) {
|
||||||
GST_DEBUG_OBJECT (vf, "converting %fx%f", x, y);
|
GST_DEBUG_OBJECT (vf, "converting %fx%f", x, y);
|
||||||
switch (vf->active_method) {
|
switch (vf->active_method) {
|
||||||
case GST_VIDEO_FLIP_METHOD_90R:
|
case GST_VIDEO_ORIENTATION_90R:
|
||||||
new_x = y;
|
new_x = y;
|
||||||
new_y = out_info->width - x;
|
new_y = out_info->width - x;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_90L:
|
case GST_VIDEO_ORIENTATION_90L:
|
||||||
new_x = out_info->height - y;
|
new_x = out_info->height - y;
|
||||||
new_y = x;
|
new_y = x;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_OTHER:
|
case GST_VIDEO_ORIENTATION_UR_LL:
|
||||||
new_x = out_info->height - y;
|
new_x = out_info->height - y;
|
||||||
new_y = out_info->width - x;
|
new_y = out_info->width - x;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_TRANS:
|
case GST_VIDEO_ORIENTATION_UL_LR:
|
||||||
new_x = y;
|
new_x = y;
|
||||||
new_y = x;
|
new_y = x;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_180:
|
case GST_VIDEO_ORIENTATION_180:
|
||||||
new_x = out_info->width - x;
|
new_x = out_info->width - x;
|
||||||
new_y = out_info->height - y;
|
new_y = out_info->height - y;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_HORIZ:
|
case GST_VIDEO_ORIENTATION_HORIZ:
|
||||||
new_x = out_info->width - x;
|
new_x = out_info->width - x;
|
||||||
new_y = y;
|
new_y = y;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FLIP_METHOD_VERT:
|
case GST_VIDEO_ORIENTATION_VERT:
|
||||||
new_x = x;
|
new_x = x;
|
||||||
new_y = out_info->height - y;
|
new_y = out_info->height - y;
|
||||||
break;
|
break;
|
||||||
|
@ -1201,21 +1232,21 @@ gst_video_flip_sink_event (GstBaseTransform * trans, GstEvent * event)
|
||||||
|
|
||||||
if (gst_tag_list_get_string (taglist, "image-orientation", &orientation)) {
|
if (gst_tag_list_get_string (taglist, "image-orientation", &orientation)) {
|
||||||
if (!g_strcmp0 ("rotate-0", orientation))
|
if (!g_strcmp0 ("rotate-0", orientation))
|
||||||
gst_video_flip_set_method (vf, GST_VIDEO_FLIP_METHOD_IDENTITY, TRUE);
|
gst_video_flip_set_method (vf, GST_VIDEO_ORIENTATION_IDENTITY, TRUE);
|
||||||
else if (!g_strcmp0 ("rotate-90", orientation))
|
else if (!g_strcmp0 ("rotate-90", orientation))
|
||||||
gst_video_flip_set_method (vf, GST_VIDEO_FLIP_METHOD_90R, TRUE);
|
gst_video_flip_set_method (vf, GST_VIDEO_ORIENTATION_90R, TRUE);
|
||||||
else if (!g_strcmp0 ("rotate-180", orientation))
|
else if (!g_strcmp0 ("rotate-180", orientation))
|
||||||
gst_video_flip_set_method (vf, GST_VIDEO_FLIP_METHOD_180, TRUE);
|
gst_video_flip_set_method (vf, GST_VIDEO_ORIENTATION_180, TRUE);
|
||||||
else if (!g_strcmp0 ("rotate-270", orientation))
|
else if (!g_strcmp0 ("rotate-270", orientation))
|
||||||
gst_video_flip_set_method (vf, GST_VIDEO_FLIP_METHOD_90L, TRUE);
|
gst_video_flip_set_method (vf, GST_VIDEO_ORIENTATION_90L, TRUE);
|
||||||
else if (!g_strcmp0 ("flip-rotate-0", orientation))
|
else if (!g_strcmp0 ("flip-rotate-0", orientation))
|
||||||
gst_video_flip_set_method (vf, GST_VIDEO_FLIP_METHOD_HORIZ, TRUE);
|
gst_video_flip_set_method (vf, GST_VIDEO_ORIENTATION_HORIZ, TRUE);
|
||||||
else if (!g_strcmp0 ("flip-rotate-90", orientation))
|
else if (!g_strcmp0 ("flip-rotate-90", orientation))
|
||||||
gst_video_flip_set_method (vf, GST_VIDEO_FLIP_METHOD_TRANS, TRUE);
|
gst_video_flip_set_method (vf, GST_VIDEO_ORIENTATION_UL_LR, TRUE);
|
||||||
else if (!g_strcmp0 ("flip-rotate-180", orientation))
|
else if (!g_strcmp0 ("flip-rotate-180", orientation))
|
||||||
gst_video_flip_set_method (vf, GST_VIDEO_FLIP_METHOD_VERT, TRUE);
|
gst_video_flip_set_method (vf, GST_VIDEO_ORIENTATION_VERT, TRUE);
|
||||||
else if (!g_strcmp0 ("flip-rotate-270", orientation))
|
else if (!g_strcmp0 ("flip-rotate-270", orientation))
|
||||||
gst_video_flip_set_method (vf, GST_VIDEO_FLIP_METHOD_OTHER, TRUE);
|
gst_video_flip_set_method (vf, GST_VIDEO_ORIENTATION_UR_LL, TRUE);
|
||||||
|
|
||||||
g_free (orientation);
|
g_free (orientation);
|
||||||
}
|
}
|
||||||
|
@ -1237,6 +1268,7 @@ gst_video_flip_set_property (GObject * object, guint prop_id,
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_METHOD:
|
case PROP_METHOD:
|
||||||
|
case PROP_VIDEO_DIRECTION:
|
||||||
gst_video_flip_set_method (videoflip, g_value_get_enum (value), FALSE);
|
gst_video_flip_set_method (videoflip, g_value_get_enum (value), FALSE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1253,6 +1285,7 @@ gst_video_flip_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_METHOD:
|
case PROP_METHOD:
|
||||||
|
case PROP_VIDEO_DIRECTION:
|
||||||
g_value_set_enum (value, videoflip->method);
|
g_value_set_enum (value, videoflip->method);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1275,10 +1308,13 @@ gst_video_flip_class_init (GstVideoFlipClass * klass)
|
||||||
gobject_class->get_property = gst_video_flip_get_property;
|
gobject_class->get_property = gst_video_flip_get_property;
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_METHOD,
|
g_object_class_install_property (gobject_class, PROP_METHOD,
|
||||||
g_param_spec_enum ("method", "method", "method",
|
g_param_spec_enum ("method", "method",
|
||||||
|
"method (deprecated, use video-direction instead)",
|
||||||
GST_TYPE_VIDEO_FLIP_METHOD, PROP_METHOD_DEFAULT,
|
GST_TYPE_VIDEO_FLIP_METHOD, PROP_METHOD_DEFAULT,
|
||||||
GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
|
GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
g_object_class_override_property (gobject_class, PROP_VIDEO_DIRECTION,
|
||||||
|
"video-direction");
|
||||||
|
|
||||||
gst_element_class_set_static_metadata (gstelement_class, "Video flipper",
|
gst_element_class_set_static_metadata (gstelement_class, "Video flipper",
|
||||||
"Filter/Effect/Video",
|
"Filter/Effect/Video",
|
||||||
|
@ -1306,5 +1342,5 @@ gst_video_flip_init (GstVideoFlip * videoflip)
|
||||||
{
|
{
|
||||||
/* AUTO is not valid for active method, this is just to ensure we setup the
|
/* AUTO is not valid for active method, this is just to ensure we setup the
|
||||||
* method in gst_video_flip_set_method() */
|
* method in gst_video_flip_set_method() */
|
||||||
videoflip->active_method = GST_VIDEO_FLIP_METHOD_AUTO;
|
videoflip->active_method = GST_VIDEO_ORIENTATION_AUTO;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,9 +75,9 @@ struct _GstVideoFlip {
|
||||||
GstVideoFilter videofilter;
|
GstVideoFilter videofilter;
|
||||||
|
|
||||||
/* < private > */
|
/* < private > */
|
||||||
GstVideoFlipMethod method;
|
GstVideoOrientationMethod method;
|
||||||
GstVideoFlipMethod tag_method;
|
GstVideoOrientationMethod tag_method;
|
||||||
GstVideoFlipMethod active_method;
|
GstVideoOrientationMethod active_method;
|
||||||
void (*process) (GstVideoFlip *videoflip, GstVideoFrame *dest, const GstVideoFrame *src);
|
void (*process) (GstVideoFlip *videoflip, GstVideoFrame *dest, const GstVideoFrame *src);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue