linux/drivers/media/test-drivers/vidtv/vidtv_psi.c

// SPDX-License-Identifier: GPL-2.0
/*
 * This file contains the logic to work with MPEG Program-Specific Information.
 * These are defined both in ISO/IEC 13818-1 (systems) and ETSI EN 300 468.
 * PSI is carried in the form of table structures, and although each table might
 * technically be broken into one or more sections, we do not do this here,
 * hence 'table' and 'section' are interchangeable for vidtv.
 *
 * Copyright (C) 2020 Daniel W. S. Almeida
 */

#define pr_fmt(fmt)

#include <linux/bcd.h>
#include <linux/crc32.h>
#include <linux/kernel.h>
#include <linux/ktime.h>
#include <linux/printk.h>
#include <linux/ratelimit.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/time.h>
#include <linux/types.h>

#include "vidtv_common.h"
#include "vidtv_psi.h"
#include "vidtv_ts.h"

#define CRC_SIZE_IN_BYTES
#define MAX_VERSION_NUM
#define INITIAL_CRC
#define ISO_LANGUAGE_CODE_LEN

static const u32 CRC_LUT[256] =;

static u32 dvb_crc32(u32 crc, u8 *data, u32 len)
{}

static void vidtv_psi_update_version_num(struct vidtv_psi_table_header *h)
{}

static u16 vidtv_psi_get_sec_len(struct vidtv_psi_table_header *h)
{}

u16 vidtv_psi_get_pat_program_pid(struct vidtv_psi_table_pat_program *p)
{}

u16 vidtv_psi_pmt_stream_get_elem_pid(struct vidtv_psi_table_pmt_stream *s)
{}

static void vidtv_psi_set_desc_loop_len(__be16 *bitfield, u16 new_len,
					u8 desc_len_nbits)
{}

static void vidtv_psi_set_sec_len(struct vidtv_psi_table_header *h, u16 new_len)
{}

/*
 * Packetize PSI sections into TS packets:
 * push a TS header (4bytes) every 184 bytes
 * manage the continuity_counter
 * add stuffing (i.e. padding bytes) after the CRC
 */
static u32 vidtv_psi_ts_psi_write_into(struct psi_write_args *args)
{}

static u32 table_section_crc32_write_into(struct crc32_write_args *args)
{}

static void vidtv_psi_desc_chain(struct vidtv_psi_desc *head, struct vidtv_psi_desc *desc)
{}

struct vidtv_psi_desc_service *vidtv_psi_service_desc_init(struct vidtv_psi_desc *head,
							   enum service_type service_type,
							   char *service_name,
							   char *provider_name)
{}

struct vidtv_psi_desc_registration
*vidtv_psi_registration_desc_init(struct vidtv_psi_desc *head,
				  __be32 format_id,
				  u8 *additional_ident_info,
				  u32 additional_info_len)
{}

struct vidtv_psi_desc_network_name
*vidtv_psi_network_name_desc_init(struct vidtv_psi_desc *head, char *network_name)
{}

struct vidtv_psi_desc_service_list
*vidtv_psi_service_list_desc_init(struct vidtv_psi_desc *head,
				  struct vidtv_psi_desc_service_list_entry *entry)
{}

struct vidtv_psi_desc_short_event
*vidtv_psi_short_event_desc_init(struct vidtv_psi_desc *head,
				 char *iso_language_code,
				 char *event_name,
				 char *text)
{}

struct vidtv_psi_desc *vidtv_psi_desc_clone(struct vidtv_psi_desc *desc)
{}

void vidtv_psi_desc_destroy(struct vidtv_psi_desc *desc)
{}

static u16
vidtv_psi_desc_comp_loop_len(struct vidtv_psi_desc *desc)
{}

void vidtv_psi_desc_assign(struct vidtv_psi_desc **to,
			   struct vidtv_psi_desc *desc)
{}

void vidtv_pmt_desc_assign(struct vidtv_psi_table_pmt *pmt,
			   struct vidtv_psi_desc **to,
			   struct vidtv_psi_desc *desc)
{}

void vidtv_sdt_desc_assign(struct vidtv_psi_table_sdt *sdt,
			   struct vidtv_psi_desc **to,
			   struct vidtv_psi_desc *desc)
{}

static u32 vidtv_psi_desc_write_into(struct desc_write_args *args)
{}

static u32
vidtv_psi_table_header_write_into(struct header_write_args *args)
{}

void
vidtv_psi_pat_table_update_sec_len(struct vidtv_psi_table_pat *pat)
{}

void vidtv_psi_pmt_table_update_sec_len(struct vidtv_psi_table_pmt *pmt)
{}

void vidtv_psi_sdt_table_update_sec_len(struct vidtv_psi_table_sdt *sdt)
{}

struct vidtv_psi_table_pat_program*
vidtv_psi_pat_program_init(struct vidtv_psi_table_pat_program *head,
			   u16 service_id,
			   u16 program_map_pid)
{}

void
vidtv_psi_pat_program_destroy(struct vidtv_psi_table_pat_program *p)
{}

/* This function transfers ownership of p to the table */
void
vidtv_psi_pat_program_assign(struct vidtv_psi_table_pat *pat,
			     struct vidtv_psi_table_pat_program *p)
{}

struct vidtv_psi_table_pat *vidtv_psi_pat_table_init(u16 transport_stream_id)
{}

u32 vidtv_psi_pat_write_into(struct vidtv_psi_pat_write_args *args)
{}

void
vidtv_psi_pat_table_destroy(struct vidtv_psi_table_pat *p)
{}

struct vidtv_psi_table_pmt_stream*
vidtv_psi_pmt_stream_init(struct vidtv_psi_table_pmt_stream *head,
			  enum vidtv_psi_stream_types stream_type,
			  u16 es_pid)
{}

void vidtv_psi_pmt_stream_destroy(struct vidtv_psi_table_pmt_stream *s)
{}

void vidtv_psi_pmt_stream_assign(struct vidtv_psi_table_pmt *pmt,
				 struct vidtv_psi_table_pmt_stream *s)
{}

u16 vidtv_psi_pmt_get_pid(struct vidtv_psi_table_pmt *section,
			  struct vidtv_psi_table_pat *pat)
{}

struct vidtv_psi_table_pmt *vidtv_psi_pmt_table_init(u16 program_number,
						     u16 pcr_pid)
{}

u32 vidtv_psi_pmt_write_into(struct vidtv_psi_pmt_write_args *args)
{}

void vidtv_psi_pmt_table_destroy(struct vidtv_psi_table_pmt *pmt)
{}

struct vidtv_psi_table_sdt *vidtv_psi_sdt_table_init(u16 network_id,
						     u16 transport_stream_id)
{}

u32 vidtv_psi_sdt_write_into(struct vidtv_psi_sdt_write_args *args)
{}

void vidtv_psi_sdt_table_destroy(struct vidtv_psi_table_sdt *sdt)
{}

struct vidtv_psi_table_sdt_service
*vidtv_psi_sdt_service_init(struct vidtv_psi_table_sdt_service *head,
			    u16 service_id,
			    bool eit_schedule,
			    bool eit_present_following)
{}

void
vidtv_psi_sdt_service_destroy(struct vidtv_psi_table_sdt_service *service)
{}

void
vidtv_psi_sdt_service_assign(struct vidtv_psi_table_sdt *sdt,
			     struct vidtv_psi_table_sdt_service *service)
{}

/*
 * PMTs contain information about programs. For each program,
 * there is one PMT section. This function will create a section
 * for each program found in the PAT
 */
struct vidtv_psi_table_pmt**
vidtv_psi_pmt_create_sec_for_each_pat_entry(struct vidtv_psi_table_pat *pat,
					    u16 pcr_pid)

{}

/* find the PMT section associated with 'program_num' */
struct vidtv_psi_table_pmt
*vidtv_psi_find_pmt_sec(struct vidtv_psi_table_pmt **pmt_sections,
			u16 nsections,
			u16 program_num)
{}

static void vidtv_psi_nit_table_update_sec_len(struct vidtv_psi_table_nit *nit)
{}

struct vidtv_psi_table_nit
*vidtv_psi_nit_table_init(u16 network_id,
			  u16 transport_stream_id,
			  char *network_name,
			  struct vidtv_psi_desc_service_list_entry *service_list)
{}

u32 vidtv_psi_nit_write_into(struct vidtv_psi_nit_write_args *args)
{}

static void vidtv_psi_transport_destroy(struct vidtv_psi_table_transport *t)
{}

void vidtv_psi_nit_table_destroy(struct vidtv_psi_table_nit *nit)
{}

void vidtv_psi_eit_table_update_sec_len(struct vidtv_psi_table_eit *eit)
{}

void vidtv_psi_eit_event_assign(struct vidtv_psi_table_eit *eit,
				struct vidtv_psi_table_eit_event *e)
{}

struct vidtv_psi_table_eit
*vidtv_psi_eit_table_init(u16 network_id,
			  u16 transport_stream_id,
			  __be16 service_id)
{}

u32 vidtv_psi_eit_write_into(struct vidtv_psi_eit_write_args *args)
{}

struct vidtv_psi_table_eit_event
*vidtv_psi_eit_event_init(struct vidtv_psi_table_eit_event *head, u16 event_id)
{}

void vidtv_psi_eit_event_destroy(struct vidtv_psi_table_eit_event *e)
{}

void vidtv_psi_eit_table_destroy(struct vidtv_psi_table_eit *eit)
{}