drivers/media/pci/ivtv/ivtv-streams.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/ivtv/ivtv-streams.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/ivtv/ivtv-streams.c- Extension
.c- Size
- 30116 bytes
- Lines
- 1027
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
ivtv-driver.hivtv-fileops.hivtv-queue.hivtv-mailbox.hivtv-ioctl.hivtv-irq.hivtv-yuv.hivtv-cards.hivtv-streams.hivtv-firmware.hmedia/v4l2-event.h
Detected Declarations
function ivtv_stream_initfunction ivtv_prep_devfunction ivtv_streams_setupfunction ivtv_reg_devfunction ivtv_streams_registerfunction ivtv_streams_cleanupfunction ivtv_vbi_setupfunction ivtv_start_v4l2_encode_streamfunction ivtv_setup_v4l2_decode_streamfunction ivtv_start_v4l2_decode_streamfunction ivtv_stop_all_capturesfunction ivtv_stop_v4l2_encode_streamfunction ivtv_stop_v4l2_decode_streamfunction ivtv_passthrough_modeexport ivtv_start_v4l2_encode_streamexport ivtv_stop_v4l2_encode_stream
Annotated Snippet
if (raw) {
data[3] = 0x20602060;
data[4] = 0x30703070;
} else {
data[3] = 0xB0F0B0F0;
data[4] = 0xA0E0A0E0;
}
/* Lines per frame */
data[5] = lines;
/* bytes per line */
data[6] = (raw ? itv->vbi.raw_size : itv->vbi.sliced_size);
} else {
/* Setup VBI for the saa7115 digitizer */
if (raw) {
data[3] = 0x25256262;
data[4] = 0x387F7F7F;
} else {
data[3] = 0xABABECEC;
data[4] = 0xB6F1F1F1;
}
/* Lines per frame */
data[5] = lines;
/* bytes per line */
data[6] = itv->vbi.enc_size / lines;
}
IVTV_DEBUG_INFO(
"Setup VBI API header 0x%08x pkts %d buffs %d ln %d sz %d\n",
data[0], data[1], data[2], data[5], data[6]);
ivtv_api(itv, CX2341X_ENC_SET_VBI_CONFIG, 7, data);
/* returns the VBI encoder memory area. */
itv->vbi.enc_start = data[2];
itv->vbi.fpi = data[0];
if (!itv->vbi.fpi)
itv->vbi.fpi = 1;
IVTV_DEBUG_INFO("Setup VBI start 0x%08x frames %d fpi %d\n",
itv->vbi.enc_start, data[1], itv->vbi.fpi);
/* select VBI lines.
Note that the sliced argument seems to have no effect. */
for (i = 2; i <= 24; i++) {
int valid;
if (itv->is_60hz) {
valid = i >= 10 && i < 22;
} else {
valid = i >= 6 && i < 24;
}
ivtv_vapi(itv, CX2341X_ENC_SET_VBI_LINE, 5, i - 1,
valid, 0 , 0, 0);
ivtv_vapi(itv, CX2341X_ENC_SET_VBI_LINE, 5, (i - 1) | 0x80000000,
valid, 0, 0, 0);
}
/* Remaining VBI questions:
- Is it possible to select particular VBI lines only for inclusion in the MPEG
stream? Currently you can only get the first X lines.
- Is mixed raw and sliced VBI possible?
- What's the meaning of the raw/sliced flag?
- What's the meaning of params 2, 3 & 4 of the Select VBI command? */
}
int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s)
{
u32 data[CX2341X_MBOX_MAX_DATA];
struct ivtv *itv = s->itv;
int captype = 0, subtype = 0;
int enable_passthrough = 0;
if (s->vdev.v4l2_dev == NULL)
return -EINVAL;
IVTV_DEBUG_INFO("Start encoder stream %s\n", s->name);
switch (s->type) {
case IVTV_ENC_STREAM_TYPE_MPG:
captype = 0;
subtype = 3;
/* Stop Passthrough */
if (itv->output_mode == OUT_PASSTHROUGH) {
ivtv_passthrough_mode(itv, 0);
enable_passthrough = 1;
}
itv->mpg_data_received = itv->vbi_data_inserted = 0;
itv->dualwatch_jiffies = jiffies;
itv->dualwatch_stereo_mode = v4l2_ctrl_g_ctrl(itv->cxhdl.audio_mode);
Annotation
- Immediate include surface: `ivtv-driver.h`, `ivtv-fileops.h`, `ivtv-queue.h`, `ivtv-mailbox.h`, `ivtv-ioctl.h`, `ivtv-irq.h`, `ivtv-yuv.h`, `ivtv-cards.h`.
- Detected declarations: `function ivtv_stream_init`, `function ivtv_prep_dev`, `function ivtv_streams_setup`, `function ivtv_reg_dev`, `function ivtv_streams_register`, `function ivtv_streams_cleanup`, `function ivtv_vbi_setup`, `function ivtv_start_v4l2_encode_stream`, `function ivtv_setup_v4l2_decode_stream`, `function ivtv_start_v4l2_decode_stream`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.