diff options
author | Gerd Knorr <devnull@localhost> | 2004-12-01 15:10:26 +0000 |
---|---|---|
committer | Gerd Knorr <devnull@localhost> | 2004-12-01 15:10:26 +0000 |
commit | 417dd79a758f99e780ddf4cc716d3dd6eb2bb1c5 (patch) | |
tree | e16c24abc3c3ad2eb51f472ae2ac7986ebb9dffa /linux/drivers | |
parent | da58cf8502cca40e9d3ac205d47ee4c6b842a03d (diff) | |
download | mediapointer-dvb-s2-417dd79a758f99e780ddf4cc716d3dd6eb2bb1c5.tar.gz mediapointer-dvb-s2-417dd79a758f99e780ddf4cc716d3dd6eb2bb1c5.tar.bz2 |
- mpeg aspect ratio stuff.
Diffstat (limited to 'linux/drivers')
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-input.c | 8 | ||||
-rw-r--r-- | linux/drivers/media/video/saa6752hs.c | 83 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa6752hs.c | 83 |
3 files changed, 122 insertions, 52 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-input.c b/linux/drivers/media/video/cx88/cx88-input.c index ff0d1b95e..63e61748a 100644 --- a/linux/drivers/media/video/cx88/cx88-input.c +++ b/linux/drivers/media/video/cx88/cx88-input.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-input.c,v 1.1 2004/11/30 17:00:46 kraxel Exp $ + * $Id: cx88-input.c,v 1.2 2004/12/01 15:10:26 kraxel Exp $ * * Device driver for GPIO attached remote control interfaces * on Conexant 2388x based TV/DVB cards. @@ -181,7 +181,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) memset(ir,0,sizeof(*ir)); /* detect & configure */ - /* XXX: move this data into cx88-cards? */ switch (core->board) { case CX88_BOARD_DNTV_LIVE_DVB_T: ir_codes = ir_codes_dntv_live_dvb_t; @@ -193,6 +192,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_HAUPPAUGE: case CX88_BOARD_HAUPPAUGE_DVB_T1: ir_codes = ir_codes_rc5_tv; + ir_type = IR_TYPE_RC5; ir->sampling = 1; break; } @@ -203,7 +203,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) /* init input device */ snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", - core->name); + cx88_boards[core->board].name); snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); @@ -371,7 +371,7 @@ void cx88_ir_irq(struct cx88_core *core) if ((rc5 & 0xfffff000) != 0x3000) break; ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5); - ir->release = jiffies + msecs_to_jiffies(100); + ir->release = jiffies + msecs_to_jiffies(120); break; } diff --git a/linux/drivers/media/video/saa6752hs.c b/linux/drivers/media/video/saa6752hs.c index 875a71383..dc35bf34d 100644 --- a/linux/drivers/media/video/saa6752hs.c +++ b/linux/drivers/media/video/saa6752hs.c @@ -114,28 +114,29 @@ static u8 PMT[] = { static struct v4l2_mpeg_compression param_defaults = { - .st_type = V4L2_MPEG_TS_2, - .st_bitrate = { - .mode = V4L2_BITRATE_CBR, - .target = 7000, + .st_type = V4L2_MPEG_TS_2, + .st_bitrate = { + .mode = V4L2_BITRATE_CBR, + .target = 7000, }, - .ts_pid_pmt = 16, - .ts_pid_video = 260, - .ts_pid_audio = 256, - .ts_pid_pcr = 259, - - .vi_type = V4L2_MPEG_VI_2, - .vi_bitrate = { - .mode = V4L2_BITRATE_VBR, - .target = 4000, - .max = 6000, + .ts_pid_pmt = 16, + .ts_pid_video = 260, + .ts_pid_audio = 256, + .ts_pid_pcr = 259, + + .vi_type = V4L2_MPEG_VI_2, + .vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3, + .vi_bitrate = { + .mode = V4L2_BITRATE_VBR, + .target = 4000, + .max = 6000, }, - .au_type = V4L2_MPEG_AU_2_II, - .au_bitrate = { - .mode = V4L2_BITRATE_CBR, - .target = 256, + .au_type = V4L2_MPEG_AU_2_II, + .au_bitrate = { + .mode = V4L2_BITRATE_CBR, + .target = 256, }, #if 0 @@ -290,6 +291,11 @@ static void saa6752hs_set_params(struct i2c_client* client, if (params->au_bitrate.mode != V4L2_BITRATE_NONE) h->params.au_bitrate.target = params->au_bitrate.target; + /* aspect ratio */ + if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3 || + params->vi_aspect_ratio == V4L2_MPEG_ASPECT_16_9) + h->params.vi_aspect_ratio = params->vi_aspect_ratio; + /* range checks */ if (h->params.st_bitrate.target > MPEG_TOTAL_TARGET_BITRATE_MAX) h->params.st_bitrate.target = MPEG_TOTAL_TARGET_BITRATE_MAX; @@ -305,7 +311,7 @@ static void saa6752hs_set_params(struct i2c_client* client, static int saa6752hs_init(struct i2c_client* client) { - unsigned char buf[3]; + unsigned char buf[9], buf2[4]; struct saa6752hs_state *h; u32 crc; unsigned char localPAT[256]; @@ -313,6 +319,11 @@ static int saa6752hs_init(struct i2c_client* client) h = i2c_get_clientdata(client); + // Set video format - must be done first as it resets other settings + buf[0] = 0x41; + buf[1] = 0 /* MPEG_VIDEO_FORMAT_D1 */; + i2c_master_send(client, buf, 2); + // set bitrate saa6752hs_set_bitrate(client, &h->params); @@ -397,14 +408,38 @@ static int saa6752hs_init(struct i2c_client* client) buf[1] = 0; i2c_master_send(client, buf, 2); - // Set video format - buf[0] = 0x41; - buf[1] = 0 /* MPEG_VIDEO_FORMAT_D1 */; - i2c_master_send(client, buf, 2); - // start it going saa6752hs_chip_command(client, SAA6752HS_COMMAND_START); + // readout current state + buf[0] = 0xE1; + buf[1] = 0xA7; + buf[2] = 0xFE; + buf[3] = 0x82; + buf[4] = 0xB0; + i2c_master_send(client, buf, 5); + i2c_master_recv(client, buf2, 4); + + // change aspect ratio + buf[0] = 0xE0; + buf[1] = 0xA7; + buf[2] = 0xFE; + buf[3] = 0x82; + buf[4] = 0xB0; + buf[5] = buf2[0]; + switch(h->params.vi_aspect_ratio) { + case V4L2_MPEG_ASPECT_4_3: + buf[6] = buf2[1] & 0xBF; + break; + + case V4L2_MPEG_ASPECT_16_9: + buf[6] = buf2[1] | 0x40; + break; + } + buf[7] = buf2[2]; + buf[8] = buf2[3]; + i2c_master_send(client, buf, 9); + // return success return 0; } diff --git a/linux/drivers/media/video/saa7134/saa6752hs.c b/linux/drivers/media/video/saa7134/saa6752hs.c index 875a71383..dc35bf34d 100644 --- a/linux/drivers/media/video/saa7134/saa6752hs.c +++ b/linux/drivers/media/video/saa7134/saa6752hs.c @@ -114,28 +114,29 @@ static u8 PMT[] = { static struct v4l2_mpeg_compression param_defaults = { - .st_type = V4L2_MPEG_TS_2, - .st_bitrate = { - .mode = V4L2_BITRATE_CBR, - .target = 7000, + .st_type = V4L2_MPEG_TS_2, + .st_bitrate = { + .mode = V4L2_BITRATE_CBR, + .target = 7000, }, - .ts_pid_pmt = 16, - .ts_pid_video = 260, - .ts_pid_audio = 256, - .ts_pid_pcr = 259, - - .vi_type = V4L2_MPEG_VI_2, - .vi_bitrate = { - .mode = V4L2_BITRATE_VBR, - .target = 4000, - .max = 6000, + .ts_pid_pmt = 16, + .ts_pid_video = 260, + .ts_pid_audio = 256, + .ts_pid_pcr = 259, + + .vi_type = V4L2_MPEG_VI_2, + .vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3, + .vi_bitrate = { + .mode = V4L2_BITRATE_VBR, + .target = 4000, + .max = 6000, }, - .au_type = V4L2_MPEG_AU_2_II, - .au_bitrate = { - .mode = V4L2_BITRATE_CBR, - .target = 256, + .au_type = V4L2_MPEG_AU_2_II, + .au_bitrate = { + .mode = V4L2_BITRATE_CBR, + .target = 256, }, #if 0 @@ -290,6 +291,11 @@ static void saa6752hs_set_params(struct i2c_client* client, if (params->au_bitrate.mode != V4L2_BITRATE_NONE) h->params.au_bitrate.target = params->au_bitrate.target; + /* aspect ratio */ + if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3 || + params->vi_aspect_ratio == V4L2_MPEG_ASPECT_16_9) + h->params.vi_aspect_ratio = params->vi_aspect_ratio; + /* range checks */ if (h->params.st_bitrate.target > MPEG_TOTAL_TARGET_BITRATE_MAX) h->params.st_bitrate.target = MPEG_TOTAL_TARGET_BITRATE_MAX; @@ -305,7 +311,7 @@ static void saa6752hs_set_params(struct i2c_client* client, static int saa6752hs_init(struct i2c_client* client) { - unsigned char buf[3]; + unsigned char buf[9], buf2[4]; struct saa6752hs_state *h; u32 crc; unsigned char localPAT[256]; @@ -313,6 +319,11 @@ static int saa6752hs_init(struct i2c_client* client) h = i2c_get_clientdata(client); + // Set video format - must be done first as it resets other settings + buf[0] = 0x41; + buf[1] = 0 /* MPEG_VIDEO_FORMAT_D1 */; + i2c_master_send(client, buf, 2); + // set bitrate saa6752hs_set_bitrate(client, &h->params); @@ -397,14 +408,38 @@ static int saa6752hs_init(struct i2c_client* client) buf[1] = 0; i2c_master_send(client, buf, 2); - // Set video format - buf[0] = 0x41; - buf[1] = 0 /* MPEG_VIDEO_FORMAT_D1 */; - i2c_master_send(client, buf, 2); - // start it going saa6752hs_chip_command(client, SAA6752HS_COMMAND_START); + // readout current state + buf[0] = 0xE1; + buf[1] = 0xA7; + buf[2] = 0xFE; + buf[3] = 0x82; + buf[4] = 0xB0; + i2c_master_send(client, buf, 5); + i2c_master_recv(client, buf2, 4); + + // change aspect ratio + buf[0] = 0xE0; + buf[1] = 0xA7; + buf[2] = 0xFE; + buf[3] = 0x82; + buf[4] = 0xB0; + buf[5] = buf2[0]; + switch(h->params.vi_aspect_ratio) { + case V4L2_MPEG_ASPECT_4_3: + buf[6] = buf2[1] & 0xBF; + break; + + case V4L2_MPEG_ASPECT_16_9: + buf[6] = buf2[1] | 0x40; + break; + } + buf[7] = buf2[2]; + buf[8] = buf2[3]; + i2c_master_send(client, buf, 9); + // return success return 0; } |