diff options
Diffstat (limited to 'drivers/media/video/saa7134/saa6752hs.c')
| -rw-r--r-- | drivers/media/video/saa7134/saa6752hs.c | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 57f1f5d409e0..002e70a33a4f 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
| @@ -71,7 +71,6 @@ static const struct v4l2_format v4l2_format_table[] = | |||
| 71 | 71 | ||
| 72 | struct saa6752hs_state { | 72 | struct saa6752hs_state { |
| 73 | struct i2c_client client; | 73 | struct i2c_client client; |
| 74 | struct v4l2_mpeg_compression old_params; | ||
| 75 | struct saa6752hs_mpeg_params params; | 74 | struct saa6752hs_mpeg_params params; |
| 76 | enum saa6752hs_videoformat video_format; | 75 | enum saa6752hs_videoformat video_format; |
| 77 | v4l2_std_id standard; | 76 | v4l2_std_id standard; |
| @@ -161,35 +160,6 @@ static struct saa6752hs_mpeg_params param_defaults = | |||
| 161 | .au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K, | 160 | .au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K, |
| 162 | }; | 161 | }; |
| 163 | 162 | ||
| 164 | static struct v4l2_mpeg_compression old_param_defaults = | ||
| 165 | { | ||
| 166 | .st_type = V4L2_MPEG_TS_2, | ||
| 167 | .st_bitrate = { | ||
| 168 | .mode = V4L2_BITRATE_CBR, | ||
| 169 | .target = 7000, | ||
| 170 | }, | ||
| 171 | |||
| 172 | .ts_pid_pmt = 16, | ||
| 173 | .ts_pid_video = 260, | ||
| 174 | .ts_pid_audio = 256, | ||
| 175 | .ts_pid_pcr = 259, | ||
| 176 | |||
| 177 | .vi_type = V4L2_MPEG_VI_2, | ||
| 178 | .vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3, | ||
| 179 | .vi_bitrate = { | ||
| 180 | .mode = V4L2_BITRATE_VBR, | ||
| 181 | .target = 4000, | ||
| 182 | .max = 6000, | ||
| 183 | }, | ||
| 184 | |||
| 185 | .au_type = V4L2_MPEG_AU_2_II, | ||
| 186 | .au_bitrate = { | ||
| 187 | .mode = V4L2_BITRATE_CBR, | ||
| 188 | .target = 256, | ||
| 189 | }, | ||
| 190 | |||
| 191 | }; | ||
| 192 | |||
| 193 | /* ---------------------------------------------------------------------- */ | 163 | /* ---------------------------------------------------------------------- */ |
| 194 | 164 | ||
| 195 | static int saa6752hs_chip_command(struct i2c_client* client, | 165 | static int saa6752hs_chip_command(struct i2c_client* client, |
| @@ -362,74 +332,6 @@ static void saa6752hs_set_subsampling(struct i2c_client* client, | |||
| 362 | } | 332 | } |
| 363 | 333 | ||
| 364 | 334 | ||
| 365 | static void saa6752hs_old_set_params(struct i2c_client* client, | ||
| 366 | struct v4l2_mpeg_compression* params) | ||
| 367 | { | ||
| 368 | struct saa6752hs_state *h = i2c_get_clientdata(client); | ||
| 369 | |||
| 370 | /* check PIDs */ | ||
| 371 | if (params->ts_pid_pmt <= MPEG_PID_MAX) { | ||
| 372 | h->old_params.ts_pid_pmt = params->ts_pid_pmt; | ||
| 373 | h->params.ts_pid_pmt = params->ts_pid_pmt; | ||
| 374 | } | ||
| 375 | if (params->ts_pid_pcr <= MPEG_PID_MAX) { | ||
| 376 | h->old_params.ts_pid_pcr = params->ts_pid_pcr; | ||
| 377 | h->params.ts_pid_pcr = params->ts_pid_pcr; | ||
| 378 | } | ||
| 379 | if (params->ts_pid_video <= MPEG_PID_MAX) { | ||
| 380 | h->old_params.ts_pid_video = params->ts_pid_video; | ||
| 381 | h->params.ts_pid_video = params->ts_pid_video; | ||
| 382 | } | ||
| 383 | if (params->ts_pid_audio <= MPEG_PID_MAX) { | ||
| 384 | h->old_params.ts_pid_audio = params->ts_pid_audio; | ||
| 385 | h->params.ts_pid_audio = params->ts_pid_audio; | ||
| 386 | } | ||
| 387 | |||
| 388 | /* check bitrate parameters */ | ||
| 389 | if ((params->vi_bitrate.mode == V4L2_BITRATE_CBR) || | ||
| 390 | (params->vi_bitrate.mode == V4L2_BITRATE_VBR)) { | ||
| 391 | h->old_params.vi_bitrate.mode = params->vi_bitrate.mode; | ||
| 392 | h->params.vi_bitrate_mode = (params->vi_bitrate.mode == V4L2_BITRATE_VBR) ? | ||
| 393 | V4L2_MPEG_VIDEO_BITRATE_MODE_VBR : V4L2_MPEG_VIDEO_BITRATE_MODE_CBR; | ||
| 394 | } | ||
| 395 | if (params->vi_bitrate.mode != V4L2_BITRATE_NONE) | ||
| 396 | h->old_params.st_bitrate.target = params->st_bitrate.target; | ||
| 397 | if (params->vi_bitrate.mode != V4L2_BITRATE_NONE) | ||
| 398 | h->old_params.vi_bitrate.target = params->vi_bitrate.target; | ||
| 399 | if (params->vi_bitrate.mode == V4L2_BITRATE_VBR) | ||
| 400 | h->old_params.vi_bitrate.max = params->vi_bitrate.max; | ||
| 401 | if (params->au_bitrate.mode != V4L2_BITRATE_NONE) | ||
| 402 | h->old_params.au_bitrate.target = params->au_bitrate.target; | ||
| 403 | |||
| 404 | /* aspect ratio */ | ||
| 405 | if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3 || | ||
| 406 | params->vi_aspect_ratio == V4L2_MPEG_ASPECT_16_9) { | ||
| 407 | h->old_params.vi_aspect_ratio = params->vi_aspect_ratio; | ||
| 408 | if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3) | ||
| 409 | h->params.vi_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3; | ||
| 410 | else | ||
| 411 | h->params.vi_aspect = V4L2_MPEG_VIDEO_ASPECT_16x9; | ||
| 412 | } | ||
| 413 | |||
| 414 | /* range checks */ | ||
| 415 | if (h->old_params.st_bitrate.target > MPEG_TOTAL_TARGET_BITRATE_MAX) | ||
| 416 | h->old_params.st_bitrate.target = MPEG_TOTAL_TARGET_BITRATE_MAX; | ||
| 417 | if (h->old_params.vi_bitrate.target > MPEG_VIDEO_TARGET_BITRATE_MAX) | ||
| 418 | h->old_params.vi_bitrate.target = MPEG_VIDEO_TARGET_BITRATE_MAX; | ||
| 419 | if (h->old_params.vi_bitrate.max > MPEG_VIDEO_MAX_BITRATE_MAX) | ||
| 420 | h->old_params.vi_bitrate.max = MPEG_VIDEO_MAX_BITRATE_MAX; | ||
| 421 | h->params.vi_bitrate = params->vi_bitrate.target; | ||
| 422 | h->params.vi_bitrate_peak = params->vi_bitrate.max; | ||
| 423 | if (h->old_params.au_bitrate.target <= 256) { | ||
| 424 | h->old_params.au_bitrate.target = 256; | ||
| 425 | h->params.au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K; | ||
| 426 | } | ||
| 427 | else { | ||
| 428 | h->old_params.au_bitrate.target = 384; | ||
| 429 | h->params.au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_384K; | ||
| 430 | } | ||
| 431 | } | ||
| 432 | |||
| 433 | static int handle_ctrl(struct saa6752hs_mpeg_params *params, | 335 | static int handle_ctrl(struct saa6752hs_mpeg_params *params, |
| 434 | struct v4l2_ext_control *ctrl, unsigned int cmd) | 336 | struct v4l2_ext_control *ctrl, unsigned int cmd) |
| 435 | { | 337 | { |
| @@ -697,7 +599,6 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind) | |||
| 697 | return -ENOMEM; | 599 | return -ENOMEM; |
| 698 | h->client = client_template; | 600 | h->client = client_template; |
| 699 | h->params = param_defaults; | 601 | h->params = param_defaults; |
| 700 | h->old_params = old_param_defaults; | ||
| 701 | h->client.adapter = adap; | 602 | h->client.adapter = adap; |
| 702 | h->client.addr = addr; | 603 | h->client.addr = addr; |
| 703 | 604 | ||
| @@ -734,23 +635,11 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 734 | { | 635 | { |
| 735 | struct saa6752hs_state *h = i2c_get_clientdata(client); | 636 | struct saa6752hs_state *h = i2c_get_clientdata(client); |
| 736 | struct v4l2_ext_controls *ctrls = arg; | 637 | struct v4l2_ext_controls *ctrls = arg; |
| 737 | struct v4l2_mpeg_compression *old_params = arg; | ||
| 738 | struct saa6752hs_mpeg_params params; | 638 | struct saa6752hs_mpeg_params params; |
| 739 | int err = 0; | 639 | int err = 0; |
| 740 | int i; | 640 | int i; |
| 741 | 641 | ||
| 742 | switch (cmd) { | 642 | switch (cmd) { |
| 743 | case VIDIOC_S_MPEGCOMP: | ||
| 744 | if (NULL == old_params) { | ||
| 745 | /* apply settings and start encoder */ | ||
| 746 | saa6752hs_init(client); | ||
| 747 | break; | ||
| 748 | } | ||
| 749 | saa6752hs_old_set_params(client, old_params); | ||
| 750 | /* fall through */ | ||
| 751 | case VIDIOC_G_MPEGCOMP: | ||
| 752 | *old_params = h->old_params; | ||
| 753 | break; | ||
| 754 | case VIDIOC_S_EXT_CTRLS: | 643 | case VIDIOC_S_EXT_CTRLS: |
| 755 | if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) | 644 | if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) |
| 756 | return -EINVAL; | 645 | return -EINVAL; |
