Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Vidtv serves as a reference DVB driver and helps validate the existing APIs
0004  * in the media subsystem. It can also aid developers working on userspace
0005  * applications.
0006  *
0007  * This file contains the code for a 'channel' abstraction.
0008  *
0009  * When vidtv boots, it will create some hardcoded channels.
0010  * Their services will be concatenated to populate the SDT.
0011  * Their programs will be concatenated to populate the PAT
0012  * Their events will be concatenated to populate the EIT
0013  * For each program in the PAT, a PMT section will be created
0014  * The PMT section for a channel will be assigned its streams.
0015  * Every stream will have its corresponding encoder polled to produce TS packets
0016  * These packets may be interleaved by the mux and then delivered to the bridge
0017  *
0018  *
0019  * Copyright (C) 2020 Daniel W. S. Almeida
0020  */
0021 
0022 #ifndef VIDTV_CHANNEL_H
0023 #define VIDTV_CHANNEL_H
0024 
0025 #include <linux/types.h>
0026 
0027 #include "vidtv_encoder.h"
0028 #include "vidtv_mux.h"
0029 #include "vidtv_psi.h"
0030 
0031 /**
0032  * struct vidtv_channel - A 'channel' abstraction
0033  *
0034  * When vidtv boots, it will create some hardcoded channels.
0035  * Their services will be concatenated to populate the SDT.
0036  * Their programs will be concatenated to populate the PAT
0037  * For each program in the PAT, a PMT section will be created
0038  * The PMT section for a channel will be assigned its streams.
0039  * Every stream will have its corresponding encoder polled to produce TS packets
0040  * These packets may be interleaved by the mux and then delivered to the bridge
0041  *
0042  * @name: name of the channel
0043  * @transport_stream_id: a number to identify the TS, chosen at will.
0044  * @service: A _single_ service. Will be concatenated into the SDT.
0045  * @program_num: The link between PAT, PMT and SDT.
0046  * @program: A _single_ program with one or more streams associated with it.
0047  * Will be concatenated into the PAT.
0048  * @streams: A stream loop used to populate the PMT section for 'program'
0049  * @encoders: A encoder loop. There must be one encoder for each stream.
0050  * @events: Optional event information. This will feed into the EIT.
0051  * @next: Optionally chain this channel.
0052  */
0053 struct vidtv_channel {
0054     char *name;
0055     u16 transport_stream_id;
0056     struct vidtv_psi_table_sdt_service *service;
0057     u16 program_num;
0058     struct vidtv_psi_table_pat_program *program;
0059     struct vidtv_psi_table_pmt_stream *streams;
0060     struct vidtv_encoder *encoders;
0061     struct vidtv_psi_table_eit_event *events;
0062     struct vidtv_channel *next;
0063 };
0064 
0065 /**
0066  * vidtv_channel_si_init - Init the PSI tables from the channels in the mux
0067  * @m: The mux containing the channels.
0068  */
0069 int vidtv_channel_si_init(struct vidtv_mux *m);
0070 void vidtv_channel_si_destroy(struct vidtv_mux *m);
0071 
0072 /**
0073  * vidtv_channels_init - Init hardcoded, fake 'channels'.
0074  * @m: The mux to store the channels into.
0075  */
0076 int vidtv_channels_init(struct vidtv_mux *m);
0077 struct vidtv_channel
0078 *vidtv_channel_s302m_init(struct vidtv_channel *head, u16 transport_stream_id);
0079 void vidtv_channels_destroy(struct vidtv_mux *m);
0080 
0081 #endif //VIDTV_CHANNEL_H