45 struct cx18 *cx =
id->cx;
51 CX18_WARN(
"MPEG Index stream cannot be claimed "
52 "directly, but something tried.\n");
88 if (cx->
vbi.insert_mpeg && !cx18_raw_vbi(cx))
90 else if (!cx18_stream_enabled(s_assoc))
148 if (s_assoc->
id == -1) {
160 static void cx18_dualwatch(
struct cx18 *
cx)
167 memset(&vt, 0,
sizeof(vt));
171 new_stereo_mode = dual;
206 cx18_stream_put_mdl_fw(s_vbi, mdl);
209 mdl = &cx->
vbi.sliced_mpeg_mdl;
258 static void cx18_setup_sliced_vbi_mdl(
struct cx18 *cx)
264 buf->
buf = cx->
vbi.sliced_mpeg_data[
idx];
273 static size_t cx18_copy_buf_to_user(
struct cx18_stream *s,
283 !cx18_raw_vbi(cx) && buf != &cx->
vbi.sliced_mpeg_buf) {
304 const char *
p = start + 1;
309 while (start + len > p) {
311 q =
memchr(p, 0, start + len - p);
321 q[1] != 0 || q[2] != 1 || q[3] != ch)
327 if ((q[6] & 0xc0) != 0x80)
330 if (((q[7] & 0xc0) == 0x80 &&
331 (q[9] & 0xf0) == 0x20) ||
332 ((q[7] & 0xc0) == 0xc0 &&
333 (q[9] & 0xf0) == 0x30)) {
345 stuffing = q[13] & 7;
347 for (i = 0; i < stuffing; i++)
348 if (q[14 + i] != 0xff)
351 (q[4] & 0xc4) == 0x44 &&
353 q[14 + stuffing] == 0 &&
354 q[15 + stuffing] == 0 &&
355 q[16 + stuffing] == 1) {
358 len = (
char *)q - start;
359 cx18_setup_sliced_vbi_mdl(cx);
372 buf != &cx->
vbi.sliced_mpeg_buf)
377 static size_t cx18_copy_mdl_to_user(
struct cx18_stream *s,
378 struct cx18_mdl *mdl,
char __user *ubuf,
size_t ucount)
380 size_t tot_written = 0;
403 rc = cx18_copy_buf_to_user(s, mdl->
curr_buf, ubuf + tot_written,
404 ucount - tot_written, &stop);
411 tot_written >= ucount ||
420 size_t tot_count,
int non_block)
423 size_t tot_written = 0;
424 int single_frame = 0;
443 mdl = cx18_get_mdl(s, non_block, &rc);
459 rc = cx18_copy_mdl_to_user(s, mdl, ubuf + tot_written,
460 tot_count - tot_written);
462 if (mdl != &cx->
vbi.sliced_mpeg_mdl) {
464 cx18_stream_put_mdl_fw(s, mdl);
466 cx18_push(s, mdl, &s->
q_full);
470 cx->
vbi.sliced_mpeg_size[
idx] = 0;
471 cx->
vbi.inserted_frame++;
478 if (tot_written == tot_count || single_frame)
485 size_t count, loff_t *
pos,
int non_block)
487 ssize_t rc = count ? cx18_read(s, ubuf, count, non_block) : 0;
498 struct cx18 *cx =
id->cx;
589 struct cx18 *cx =
id->cx;
613 struct cx18 *cx =
id->cx;
635 if (eof && videobuf_poll ==
POLLERR)
638 return videobuf_poll;
643 poll_wait(filp, &s->
waitq, wait);
655 struct cx18 *cx =
id->cx;
671 "Could not start capture for %s (%d)\n",
701 spin_unlock_irqrestore(&s->
vb_lock, flags);
706 struct cx18 *cx =
id->cx;
749 struct cx18 *cx =
id->cx;
757 v4l2_fh_is_singular_file(filp)) {
787 static int cx18_serialized_open(
struct cx18_stream *s,
struct file *filp)
810 v4l2_fh_is_singular_file(filp)) {
840 struct cx18_stream *s = video_get_drvdata(video_dev);
845 CX18_ERR(
"Failed to initialize on %s\n",
846 video_device_node_name(video_dev));
850 res = cx18_serialized_open(s, filp);
863 CX18_ERR(
"Can't find valid task handle for mute\n");
878 CX18_ERR(
"Can't find valid task handle for unmute\n");