PROP_DECIMATE
};
-GST_IMPLEMENT_V4L2_PROBE_METHODS (GstV4l2SrcClass, gst_v4l2src);
GST_IMPLEMENT_V4L2_COLOR_BALANCE_METHODS (GstV4l2Src, gst_v4l2src);
GST_IMPLEMENT_V4L2_TUNER_METHODS (GstV4l2Src, gst_v4l2src);
#ifdef HAVE_XVIDEO
G_IMPLEMENT_INTERFACE (GST_TYPE_COLOR_BALANCE,
gst_v4l2src_color_balance_interface_init);
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_ORIENTATION,
- gst_v4l2src_video_orientation_interface_init);
- G_IMPLEMENT_INTERFACE (GST_TYPE_PROPERTY_PROBE,
- gst_v4l2src_property_probe_interface_init));
+ gst_v4l2src_video_orientation_interface_init));
static void gst_v4l2src_dispose (GObject * object);
static void gst_v4l2src_finalize (GstV4l2Src * v4l2src);
static gboolean gst_v4l2src_decide_allocation (GstBaseSrc * src,
GstQuery * query);
static GstFlowReturn gst_v4l2src_fill (GstPushSrc * src, GstBuffer * out);
-static void gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps);
+static GstCaps *gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps);
static gboolean gst_v4l2src_negotiate (GstBaseSrc * basesrc);
static void gst_v4l2src_set_property (GObject * object, guint prop_id,
}
/* this function is a bit of a last resort */
-static void
+static GstCaps *
gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps)
{
GstStructure *structure;
GST_DEBUG_OBJECT (basesrc, "fixating caps %" GST_PTR_FORMAT, caps);
+ caps = gst_caps_make_writable (caps);
+
for (i = 0; i < gst_caps_get_size (caps); ++i) {
structure = gst_caps_get_structure (caps, i);
GST_DEBUG_OBJECT (basesrc, "fixated caps %" GST_PTR_FORMAT, caps);
- GST_BASE_SRC_CLASS (parent_class)->fixate (basesrc, caps);
+ caps = GST_BASE_SRC_CLASS (parent_class)->fixate (basesrc, caps);
+
+ return caps;
}
gboolean result = FALSE;
/* first see what is possible on our source pad */
- thiscaps = gst_pad_get_caps (GST_BASE_SRC_PAD (basesrc), NULL);
+ thiscaps = gst_pad_query_caps (GST_BASE_SRC_PAD (basesrc), NULL);
GST_DEBUG_OBJECT (basesrc, "caps of src: %" GST_PTR_FORMAT, thiscaps);
LOG_CAPS (basesrc, thiscaps);
goto no_nego_needed;
/* get the peer caps */
- peercaps = gst_pad_peer_get_caps (GST_BASE_SRC_PAD (basesrc), thiscaps);
+ peercaps = gst_pad_peer_query_caps (GST_BASE_SRC_PAD (basesrc), thiscaps);
GST_DEBUG_OBJECT (basesrc, "caps of peer: %" GST_PTR_FORMAT, peercaps);
LOG_CAPS (basesrc, peercaps);
if (peercaps && !gst_caps_is_any (peercaps)) {
}
}
gst_caps_unref (thiscaps);
- gst_caps_unref (peercaps);
} else {
/* no peer or peer have ANY caps, work with our own caps then */
caps = thiscaps;
}
+ if (peercaps)
+ gst_caps_unref (peercaps);
if (caps) {
- caps = gst_caps_make_writable (caps);
- gst_caps_truncate (caps);
+ caps = gst_caps_truncate (caps);
/* now fixate */
if (!gst_caps_is_empty (caps)) {
- gst_pad_fixate_caps (GST_BASE_SRC_PAD (basesrc), caps);
+ caps = gst_v4l2src_fixate (basesrc, caps);
GST_DEBUG_OBJECT (basesrc, "fixated to: %" GST_PTR_FORMAT, caps);
LOG_CAPS (basesrc, caps);
GstV4l2Src *src;
GstV4l2Object *obj;
GstBufferPool *pool;
- guint size, min, max, prefix, alignment;
+ guint size, min, max;
+ gboolean update;
src = GST_V4L2SRC (bsrc);
obj = src->v4l2object;
- gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &alignment, &pool);
+ if (gst_query_get_n_allocation_pools (query) > 0) {
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
+ update = TRUE;
+ } else {
+ pool = NULL;
+ min = max = 0;
+ size = 0;
+ update = FALSE;
+ }
- GST_DEBUG_OBJECT (src, "allocation: size:%u min:%u max:%u prefix:%u "
- "align:%u pool:%" GST_PTR_FORMAT, size, min, max, prefix, alignment,
- pool);
+ GST_DEBUG_OBJECT (src, "allocation: size:%u min:%u max:%u pool:%"
+ GST_PTR_FORMAT, size, min, max, pool);
if (min != 0) {
/* if there is a min-buffers suggestion, use it. We add 1 because we need 1
const GstCaps *caps;
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL);
- gst_buffer_pool_config_set (config, caps, size, min, max, prefix,
- alignment);
+ gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
+ NULL);
+ gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
/* if downstream supports video metadata, add this to the pool config */
- if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API))
+ if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE))
gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
gst_buffer_pool_set_config (pool, config);
}
- gst_query_set_allocation_params (query, size, min, max, prefix,
- alignment, pool);
+ if (update)
+ gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
+ else
+ gst_query_add_allocation_pool (query, pool, size, min, max);
return TRUE;
}
/* activate settings for first frame */
v4l2src->ctrl_time = 0;
- gst_object_sync_values (G_OBJECT (src), v4l2src->ctrl_time);
+ gst_object_sync_values (GST_OBJECT (src), v4l2src->ctrl_time);
return TRUE;
}
*/
v4l2src->ctrl_time = timestamp;
}
- gst_object_sync_values (G_OBJECT (src), v4l2src->ctrl_time);
+ gst_object_sync_values (GST_OBJECT (src), v4l2src->ctrl_time);
GST_INFO_OBJECT (src, "sync to %" GST_TIME_FORMAT,
GST_TIME_ARGS (v4l2src->ctrl_time));
return GST_URI_SRC;
}
-static gchar **
+static const gchar *const *
gst_v4l2src_uri_get_protocols (GType type)
{
- static gchar *protocols[] = { (char *) "v4l2", NULL };
+ static const gchar *protocols[] = { "v4l2", NULL };
return protocols;
}
-static const gchar *
+static gchar *
gst_v4l2src_uri_get_uri (GstURIHandler * handler)
{
GstV4l2Src *v4l2src = GST_V4L2SRC (handler);
if (v4l2src->v4l2object->videodev != NULL) {
- gchar uri[256];
-
- /* need to return a const string, but also don't want to leak the generated
- * string, so just intern it - there's a limited number of video devices
- * after all */
- g_snprintf (uri, sizeof (uri), "v4l2://%s", v4l2src->v4l2object->videodev);
- return g_intern_string (uri);
+ return g_strdup_printf ("v4l2://%s", v4l2src->v4l2object->videodev);
}
- return "v4l2://";
+ return g_strdup ("v4l2://");
}
static gboolean
-gst_v4l2src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_v4l2src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** error)
{
GstV4l2Src *v4l2src = GST_V4L2SRC (handler);
const gchar *device = DEFAULT_PROP_DEVICE;