summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/ttusb-dec
diff options
context:
space:
mode:
authorAlex Woods <devnull@localhost>2004-01-13 18:40:51 +0000
committerAlex Woods <devnull@localhost>2004-01-13 18:40:51 +0000
commit92090b9c5a4c691e6b6a58aab4855adac20ffa47 (patch)
treede0fdb58467a0e8fa5e4fe1b1e76a19f4295fb21 /linux/drivers/media/dvb/ttusb-dec
parent2d7fbe39b4d518dad90974c3fff93a77ae78f6c1 (diff)
downloadmediapointer-dvb-s2-92090b9c5a4c691e6b6a58aab4855adac20ffa47.tar.gz
mediapointer-dvb-s2-92090b9c5a4c691e6b6a58aab4855adac20ffa47.tar.bz2
Send audio packets to their filter rather than the videos.
Change some variable names to make it clearer what we are dealing with (PVA).
Diffstat (limited to 'linux/drivers/media/dvb/ttusb-dec')
-rw-r--r--linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c123
1 files changed, 70 insertions, 53 deletions
diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
index a75509993..bb70b7e65 100644
--- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
+++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
@@ -41,7 +41,7 @@
#include "dvb_net.h"
static int debug = 0;
-static int output_avpes = 0;
+static int output_pva = 0;
#define dprintk if (debug) printk
@@ -59,7 +59,7 @@ static int output_avpes = 0;
#define FRAMES_PER_ISO_BUF 0x04
#define ISO_FRAME_SIZE 0x03FF
-#define MAX_AV_PES_LENGTH 6144
+#define MAX_PVA_LENGTH 6144
#define LOF_HI 10600000
#define LOF_LO 9750000
@@ -71,7 +71,7 @@ enum ttusb_dec_model {
};
enum ttusb_dec_packet_type {
- TTUSB_DEC_PACKET_AV_PES,
+ TTUSB_DEC_PACKET_PVA,
TTUSB_DEC_PACKET_SECTION,
TTUSB_DEC_PACKET_EMPTY
};
@@ -117,20 +117,20 @@ struct ttusb_dec {
int iso_stream_count;
struct semaphore iso_sem;
- u8 packet[MAX_AV_PES_LENGTH + 4];
+ u8 packet[MAX_PVA_LENGTH + 4];
enum ttusb_dec_packet_type packet_type;
int packet_state;
int packet_length;
int packet_payload_length;
u16 next_packet_id;
- int av_pes_stream_count;
+ int pva_stream_count;
int filter_stream_count;
struct dvb_filter_pes2ts a_pes2ts;
struct dvb_filter_pes2ts v_pes2ts;
- u8 v_pes[16 + MAX_AV_PES_LENGTH];
+ u8 v_pes[16 + MAX_PVA_LENGTH];
int v_pes_length;
int v_pes_postbytes;
@@ -138,7 +138,8 @@ struct ttusb_dec {
struct tasklet_struct urb_tasklet;
spinlock_t urb_frame_list_lock;
- struct dvb_demux_filter *av_filter;
+ struct dvb_demux_filter *audio_filter;
+ struct dvb_demux_filter *video_filter;
struct list_head filter_info_list;
spinlock_t filter_info_list_lock;
@@ -299,12 +300,24 @@ static int ttusb_dec_get_stb_state (struct ttusb_dec *dec, unsigned int *mode,
}
}
-static int ttusb_dec_av_pes2ts_cb(void *priv, unsigned char *data)
+static int ttusb_dec_audio_pes2ts_cb(void *priv, unsigned char *data)
{
struct ttusb_dec *dec = (struct ttusb_dec *)priv;
- dec->av_filter->feed->cb.ts(data, 188, 0, 0,
- &dec->av_filter->feed->feed.ts, DMX_OK);
+ dec->audio_filter->feed->cb.ts(data, 188, 0, 0,
+ &dec->audio_filter->feed->feed.ts,
+ DMX_OK);
+
+ return 0;
+}
+
+static int ttusb_dec_video_pes2ts_cb(void *priv, unsigned char *data)
+{
+ struct ttusb_dec *dec = (struct ttusb_dec *)priv;
+
+ dec->video_filter->feed->cb.ts(data, 188, 0, 0,
+ &dec->video_filter->feed->feed.ts,
+ DMX_OK);
return 0;
}
@@ -328,71 +341,69 @@ static void ttusb_dec_set_pids(struct ttusb_dec *dec)
ttusb_dec_send_command(dec, 0x50, sizeof(b), b, NULL, NULL);
dvb_filter_pes2ts_init(&dec->a_pes2ts, dec->pid[DMX_PES_AUDIO],
- ttusb_dec_av_pes2ts_cb, dec);
+ ttusb_dec_audio_pes2ts_cb, dec);
dvb_filter_pes2ts_init(&dec->v_pes2ts, dec->pid[DMX_PES_VIDEO],
- ttusb_dec_av_pes2ts_cb, dec);
+ ttusb_dec_video_pes2ts_cb, dec);
dec->v_pes_length = 0;
dec->v_pes_postbytes = 0;
}
-static void ttusb_dec_process_av_pes(struct ttusb_dec *dec, u8 *av_pes,
- int length)
+static void ttusb_dec_process_pva(struct ttusb_dec *dec, u8 *pva, int length)
{
if (length < 8) {
printk("%s: packet too short - discarding\n", __FUNCTION__);
return;
}
- if (length > 8 + MAX_AV_PES_LENGTH) {
+ if (length > 8 + MAX_PVA_LENGTH) {
printk("%s: packet too long - discarding\n", __FUNCTION__);
return;
}
- if (output_avpes) {
- dec->av_filter->feed->cb.ts(av_pes, length, 0, 0,
- &dec->av_filter->feed->feed.ts,
- DMX_OK);
- return;
- }
-
- switch (av_pes[2]) {
+ switch (pva[2]) {
case 0x01: { /* VideoStream */
- int prebytes = av_pes[5] & 0x03;
- int postbytes = (av_pes[5] & 0x0c) >> 2;
+ int prebytes = pva[5] & 0x03;
+ int postbytes = (pva[5] & 0x0c) >> 2;
u16 v_pes_payload_length;
+ if (output_pva) {
+ dec->video_filter->feed->cb.ts(pva, length, 0, 0,
+ &dec->video_filter->feed->feed.ts, DMX_OK);
+ return;
+ }
+
if (dec->v_pes_postbytes > 0 &&
dec->v_pes_postbytes == prebytes) {
memcpy(&dec->v_pes[dec->v_pes_length],
- &av_pes[12], prebytes);
+ &pva[12], prebytes);
dvb_filter_pes2ts(&dec->v_pes2ts, dec->v_pes,
dec->v_pes_length + prebytes, 1);
}
- if (av_pes[5] & 0x10) {
+ if (pva[5] & 0x10) {
dec->v_pes[7] = 0x80;
dec->v_pes[8] = 0x05;
- dec->v_pes[9] = 0x21 | ((av_pes[8] & 0xc0) >> 5);
- dec->v_pes[10] = ((av_pes[8] & 0x3f) << 2) |
- ((av_pes[9] & 0xc0) >> 6);
+ dec->v_pes[9] = 0x21 | ((pva[8] & 0xc0) >> 5);
+ dec->v_pes[10] = ((pva[8] & 0x3f) << 2) |
+ ((pva[9] & 0xc0) >> 6);
dec->v_pes[11] = 0x01 |
- ((av_pes[9] & 0x3f) << 2) |
- ((av_pes[10] & 0x80) >> 6);
- dec->v_pes[12] = ((av_pes[10] & 0x7f) << 1) |
- ((av_pes[11] & 0xc0) >> 7);
- dec->v_pes[13] = 0x01 | ((av_pes[11] & 0x7f) << 1);
+ ((pva[9] & 0x3f) << 2) |
+ ((pva[10] & 0x80) >> 6);
+ dec->v_pes[12] = ((pva[10] & 0x7f) << 1) |
+ ((pva[11] & 0xc0) >> 7);
+ dec->v_pes[13] = 0x01 | ((pva[11] & 0x7f) << 1);
- memcpy(&dec->v_pes[14], &av_pes[12 + prebytes],
+ memcpy(&dec->v_pes[14], &pva[12 + prebytes],
length - 12 - prebytes);
dec->v_pes_length = 14 + length - 12 - prebytes;
} else {
dec->v_pes[7] = 0x00;
dec->v_pes[8] = 0x00;
- memcpy(&dec->v_pes[9], &av_pes[8], length - 8);
+ memcpy(&dec->v_pes[9], &pva[8], length - 8);
dec->v_pes_length = 9 + length - 8;
}
@@ -417,13 +428,19 @@ static void ttusb_dec_process_av_pes(struct ttusb_dec *dec, u8 *av_pes,
}
case 0x02: /* MainAudioStream */
- dvb_filter_pes2ts(&dec->a_pes2ts, &av_pes[8], length - 8,
- av_pes[5] & 0x10);
+ if (output_pva) {
+ dec->audio_filter->feed->cb.ts(pva, length, 0, 0,
+ &dec->audio_filter->feed->feed.ts, DMX_OK);
+ return;
+ }
+
+ dvb_filter_pes2ts(&dec->a_pes2ts, &pva[8], length - 8,
+ pva[5] & 0x10);
break;
default:
- printk("%s: unknown AV_PES type: %02x.\n", __FUNCTION__,
- av_pes[2]);
+ printk("%s: unknown PVA type: %02x.\n", __FUNCTION__,
+ pva[2]);
break;
}
}
@@ -487,10 +504,10 @@ static void ttusb_dec_process_packet(struct ttusb_dec *dec)
dec->next_packet_id = packet_id + 1;
switch (dec->packet_type) {
- case TTUSB_DEC_PACKET_AV_PES:
- if (dec->av_pes_stream_count)
- ttusb_dec_process_av_pes(dec, dec->packet,
- dec->packet_payload_length);
+ case TTUSB_DEC_PACKET_PVA:
+ if (dec->pva_stream_count)
+ ttusb_dec_process_pva(dec, dec->packet,
+ dec->packet_payload_length);
break;
case TTUSB_DEC_PACKET_SECTION:
@@ -553,7 +570,7 @@ static void ttusb_dec_process_urb_frame(struct ttusb_dec *dec, u8 *b,
if (dec->packet[0] == 'A' &&
dec->packet[1] == 'V') {
dec->packet_type =
- TTUSB_DEC_PACKET_AV_PES;
+ TTUSB_DEC_PACKET_PVA;
dec->packet_state++;
} else if (dec->packet[0] == 'S') {
dec->packet_type =
@@ -578,7 +595,7 @@ static void ttusb_dec_process_urb_frame(struct ttusb_dec *dec, u8 *b,
case 5:
dec->packet[dec->packet_length++] = *b++;
- if (dec->packet_type == TTUSB_DEC_PACKET_AV_PES &&
+ if (dec->packet_type == TTUSB_DEC_PACKET_PVA &&
dec->packet_length == 8) {
dec->packet_state++;
dec->packet_payload_length = 8 +
@@ -877,20 +894,20 @@ static int ttusb_dec_start_ts_feed(struct dvb_demux_feed *dvbdmxfeed)
dprintk("\n");
- dec->av_filter = dvbdmxfeed->filter;
-
switch (dvbdmxfeed->pes_type) {
case DMX_TS_PES_VIDEO:
dprintk(" pes_type: DMX_TS_PES_VIDEO\n");
dec->pid[DMX_PES_PCR] = dvbdmxfeed->pid;
dec->pid[DMX_PES_VIDEO] = dvbdmxfeed->pid;
+ dec->video_filter = dvbdmxfeed->filter;
ttusb_dec_set_pids(dec);
break;
case DMX_TS_PES_AUDIO:
dprintk(" pes_type: DMX_TS_PES_AUDIO\n");
dec->pid[DMX_PES_AUDIO] = dvbdmxfeed->pid;
+ dec->audio_filter = dvbdmxfeed->filter;
ttusb_dec_set_pids(dec);
break;
@@ -919,7 +936,7 @@ static int ttusb_dec_start_ts_feed(struct dvb_demux_feed *dvbdmxfeed)
if (result)
return result;
- dec->av_pes_stream_count++;
+ dec->pva_stream_count++;
return ttusb_dec_start_iso_xfer(dec);
}
@@ -1013,7 +1030,7 @@ static int ttusb_dec_stop_ts_feed(struct dvb_demux_feed *dvbdmxfeed)
ttusb_dec_send_command(dec, 0x81, sizeof(b0), b0, NULL, NULL);
- dec->av_pes_stream_count--;
+ dec->pva_stream_count--;
ttusb_dec_stop_iso_xfer(dec);
@@ -1875,5 +1892,5 @@ MODULE_DEVICE_TABLE(usb, ttusb_dec_table);
MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "Debug level");
-MODULE_PARM(output_avpes, "i");
-MODULE_PARM_DESC(output_avpes, "Output AVPES from dvr device");
+MODULE_PARM(output_pva, "i");
+MODULE_PARM_DESC(output_pva, "Output PVA from dvr device");