diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-02-03 21:55:07 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:09:46 -0400 |
commit | d8abe97d0063cf77e9bbbee076181e4657c7e09c (patch) | |
tree | f3e792f56bc232bda063cba7758a73242f98a908 /drivers | |
parent | 99443ae04f7002530f666ba0747f7b1ecafb3002 (diff) |
V4L/DVB (7681): pvrusb2-dvb: start working on streaming / buffer handling code
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-dvb.c | 44 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-dvb.h | 3 |
2 files changed, 45 insertions, 2 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.c b/drivers/media/video/pvrusb2/pvrusb2-dvb.c index 250462265a41..c85477709e6e 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-dvb.c +++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.c | |||
@@ -18,6 +18,7 @@ | |||
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/kthread.h> | ||
21 | #include "dvbdev.h" | 22 | #include "dvbdev.h" |
22 | #include "pvrusb2-hdw-internal.h" | 23 | #include "pvrusb2-hdw-internal.h" |
23 | #include "pvrusb2-hdw.h" | 24 | #include "pvrusb2-hdw.h" |
@@ -25,18 +26,56 @@ | |||
25 | 26 | ||
26 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 27 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
27 | 28 | ||
29 | static int pvr2_dvb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) | ||
30 | { | ||
31 | struct pvr2_dvb_adapter *adap = dvbdmxfeed->demux->priv; | ||
32 | int newfeedcount, ret = 0; | ||
33 | |||
34 | if (adap == NULL) | ||
35 | return -ENODEV; | ||
36 | |||
37 | mutex_lock(&adap->lock); | ||
38 | newfeedcount = adap->feedcount + (onoff ? 1 : -1); | ||
39 | |||
40 | if (newfeedcount == 0) { | ||
41 | printk(KERN_DEBUG "stop feeding\n"); | ||
42 | |||
43 | ret = kthread_stop(adap->thread); | ||
44 | adap->thread = NULL; | ||
45 | } | ||
46 | |||
47 | adap->feedcount = newfeedcount; | ||
48 | |||
49 | if (adap->feedcount == onoff && adap->feedcount > 0) { | ||
50 | if (NULL != adap->thread) | ||
51 | goto fail; | ||
52 | |||
53 | printk(KERN_DEBUG "start feeding\n"); | ||
54 | |||
55 | if (IS_ERR(adap->thread)) { | ||
56 | ret = PTR_ERR(adap->thread); | ||
57 | adap->thread = NULL; | ||
58 | } | ||
59 | //ret = newfeedcount; | ||
60 | } | ||
61 | fail: | ||
62 | mutex_unlock(&adap->lock); | ||
63 | |||
64 | return ret; | ||
65 | } | ||
66 | |||
28 | static int pvr2_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed) | 67 | static int pvr2_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed) |
29 | { | 68 | { |
30 | printk(KERN_DEBUG "start pid: 0x%04x, feedtype: %d\n", | 69 | printk(KERN_DEBUG "start pid: 0x%04x, feedtype: %d\n", |
31 | dvbdmxfeed->pid, dvbdmxfeed->type); | 70 | dvbdmxfeed->pid, dvbdmxfeed->type); |
32 | return 0; /* FIXME: pvr2_dvb_ctrl_feed(dvbdmxfeed, 1); */ | 71 | return pvr2_dvb_ctrl_feed(dvbdmxfeed, 1); |
33 | } | 72 | } |
34 | 73 | ||
35 | static int pvr2_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | 74 | static int pvr2_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) |
36 | { | 75 | { |
37 | printk(KERN_DEBUG "stop pid: 0x%04x, feedtype: %d\n", | 76 | printk(KERN_DEBUG "stop pid: 0x%04x, feedtype: %d\n", |
38 | dvbdmxfeed->pid, dvbdmxfeed->type); | 77 | dvbdmxfeed->pid, dvbdmxfeed->type); |
39 | return 0; /* FIXME: pvr2_dvb_ctrl_feed(dvbdmxfeed, 0); */ | 78 | return pvr2_dvb_ctrl_feed(dvbdmxfeed, 0); |
40 | } | 79 | } |
41 | 80 | ||
42 | static int pvr2_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire) | 81 | static int pvr2_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire) |
@@ -172,6 +211,7 @@ int pvr2_dvb_init(struct pvr2_context *pvr) | |||
172 | int ret = 0; | 211 | int ret = 0; |
173 | 212 | ||
174 | pvr->hdw->dvb.pvr = pvr; | 213 | pvr->hdw->dvb.pvr = pvr; |
214 | mutex_init(&pvr->hdw->dvb.lock); | ||
175 | 215 | ||
176 | ret = pvr2_dvb_adapter_init(&pvr->hdw->dvb); | 216 | ret = pvr2_dvb_adapter_init(&pvr->hdw->dvb); |
177 | if (ret < 0) | 217 | if (ret < 0) |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.h b/drivers/media/video/pvrusb2/pvrusb2-dvb.h index 0aff05cb9415..98728d44a4b6 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-dvb.h +++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.h | |||
@@ -19,6 +19,9 @@ struct pvr2_dvb_adapter { | |||
19 | int feedcount; | 19 | int feedcount; |
20 | int max_feed_count; | 20 | int max_feed_count; |
21 | 21 | ||
22 | struct task_struct *thread; | ||
23 | struct mutex lock; | ||
24 | |||
22 | unsigned int digital_up:1; | 25 | unsigned int digital_up:1; |
23 | }; | 26 | }; |
24 | 27 | ||