sys/v4l2/Makefile.am: Fix makefile, list libs in stack order.

Original commit message from CVS:
* sys/v4l2/Makefile.am:
Fix makefile, list libs in stack order.
* sys/v4l2/gstv4l2colorbalance.c:
* sys/v4l2/gstv4l2colorbalance.h:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_device_get_type),
(gst_v4l2_object_install_properties_helper):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read),
(gst_v4l2src_get_mmap), (gst_v4l2src_create):
* sys/v4l2/gstv4l2src.h:
* sys/v4l2/gstv4l2tuner.h:
* sys/v4l2/gstv4l2vidorient.h:
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2_calls.h:
* sys/v4l2/v4l2src_calls.h:
Fix coding style:
- Remove extern from functions.
- Fix header indentation.
Fix Flags, add defaults for properties.
Remove unused enums.
Fix TOO_LAZY in error messages.
This commit is contained in:
Wim Taymans 2006-09-26 13:18:06 +00:00
parent d9db447dfa
commit 27bde5b96e
12 changed files with 150 additions and 202 deletions

View file

@ -27,9 +27,9 @@ libgstvideo4linux2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstvideo4linux2_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
$(GST_BASE_LIBS) \
-lgstinterfaces-$(GST_MAJORMINOR) \
$(GST_LIBS) \
$(xv_libs) \
-lgstinterfaces-$(GST_MAJORMINOR)
$(xv_libs)
noinst_HEADERS = gstv4l2object.h v4l2_calls.h \
gstv4l2src.h v4l2src_calls.h \

View file

@ -33,7 +33,6 @@ GST_BOILERPLATE (GstV4l2ColorBalanceChannel,
gst_v4l2_color_balance_channel,
GstColorBalanceChannel, GST_TYPE_COLOR_BALANCE_CHANNEL);
static void
gst_v4l2_color_balance_channel_base_init (gpointer g_class)
{

View file

@ -55,15 +55,13 @@ typedef struct _GstV4l2ColorBalanceChannelClass {
GType gst_v4l2_color_balance_channel_get_type (void);
extern const GList *
gst_v4l2_color_balance_list_channels (GstV4l2Object * v4l2object);
const GList * gst_v4l2_color_balance_list_channels (GstV4l2Object * v4l2object);
extern void
gst_v4l2_color_balance_set_value (GstV4l2Object * v4l2object,
GstColorBalanceChannel * channel, gint value);
void gst_v4l2_color_balance_set_value (GstV4l2Object * v4l2object,
GstColorBalanceChannel * channel,
gint value);
extern gint
gst_v4l2_color_balance_get_value (GstV4l2Object * v4l2object,
gint gst_v4l2_color_balance_get_value (GstV4l2Object * v4l2object,
GstColorBalanceChannel * channel);
#define GST_IMPLEMENT_V4L2_COLOR_BALANCE_METHODS(Type, interface_as_function) \

View file

@ -35,6 +35,13 @@
#endif
#include "gstv4l2colorbalance.h"
#define DEFAULT_PROP_DEVICE "/dev/video0"
#define DEFAULT_PROP_DEVICE_NAME NULL
#define DEFAULT_PROP_FLAGS 0
#define DEFAULT_PROP_STD NULL
#define DEFAULT_PROP_INPUT NULL
#define DEFAULT_PROP_FREQUENCY 0
enum
{
PROP_0,
@ -205,22 +212,15 @@ gst_v4l2_device_get_type (void)
if (v4l2_device_type == 0) {
static const GFlagsValue values[] = {
{V4L2_CAP_VIDEO_CAPTURE, "CAPTURE",
"Device supports video capture"},
{V4L2_CAP_VIDEO_OUTPUT, "PLAYBACK",
"Device supports video playback"},
{V4L2_CAP_VIDEO_OVERLAY, "OVERLAY",
"Device supports video overlay"},
{V4L2_CAP_VIDEO_CAPTURE, "Device supports video capture", "capture"},
{V4L2_CAP_VIDEO_OUTPUT, "Device supports video playback", "output"},
{V4L2_CAP_VIDEO_OVERLAY, "Device supports video overlay", "overlay"},
{V4L2_CAP_VBI_CAPTURE, "VBI_CAPTURE",
"Device supports the VBI capture"},
{V4L2_CAP_VBI_OUTPUT, "VBI_OUTPUT",
"Device supports the VBI output"},
{V4L2_CAP_VBI_CAPTURE, "Device supports the VBI capture", "vbi-capture"},
{V4L2_CAP_VBI_OUTPUT, "Device supports the VBI output", "vbi-output"},
{V4L2_CAP_TUNER, "TUNER",
"Device has a tuner or modulator"},
{V4L2_CAP_AUDIO, "AUDIO",
"Device has audio inputs or outputs"},
{V4L2_CAP_TUNER, "Device has a tuner or modulator", "tuner"},
{V4L2_CAP_AUDIO, "Device has audio inputs or outputs", "audio"},
{0, NULL, NULL}
};
@ -235,34 +235,26 @@ gst_v4l2_device_get_type (void)
void
gst_v4l2_object_install_properties_helper (GObjectClass * gobject_class)
{
g_object_class_install_property
(G_OBJECT_CLASS (gobject_class), PROP_DEVICE,
g_param_spec_string ("device",
"Device", "Device location", NULL, G_PARAM_READWRITE));
g_object_class_install_property
(G_OBJECT_CLASS (gobject_class),
PROP_DEVICE_NAME,
g_param_spec_string ("device-name",
"Device name", "Name of the device", NULL, G_PARAM_READABLE));
g_object_class_install_property
(G_OBJECT_CLASS (gobject_class), PROP_FLAGS,
g_param_spec_flags ("flags", "Flags",
"Device type flags",
GST_TYPE_V4L2_DEVICE_FLAGS, 0, G_PARAM_READABLE));
g_object_class_install_property
(gobject_class, PROP_STD,
g_param_spec_string ("std", "Std",
"Standard (norm) to use", NULL, G_PARAM_READWRITE));
g_object_class_install_property
(gobject_class, PROP_INPUT,
g_param_spec_string ("input",
"Input",
"Input/output (channel) to switch to", NULL, G_PARAM_READWRITE));
g_object_class_install_property
(gobject_class, PROP_FREQUENCY,
g_param_spec_ulong ("frequency",
"Frequency",
"Frequency to tune to (in Hz)", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_DEVICE,
g_param_spec_string ("device", "Device", "Device location",
DEFAULT_PROP_DEVICE, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
g_param_spec_string ("device-name", "Device name",
"Name of the device", DEFAULT_PROP_DEVICE_NAME, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_FLAGS,
g_param_spec_flags ("flags", "Flags", "Device type flags",
GST_TYPE_V4L2_DEVICE_FLAGS, DEFAULT_PROP_FLAGS, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_STD,
g_param_spec_string ("std", "Std", "Standard (norm) to use",
DEFAULT_PROP_STD, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_INPUT,
g_param_spec_string ("input", "Input",
"Input/output (channel) to switch to", DEFAULT_PROP_INPUT,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_FREQUENCY,
g_param_spec_ulong ("frequency", "Frequency",
"Frequency to tune to (in Hz)", 0, G_MAXULONG, DEFAULT_PROP_FREQUENCY,
G_PARAM_READWRITE));
}
GstV4l2Object *
@ -285,7 +277,7 @@ gst_v4l2_object_new (GstElement * element,
v4l2object->video_fd = -1;
v4l2object->buffer = NULL;
v4l2object->videodev = g_strdup ("/dev/video0");
v4l2object->videodev = g_strdup (DEFAULT_PROP_DEVICE);
v4l2object->stds = NULL;
v4l2object->inputs = NULL;

View file

@ -90,7 +90,6 @@ struct _GstV4l2Object {
gchar *input;
gulong frequency;
/* X-overlay */
GstV4l2Xv *xv;
gulong xwindow_id;
@ -117,46 +116,36 @@ GType gst_v4l2_object_get_type(void);
PROP_FREQUENCY
extern GstV4l2Object *
gst_v4l2_object_new (GstElement * element,
/* create/destroy */
GstV4l2Object * gst_v4l2_object_new (GstElement * element,
GstV4l2GetInOutFunction get_in_out_func,
GstV4l2SetInOutFunction set_in_out_func,
GstV4l2UpdateFpsFunction update_fps_func);
void gst_v4l2_object_destroy (GstV4l2Object ** v4l2object);
extern void
gst_v4l2_object_destroy (GstV4l2Object ** v4l2object);
/* properties */
void gst_v4l2_object_install_properties_helper (GObjectClass *gobject_class);
extern void
gst_v4l2_object_install_properties_helper (GObjectClass *gobject_class);
gboolean gst_v4l2_object_set_property_helper (GstV4l2Object *v4l2object,
guint prop_id, const GValue * value,
GParamSpec * pspec);
gboolean gst_v4l2_object_get_property_helper (GstV4l2Object *v4l2object,
guint prop_id, GValue * value,
GParamSpec * pspec);
/* starting/stopping */
gboolean gst_v4l2_object_start (GstV4l2Object *v4l2object);
gboolean gst_v4l2_object_stop (GstV4l2Object *v4l2object);
extern gboolean
gst_v4l2_object_set_property_helper (GstV4l2Object *v4l2object,
guint prop_id, const GValue * value, GParamSpec * pspec);
extern gboolean
gst_v4l2_object_get_property_helper (GstV4l2Object *v4l2object,
guint prop_id, GValue * value, GParamSpec * pspec);
/* probing */
const GList* gst_v4l2_probe_get_properties (GstPropertyProbe * probe);
extern gboolean gst_v4l2_object_start (GstV4l2Object *v4l2object);
extern gboolean gst_v4l2_object_stop (GstV4l2Object *v4l2object);
extern const GList *
gst_v4l2_probe_get_properties (GstPropertyProbe * probe);
extern void
gst_v4l2_probe_probe_property (GstPropertyProbe * probe,
guint prop_id,
void gst_v4l2_probe_probe_property (GstPropertyProbe * probe, guint prop_id,
const GParamSpec * pspec,
GList ** klass_devices);
extern gboolean
gst_v4l2_probe_needs_probe (GstPropertyProbe * probe,
guint prop_id,
gboolean gst_v4l2_probe_needs_probe (GstPropertyProbe * probe, guint prop_id,
const GParamSpec * pspec,
GList ** klass_devices);
extern GValueArray *
gst_v4l2_probe_get_values (GstPropertyProbe * probe,
guint prop_id,
GValueArray* gst_v4l2_probe_get_values (GstPropertyProbe * probe, guint prop_id,
const GParamSpec * pspec,
GList ** klass_devices);

View file

@ -67,6 +67,7 @@ GST_ELEMENT_DETAILS ("Video (video4linux2/raw) Source",
GST_DEBUG_CATEGORY (v4l2src_debug);
#define GST_CAT_DEFAULT v4l2src_debug
#define DEFAULT_PROP_USE_FIXED_FPS TRUE
enum
{
@ -276,6 +277,7 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass)
basesrc_class = GST_BASE_SRC_CLASS (klass);
pushsrc_class = GST_PUSH_SRC_CLASS (klass);
gobject_class->dispose = gst_v4l2src_dispose;
gobject_class->set_property = gst_v4l2src_set_property;
gobject_class->get_property = gst_v4l2src_get_property;
@ -286,7 +288,7 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass)
g_param_spec_boolean ("use-fixed-fps", "Use Fixed FPS",
"Drop/Insert frames to reach a certain FPS (TRUE) "
"or adapt FPS to suit the number of frabbed frames",
TRUE, G_PARAM_READWRITE));
DEFAULT_PROP_USE_FIXED_FPS, G_PARAM_READWRITE));
basesrc_class->get_caps = gst_v4l2src_get_caps;
basesrc_class->set_caps = gst_v4l2src_set_caps;
@ -294,8 +296,6 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass)
basesrc_class->stop = gst_v4l2src_stop;
pushsrc_class->create = gst_v4l2src_create;
gobject_class->dispose = gst_v4l2src_dispose;
}
static void
@ -311,7 +311,7 @@ gst_v4l2src_init (GstV4l2Src * v4l2src, GstV4l2SrcClass * klass)
/* fps */
v4l2src->fps_n = 0;
v4l2src->fps_d = 1;
v4l2src->use_fixed_fps = TRUE;
v4l2src->use_fixed_fps = DEFAULT_PROP_USE_FIXED_FPS;
v4l2src->is_capturing = FALSE;

View file

@ -24,7 +24,6 @@
#ifndef __GST_V4L2SRC_H__
#define __GST_V4L2SRC_H__
#include <gstv4l2object.h>
GST_DEBUG_CATEGORY_EXTERN (v4l2src_debug);
@ -69,15 +68,6 @@ struct _GstV4l2Buffer
GstV4l2BufferPool *pool;
};
enum
{
QUEUE_STATE_ERROR = -1,
QUEUE_STATE_READY_FOR_QUEUE, /* the frame is ready to be queued for capture */
QUEUE_STATE_QUEUED, /* the frame is queued for capture */
QUEUE_STATE_SYNCED /* the frame is captured */
};
struct _GstV4l2Src
{
GstPushSrc pushsrc;
@ -111,11 +101,10 @@ struct _GstV4l2SrcClass
GstPushSrcClass parent_class;
GList *v4l2_class_devices;
};
GType gst_v4l2src_get_type (void);
G_END_DECLS
#endif /* __GST_V4L2SRC_H__ */

View file

@ -79,38 +79,34 @@ typedef struct _GstV4l2TunerNormClass {
GstTunerNormClass parent;
} GstV4l2TunerNormClass;
extern gboolean
gst_v4l2_tuner_set_channel (GstV4l2Object * v4l2object, GstTunerChannel * channel);
extern gboolean
gst_v4l2_tuner_set_norm (GstV4l2Object * v4l2object, GstTunerNorm * norm);
extern gboolean
gst_v4l2_tuner_set_frequency (GstV4l2Object * v4l2object,
GstTunerChannel * channel, gulong frequency);
GType gst_v4l2_tuner_channel_get_type (void);
GType gst_v4l2_tuner_norm_get_type (void);
extern const GList *
gst_v4l2_tuner_list_channels (GstV4l2Object * v4l2object);
extern void
gst_v4l2_tuner_set_channel_and_notify (GstV4l2Object * v4l2object, GstTunerChannel * channel);
extern GstTunerChannel *
gst_v4l2_tuner_get_channel (GstV4l2Object * v4l2object);
extern const GList *
gst_v4l2_tuner_list_norms (GstV4l2Object * v4l2object);
extern void
gst_v4l2_tuner_set_norm_and_notify (GstV4l2Object * v4l2object, GstTunerNorm * norm);
extern GstTunerNorm *
gst_v4l2_tuner_get_norm (GstV4l2Object * v4l2object);
extern void
gst_v4l2_tuner_set_frequency_and_notify (GstV4l2Object * v4l2object,
GstTunerChannel * channel, gulong frequency);
extern gulong
gst_v4l2_tuner_get_frequency (GstV4l2Object * v4l2object, GstTunerChannel * channel);
extern gint
gst_v4l2_tuner_signal_strength (GstV4l2Object * v4l2object, GstTunerChannel * channel);
/* channels */
const GList* gst_v4l2_tuner_list_channels (GstV4l2Object * v4l2object);
void gst_v4l2_tuner_set_channel_and_notify (GstV4l2Object * v4l2object,
GstTunerChannel * channel);
GstTunerChannel* gst_v4l2_tuner_get_channel (GstV4l2Object * v4l2object);
gboolean gst_v4l2_tuner_set_channel (GstV4l2Object * v4l2object,
GstTunerChannel * channel);
/* norms */
const GList* gst_v4l2_tuner_list_norms (GstV4l2Object * v4l2object);
void gst_v4l2_tuner_set_norm_and_notify (GstV4l2Object * v4l2object,
GstTunerNorm * norm);
GstTunerNorm* gst_v4l2_tuner_get_norm (GstV4l2Object * v4l2object);
gboolean gst_v4l2_tuner_set_norm (GstV4l2Object * v4l2object,
GstTunerNorm * norm);
/* frequency */
void gst_v4l2_tuner_set_frequency_and_notify (GstV4l2Object * v4l2object,
GstTunerChannel * channel,
gulong frequency);
gint gst_v4l2_tuner_signal_strength (GstV4l2Object * v4l2object,
GstTunerChannel * channel);
gulong gst_v4l2_tuner_get_frequency (GstV4l2Object * v4l2object,
GstTunerChannel * channel);
gboolean gst_v4l2_tuner_set_frequency (GstV4l2Object * v4l2object,
GstTunerChannel * channel,
gulong frequency);
#define GST_IMPLEMENT_V4L2_TUNER_METHODS(Type, interface_as_function) \
\

View file

@ -30,27 +30,17 @@
G_BEGIN_DECLS
extern gboolean
gst_v4l2_video_orientation_get_hflip (GstV4l2Object *v4l2object, gboolean *flip);
extern gboolean
gst_v4l2_video_orientation_get_vflip (GstV4l2Object *v4l2object, gboolean *flip);
extern gboolean
gst_v4l2_video_orientation_get_hcenter (GstV4l2Object *v4l2object, gint *center);
extern gboolean
gst_v4l2_video_orientation_get_vcenter (GstV4l2Object *v4l2object, gint *center);
void gst_v4l2_video_orientation_interface_init (GstVideoOrientationInterface * klass);
extern gboolean
gst_v4l2_video_orientation_set_hflip (GstV4l2Object *v4l2object, gboolean flip);
extern gboolean
gst_v4l2_video_orientation_set_vflip (GstV4l2Object *v4l2object, gboolean flip);
extern gboolean
gst_v4l2_video_orientation_set_hcenter (GstV4l2Object *v4l2object, gint center);
extern gboolean
gst_v4l2_video_orientation_set_vcenter (GstV4l2Object *v4l2object, gint center);
gboolean gst_v4l2_video_orientation_get_hflip (GstV4l2Object *v4l2object, gboolean *flip);
gboolean gst_v4l2_video_orientation_get_vflip (GstV4l2Object *v4l2object, gboolean *flip);
gboolean gst_v4l2_video_orientation_get_hcenter (GstV4l2Object *v4l2object, gint *center);
gboolean gst_v4l2_video_orientation_get_vcenter (GstV4l2Object *v4l2object, gint *center);
extern void
gst_v4l2_video_orientation_interface_init (GstVideoOrientationInterface * klass);
gboolean gst_v4l2_video_orientation_set_hflip (GstV4l2Object *v4l2object, gboolean flip);
gboolean gst_v4l2_video_orientation_set_vflip (GstV4l2Object *v4l2object, gboolean flip);
gboolean gst_v4l2_video_orientation_set_hcenter (GstV4l2Object *v4l2object, gint center);
gboolean gst_v4l2_video_orientation_set_vcenter (GstV4l2Object *v4l2object, gint center);
#define GST_IMPLEMENT_V4L2_VIDORIENT_METHODS(Type, interface_as_function) \
\

View file

@ -36,8 +36,7 @@ G_BEGIN_DECLS
void gst_v4l2_xoverlay_start (GstV4l2Object *v4l2object);
void gst_v4l2_xoverlay_stop (GstV4l2Object *v4l2object);
extern void
gst_v4l2_xoverlay_interface_init (GstXOverlayClass * klass);
void gst_v4l2_xoverlay_interface_init (GstXOverlayClass * klass);
#define GST_IMPLEMENT_V4L2_XOVERLAY_METHODS(Type, interface_as_function) \
\

View file

@ -43,7 +43,7 @@
#define GST_V4L2_CHECK_OPEN(v4l2object) \
if (!GST_V4L2_IS_OPEN(v4l2object)) \
{ \
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, TOO_LAZY, \
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, \
(_("Device is not open.")), (NULL)); \
return FALSE; \
}
@ -52,7 +52,7 @@
#define GST_V4L2_CHECK_NOT_OPEN(v4l2object) \
if (GST_V4L2_IS_OPEN(v4l2object)) \
{ \
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, TOO_LAZY, \
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, \
(_("Device is open.")), (NULL)); \
return FALSE; \
}
@ -61,7 +61,7 @@
#define GST_V4L2_CHECK_OVERLAY(v4l2object) \
if (!GST_V4L2_IS_OVERLAY(v4l2object)) \
{ \
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, TOO_LAZY, \
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, \
(NULL), ("Device cannot handle overlay")); \
return FALSE; \
}

View file

@ -27,45 +27,41 @@
#include "gstv4l2src.h"
#include "v4l2_calls.h"
gboolean gst_v4l2src_get_capture (GstV4l2Src * v4l2src);
gboolean gst_v4l2src_set_capture (GstV4l2Src * v4l2src,
struct v4l2_fmtdesc *fmt,
gint * width, gint * height,
guint *fps_n, guint * fps_d);
gboolean gst_v4l2src_capture_init (GstV4l2Src * v4l2src);
gboolean gst_v4l2src_capture_start (GstV4l2Src * v4l2src);
gint gst_v4l2src_grab_frame (GstV4l2Src * v4l2src);
gint gst_v4l2src_grab_frame (GstV4l2Src * v4l2src);
gboolean gst_v4l2src_queue_frame (GstV4l2Src * v4l2src, guint i);
gboolean gst_v4l2src_capture_stop (GstV4l2Src * v4l2src);
gboolean gst_v4l2src_capture_deinit (GstV4l2Src * v4l2src);
gboolean gst_v4l2src_fill_format_list (GstV4l2Src * v4l2src);
gboolean gst_v4l2src_clear_format_list (GstV4l2Src * v4l2src);
/* hacky */
gboolean gst_v4l2src_get_size_limits (GstV4l2Src * v4l2src,
struct v4l2_fmtdesc *fmt,
gint * min_w, gint * max_w,
gint * min_h, gint * max_h);
void gst_v4l2src_free_buffer (GstBuffer * buffer);
extern gboolean
gst_v4l2src_update_fps (GstV4l2Object * v4l2object);
extern gboolean
gst_v4l2src_get_fps (GstV4l2Src * v4l2src, guint * fps_n, guint * fps_d);
extern gboolean
gst_v4l2src_set_fps (GstV4l2Src * v4l2src, guint * fps_n, guint * fps_d);
GValue *gst_v4l2src_get_fps_list (GstV4l2Src * v4l2src);
GstBuffer *gst_v4l2src_buffer_new (GstV4l2Src * v4l2src,
/* buffers */
GstBuffer* gst_v4l2src_buffer_new (GstV4l2Src * v4l2src,
guint size, guint8 * data,
GstV4l2Buffer * srcbuf);
void gst_v4l2src_free_buffer (GstBuffer * buffer);
/* FPS stuff */
gboolean gst_v4l2src_update_fps (GstV4l2Object * v4l2object);
gboolean gst_v4l2src_get_fps (GstV4l2Src * v4l2src,
guint * fps_n, guint * fps_d);
gboolean gst_v4l2src_set_fps (GstV4l2Src * v4l2src,
guint * fps_n, guint * fps_d);
GValue* gst_v4l2src_get_fps_list (GstV4l2Src * v4l2src);
#endif /* __V4L2SRC_CALLS_H__ */