diff options
Diffstat (limited to 'drivers/media/video/saa7164/saa7164-encoder.c')
-rw-r--r-- | drivers/media/video/saa7164/saa7164-encoder.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/media/video/saa7164/saa7164-encoder.c b/drivers/media/video/saa7164/saa7164-encoder.c index cbb53d0ee979..1838408cd5cb 100644 --- a/drivers/media/video/saa7164/saa7164-encoder.c +++ b/drivers/media/video/saa7164/saa7164-encoder.c | |||
@@ -125,16 +125,22 @@ static int saa7164_encoder_buffers_alloc(struct saa7164_port *port) | |||
125 | 125 | ||
126 | dprintk(DBGLVL_ENC, "%s()\n", __func__); | 126 | dprintk(DBGLVL_ENC, "%s()\n", __func__); |
127 | 127 | ||
128 | if (port->encoder_params.stream_type == V4L2_MPEG_STREAM_TYPE_MPEG2_PS) { | 128 | if (port->encoder_params.stream_type == |
129 | dprintk(DBGLVL_ENC, "%s() type=V4L2_MPEG_STREAM_TYPE_MPEG2_PS\n", __func__); | 129 | V4L2_MPEG_STREAM_TYPE_MPEG2_PS) { |
130 | dprintk(DBGLVL_ENC, | ||
131 | "%s() type=V4L2_MPEG_STREAM_TYPE_MPEG2_PS\n", | ||
132 | __func__); | ||
130 | params->samplesperline = 128; | 133 | params->samplesperline = 128; |
131 | params->numberoflines = 256; | 134 | params->numberoflines = 256; |
132 | params->pitch = 128; | 135 | params->pitch = 128; |
133 | params->numpagetables = 2 + | 136 | params->numpagetables = 2 + |
134 | ((SAA7164_PS_NUMBER_OF_LINES * 128) / PAGE_SIZE); | 137 | ((SAA7164_PS_NUMBER_OF_LINES * 128) / PAGE_SIZE); |
135 | } else | 138 | } else |
136 | if (port->encoder_params.stream_type == V4L2_MPEG_STREAM_TYPE_MPEG2_TS) { | 139 | if (port->encoder_params.stream_type == |
137 | dprintk(DBGLVL_ENC, "%s() type=V4L2_MPEG_STREAM_TYPE_MPEG2_TS\n", __func__); | 140 | V4L2_MPEG_STREAM_TYPE_MPEG2_TS) { |
141 | dprintk(DBGLVL_ENC, | ||
142 | "%s() type=V4L2_MPEG_STREAM_TYPE_MPEG2_TS\n", | ||
143 | __func__); | ||
138 | params->samplesperline = 188; | 144 | params->samplesperline = 188; |
139 | params->numberoflines = 312; | 145 | params->numberoflines = 312; |
140 | params->pitch = 188; | 146 | params->pitch = 188; |
@@ -826,7 +832,8 @@ static int fill_queryctrl(struct saa7164_encoder_params *params, | |||
826 | return v4l2_ctrl_query_fill(c, 1, 255, 1, 15); | 832 | return v4l2_ctrl_query_fill(c, 1, 255, 1, 15); |
827 | case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: | 833 | case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: |
828 | return v4l2_ctrl_query_fill(c, | 834 | return v4l2_ctrl_query_fill(c, |
829 | V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, | 835 | V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, |
836 | V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, | ||
830 | 1, V4L2_MPEG_VIDEO_BITRATE_MODE_VBR); | 837 | 1, V4L2_MPEG_VIDEO_BITRATE_MODE_VBR); |
831 | case V4L2_CID_MPEG_VIDEO_B_FRAMES: | 838 | case V4L2_CID_MPEG_VIDEO_B_FRAMES: |
832 | return v4l2_ctrl_query_fill(c, | 839 | return v4l2_ctrl_query_fill(c, |
@@ -1113,7 +1120,9 @@ struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port) | |||
1113 | if (crc_checking) { | 1120 | if (crc_checking) { |
1114 | crc = crc32(0, ubuf->data, ubuf->actual_size); | 1121 | crc = crc32(0, ubuf->data, ubuf->actual_size); |
1115 | if (crc != ubuf->crc) { | 1122 | if (crc != ubuf->crc) { |
1116 | printk(KERN_ERR "%s() ubuf %p crc became invalid, was 0x%x became 0x%x\n", __func__, | 1123 | printk(KERN_ERR |
1124 | "%s() ubuf %p crc became invalid, was 0x%x became 0x%x\n", | ||
1125 | __func__, | ||
1117 | ubuf, ubuf->crc, crc); | 1126 | ubuf, ubuf->crc, crc); |
1118 | } | 1127 | } |
1119 | } | 1128 | } |
@@ -1201,9 +1210,8 @@ static ssize_t fops_read(struct file *file, char __user *buffer, | |||
1201 | buffer += cnt; | 1210 | buffer += cnt; |
1202 | ret += cnt; | 1211 | ret += cnt; |
1203 | 1212 | ||
1204 | if (ubuf->pos > ubuf->actual_size) { | 1213 | if (ubuf->pos > ubuf->actual_size) |
1205 | printk(KERN_ERR "read() pos > actual, huh?\n"); | 1214 | printk(KERN_ERR "read() pos > actual, huh?\n"); |
1206 | } | ||
1207 | 1215 | ||
1208 | if (ubuf->pos == ubuf->actual_size) { | 1216 | if (ubuf->pos == ubuf->actual_size) { |
1209 | 1217 | ||
@@ -1227,16 +1235,16 @@ static ssize_t fops_read(struct file *file, char __user *buffer, | |||
1227 | } | 1235 | } |
1228 | } | 1236 | } |
1229 | err: | 1237 | err: |
1230 | if (!ret && !ubuf) { | 1238 | if (!ret && !ubuf) |
1231 | ret = -EAGAIN; | 1239 | ret = -EAGAIN; |
1232 | } | ||
1233 | 1240 | ||
1234 | return ret; | 1241 | return ret; |
1235 | } | 1242 | } |
1236 | 1243 | ||
1237 | static unsigned int fops_poll(struct file *file, poll_table *wait) | 1244 | static unsigned int fops_poll(struct file *file, poll_table *wait) |
1238 | { | 1245 | { |
1239 | struct saa7164_encoder_fh *fh = (struct saa7164_encoder_fh *)file->private_data; | 1246 | struct saa7164_encoder_fh *fh = |
1247 | (struct saa7164_encoder_fh *)file->private_data; | ||
1240 | struct saa7164_port *port = fh->port; | 1248 | struct saa7164_port *port = fh->port; |
1241 | struct saa7164_user_buffer *ubuf; | 1249 | struct saa7164_user_buffer *ubuf; |
1242 | unsigned int mask = 0; | 1250 | unsigned int mask = 0; |
@@ -1249,9 +1257,8 @@ static unsigned int fops_poll(struct file *file, poll_table *wait) | |||
1249 | saa7164_histogram_update(&port->poll_interval, | 1257 | saa7164_histogram_update(&port->poll_interval, |
1250 | port->last_poll_msecs_diff); | 1258 | port->last_poll_msecs_diff); |
1251 | 1259 | ||
1252 | if (!video_is_registered(port->v4l_device)) { | 1260 | if (!video_is_registered(port->v4l_device)) |
1253 | return -EIO; | 1261 | return -EIO; |
1254 | } | ||
1255 | 1262 | ||
1256 | if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) { | 1263 | if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) { |
1257 | if (atomic_inc_return(&port->v4l_reader_count) == 1) { | 1264 | if (atomic_inc_return(&port->v4l_reader_count) == 1) { |