Commit 3256cdef authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] dvb_usb_v2: move (struct usb_data_stream) to one level up

Move stream from the frontend to adapter. There could be only
one stream per adapter. One adapter can has multiple frontends
but only one can stream at the time.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 39831f09
...@@ -314,8 +314,6 @@ struct dvb_usb_fe_adapter { ...@@ -314,8 +314,6 @@ struct dvb_usb_fe_adapter {
int (*fe_init) (struct dvb_frontend *); int (*fe_init) (struct dvb_frontend *);
int (*fe_sleep) (struct dvb_frontend *); int (*fe_sleep) (struct dvb_frontend *);
struct usb_data_stream stream;
int pid_filtering; int pid_filtering;
int max_feed_count; int max_feed_count;
...@@ -325,6 +323,7 @@ struct dvb_usb_fe_adapter { ...@@ -325,6 +323,7 @@ struct dvb_usb_fe_adapter {
struct dvb_usb_adapter { struct dvb_usb_adapter {
struct dvb_usb_device *dev; struct dvb_usb_device *dev;
struct dvb_usb_adapter_properties props; struct dvb_usb_adapter_properties props;
struct usb_data_stream stream;
#define DVB_USB_ADAP_STATE_INIT 0x000 #define DVB_USB_ADAP_STATE_INIT 0x000
#define DVB_USB_ADAP_STATE_DVB 0x001 #define DVB_USB_ADAP_STATE_DVB 0x001
......
...@@ -27,7 +27,7 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) ...@@ -27,7 +27,7 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
/* stop feed before setting a new pid if there will be no pid anymore */ /* stop feed before setting a new pid if there will be no pid anymore */
if (newfeedcount == 0) { if (newfeedcount == 0) {
deb_ts("stop feeding\n"); deb_ts("stop feeding\n");
usb_urb_kill(&adap->fe_adap[adap->active_fe].stream); usb_urb_kill(&adap->stream);
if (adap->props.fe[adap->active_fe].streaming_ctrl != NULL) { if (adap->props.fe[adap->active_fe].streaming_ctrl != NULL) {
ret = adap->props.fe[adap->active_fe].streaming_ctrl( ret = adap->props.fe[adap->active_fe].streaming_ctrl(
...@@ -70,8 +70,7 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) ...@@ -70,8 +70,7 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
} }
deb_ts("submitting all URBs\n"); deb_ts("submitting all URBs\n");
usb_urb_submit(&adap->fe_adap[adap->active_fe].stream, usb_urb_submit(&adap->stream, &stream_props);
&stream_props);
deb_ts("controlling pid parser\n"); deb_ts("controlling pid parser\n");
if (adap->props.fe[adap->active_fe].caps & DVB_USB_ADAP_HAS_PID_FILTER && if (adap->props.fe[adap->active_fe].caps & DVB_USB_ADAP_HAS_PID_FILTER &&
......
...@@ -93,43 +93,39 @@ static void dvb_usb_data_complete_raw(struct usb_data_stream *stream, ...@@ -93,43 +93,39 @@ static void dvb_usb_data_complete_raw(struct usb_data_stream *stream,
int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap) int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap)
{ {
int i, ret = 0; int ret;
struct usb_data_stream_properties stream_props; struct usb_data_stream_properties stream_props;
for (i = 0; i < adap->props.num_frontends; i++) { /*
adap->fe_adap[i].stream.udev = adap->dev->udev; * FIXME: We should config demux callback for each time streaming is
if (adap->props.fe[i].caps & DVB_USB_ADAP_RECEIVES_204_BYTE_TS) * started. Same for the USB data stream config.
adap->fe_adap[i].stream.complete = */
dvb_usb_data_complete_204;
else adap->stream.udev = adap->dev->udev;
if (adap->props.fe[i].caps & DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD) if (adap->props.fe[0].caps & DVB_USB_ADAP_RECEIVES_204_BYTE_TS)
adap->fe_adap[i].stream.complete = adap->stream.complete = dvb_usb_data_complete_204;
dvb_usb_data_complete_raw; else if (adap->props.fe[0].caps & DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD)
else adap->stream.complete = dvb_usb_data_complete_raw;
adap->fe_adap[i].stream.complete = dvb_usb_data_complete; else
adap->fe_adap[i].stream.user_priv = adap; adap->stream.complete = dvb_usb_data_complete;
/* resolve USB stream configuration */
if (adap->dev->props.get_usb_stream_config) {
ret = adap->dev->props.get_usb_stream_config(NULL,
&stream_props);
if (ret < 0)
break;
} else {
stream_props = adap->props.fe[i].stream;
}
ret = usb_urb_init(&adap->fe_adap[i].stream, &stream_props); adap->stream.user_priv = adap;
/* resolve USB stream configuration */
if (adap->dev->props.get_usb_stream_config) {
ret = adap->dev->props.get_usb_stream_config(NULL,
&stream_props);
if (ret < 0) if (ret < 0)
break; return ret;
} else {
stream_props = adap->props.fe[0].stream;
} }
return ret;
return usb_urb_init(&adap->stream, &stream_props);
} }
int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap) int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap)
{ {
int i; usb_urb_exit(&adap->stream);
for (i = 0; i < adap->props.num_frontends; i++)
usb_urb_exit(&adap->fe_adap[i].stream);
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment