Re: setting frequency with v4lctl - PATCH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Here is a patch that should let you do:

   v4l2 -v 2 setfrequency 196.250

and get BBC (well, if you live here....).

I *DO NOT* guarantee that this does everything correctly.
I just hacked the set_station section (or was it the
set_channel section?) to change the channel. I didn't
even check the audio to see if that worked after.
Use at your own risk.

--- common/commands.c   Wed Jun 26 12:37:41 2002
+++ common/commands.c.hacked    Mon Aug 19 16:15:22 2002
@@ -77,6 +77,7 @@
 static int setfreqtab_handler(char *name, int argc, char **argv);
 static int setstation_handler(char *name, int argc, char **argv);
 static int setchannel_handler(char *name, int argc, char **argv);
+static int setfrequency_handler(char *name, int argc, char **argv);

 static int capture_handler(char *name, int argc, char **argv);
 static int volume_handler(char *name, int argc, char **argv);
@@ -105,6 +106,7 @@
 } commands[] = {
     { "setstation", 0, setstation_handler },
     { "setchannel", 0, setchannel_handler },
+    { "setfrequency", 0, setfrequency_handler },
     { "setfreqtab", 1, setfreqtab_handler },

     { "capture",    1, capture_handler    },
@@ -628,6 +630,42 @@
     set_title();
     if (setstation_notify)
        setstation_notify();
+
+    if (mute && !cur_attrs[ATTR_ID_MUTE]) {
+       usleep(20000);
+       mute->write(mute,0);
+    }
+    return 0;
+}
+
+static int setfrequency_handler(char *name, int argc, char **argv)
+{
+    struct ng_attribute *mute;
+    int c,i;
+    unsigned long new_freq;
+
+    if (cur_movie) {
+       if (display_message)
+           display_message("grabber busy");
+       return -1;
+    }
+
+    new_freq=(unsigned long)(atof(argv[0])*16);
+    printf("new_freq: %6.3lf\n",(double)new_freq/16);
+
+    cur_sender  = -1;
+
+    mute = ng_attr_byid(attrs,ATTR_ID_MUTE);
+    if (mute && !cur_attrs[ATTR_ID_MUTE])
+       mute->write(mute,1);
+
+    if (f_drv & CAN_TUNE)
+       drv->setfreq(h_drv,new_freq);
+    set_capture(defaults.capture,0);
+
+    set_title();
+    if (setstation_notify)
+       setstation_notify();

     if (mute && !cur_attrs[ATTR_ID_MUTE]) {
        usleep(20000);


Ronald Verlaan wrote:
Hi all,

I was wondering why v4ctl can set channels but NOT frequencies?
It spend a reasonable amount of time to figure out which channels my cable
provider lists on its homepage correspond with which channels in xawtv for
instance. Being able to set the frequency right away would save a lot of
time :P

Is there any reason why this aint possible?

For setting radio channels it is possible with the application named
"radio"...

Best regards,

--
Ronald Verlaan
http://www.ronaldverlaan.com
ronald@xxxxxxxxxxxxxxxxx
--------------------------------------------------------------------------
Long life is in store for you.



_______________________________________________
Video4linux-list mailing list
Video4linux-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/video4linux-list



--
Bill Eldridge
Radio Free Asia
bill@xxxxxxx






[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux