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/media/video/saa7134 | |
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/media/video/saa7134')
-rw-r--r-- | linux/drivers/media/video/saa7134/saa6752hs.c | 83 |
1 files changed, 59 insertions, 24 deletions
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; } |