aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-06-23 15:13:56 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 01:05:24 -0400
commitb57e5578f913a304e97cb66aa0044a894ca47f2f (patch)
tree2f0210661e2f42e10e121311092b6cd1c948914a /drivers/media/video
parent45f87a21735804760dd7db0e2e3c609c332b15e3 (diff)
Fixes some sync issues between V4L/DVB development and GIT
Some changes didn't went ok to -git, probably due to changes at merging patches. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/saa7134/saa6752hs.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
index e8c65ddd0181..de7b9e6e932a 100644
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -261,45 +261,57 @@ static int saa6752hs_chip_command(struct i2c_client* client,
261 261
262 262
263static int saa6752hs_set_bitrate(struct i2c_client* client, 263static int saa6752hs_set_bitrate(struct i2c_client* client,
264 struct v4l2_mpeg_compression* params) 264 struct saa6752hs_mpeg_params* params)
265{ 265{
266 u8 buf[3]; 266 u8 buf[3];
267 int tot_bitrate;
267 268
268 /* set the bitrate mode */ 269 /* set the bitrate mode */
269 buf[0] = 0x71; 270 buf[0] = 0x71;
270 buf[1] = (params->vi_bitrate.mode == V4L2_BITRATE_VBR) ? 0 : 1; 271 buf[1] = (params->vi_bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) ? 0 : 1;
271 i2c_master_send(client, buf, 2); 272 i2c_master_send(client, buf, 2);
272 273
273 /* set the video bitrate */ 274 /* set the video bitrate */
274 if (params->vi_bitrate.mode == V4L2_BITRATE_VBR) { 275 if (params->vi_bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) {
275 /* set the target bitrate */ 276 /* set the target bitrate */
276 buf[0] = 0x80; 277 buf[0] = 0x80;
277 buf[1] = params->vi_bitrate.target >> 8; 278 buf[1] = params->vi_bitrate >> 8;
278 buf[2] = params->vi_bitrate.target & 0xff; 279 buf[2] = params->vi_bitrate & 0xff;
279 i2c_master_send(client, buf, 3); 280 i2c_master_send(client, buf, 3);
280 281
281 /* set the max bitrate */ 282 /* set the max bitrate */
282 buf[0] = 0x81; 283 buf[0] = 0x81;
283 buf[1] = params->vi_bitrate.max >> 8; 284 buf[1] = params->vi_bitrate_peak >> 8;
284 buf[2] = params->vi_bitrate.max & 0xff; 285 buf[2] = params->vi_bitrate_peak & 0xff;
285 i2c_master_send(client, buf, 3); 286 i2c_master_send(client, buf, 3);
287 tot_bitrate = params->vi_bitrate_peak;
286 } else { 288 } else {
287 /* set the target bitrate (no max bitrate for CBR) */ 289 /* set the target bitrate (no max bitrate for CBR) */
288 buf[0] = 0x81; 290 buf[0] = 0x81;
289 buf[1] = params->vi_bitrate.target >> 8; 291 buf[1] = params->vi_bitrate >> 8;
290 buf[2] = params->vi_bitrate.target & 0xff; 292 buf[2] = params->vi_bitrate & 0xff;
291 i2c_master_send(client, buf, 3); 293 i2c_master_send(client, buf, 3);
294 tot_bitrate = params->vi_bitrate;
292 } 295 }
293 296
294 /* set the audio bitrate */ 297 /* set the audio bitrate */
295 buf[0] = 0x94; 298 buf[0] = 0x94;
296 buf[1] = (256 == params->au_bitrate.target) ? 0 : 1; 299 buf[1] = (V4L2_MPEG_AUDIO_L2_BITRATE_256K == params->au_l2_bitrate) ? 0 : 1;
297 i2c_master_send(client, buf, 2); 300 i2c_master_send(client, buf, 2);
301 tot_bitrate += (V4L2_MPEG_AUDIO_L2_BITRATE_256K == params->au_l2_bitrate) ? 256 : 384;
302
303 /* Note: the total max bitrate is determined by adding the video and audio
304 bitrates together and also adding an extra 768kbit/s to stay on the
305 safe side. If more control should be required, then an extra MPEG control
306 should be added. */
307 tot_bitrate += 768;
308 if (tot_bitrate > MPEG_TOTAL_TARGET_BITRATE_MAX)
309 tot_bitrate = MPEG_TOTAL_TARGET_BITRATE_MAX;
298 310
299 /* set the total bitrate */ 311 /* set the total bitrate */
300 buf[0] = 0xb1; 312 buf[0] = 0xb1;
301 buf[1] = params->st_bitrate.target >> 8; 313 buf[1] = tot_bitrate >> 8;
302 buf[2] = params->st_bitrate.target & 0xff; 314 buf[2] = tot_bitrate & 0xff;
303 i2c_master_send(client, buf, 3); 315 i2c_master_send(client, buf, 3);
304 316
305 return 0; 317 return 0;