Small updates to avimux and the v4l plugins for usability in general

Original commit message from CVS:
Small updates to avimux and the v4l plugins for usability in general
This commit is contained in:
Ronald S. Bultje 2002-02-20 07:25:40 +00:00
parent 3166609b38
commit 712fbd0e6b
8 changed files with 82 additions and 31 deletions

View file

@ -3,11 +3,13 @@ TODO list (short term):
* as soon as we've trashed Gtk-1.2, change 'gint palette' * as soon as we've trashed Gtk-1.2, change 'gint palette'
to 'guint16 palette' in gstv4lsrc.[ch] to 'guint16 palette' in gstv4lsrc.[ch]
* v4lsrc: actually try the format out on capsnego * v4lsrc: actually try the format out on capsnego
* all plugins: on try_set_caps(), loop try_set_caps() per caps
instead of using a multi-caps so we know the end-format
* all three: fix interlacing (not handled at all...) * all three: fix interlacing (not handled at all...)
* add overlay handling in v4lelement * add overlay handling in v4lelement
* libgstrec * libgstrec
* avidemux: add events (seek) * avidemux: add events (seek)
* avimux: fps calculations * avimux: fps calculations (or make that a set/get_property()?)
TODO list (long term): TODO list (long term):
====================== ======================

View file

@ -37,9 +37,9 @@ enum {
enum { enum {
ARG_0, ARG_0,
ARG_CHANNEL, ARG_CHANNEL,
ARG_CHANNEL_NAME, ARG_CHANNEL_NAMES,
ARG_NORM, ARG_NORM,
ARG_NORM_NAME, ARG_NORM_NAMES,
ARG_HAS_TUNER, ARG_HAS_TUNER,
ARG_FREQUENCY, ARG_FREQUENCY,
ARG_HAS_AUDIO, ARG_HAS_AUDIO,
@ -119,15 +119,15 @@ gst_v4lelement_class_init (GstV4lElementClass *klass)
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_CHANNEL, g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_CHANNEL,
g_param_spec_int("channel","channel","channel", g_param_spec_int("channel","channel","channel",
G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); G_MININT,G_MAXINT,0,G_PARAM_READWRITE));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_CHANNEL_NAME, g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_CHANNEL_NAMES,
g_param_spec_string("channel_name","channel_name","channel_name", g_param_spec_pointer("channel_names","channel_names","channel_names",
NULL, G_PARAM_READABLE)); G_PARAM_READABLE));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_NORM, g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_NORM,
g_param_spec_int("norm","norm","norm", g_param_spec_int("norm","norm","norm",
G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); G_MININT,G_MAXINT,0,G_PARAM_READWRITE));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_NORM_NAME, g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_NORM_NAMES,
g_param_spec_string("norm_name","norm_name","norm_name", g_param_spec_pointer("norm_names","norm_names","norm_names",
NULL, G_PARAM_READABLE)); G_PARAM_READABLE));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_HAS_TUNER, g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_HAS_TUNER,
g_param_spec_boolean("has_tuner","has_tuner","has_tuner", g_param_spec_boolean("has_tuner","has_tuner","has_tuner",
@ -346,6 +346,7 @@ gst_v4lelement_get_property (GObject *object,
GstV4lElement *v4lelement; GstV4lElement *v4lelement;
gint temp_i = 0; gint temp_i = 0;
gulong temp_ul = 0; gulong temp_ul = 0;
GList *list = NULL;
/* it's not null if we got it, but it might not be ours */ /* it's not null if we got it, but it might not be ours */
g_return_if_fail(GST_IS_V4LELEMENT(object)); g_return_if_fail(GST_IS_V4LELEMENT(object));
@ -358,25 +359,20 @@ gst_v4lelement_get_property (GObject *object,
gst_v4l_get_chan_norm(v4lelement, &temp_i, NULL); gst_v4l_get_chan_norm(v4lelement, &temp_i, NULL);
g_value_set_int(value, temp_i); g_value_set_int(value, temp_i);
break; break;
case ARG_CHANNEL_NAME: case ARG_CHANNEL_NAMES:
if (GST_V4L_IS_OPEN(v4lelement)) if (GST_V4L_IS_OPEN(v4lelement))
g_value_set_string(value, g_strdup(v4lelement->vchan.name)); list = gst_v4l_get_chan_names(v4lelement);
else g_value_set_pointer(value, (gpointer)list);
g_value_set_string(value, g_strdup("Unknown"));
break; break;
case ARG_NORM: case ARG_NORM:
if (GST_V4L_IS_OPEN(v4lelement)) if (GST_V4L_IS_OPEN(v4lelement))
gst_v4l_get_chan_norm(v4lelement, NULL, &temp_i); gst_v4l_get_chan_norm(v4lelement, NULL, &temp_i);
g_value_set_int(value, temp_i); g_value_set_int(value, temp_i);
break; break;
case ARG_NORM_NAME: case ARG_NORM_NAMES:
if (GST_V4L_IS_OPEN(v4lelement)) for (temp_i=0;norm_name[temp_i]!=NULL;temp_i++)
{ list = g_list_append(list, (gpointer)g_strdup(norm_name[temp_i]));
gst_v4l_get_chan_norm(v4lelement, NULL, &temp_i); g_value_set_pointer(value, (gpointer)list);
g_value_set_string(value, g_strdup(norm_name[temp_i]));
}
else
g_value_set_string(value, g_strdup("Unknwon"));
break; break;
case ARG_HAS_TUNER: case ARG_HAS_TUNER:
g_value_set_boolean(value, FALSE); g_value_set_boolean(value, FALSE);

View file

@ -313,6 +313,27 @@ gst_v4lmjpegsrc_get_property (GObject *object,
case ARG_HEIGHT: case ARG_HEIGHT:
g_value_set_int(value, v4lmjpegsrc->end_height); g_value_set_int(value, v4lmjpegsrc->end_height);
break; break;
case ARG_X_OFFSET:
g_value_set_int(value, v4lmjpegsrc->x_offset);
break;
case ARG_Y_OFFSET:
g_value_set_int(value, v4lmjpegsrc->y_offset);
break;
case ARG_F_WIDTH:
g_value_set_int(value, v4lmjpegsrc->frame_width);
break;
case ARG_F_HEIGHT:
g_value_set_int(value, v4lmjpegsrc->frame_height);
break;
case ARG_H_DECIMATION:
g_value_set_int(value, v4lmjpegsrc->horizontal_decimation);
break;
case ARG_V_DECIMATION:
g_value_set_int(value, v4lmjpegsrc->vertical_decimation);
break;
case ARG_QUALITY:
g_value_set_int(value, v4lmjpegsrc->quality);
break;
case ARG_NUMBUFS: case ARG_NUMBUFS:
g_value_set_int(value, v4lmjpegsrc->breq.count); g_value_set_int(value, v4lmjpegsrc->breq.count);
break; break;

View file

@ -29,11 +29,11 @@
#include "v4l_calls.h" #include "v4l_calls.h"
char *picture_name[] = { "Hue", "Brightness", "Contrast", "Saturation" }; char *picture_name[] = { "Hue", "Brightness", "Contrast", "Saturation", NULL };
char *audio_name[] = { "Volume", "Mute", "Mode" }; char *audio_name[] = { "Volume", "Mute", "Mode", NULL };
char *norm_name[] = { "PAL", "NTSC", "SECAM", "Autodetect" }; char *norm_name[] = { "PAL", "NTSC", "SECAM", NULL };
/****************************************************** /******************************************************
* gst_v4l_get_capabilities(): * gst_v4l_get_capabilities():
@ -100,7 +100,7 @@ gst_v4l_open (GstV4lElement *v4lelement)
return FALSE; return FALSE;
} }
g_message("Opened device \'%s\' (\'%s\') successfully\n", gst_info("Opened device \'%s\' (\'%s\') successfully\n",
v4lelement->vcap.name, v4lelement->videodev); v4lelement->vcap.name, v4lelement->videodev);
return TRUE; return TRUE;
@ -148,6 +148,37 @@ gst_v4l_get_num_chans (GstV4lElement *v4lelement)
} }
/******************************************************
* gst_v4l_get_chan_names()
* return value: a GList containing the channel names
******************************************************/
GList *
gst_v4l_get_chan_names (GstV4lElement *v4lelement)
{
struct video_channel vchan;
GList *list = NULL;
gint i;
#ifdef DEBUG
fprintf(stderr, "V4L: gst_v4l_get_chan_names()\n");
#endif
if (!GST_V4L_IS_OPEN(v4lelement))
return NULL;
for (i=0;i<gst_v4l_get_num_chans(v4lelement);i++)
{
vchan.channel = i;
if (ioctl(v4lelement->video_fd, VIDIOCGCHAN, &vchan) < 0)
return NULL;
list = g_list_append(list, (gpointer)g_strdup(vchan.name));
}
return list;
}
/****************************************************** /******************************************************
* gst_v4l_get_chan_norm(): * gst_v4l_get_chan_norm():
* get the currently active video-channel and it's * get the currently active video-channel and it's

View file

@ -100,6 +100,7 @@ gboolean gst_v4l_close (GstV4lElement *v4lelement);
gint gst_v4l_get_num_chans (GstV4lElement *v4lelement); gint gst_v4l_get_num_chans (GstV4lElement *v4lelement);
gboolean gst_v4l_get_chan_norm (GstV4lElement *v4lelement, gint *channel, gint *norm); gboolean gst_v4l_get_chan_norm (GstV4lElement *v4lelement, gint *channel, gint *norm);
gboolean gst_v4l_set_chan_norm (GstV4lElement *v4lelement, gint channel, gint norm); gboolean gst_v4l_set_chan_norm (GstV4lElement *v4lelement, gint channel, gint norm);
GList *gst_v4l_get_chan_names (GstV4lElement *v4lelement);
/* frequency control */ /* frequency control */
gboolean gst_v4l_has_tuner (GstV4lElement *v4lelement); gboolean gst_v4l_has_tuner (GstV4lElement *v4lelement);

View file

@ -363,7 +363,7 @@ gst_v4lmjpegsink_playback_init (GstV4lMjpegSink *v4lmjpegsink)
return FALSE; return FALSE;
} }
g_message("Got %ld buffers of size %ld KB\n", gst_info("Got %ld buffers of size %ld KB\n",
v4lmjpegsink->breq.count, v4lmjpegsink->breq.size/1024); v4lmjpegsink->breq.count, v4lmjpegsink->breq.size/1024);
/* Map the buffers */ /* Map the buffers */

View file

@ -120,7 +120,7 @@ gst_v4lmjpegsrc_set_input_norm (GstV4lMjpegSrc *v4lmjpegsrc,
for (n=V4L_MJPEG_INPUT_COMPOSITE;n<V4L_MJPEG_INPUT_AUTO;n++) for (n=V4L_MJPEG_INPUT_COMPOSITE;n<V4L_MJPEG_INPUT_AUTO;n++)
{ {
g_message("Trying %s as input...\n", gst_info("Trying %s as input...\n",
input_name[n]); input_name[n]);
bstat.input = n; bstat.input = n;
@ -137,7 +137,7 @@ gst_v4lmjpegsrc_set_input_norm (GstV4lMjpegSrc *v4lmjpegsrc,
input = bstat.input; input = bstat.input;
if (norm == VIDEO_MODE_AUTO) if (norm == VIDEO_MODE_AUTO)
norm = bstat.norm; norm = bstat.norm;
g_message("Signal found: on input %s, norm %s\n", gst_info("Signal found: on input %s, norm %s\n",
input_name[bstat.input], norm_name[bstat.norm]); input_name[bstat.input], norm_name[bstat.norm]);
break; break;
} }
@ -170,7 +170,7 @@ gst_v4lmjpegsrc_set_input_norm (GstV4lMjpegSrc *v4lmjpegsrc,
if (bstat.signal) if (bstat.signal)
{ {
norm = bstat.norm; norm = bstat.norm;
g_message("Norm %s detected on input %s\n", gst_info("Norm %s detected on input %s\n",
norm_name[bstat.norm], input_name[input]); norm_name[bstat.norm], input_name[input]);
GST_V4LELEMENT(v4lmjpegsrc)->norm = norm; GST_V4LELEMENT(v4lmjpegsrc)->norm = norm;
} }
@ -435,7 +435,7 @@ gst_v4lmjpegsrc_capture_init (GstV4lMjpegSrc *v4lmjpegsrc)
return FALSE; return FALSE;
} }
g_message("Got %ld buffers of size %ld KB\n", gst_info("Got %ld buffers of size %ld KB\n",
v4lmjpegsrc->breq.count, v4lmjpegsrc->breq.size/1024); v4lmjpegsrc->breq.count, v4lmjpegsrc->breq.size/1024);
/* Map the buffers */ /* Map the buffers */

View file

@ -292,7 +292,7 @@ gst_v4lsrc_capture_init (GstV4lSrc *v4lsrc)
return FALSE; return FALSE;
} }
g_message("Got %d buffers (\'%s\') of size %d KB\n", gst_info("Got %d buffers (\'%s\') of size %d KB\n",
v4lsrc->mbuf.frames, palette_name[v4lsrc->mmap.format], v4lsrc->mbuf.frames, palette_name[v4lsrc->mmap.format],
v4lsrc->mbuf.size/(v4lsrc->mbuf.frames*1024)); v4lsrc->mbuf.size/(v4lsrc->mbuf.frames*1024));