+2004-06-16 Wim Taymans <wim@fluendo.com>
+
+ * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_get):
+ * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_sync_mode_get_type),
+ (gst_v4lsrc_class_init), (gst_v4lsrc_init), (gst_v4lsrc_get_fps),
+ (gst_v4lsrc_get), (gst_v4lsrc_set_property),
+ (gst_v4lsrc_get_property):
+ * sys/v4l/gstv4lsrc.h:
+ Added a copy mode to v4lsrc where it will output a copied version
+ of its internal hardware buffer.
+ Fix the wrong FLAG_SET usage. The flags are integers, not bits, you
+ can't | them.
+
2004-06-16 Wim Taymans <wim@fluendo.com>
* sys/oss/gstosssrc.c: (gst_osssrc_get):
GST_BUFFER_DATA (buf) = gst_v4lmjpegsrc_get_buffer (v4lmjpegsrc, num);
GST_BUFFER_SIZE (buf) = v4lmjpegsrc->last_size;
GST_BUFFER_MAXSIZE (buf) = v4lmjpegsrc->breq.size;
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY | GST_BUFFER_DONTFREE);
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY);
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
if (v4lmjpegsrc->use_fixed_fps)
GST_BUFFER_TIMESTAMP (buf) = v4lmjpegsrc->handled * GST_SECOND / fps;
else /* calculate time based on our own clock */
LAST_SIGNAL
};
+#define DEFAULT_SYNC_MODE GST_V4LSRC_SYNC_MODE_CLOCK
+#define DEFAULT_COPY_MODE FALSE
/* arguments */
enum
{
ARG_0,
ARG_NUMBUFS,
ARG_BUFSIZE,
- ARG_SYNC_MODE
+ ARG_SYNC_MODE,
+ ARG_COPY_MODE
};
GST_FORMATS_FUNCTION (GstPad *, gst_v4lsrc_get_formats,
GST_QUERY_TYPE_FUNCTION (GstPad *, gst_v4lsrc_get_query_types,
GST_QUERY_POSITION);
-#define DEFAULT_SYNC_MODE GST_V4LSRC_SYNC_MODE_CLOCK
-
#define GST_TYPE_V4LSRC_SYNC_MODE (gst_v4lsrc_sync_mode_get_type())
static GType
gst_v4lsrc_sync_mode_get_type (void)
g_param_spec_enum ("sync_mode", "Sync mode",
"Method to use for timestamping captured frames",
GST_TYPE_V4LSRC_SYNC_MODE, DEFAULT_SYNC_MODE, G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COPY_MODE,
+ g_param_spec_boolean ("copy_mode", "Copy mode",
+ "Don't send out HW buffers, send copy instead", DEFAULT_COPY_MODE,
+ G_PARAM_READWRITE));
/* signals */
gst_v4lsrc_signals[SIGNAL_FRAME_CAPTURE] =
/* no colourspaces */
v4lsrc->colourspaces = NULL;
- /* fps */
v4lsrc->syncmode = DEFAULT_SYNC_MODE;
+ v4lsrc->copy_mode = DEFAULT_COPY_MODE;
v4lsrc->is_capturing = FALSE;
}
v4lsrc_private->num = num;
GST_BUFFER_PRIVATE (buf) = v4lsrc_private;
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY | GST_BUFFER_DONTFREE);
+ /* don't | the flags, they are integers, not bits!! */
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY);
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
GST_BUFFER_DATA (buf) = gst_v4lsrc_get_buffer (v4lsrc, num);
GST_BUFFER_MAXSIZE (buf) = v4lsrc->mbuf.size / v4lsrc->mbuf.frames;
GST_BUFFER_SIZE (buf) = v4lsrc->buffer_size;
+ if (v4lsrc->copy_mode) {
+ GstBuffer *copy = gst_buffer_copy (buf);
+
+ gst_buffer_unref (buf);
+ buf = copy;
+ }
switch (v4lsrc->syncmode) {
case GST_V4LSRC_SYNC_MODE_FIXED_FPS:
}
break;
+ case ARG_COPY_MODE:
+ v4lsrc->copy_mode = g_value_get_boolean (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
g_value_set_enum (value, v4lsrc->syncmode);
break;
+ case ARG_COPY_MODE:
+ g_value_set_boolean (value, v4lsrc->copy_mode);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;