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)
This commit is contained in:
Stéphane Loeuillet 2004-05-31 14:16:54 +00:00
parent 0e141ff4ce
commit f47ad86b73
5 changed files with 30 additions and 3 deletions

View file

@ -1,3 +1,16 @@
2004-05-31 Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
* 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 <thaytan@mad.scientist.com>
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
Initialise b_o_s and e_o_s variables

View file

@ -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,

View file

@ -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,

View file

@ -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;

View file

@ -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)));