linux/drivers/media/test-drivers/vidtv/vidtv_ts.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * The Virtual DVB test driver serves as a reference DVB driver and helps
 * validate the existing APIs in the media subsystem. It can also aid
 * developers working on userspace applications.
 *
 * Copyright (C) 2020 Daniel W. S. Almeida
 */

#ifndef VIDTV_TS_H
#define VIDTV_TS_H

#include <linux/types.h>

#define TS_SYNC_BYTE
#define TS_PACKET_LEN
#define TS_PAYLOAD_LEN
#define TS_NULL_PACKET_PID
#define TS_CC_MAX_VAL
#define TS_LAST_VALID_PID
#define TS_FILL_BYTE

struct vidtv_mpeg_ts_adaption {} __packed;

struct vidtv_mpeg_ts {} __packed;

/**
 * struct pcr_write_args - Arguments for the pcr_write_into function.
 * @dest_buf: The buffer to write into.
 * @dest_offset: The byte offset into the buffer.
 * @pid: The TS PID for the PCR packets.
 * @buf_sz: The size of the buffer in bytes.
 * @continuity_counter: The TS continuity_counter.
 * @pcr: A sample from the system clock.
 */
struct pcr_write_args {};

/**
 * struct null_packet_write_args - Arguments for the null_write_into function
 * @dest_buf: The buffer to write into.
 * @dest_offset: The byte offset into the buffer.
 * @buf_sz: The size of the buffer in bytes.
 * @continuity_counter: The TS continuity_counter.
 */
struct null_packet_write_args {};

/* Increment the continuity counter */
void vidtv_ts_inc_cc(u8 *continuity_counter);

/**
 * vidtv_ts_null_write_into - Write a TS null packet into a buffer.
 * @args: the arguments to use when writing.
 *
 * This function will write a null packet into a buffer. This is usually used to
 * pad TS streams.
 *
 * Return: The number of bytes written into the buffer.
 */
u32 vidtv_ts_null_write_into(struct null_packet_write_args args);

/**
 * vidtv_ts_pcr_write_into - Write a PCR  packet into a buffer.
 * @args: the arguments to use when writing.
 *
 * This function will write a PCR packet into a buffer. This is used to
 * synchronize the clocks between encoders and decoders.
 *
 * Return: The number of bytes written into the buffer.
 */
u32 vidtv_ts_pcr_write_into(struct pcr_write_args args);

#endif //VIDTV_TS_H