[Xfce4-commits] <xfce4-radio-plugin:master> Dropped support for V4L1 (no longer present in kernel >= 2.6.38)

Stefan Ott noreply at xfce.org
Thu May 19 06:02:01 CEST 2011


Updating branch refs/heads/master
         to 7bf0b2f33bab58c5b47e0dd78366045ba1fcaa12 (commit)
       from 5d32cc3d8be0b0fb6a1cadcd498aa31ae4c40525 (commit)

commit 7bf0b2f33bab58c5b47e0dd78366045ba1fcaa12
Author: Stefan Ott <stefan at ott.net>
Date:   Thu May 19 03:24:47 2011 +0200

    Dropped support for V4L1 (no longer present in kernel >= 2.6.38)

 NEWS                       |    4 +
 panel-plugin/Makefile.am   |    1 -
 panel-plugin/radio.c       |   24 -----
 panel-plugin/v4l1.c        |  217 --------------------------------------------
 panel-plugin/v4l1.h        |   24 -----
 panel-plugin/xfce4-radio.c |    1 -
 panel-plugin/xfce4-radio.h |    1 -
 7 files changed, 4 insertions(+), 268 deletions(-)

diff --git a/NEWS b/NEWS
index 8cceb46..96df4f5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,10 @@
 Get the latest version of this plugin at http://goodies.xfce.org/
 ===============================================================================
 
+v0.5.0 (19 May 2011):
+=====================
+ * Dropped support for V4L1 (no longer present in kernel >= 2.6.38)
+
 v0.4.5 (11 Mar 2011):
 =====================
  * Changed the license to GPLv3
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index 32f81d3..09fa10b 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -4,7 +4,6 @@ plugin_PROGRAMS = xfce4-radio-plugin
 xfce4_radio_plugin_SOURCES =						\
 	xfce4-radio.c xfce4-radio.h					\
 	radio.c radio.h							\
-	v4l1.c v4l1.h							\
 	v4l2.c v4l2.h
 
 xfce4_radio_plugin_CFLAGS =						\
diff --git a/panel-plugin/radio.c b/panel-plugin/radio.c
index 4b8cd4c..e5df2ad 100644
--- a/panel-plugin/radio.c
+++ b/panel-plugin/radio.c
@@ -23,7 +23,6 @@
 #include <assert.h>
 
 #include "radio.h"
-#include "v4l1.h"
 #include "v4l2.h"
 
 static RadioDev *dev;
@@ -45,29 +44,6 @@ int radio_init(char *device, DriverType driver)
 	}
 	 */
 
-	switch (driver) {
-		case DRIVER_V4L2:
-			goto try_v4l2;
-		case DRIVER_ANY:
-		case DRIVER_V4L1:
-		default:
-			goto try_v4l1;
-	}
-
-try_v4l1:
-	dev = v4l1_radio_dev_new();
-	rv = dev->init (dev, device);
-	if (rv == 0) {
-        fprintf(stderr, "Initializing v4l1 failed\n");
-		dev->finalize (dev);
-		dev = NULL;
-		if (driver != DRIVER_ANY)
-			goto failure;
-	} else {
-		goto success;
-	}
-
-try_v4l2:
 	dev = v4l2_radio_dev_new();
 	rv = dev->init (dev, device);
 	if (rv == 0) {
diff --git a/panel-plugin/v4l1.c b/panel-plugin/v4l1.c
deleted file mode 100644
index 6bfc316..0000000
--- a/panel-plugin/v4l1.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <math.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <assert.h>
-
-#include <linux/videodev.h>
-#include "radio.h"
-
-typedef struct _V4L1RadioDev V4L1RadioDev;
-struct _V4L1RadioDev
-{
-	struct _RadioDev parent;
-
-	int fd;
-	int freq_fact;
-};
-
-static int
-v4l1_radio_init(RadioDev *radio_dev, char *device)
-{
-	V4L1RadioDev *dev = (V4L1RadioDev*)radio_dev;
-	struct video_tuner tuner;
-	
-	if ((dev->fd = open(device, O_RDONLY)) < 0)
-		return 0;
-	
-	tuner.tuner = 0;
-	if (ioctl (dev->fd, VIDIOCGTUNER, &tuner) < 0)
-		dev->freq_fact = 16;
-	else
-	{
-		if ((tuner.flags & VIDEO_TUNER_LOW) == 0)
-			dev->freq_fact = 16;
-		else
-			dev->freq_fact = 16000;
-	}
-	
-	return 1;
-}
-
-int v4l1_radio_is_init(RadioDev *radio_dev)
-{
-	V4L1RadioDev *dev = (V4L1RadioDev*)radio_dev;
-	return (dev->fd >= 0);
-}
-
-static void
-v4l1_radio_set_freq(RadioDev *radio_dev, float freq)
-{
-	V4L1RadioDev *dev = (V4L1RadioDev*)radio_dev;
-    int ifreq;
-
-    if (dev->fd<0)
-    	return;
-    
-	//wtf?
-	//ifreq = (freq+1.0/32)*dev->freq_fact;
-	ifreq = freq * dev->freq_fact;
-#if 0
-	printf("Setting to %i (= %.2f)\n", ifreq, freq);
-#endif
-
-	/* FIXME: Do we need really need these checks? */
-	if ((freq > 108) || (freq < 65))
-		return;
-
-	assert ((freq <= 108) && (freq > 65));
-
-    if (ioctl(dev->fd, VIDIOCSFREQ, &ifreq) < 0)
-		perror ("VIDIOCSFREQ");
-}
-
-static void
-v4l1_radio_mute(RadioDev *radio_dev, int mute)
-{
-	V4L1RadioDev *dev = (V4L1RadioDev*)radio_dev;
-    struct video_audio vid_aud;
-
-    if (dev->fd<0)
-    	return;
-
-    if (ioctl(dev->fd, VIDIOCGAUDIO, &vid_aud)) {
-		perror("VIDIOCGAUDIO");
-		memset (&vid_aud, 0, sizeof (struct video_audio));
-	}
-	if (mute) {
-    	vid_aud.flags |= VIDEO_AUDIO_MUTE;
-	} else {
-		vid_aud.volume = 0xFFFF;
-		vid_aud.flags &= ~VIDEO_AUDIO_MUTE;
-		vid_aud.mode = VIDEO_SOUND_STEREO;
-	}
-    if (ioctl(dev->fd, VIDIOCSAUDIO, &vid_aud))
-		perror("VIDIOCSAUDIO");
-}
-
-static int
-v4l1_radio_get_stereo(RadioDev *radio_dev)
-{
-	V4L1RadioDev *dev = (V4L1RadioDev*)radio_dev;
-    struct video_audio va;
-    va.mode=-1;
-
-    if (dev->fd<0)
-    	return -1;
-    
-    if (ioctl (dev->fd, VIDIOCGAUDIO, &va) < 0)
-		return -1;
-	if (va.mode == VIDEO_SOUND_STEREO)
-		return 1;
-	else 
-		return 0;
-}
-
-static int
-v4l1_radio_get_signal(RadioDev *radio_dev)
-{
-	V4L1RadioDev *dev = (V4L1RadioDev*)radio_dev;
-    struct video_tuner vt;
-    int signal;
-
-    if (dev->fd<0)
-    	return -1;
-
-    memset(&vt,0,sizeof(vt));
-    ioctl (dev->fd, VIDIOCGTUNER, &vt);
-    signal=vt.signal>>13;
-
-    return signal;
-}
-
-static double
-v4l1_radio_get_freq(RadioDev *radio_dev)
-{
-	V4L1RadioDev *dev = (V4L1RadioDev*)radio_dev;
-	long freq;
-
-	if (dev->fd<0)
-		return -1;
-
-	if (ioctl (dev->fd, VIDIOCGFREQ, &freq))
-	{
-		perror ("VIDIOCGFREQ");
-		return -1;
-	}
-	return freq / (double) dev->freq_fact;
-}
-
-static int
-v4l1_radio_is_muted(RadioDev *radio_dev)
-{
-	V4L1RadioDev *dev = (V4L1RadioDev*)radio_dev;
-	struct video_audio vid_aud;
-
-	if (dev->fd<0)
-		return -1;
-
-	if (ioctl (dev->fd, VIDIOCGAUDIO, &vid_aud)) {
-		perror ("VIDIOCGAUDIO");
-		return -1;
-	}
-
-	return (vid_aud.flags & VIDEO_AUDIO_MUTE);
-}
-
-static void
-v4l1_radio_finalize(RadioDev *radio_dev)
-{
-	V4L1RadioDev *dev = (V4L1RadioDev*)radio_dev;
-	
-	if (dev->fd >= 0)
-		close(dev->fd);
-	free (dev);
-}
-
-RadioDev*
-v4l1_radio_dev_new (void)
-{
-    RadioDev *dev;
-	V4L1RadioDev *v4l1_dev;
-
-	v4l1_dev = malloc(sizeof(V4L1RadioDev));
-	v4l1_dev->fd = -1;
-	dev = (RadioDev*)v4l1_dev;
-
-	dev->init       = v4l1_radio_init;
-	dev->is_init    = v4l1_radio_is_init;
-	dev->set_freq   = v4l1_radio_set_freq;
-	dev->mute       = v4l1_radio_mute;
-	dev->get_stereo = v4l1_radio_get_stereo;
-	dev->get_signal = v4l1_radio_get_signal;
-	dev->get_freq   = v4l1_radio_get_freq;
-	dev->is_muted   = v4l1_radio_is_muted;
-	dev->finalize   = v4l1_radio_finalize;
-
-	return dev;
-}
-
diff --git a/panel-plugin/v4l1.h b/panel-plugin/v4l1.h
deleted file mode 100644
index 1a80119..0000000
--- a/panel-plugin/v4l1.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _V4L1_H
-#define _V4L1_H
-
-#include <radio.h>
-
-RadioDev* v4l1_radio_dev_new (void);
-
-#endif
-
diff --git a/panel-plugin/xfce4-radio.c b/panel-plugin/xfce4-radio.c
index 06b4b67..022420a 100644
--- a/panel-plugin/xfce4-radio.c
+++ b/panel-plugin/xfce4-radio.c
@@ -47,7 +47,6 @@
 #include "../icons/signal.xpm"
 
 #include "radio.h"
-#include "v4l1.h"
 #include "v4l2.h"
 
 #include <libxfcegui4/dialogs.h>
diff --git a/panel-plugin/xfce4-radio.h b/panel-plugin/xfce4-radio.h
index a8ad6fc..290ff32 100644
--- a/panel-plugin/xfce4-radio.h
+++ b/panel-plugin/xfce4-radio.h
@@ -25,7 +25,6 @@
 #include <fcntl.h>
 
 #include <sys/ioctl.h>
-#include <linux/videodev.h>
 
 #include <libxfce4panel/xfce-panel-plugin.h>
 



More information about the Xfce4-commits mailing list