rpicamsrc: enable video orientation/direction unconditionally

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/667>
This commit is contained in:
Tim-Philipp Müller 2020-07-09 18:04:10 +00:00
parent b222ca1fc9
commit b7c07b1a95
2 changed files with 6 additions and 26 deletions

View file

@ -135,9 +135,7 @@ enum
PROP_ANNOTATION_TEXT_COLOUR, PROP_ANNOTATION_TEXT_COLOUR,
PROP_ANNOTATION_TEXT_BG_COLOUR, PROP_ANNOTATION_TEXT_BG_COLOUR,
PROP_INTRA_REFRESH_TYPE, PROP_INTRA_REFRESH_TYPE,
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
PROP_VIDEO_DIRECTION, PROP_VIDEO_DIRECTION,
#endif
PROP_JPEG_QUALITY, PROP_JPEG_QUALITY,
PROP_USE_STC PROP_USE_STC
}; };
@ -193,12 +191,6 @@ enum
#define RAW_CAPS \ #define RAW_CAPS \
GST_VIDEO_CAPS_MAKE ("{ I420, RGB, BGR, RGBA }") /* FIXME: Map more raw formats */ GST_VIDEO_CAPS_MAKE ("{ I420, RGB, BGR, RGBA }") /* FIXME: Map more raw formats */
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
#define gst_rpi_cam_src_reset_custom_orientation(src) { src->orientation = GST_VIDEO_ORIENTATION_CUSTOM; }
#else
#define gst_rpi_cam_src_reset_custom_orientation(src) { }
#endif
static GstStaticPadTemplate video_src_template = GST_STATIC_PAD_TEMPLATE ("src", static GstStaticPadTemplate video_src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
@ -212,9 +204,7 @@ static void gst_rpi_cam_src_colorbalance_init (GstColorBalanceInterface *
iface); iface);
static void gst_rpi_cam_src_orientation_init (GstVideoOrientationInterface * static void gst_rpi_cam_src_orientation_init (GstVideoOrientationInterface *
iface); iface);
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
static void gst_rpi_cam_src_direction_init (GstVideoDirectionInterface * iface); static void gst_rpi_cam_src_direction_init (GstVideoDirectionInterface * iface);
#endif
static void gst_rpi_cam_src_set_property (GObject * object, guint prop_id, static void gst_rpi_cam_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
@ -238,10 +228,8 @@ G_DEFINE_TYPE_WITH_CODE (GstRpiCamSrc, gst_rpi_cam_src,
GST_TYPE_PUSH_SRC, GST_TYPE_PUSH_SRC,
G_IMPLEMENT_INTERFACE (GST_TYPE_COLOR_BALANCE, G_IMPLEMENT_INTERFACE (GST_TYPE_COLOR_BALANCE,
gst_rpi_cam_src_colorbalance_init); gst_rpi_cam_src_colorbalance_init);
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_DIRECTION, G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_DIRECTION,
gst_rpi_cam_src_direction_init); gst_rpi_cam_src_direction_init);
#endif
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_ORIENTATION, G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_ORIENTATION,
gst_rpi_cam_src_orientation_init)); gst_rpi_cam_src_orientation_init));
@ -492,10 +480,8 @@ gst_rpi_cam_src_class_init (GstRpiCamSrcClass * klass)
"Annotation text background colour (VUY)", "Annotation text background colour (VUY)",
"Set the annotation text background colour, as the integer corresponding to a VUY value eg 0x8080FF = 8421631, -1 for default", "Set the annotation text background colour, as the integer corresponding to a VUY value eg 0x8080FF = 8421631, -1 for default",
-1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
g_object_class_override_property (gobject_class, PROP_VIDEO_DIRECTION, g_object_class_override_property (gobject_class, PROP_VIDEO_DIRECTION,
"video-direction"); "video-direction");
#endif
g_object_class_install_property (gobject_class, PROP_USE_STC, g_object_class_install_property (gobject_class, PROP_USE_STC,
g_param_spec_boolean ("use-stc", "Use System Time Clock", g_param_spec_boolean ("use-stc", "Use System Time Clock",
"Use the camera STC for timestamping buffers", TRUE, "Use the camera STC for timestamping buffers", TRUE,
@ -655,7 +641,12 @@ gst_rpi_cam_src_colorbalance_get_balance_type (GstColorBalance * balance)
return GST_COLOR_BALANCE_HARDWARE; return GST_COLOR_BALANCE_HARDWARE;
} }
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION static void
gst_rpi_cam_src_reset_custom_orientation (GstRpiCamSrc * src)
{
src->orientation = GST_VIDEO_ORIENTATION_CUSTOM;
}
static void static void
gst_rpi_cam_src_set_orientation (GstRpiCamSrc * src, gst_rpi_cam_src_set_orientation (GstRpiCamSrc * src,
GstVideoOrientationMethod orientation) GstVideoOrientationMethod orientation)
@ -727,7 +718,6 @@ gst_rpi_cam_src_direction_init (GstVideoDirectionInterface * iface)
{ {
/* We implement the video-direction property */ /* We implement the video-direction property */
} }
#endif
static void static void
gst_rpi_cam_src_colorbalance_init (GstColorBalanceInterface * iface) gst_rpi_cam_src_colorbalance_init (GstColorBalanceInterface * iface)
@ -1023,11 +1013,9 @@ gst_rpi_cam_src_set_property (GObject * object, guint prop_id,
src->capture_config.intra_refresh_type = g_value_get_enum (value); src->capture_config.intra_refresh_type = g_value_get_enum (value);
src->capture_config.change_flags |= PROP_CHANGE_ENCODING; src->capture_config.change_flags |= PROP_CHANGE_ENCODING;
break; break;
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
case PROP_VIDEO_DIRECTION: case PROP_VIDEO_DIRECTION:
gst_rpi_cam_src_set_orientation (src, g_value_get_enum (value)); gst_rpi_cam_src_set_orientation (src, g_value_get_enum (value));
break; break;
#endif
case PROP_USE_STC: case PROP_USE_STC:
src->capture_config.useSTC = g_value_get_boolean (value); src->capture_config.useSTC = g_value_get_boolean (value);
break; break;
@ -1197,11 +1185,9 @@ gst_rpi_cam_src_get_property (GObject * object, guint prop_id,
case PROP_INTRA_REFRESH_TYPE: case PROP_INTRA_REFRESH_TYPE:
g_value_set_enum (value, src->capture_config.intra_refresh_type); g_value_set_enum (value, src->capture_config.intra_refresh_type);
break; break;
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
case PROP_VIDEO_DIRECTION: case PROP_VIDEO_DIRECTION:
g_value_set_enum (value, src->orientation); g_value_set_enum (value, src->orientation);
break; break;
#endif
case PROP_USE_STC: case PROP_USE_STC:
g_value_set_boolean (value, src->capture_config.useSTC); g_value_set_boolean (value, src->capture_config.useSTC);
break; break;

View file

@ -61,10 +61,6 @@ G_BEGIN_DECLS
#define GST_IS_RPICAMSRC_CLASS(klass) \ #define GST_IS_RPICAMSRC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RPICAMSRC)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RPICAMSRC))
#if GST_CHECK_PLUGINS_BASE_VERSION(1, 9, 2)
#define GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
#endif
typedef struct _GstRpiCamSrc GstRpiCamSrc; typedef struct _GstRpiCamSrc GstRpiCamSrc;
typedef struct _GstRpiCamSrcClass GstRpiCamSrcClass; typedef struct _GstRpiCamSrcClass GstRpiCamSrcClass;
@ -83,9 +79,7 @@ struct _GstRpiCamSrc
/* channels for interface */ /* channels for interface */
GList *channels; GList *channels;
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
GstVideoOrientationMethod orientation; GstVideoOrientationMethod orientation;
#endif
GstClockTime duration; GstClockTime duration;
}; };