[media] dvb_usb_v2: merge get_ts_config() to get_usb_stream_config()

Piggypag TS type callback to USB stream callback and change
callback name slightly to fit better.
Both of those are rather rare callback and has a relation. Transport
Stream, TS, is input stream and USB stream is output stream of
DVB USB bridge.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Antti Palosaari 2012-06-18 22:54:16 -03:00 committed by Mauro Carvalho Chehab
parent ec0dd2f20c
commit b905a2a133
3 changed files with 24 additions and 29 deletions

View File

@ -599,7 +599,7 @@ error:
return ret; return ret;
} }
static int af9015_get_usb_stream_config(struct dvb_frontend *fe, static int af9015_get_stream_config(struct dvb_frontend *fe, u8 *ts_type,
struct usb_data_stream_properties *stream) struct usb_data_stream_properties *stream)
{ {
deb_info("%s: adap=%d\n", __func__, fe_to_adap(fe)->id); deb_info("%s: adap=%d\n", __func__, fe_to_adap(fe)->id);
@ -1304,7 +1304,7 @@ static struct dvb_usb_device_properties af9015_props = {
.tuner_attach = af9015_tuner_attach, .tuner_attach = af9015_tuner_attach,
.init = af9015_init, .init = af9015_init,
.get_rc_config = af9015_get_rc_config, .get_rc_config = af9015_get_rc_config,
.get_usb_stream_config = af9015_get_usb_stream_config, .get_stream_config = af9015_get_stream_config,
.get_adapter_count = af9015_get_adapter_count, .get_adapter_count = af9015_get_adapter_count,
.adapter = { .adapter = {

View File

@ -124,8 +124,6 @@ struct dvb_usb_adapter_properties {
#define DVB_USB_ADAP_HAS_PID_FILTER 0x01 #define DVB_USB_ADAP_HAS_PID_FILTER 0x01
#define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02 #define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02
#define DVB_USB_ADAP_NEED_PID_FILTERING 0x04 #define DVB_USB_ADAP_NEED_PID_FILTERING 0x04
#define DVB_USB_ADAP_RECEIVES_204_BYTE_TS 0x08
#define DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD 0x10
int caps; int caps;
int size_of_priv; int size_of_priv;
@ -228,9 +226,11 @@ struct dvb_usb_device_properties {
int (*init) (struct dvb_usb_device *); int (*init) (struct dvb_usb_device *);
void (*disconnect) (struct dvb_usb_device *); void (*disconnect) (struct dvb_usb_device *);
int (*get_rc_config) (struct dvb_usb_device *, struct dvb_usb_rc *); int (*get_rc_config) (struct dvb_usb_device *, struct dvb_usb_rc *);
int (*get_usb_stream_config) (struct dvb_frontend *, #define DVB_USB_FE_TS_TYPE_188 0
#define DVB_USB_FE_TS_TYPE_204 1
#define DVB_USB_FE_TS_TYPE_RAW 2
int (*get_stream_config) (struct dvb_frontend *, u8 *,
struct usb_data_stream_properties *); struct usb_data_stream_properties *);
int (*get_ts_config) (struct dvb_frontend *, unsigned int *);
struct i2c_algorithm *i2c_algo; struct i2c_algorithm *i2c_algo;
@ -301,7 +301,7 @@ struct dvb_usb_adapter {
const struct dvb_usb_adapter_properties *props; const struct dvb_usb_adapter_properties *props;
struct usb_data_stream stream; struct usb_data_stream stream;
u8 id; u8 id;
u8 ts_type;
int pid_filtering; int pid_filtering;
int feedcount; int feedcount;
int max_feed_count; int max_feed_count;

View File

@ -100,39 +100,34 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
*/ */
if (adap->feedcount == onoff && adap->feedcount > 0) { if (adap->feedcount == onoff && adap->feedcount > 0) {
struct usb_data_stream_properties stream_props; struct usb_data_stream_properties stream_props;
unsigned int ts_props;
mutex_lock(&adap->sync_mutex); mutex_lock(&adap->sync_mutex);
/* resolve TS configuration */ /* resolve input and output streaming paramters */
if (d->props->get_ts_config) { if (d->props->get_stream_config) {
ret = d->props->get_ts_config(adap->fe[adap->active_fe],
&ts_props);
if (ret < 0)
goto err_mutex_unlock;
} else {
ts_props = 0; /* normal 188 payload only TS */
}
if (ts_props & DVB_USB_ADAP_RECEIVES_204_BYTE_TS)
adap->stream.complete = dvb_usb_data_complete_204;
else if (ts_props & DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD)
adap->stream.complete = dvb_usb_data_complete_raw;
else
adap->stream.complete = dvb_usb_data_complete;
/* resolve USB stream configuration */
if (d->props->get_usb_stream_config) {
memcpy(&stream_props, &adap->props->stream, memcpy(&stream_props, &adap->props->stream,
sizeof(struct usb_data_stream_properties)); sizeof(struct usb_data_stream_properties));
ret = d->props->get_usb_stream_config( ret = d->props->get_stream_config(
adap->fe[adap->active_fe], adap->fe[adap->active_fe],
&stream_props); &adap->ts_type, &stream_props);
if (ret < 0) if (ret < 0)
goto err_mutex_unlock; goto err_mutex_unlock;
} else { } else {
stream_props = adap->props->stream; stream_props = adap->props->stream;
} }
switch (adap->ts_type) {
case DVB_USB_FE_TS_TYPE_204:
adap->stream.complete = dvb_usb_data_complete_204;
break;
case DVB_USB_FE_TS_TYPE_RAW:
adap->stream.complete = dvb_usb_data_complete_raw;
break;
case DVB_USB_FE_TS_TYPE_188:
default:
adap->stream.complete = dvb_usb_data_complete;
break;
}
pr_debug("%s: submitting all URBs\n", __func__); pr_debug("%s: submitting all URBs\n", __func__);
usb_urb_submitv2(&adap->stream, &stream_props); usb_urb_submitv2(&adap->stream, &stream_props);