76 #define IVTV_V4L2_DEC_MPG_OFFSET 16
77 #define IVTV_V4L2_ENC_PCM_OFFSET 24
78 #define IVTV_V4L2_ENC_YUV_OFFSET 32
79 #define IVTV_V4L2_DEC_YUV_OFFSET 48
80 #define IVTV_V4L2_DEC_VBI_OFFSET 8
81 #define IVTV_V4L2_DEC_VOUT_OFFSET 16
90 } ivtv_stream_info[] = {
127 &ivtv_v4l2_radio_fops
159 static void ivtv_stream_init(
struct ivtv *itv,
int type)
171 s->
name = ivtv_stream_info[
type].name;
172 s->
caps = ivtv_stream_info[
type].v4l2_caps;
174 if (ivtv_stream_info[type].
pio)
177 s->
dma = ivtv_stream_info[
type].dma;
191 static int ivtv_prep_dev(
struct ivtv *itv,
int type)
203 s->
name = ivtv_stream_info[
type].name;
214 itv->
options.kilobytes[type] == 0) {
215 IVTV_INFO(
"Disabled %s device\n", ivtv_stream_info[type].
name);
219 ivtv_stream_init(itv, type);
224 IVTV_ERR(
"Couldn't allocate v4l2 video_device for %s\n", s->
name);
236 s->
vdev->fops = ivtv_stream_info[
type].fops;
267 if (ivtv_prep_dev(itv, type))
277 if (type == IVTV_MAX_STREAMS)
285 static int ivtv_reg_dev(
struct ivtv *itv,
int type)
301 num = s_mpg->
vdev->num + ivtv_stream_info[
type].num_offset;
303 video_set_drvdata(s->
vdev, s);
306 if (video_register_device_no_warn(s->
vdev, vfl_type, num)) {
307 IVTV_ERR(
"Couldn't register v4l2 device for %s (device node number %d)\n",
313 name = video_device_node_name(s->
vdev);
317 IVTV_INFO(
"Registered device %s for %s (%d kB)\n",
321 IVTV_INFO(
"Registered device %s for %s\n",
325 if (itv->
options.kilobytes[type])
326 IVTV_INFO(
"Registered device %s for %s (%d kB)\n",
329 IVTV_INFO(
"Registered device %s for %s\n",
344 err |= ivtv_reg_dev(itv, type);
376 static void ivtv_vbi_setup(
struct ivtv *itv)
378 int raw = ivtv_raw_vbi(itv);
398 lines = itv->
vbi.count * 2;
400 lines = itv->
is_60hz ? 24 : 38;
405 itv->
vbi.enc_size = lines * (raw ? itv->
vbi.raw_size : itv->
vbi.sliced_size);
409 data[0] = raw | 0x02 | (0xbd << 8);
414 data[2] = raw ? 4 : 4 * (itv->
vbi.raw_size / itv->
vbi.enc_size);
425 data[3] = 0x20602060;
426 data[4] = 0x30703070;
428 data[3] = 0xB0F0B0F0;
429 data[4] = 0xA0E0A0E0;
434 data[6] = (raw ? itv->
vbi.raw_size : itv->
vbi.sliced_size);
438 data[3] = 0x25256262;
439 data[4] = 0x387F7F7F;
441 data[3] = 0xABABECEC;
442 data[4] = 0xB6F1F1F1;
447 data[6] = itv->
vbi.enc_size / lines;
451 "Setup VBI API header 0x%08x pkts %d buffs %d ln %d sz %d\n",
452 data[0], data[1], data[2], data[5], data[6]);
457 itv->
vbi.enc_start = data[2];
458 itv->
vbi.fpi = data[0];
463 itv->
vbi.enc_start, data[1], itv->
vbi.fpi);
467 for (i = 2; i <= 24; i++) {
471 valid = i >= 10 && i < 22;
473 valid = i >= 6 && i < 24;
494 int enable_passthrough = 0;
509 enable_passthrough = 1;
535 itv->
vbi.inserted_frame = 0;
537 0,
sizeof(itv->
vbi.sliced_mpeg_size));
574 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
642 if (enable_passthrough) {
657 static int ivtv_setup_v4l2_decode_stream(
struct ivtv_stream *s)
670 width = itv->
cxhdl.width;
671 height = itv->
cxhdl.height;
684 itv->
vbi.dec_start = data[0];
687 itv->
vbi.dec_start, data[1]);
711 width, height, itv->
cxhdl.audio_properties)) {
735 rc = ivtv_setup_v4l2_decode_stream(s);
861 duration = ((1000 +
HZ / 2) /
HZ) * (
jiffies - then);
930 IVTV_DEBUG_INFO(
"Stop Decode at %llu, flags: %x\n", (
unsigned long long)pts, flags);
939 0, (
u32)(pts & 0xffffffff), (
u32)(pts >> 32));
1005 ivtv_setup_v4l2_decode_stream(dec_stream);