From f47ad86b730441870d4b77162f6b0e8c8472d312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Loeuillet?= Date: Mon, 31 May 2004 14:16:54 +0000 Subject: [PATCH] gst-libs/gst/tuner/tunerchannel.h: - add a freq_multiplicator field to make the conversion between internal frequency... Original commit message from CVS: * gst-libs/gst/tuner/tunerchannel.h: - add a freq_multiplicator field to make the conversion between internal frequency unit and Hz * sys/v4l/gstv4lelement.c: * sys/v4l2/gstv4l2element.c: - change default video device to /dev/video0 * sys/v4l/v4l_calls.c: * sys/v4l2/v4l2_calls.c: - we only expose frequency to the user in Hz instead of bastard v4lX unit (either 62.5kHz or 62.5Hz) --- ChangeLog | 13 +++++++++++++ gst-libs/gst/interfaces/tunerchannel.h | 3 ++- gst-libs/gst/tuner/tunerchannel.h | 3 ++- sys/v4l/gstv4lelement.c | 2 +- sys/v4l/v4l_calls.c | 12 ++++++++++++ 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ffde603961..6ba4b85702 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-05-31 Stephane Loeuillet + + * gst-libs/gst/tuner/tunerchannel.h: + - add a freq_multiplicator field to make the conversion + between internal frequency unit and Hz + * sys/v4l/gstv4lelement.c: + * sys/v4l2/gstv4l2element.c: + - change default video device to /dev/video0 + * sys/v4l/v4l_calls.c: + * sys/v4l2/v4l2_calls.c: + - we only expose frequency to the user in Hz instead of + bastard v4lX unit (either 62.5kHz or 62.5Hz) + 2004-05-31 Jan Schmidt * ext/vorbis/vorbisdec.c: (vorbis_dec_chain): Initialise b_o_s and e_o_s variables diff --git a/gst-libs/gst/interfaces/tunerchannel.h b/gst-libs/gst/interfaces/tunerchannel.h index ee5654d0fb..b38dc279d9 100644 --- a/gst-libs/gst/interfaces/tunerchannel.h +++ b/gst-libs/gst/interfaces/tunerchannel.h @@ -43,7 +43,7 @@ typedef enum { GST_TUNER_CHANNEL_INPUT = (1<<0), GST_TUNER_CHANNEL_OUTPUT = (1<<1), GST_TUNER_CHANNEL_FREQUENCY = (1<<2), - GST_TUNER_CHANNEL_AUDIO = (1<<3), + GST_TUNER_CHANNEL_AUDIO = (1<<3) } GstTunerChannelFlags; #define GST_TUNER_CHANNEL_HAS_FLAG(channel, flag) \ @@ -54,6 +54,7 @@ typedef struct _GstTunerChannel { gchar *label; GstTunerChannelFlags flags; + gfloat freq_multiplicator; gulong min_frequency, max_frequency; gint min_signal, diff --git a/gst-libs/gst/tuner/tunerchannel.h b/gst-libs/gst/tuner/tunerchannel.h index ee5654d0fb..b38dc279d9 100644 --- a/gst-libs/gst/tuner/tunerchannel.h +++ b/gst-libs/gst/tuner/tunerchannel.h @@ -43,7 +43,7 @@ typedef enum { GST_TUNER_CHANNEL_INPUT = (1<<0), GST_TUNER_CHANNEL_OUTPUT = (1<<1), GST_TUNER_CHANNEL_FREQUENCY = (1<<2), - GST_TUNER_CHANNEL_AUDIO = (1<<3), + GST_TUNER_CHANNEL_AUDIO = (1<<3) } GstTunerChannelFlags; #define GST_TUNER_CHANNEL_HAS_FLAG(channel, flag) \ @@ -54,6 +54,7 @@ typedef struct _GstTunerChannel { gchar *label; GstTunerChannelFlags flags; + gfloat freq_multiplicator; gulong min_frequency, max_frequency; gint min_signal, diff --git a/sys/v4l/gstv4lelement.c b/sys/v4l/gstv4lelement.c index 5f11b38582..ad52336b60 100644 --- a/sys/v4l/gstv4lelement.c +++ b/sys/v4l/gstv4lelement.c @@ -394,7 +394,7 @@ gst_v4lelement_init (GstV4lElement * v4lelement) /* some default values */ v4lelement->video_fd = -1; v4lelement->buffer = NULL; - v4lelement->videodev = g_strdup ("/dev/video"); + v4lelement->videodev = g_strdup ("/dev/video0"); v4lelement->display = g_strdup (g_getenv ("DISPLAY")); v4lelement->norms = NULL; diff --git a/sys/v4l/v4l_calls.c b/sys/v4l/v4l_calls.c index ea07da71e8..ad88508906 100644 --- a/sys/v4l/v4l_calls.c +++ b/sys/v4l/v4l_calls.c @@ -284,6 +284,8 @@ gst_v4l_get_chan_names (GstV4lElement * v4lelement) if (!strcmp (vtun.name, vchan.name)) { v4lchannel->tuner = n; channel->flags |= GST_TUNER_CHANNEL_FREQUENCY; + channel->freq_multiplicator = + 62.5 * ((vtun.flags & VIDEO_TUNER_LOW) ? 1 : 1000); channel->min_frequency = vtun.rangelow; channel->max_frequency = vtun.rangehigh; channel->min_signal = 0; @@ -408,10 +410,13 @@ gst_v4l_get_frequency (GstV4lElement * v4lelement, gint tunernum, gulong * frequency) { struct video_tuner vtun; + GstTunerChannel *channel; DEBUG ("getting tuner frequency"); GST_V4L_CHECK_OPEN (v4lelement); + channel = gst_tuner_get_channel (GST_TUNER (v4lelement)); + /* check that this is the current input */ vtun.tuner = tunernum; if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0) @@ -425,6 +430,8 @@ gst_v4l_get_frequency (GstV4lElement * v4lelement, return FALSE; } + *frequency = *frequency * channel->freq_multiplicator; + return TRUE; } @@ -440,10 +447,13 @@ gst_v4l_set_frequency (GstV4lElement * v4lelement, gint tunernum, gulong frequency) { struct video_tuner vtun; + GstTunerChannel *channel; DEBUG ("setting tuner frequency to %lu", frequency); GST_V4L_CHECK_OPEN (v4lelement); + channel = gst_tuner_get_channel (GST_TUNER (v4lelement)); + /* check that this is the current input */ vtun.tuner = tunernum; if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0) @@ -451,6 +461,8 @@ gst_v4l_set_frequency (GstV4lElement * v4lelement, if (strcmp (vtun.name, v4lelement->vchan.name)) return FALSE; + frequency = frequency / channel->freq_multiplicator; + if (ioctl (v4lelement->video_fd, VIDIOCSFREQ, &frequency) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), ("Error setting tuner frequency: %s", g_strerror (errno)));