Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / media / test-drivers / vidtv / vidtv_channel.h
blobfff2e501d375d2b9caf2335e87e7bb734a27e818
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Vidtv serves as a reference DVB driver and helps validate the existing APIs
4 * in the media subsystem. It can also aid developers working on userspace
5 * applications.
7 * This file contains the code for a 'channel' abstraction.
9 * When vidtv boots, it will create some hardcoded channels.
10 * Their services will be concatenated to populate the SDT.
11 * Their programs will be concatenated to populate the PAT
12 * Their events will be concatenated to populate the EIT
13 * For each program in the PAT, a PMT section will be created
14 * The PMT section for a channel will be assigned its streams.
15 * Every stream will have its corresponding encoder polled to produce TS packets
16 * These packets may be interleaved by the mux and then delivered to the bridge
19 * Copyright (C) 2020 Daniel W. S. Almeida
22 #ifndef VIDTV_CHANNEL_H
23 #define VIDTV_CHANNEL_H
25 #include <linux/types.h>
27 #include "vidtv_encoder.h"
28 #include "vidtv_mux.h"
29 #include "vidtv_psi.h"
31 /**
32 * struct vidtv_channel - A 'channel' abstraction
34 * When vidtv boots, it will create some hardcoded channels.
35 * Their services will be concatenated to populate the SDT.
36 * Their programs will be concatenated to populate the PAT
37 * For each program in the PAT, a PMT section will be created
38 * The PMT section for a channel will be assigned its streams.
39 * Every stream will have its corresponding encoder polled to produce TS packets
40 * These packets may be interleaved by the mux and then delivered to the bridge
42 * @name: name of the channel
43 * @transport_stream_id: a number to identify the TS, chosen at will.
44 * @service: A _single_ service. Will be concatenated into the SDT.
45 * @program_num: The link between PAT, PMT and SDT.
46 * @program: A _single_ program with one or more streams associated with it.
47 * Will be concatenated into the PAT.
48 * @streams: A stream loop used to populate the PMT section for 'program'
49 * @encoders: A encoder loop. There must be one encoder for each stream.
50 * @events: Optional event information. This will feed into the EIT.
51 * @next: Optionally chain this channel.
53 struct vidtv_channel {
54 char *name;
55 u16 transport_stream_id;
56 struct vidtv_psi_table_sdt_service *service;
57 u16 program_num;
58 struct vidtv_psi_table_pat_program *program;
59 struct vidtv_psi_table_pmt_stream *streams;
60 struct vidtv_encoder *encoders;
61 struct vidtv_psi_table_eit_event *events;
62 struct vidtv_channel *next;
65 /**
66 * vidtv_channel_si_init - Init the PSI tables from the channels in the mux
67 * @m: The mux containing the channels.
69 int vidtv_channel_si_init(struct vidtv_mux *m);
70 void vidtv_channel_si_destroy(struct vidtv_mux *m);
72 /**
73 * vidtv_channels_init - Init hardcoded, fake 'channels'.
74 * @m: The mux to store the channels into.
76 int vidtv_channels_init(struct vidtv_mux *m);
77 struct vidtv_channel
78 *vidtv_channel_s302m_init(struct vidtv_channel *head, u16 transport_stream_id);
79 void vidtv_channels_destroy(struct vidtv_mux *m);
81 #endif //VIDTV_CHANNEL_H