summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2008-02-03 17:55:07 -0600
committerMike Isely <isely@pobox.com>2008-02-03 17:55:07 -0600
commitd243c47234ca8a92b3730661a8baea742dbfcc76 (patch)
treeeaa14f4129d71de0c31f96fe5efbf40cb349bb83 /linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c
parent0925f6ad8494d423299231d3915d4339b0f277e1 (diff)
downloadmediapointer-dvb-s2-d243c47234ca8a92b3730661a8baea742dbfcc76.tar.gz
mediapointer-dvb-s2-d243c47234ca8a92b3730661a8baea742dbfcc76.tar.bz2
pvrusb2-dvb: start working on streaming / buffer handling code
From: Michael Krufky <mkrufky@linuxtv.org> start work on streaming / buffer handling code to feed the software demux Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c')
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c b/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c
index 74bbd8e0f..228ac7112 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c
@@ -18,6 +18,7 @@
*
*/
+#include <linux/kthread.h>
#include "dvbdev.h"
#include "pvrusb2-hdw-internal.h"
#include "pvrusb2-hdw.h"
@@ -25,18 +26,60 @@
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+static int pvr2_dvb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
+{
+ struct pvr2_dvb_adapter *adap = dvbdmxfeed->demux->priv;
+ int newfeedcount, ret = 0;
+
+ if (adap == NULL)
+ return -ENODEV;
+
+ mutex_lock(&adap->lock);
+ newfeedcount = adap->feedcount + (onoff ? 1 : -1);
+
+ if (newfeedcount == 0) {
+ printk(KERN_DEBUG "stop feeding\n");
+
+ ret = kthread_stop(adap->thread);
+ adap->thread = NULL;
+ }
+
+ adap->feedcount = newfeedcount;
+
+ if (adap->feedcount == onoff && adap->feedcount > 0) {
+ if (NULL != adap->thread)
+ goto fail;
+
+ printk(KERN_DEBUG "start feeding\n");
+
+#if 0
+ adap->thread = kthread_run(pvr2_dvb_feed_thread,
+ adap, "pvrusb2-dvb");
+#endif
+ if (IS_ERR(adap->thread)) {
+ ret = PTR_ERR(adap->thread);
+ adap->thread = NULL;
+ }
+ //ret = newfeedcount;
+ }
+fail:
+ mutex_unlock(&adap->lock);
+
+ return ret;
+}
+
static int pvr2_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed)
{
printk(KERN_DEBUG "start pid: 0x%04x, feedtype: %d\n",
dvbdmxfeed->pid, dvbdmxfeed->type);
- return 0; /* FIXME: pvr2_dvb_ctrl_feed(dvbdmxfeed, 1); */
+ return pvr2_dvb_ctrl_feed(dvbdmxfeed, 1);
}
static int pvr2_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
{
printk(KERN_DEBUG "stop pid: 0x%04x, feedtype: %d\n",
dvbdmxfeed->pid, dvbdmxfeed->type);
- return 0; /* FIXME: pvr2_dvb_ctrl_feed(dvbdmxfeed, 0); */
+ return pvr2_dvb_ctrl_feed(dvbdmxfeed, 0);
}
static int pvr2_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire)
@@ -187,6 +230,7 @@ int pvr2_dvb_init(struct pvr2_context *pvr)
int ret = 0;
pvr->hdw->dvb.pvr = pvr;
+ mutex_init(&pvr->hdw->dvb.lock);
ret = pvr2_dvb_adapter_init(&pvr->hdw->dvb);
if (ret < 0)