diff options
author | Patrick Boettcher <devnull@localhost> | 2005-03-21 08:50:47 +0000 |
---|---|---|
committer | Patrick Boettcher <devnull@localhost> | 2005-03-21 08:50:47 +0000 |
commit | 5c5f250158edc0ca2909b6c703e21395b999ed60 (patch) | |
tree | fd14e498984e1ba25337fbb583ef3fbf8c35bbca /linux/drivers/media/dvb/b2c2/flexcop-usb.c | |
parent | e0f6ebb0d7b61eeda8208a0cdf2667790c03547a (diff) | |
download | mediapointer-dvb-s2-5c5f250158edc0ca2909b6c703e21395b999ed60.tar.gz mediapointer-dvb-s2-5c5f250158edc0ca2909b6c703e21395b999ed60.tar.bz2 |
Patch by Vadim Catana
- driver receives many null TS packets (pid=0x1fff). They occupy the
limited USB bandwidth and this leads to loss of video packets.
Enabling the null packet filter fixes this.
- packets that flexcop sends to USB have a 2 byte header that has to
be removed.
- sometimes a TS packet is split between different urbs. These parts have
to be combined in a temporary buffer.
Thanks a lot.
Diffstat (limited to 'linux/drivers/media/dvb/b2c2/flexcop-usb.c')
-rw-r--r-- | linux/drivers/media/dvb/b2c2/flexcop-usb.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/linux/drivers/media/dvb/b2c2/flexcop-usb.c b/linux/drivers/media/dvb/b2c2/flexcop-usb.c index b56037159..8a9cc74c1 100644 --- a/linux/drivers/media/dvb/b2c2/flexcop-usb.c +++ b/linux/drivers/media/dvb/b2c2/flexcop-usb.c @@ -282,6 +282,51 @@ static int flexcop_usb_i2c_request(struct flexcop_device *fc, flexcop_access_op_ return flexcop_usb_i2c_req(fc->bus_specific,B2C2_USB_I2C_REQUEST,USB_FUNC_I2C_WRITE,port,chipaddr,addr,buf,len); } +static void flexcop_usb_process_frame(struct flexcop_usb *fc_usb, u8 *buffer, int buffer_length) +{ + u8 *b; + int l; + + deb_ts("tmp_buffer_length=%d, buffer_length=%d\n", fc_usb->tmp_buffer_length, buffer_length); + + if (fc_usb->tmp_buffer_length > 0) { + memcpy(fc_usb->tmp_buffer+fc_usb->tmp_buffer_length, buffer, buffer_length); + fc_usb->tmp_buffer_length += buffer_length; + b = fc_usb->tmp_buffer; + l = fc_usb->tmp_buffer_length; + } else { + b=buffer; + l=buffer_length; + } + + while (l >= 190) { + if (*b == 0xff) + switch (*(b+1) & 0x03) { + case 0x01: /* media packet */ + if ( *(b+2) == 0x47 ) + flexcop_pass_dmx_packets(fc_usb->fc_dev, b+2, 1); + else + deb_ts("not ts packet %02x %02x %02x %02x \n", *(b+2), *(b+3), *(b+4), *(b+5) ); + + b += 190; + l -= 190; + break; + default: + deb_ts("wrong packet type\n"); + l = 0; + break; + } + else { + deb_ts("wrong header\n"); + l = 0; + } + } + + if (l>0) + memcpy(fc_usb->tmp_buffer, b, l); + fc_usb->tmp_buffer_length = l; +} + static void flexcop_usb_urb_complete(struct urb *urb, struct pt_regs *ptregs) { struct flexcop_usb *fc_usb = urb->context; @@ -297,7 +342,7 @@ static void flexcop_usb_urb_complete(struct urb *urb, struct pt_regs *ptregs) if (urb->iso_frame_desc[i].actual_length > 0) { deb_ts("passed %d bytes to the demux\n",urb->iso_frame_desc[i].actual_length); - flexcop_pass_dmx_data(fc_usb->fc_dev, + flexcop_usb_process_frame(fc_usb, urb->transfer_buffer + urb->iso_frame_desc[i].offset, urb->iso_frame_desc[i].actual_length); } |