Lines Matching refs:itv
15 static void ivtv_set_vps(struct ivtv *itv, int enabled) in ivtv_set_vps() argument
19 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) in ivtv_set_vps()
24 data.data[2] = itv->vbi.vps_payload.data[0]; in ivtv_set_vps()
25 data.data[8] = itv->vbi.vps_payload.data[1]; in ivtv_set_vps()
26 data.data[9] = itv->vbi.vps_payload.data[2]; in ivtv_set_vps()
27 data.data[10] = itv->vbi.vps_payload.data[3]; in ivtv_set_vps()
28 data.data[11] = itv->vbi.vps_payload.data[4]; in ivtv_set_vps()
29 ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data); in ivtv_set_vps()
32 static void ivtv_set_cc(struct ivtv *itv, int mode, const struct vbi_cc *cc) in ivtv_set_cc() argument
36 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) in ivtv_set_cc()
43 ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data); in ivtv_set_cc()
48 ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data); in ivtv_set_cc()
51 static void ivtv_set_wss(struct ivtv *itv, int enabled, int mode) in ivtv_set_wss() argument
55 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) in ivtv_set_wss()
62 if ((itv->std_out & V4L2_STD_625_50) && !enabled) { in ivtv_set_wss()
71 ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data); in ivtv_set_wss()
83 static void ivtv_write_vbi_line(struct ivtv *itv, in ivtv_write_vbi_line() argument
87 struct vbi_info *vi = &itv->vbi; in ivtv_write_vbi_line()
108 set_bit(IVTV_F_I_UPDATE_VPS, &itv->i_flags); in ivtv_write_vbi_line()
116 set_bit(IVTV_F_I_UPDATE_WSS, &itv->i_flags); in ivtv_write_vbi_line()
121 static void ivtv_write_vbi_cc_lines(struct ivtv *itv, const struct vbi_cc *cc) in ivtv_write_vbi_cc_lines() argument
123 struct vbi_info *vi = &itv->vbi; in ivtv_write_vbi_cc_lines()
129 set_bit(IVTV_F_I_UPDATE_CC, &itv->i_flags); in ivtv_write_vbi_cc_lines()
133 static void ivtv_write_vbi(struct ivtv *itv, in ivtv_write_vbi() argument
142 ivtv_write_vbi_line(itv, sliced + i, &cc, &found_cc); in ivtv_write_vbi()
145 ivtv_write_vbi_cc_lines(itv, &cc); in ivtv_write_vbi()
149 ivtv_write_vbi_from_user(struct ivtv *itv, in ivtv_write_vbi_from_user() argument
165 ivtv_write_vbi_line(itv, &d, &cc, &found_cc); in ivtv_write_vbi_from_user()
169 ivtv_write_vbi_cc_lines(itv, &cc); in ivtv_write_vbi_from_user()
174 static void copy_vbi_data(struct ivtv *itv, int lines, u32 pts_stamp) in copy_vbi_data() argument
187 int idx = itv->vbi.frame % IVTV_VBI_FRAMES; in copy_vbi_data()
188 u8 *dst = &itv->vbi.sliced_mpeg_data[idx][0]; in copy_vbi_data()
193 if (itv->vbi.sliced_data[i].id == 0) in copy_vbi_data()
196 l = itv->vbi.sliced_data[i].line - 6; in copy_vbi_data()
197 f = itv->vbi.sliced_data[i].field; in copy_vbi_data()
205 ivtv_service2vbi(itv->vbi.sliced_data[i].id); in copy_vbi_data()
206 memcpy(dst + sd + 12 + line * 43 + 1, itv->vbi.sliced_data[i].data, 42); in copy_vbi_data()
231 itv->vbi.sliced_mpeg_size[idx] = sd + size; in copy_vbi_data()
234 static int ivtv_convert_ivtv_vbi(struct ivtv *itv, u8 *p) in ivtv_convert_ivtv_vbi() argument
279 itv->vbi.sliced_dec_data[line].line = l; in ivtv_convert_ivtv_vbi()
280 itv->vbi.sliced_dec_data[line].field = i >= 18; in ivtv_convert_ivtv_vbi()
281 itv->vbi.sliced_dec_data[line].id = id2; in ivtv_convert_ivtv_vbi()
282 memcpy(itv->vbi.sliced_dec_data[line].data, p + 1, 42); in ivtv_convert_ivtv_vbi()
288 itv->vbi.sliced_dec_data[line].id = 0; in ivtv_convert_ivtv_vbi()
289 itv->vbi.sliced_dec_data[line].line = 0; in ivtv_convert_ivtv_vbi()
290 itv->vbi.sliced_dec_data[line].field = 0; in ivtv_convert_ivtv_vbi()
293 return line * sizeof(itv->vbi.sliced_dec_data[0]); in ivtv_convert_ivtv_vbi()
299 static u32 compress_raw_buf(struct ivtv *itv, u8 *buf, u32 size) in compress_raw_buf() argument
301 u32 line_size = itv->vbi.raw_decoder_line_size; in compress_raw_buf()
302 u32 lines = itv->vbi.count; in compress_raw_buf()
303 u8 sav1 = itv->vbi.raw_decoder_sav_odd_field; in compress_raw_buf()
304 u8 sav2 = itv->vbi.raw_decoder_sav_even_field; in compress_raw_buf()
325 static u32 compress_sliced_buf(struct ivtv *itv, u32 line, u8 *buf, u32 size, u8 sav) in compress_sliced_buf() argument
327 u32 line_size = itv->vbi.sliced_decoder_line_size; in compress_sliced_buf()
350 v4l2_subdev_call(itv->sd_video, vbi, decode_vbi_line, &vbi); in compress_sliced_buf()
353 itv->vbi.sliced_data[line].id = vbi.type; in compress_sliced_buf()
354 itv->vbi.sliced_data[line].field = vbi.is_second_field; in compress_sliced_buf()
355 itv->vbi.sliced_data[line].line = vbi.line; in compress_sliced_buf()
356 memcpy(itv->vbi.sliced_data[line].data, vbi.p, 42); in compress_sliced_buf()
363 void ivtv_process_vbi_data(struct ivtv *itv, struct ivtv_buffer *buf, in ivtv_process_vbi_data() argument
371 if (streamtype == IVTV_ENC_STREAM_TYPE_VBI && ivtv_raw_vbi(itv)) { in ivtv_process_vbi_data()
378 size = buf->bytesused = compress_raw_buf(itv, p, size); in ivtv_process_vbi_data()
381 if (type == itv->vbi.raw_decoder_sav_even_field) { in ivtv_process_vbi_data()
385 memcpy(p, &itv->vbi.frame, 4); in ivtv_process_vbi_data()
386 itv->vbi.frame++; in ivtv_process_vbi_data()
398 lines = compress_sliced_buf(itv, 0, p, size / 2, in ivtv_process_vbi_data()
399 itv->vbi.sliced_decoder_sav_odd_field); in ivtv_process_vbi_data()
403 lines = compress_sliced_buf(itv, lines, p + size / 2 - 32, size / 2 + 32, in ivtv_process_vbi_data()
404 itv->vbi.sliced_decoder_sav_even_field); in ivtv_process_vbi_data()
407 itv->vbi.sliced_data[0].id = 0; in ivtv_process_vbi_data()
408 itv->vbi.sliced_data[0].line = 0; in ivtv_process_vbi_data()
409 itv->vbi.sliced_data[0].field = 0; in ivtv_process_vbi_data()
412 buf->bytesused = size = lines * sizeof(itv->vbi.sliced_data[0]); in ivtv_process_vbi_data()
413 memcpy(p, &itv->vbi.sliced_data[0], size); in ivtv_process_vbi_data()
415 if (itv->vbi.insert_mpeg) { in ivtv_process_vbi_data()
416 copy_vbi_data(itv, lines, pts_stamp); in ivtv_process_vbi_data()
418 itv->vbi.frame++; in ivtv_process_vbi_data()
442 cnt = ivtv_convert_ivtv_vbi(itv, p + offset); in ivtv_process_vbi_data()
443 memcpy(buf->buf, itv->vbi.sliced_dec_data, cnt); in ivtv_process_vbi_data()
446 ivtv_write_vbi(itv, itv->vbi.sliced_dec_data, in ivtv_process_vbi_data()
447 cnt / sizeof(itv->vbi.sliced_dec_data[0])); in ivtv_process_vbi_data()
452 void ivtv_disable_cc(struct ivtv *itv) in ivtv_disable_cc() argument
456 clear_bit(IVTV_F_I_UPDATE_CC, &itv->i_flags); in ivtv_disable_cc()
457 ivtv_set_cc(itv, 0, &cc); in ivtv_disable_cc()
458 itv->vbi.cc_payload_idx = 0; in ivtv_disable_cc()
462 void ivtv_vbi_work_handler(struct ivtv *itv) in ivtv_vbi_work_handler() argument
464 struct vbi_info *vi = &itv->vbi; in ivtv_vbi_work_handler()
469 if (itv->output_mode == OUT_PASSTHROUGH) { in ivtv_vbi_work_handler()
470 if (itv->is_50hz) { in ivtv_vbi_work_handler()
474 if (v4l2_subdev_call(itv->sd_video, vbi, g_vbi_data, &data) == 0) { in ivtv_vbi_work_handler()
475 ivtv_set_wss(itv, 1, data.data[0] & 0xf); in ivtv_vbi_work_handler()
478 ivtv_set_wss(itv, 1, 0x8); /* 4x3 full format */ in ivtv_vbi_work_handler()
488 if (v4l2_subdev_call(itv->sd_video, vbi, g_vbi_data, &data) == 0) { in ivtv_vbi_work_handler()
494 if (v4l2_subdev_call(itv->sd_video, vbi, g_vbi_data, &data) == 0) { in ivtv_vbi_work_handler()
501 ivtv_set_cc(itv, mode, &cc); in ivtv_vbi_work_handler()
503 ivtv_set_cc(itv, 0, &cc); in ivtv_vbi_work_handler()
511 if (test_and_clear_bit(IVTV_F_I_UPDATE_WSS, &itv->i_flags)) { in ivtv_vbi_work_handler()
512 ivtv_set_wss(itv, 1, vi->wss_payload & 0xf); in ivtv_vbi_work_handler()
515 if (test_bit(IVTV_F_I_UPDATE_CC, &itv->i_flags)) { in ivtv_vbi_work_handler()
517 clear_bit(IVTV_F_I_UPDATE_CC, &itv->i_flags); in ivtv_vbi_work_handler()
518 ivtv_set_cc(itv, 3, &cc); in ivtv_vbi_work_handler()
529 ivtv_set_cc(itv, 3, &cc); in ivtv_vbi_work_handler()
534 if (test_and_clear_bit(IVTV_F_I_UPDATE_VPS, &itv->i_flags)) { in ivtv_vbi_work_handler()
535 ivtv_set_vps(itv, 1); in ivtv_vbi_work_handler()