Commit de654b59 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Some more explicit palette type handling

Original commit message from CVS:
Some more explicit palette type handling
parent 146fa099
......@@ -42,7 +42,10 @@ enum {
ARG_0,
ARG_WIDTH,
ARG_HEIGHT,
ARG_PALETTE
ARG_PALETTE,
ARG_PALETTE_NAME,
ARG_NUMBUFS,
ARG_BUFSIZE
};
......@@ -126,7 +129,16 @@ gst_v4lsrc_class_init (GstV4lSrcClass *klass)
G_MININT,G_MAXINT,0,G_PARAM_READWRITE));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_PALETTE,
g_param_spec_int("palette","palette","palette",
G_MININT,G_MAXINT,0,G_PARAM_READWRITE));
0,G_MAXUSHORT,0,G_PARAM_READWRITE));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_PALETTE_NAME,
g_param_spec_string("palette_name","palette_name","palette_name",
NULL, G_PARAM_READABLE));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_NUMBUFS,
g_param_spec_int("num_buffers","num_buffers","num_buffers",
G_MININT,G_MAXINT,0,G_PARAM_READABLE));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_BUFSIZE,
g_param_spec_int("buffer_size","buffer_size","buffer_size",
G_MININT,G_MAXINT,0,G_PARAM_READABLE));
gobject_class->set_property = gst_v4lsrc_set_property;
gobject_class->get_property = gst_v4lsrc_get_property;
......@@ -434,6 +446,18 @@ gst_v4lsrc_get_property (GObject *object,
g_value_set_int(value, v4lsrc->mmap.format);
break;
case ARG_PALETTE_NAME:
g_value_set_string(value, g_strdup(palette_name[v4lsrc->mmap.format]));
break;
case ARG_NUMBUFS:
g_value_set_int(value, v4lsrc->mbuf.frames);
break;
case ARG_BUFSIZE:
g_value_set_int(value, v4lsrc->mbuf.size/(v4lsrc->mbuf.frames*1024));
break;
default:
/*parent_class->get_property(object, prop_id, value, pspec);*/
break;
......
......@@ -74,7 +74,7 @@ struct _GstV4lSrc {
/* caching values */
gint width;
gint height;
gint palette;
guint16 palette;
};
struct _GstV4lSrcClass {
......
......@@ -39,6 +39,28 @@
#endif
/* palette names */
char *palette_name[] = {
"", /* 0 */
"grayscale", /* VIDEO_PALETTE_GREY */
"Hi-420", /* VIDEO_PALETTE_HI420 */
"16-bit RGB (RGB-565)", /* VIDEO_PALETTE_RB565 */
"24-bit RGB", /* VIDEO_PALETTE_RGB24 */
"32-bit RGB", /* VIDEO_PALETTE_RGB32 */
"15-bit RGB (RGB-555)", /* VIDEO_PALETTE_RGB555 */
"YUV-4:2:2 (packed)", /* VIDEO_PALETTE_YUV422 */
"YUYV", /* VIDEO_PALETTE_YUYV */
"UYVY", /* VIDEO_PALETTE_UYVY */
"YUV-4:2:0 (packed)", /* VIDEO_PALETTE_YUV420 */
"YUV-4:1:1 (packed)", /* VIDEO_PALETTE_YUV411 */
"Raw", /* VIDEO_PALETTE_RAW */
"YUV-4:2:2 (planar)", /* VIDEO_PALETTE_YUV422P */
"YUV-4:1:1 (planar)", /* VIDEO_PALETTE_YUV411P */
"YUV-4:2:0 (planar)", /* VIDEO_PALETTE_YUV420P */
"YUV-4:1:0 (planar)" /* VIDEO_PALETTE_YUV410P */
};
/******************************************************
* gst_v4lsrc_queue_frame():
* queue a frame for capturing
......@@ -265,8 +287,9 @@ gst_v4lsrc_capture_init (GstV4lSrc *v4lsrc)
}
gst_element_info(GST_ELEMENT(v4lsrc),
"Got %d buffers of size %d KB",
v4lsrc->mbuf.frames, v4lsrc->mbuf.size/(v4lsrc->mbuf.frames*1024));
"Got %d buffers (\'%s\') of size %d KB",
v4lsrc->mbuf.frames, palette_name[v4lsrc->mmap.format],
v4lsrc->mbuf.size/(v4lsrc->mbuf.frames*1024));
/* keep trakc of queued buffers */
v4lsrc->frame_queued = (gint *) malloc(sizeof(int) * v4lsrc->mbuf.frames);
......
......@@ -28,6 +28,9 @@ extern "C" {
#endif /* __cplusplus */
extern char *palette_name[];
/* frame grabbing/capture (palette = VIDEO_PALETTE_* - see videodev.h) */
gboolean gst_v4lsrc_set_capture (GstV4lSrc *v4lsrc, gint width, gint height, gint palette);
gboolean gst_v4lsrc_capture_init (GstV4lSrc *v4lsrc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment