![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 /* 0003 * The Virtual DVB test driver serves as a reference DVB driver and helps 0004 * validate the existing APIs in the media subsystem. It can also aid 0005 * developers working on userspace applications. 0006 * 0007 * Copyright (C) 2020 Daniel W. S. Almeida 0008 */ 0009 0010 #ifndef VIDTV_TS_H 0011 #define VIDTV_TS_H 0012 0013 #include <linux/types.h> 0014 0015 #define TS_SYNC_BYTE 0x47 0016 #define TS_PACKET_LEN 188 0017 #define TS_PAYLOAD_LEN 184 0018 #define TS_NULL_PACKET_PID 0x1fff 0019 #define TS_CC_MAX_VAL 0x0f /* 4 bits */ 0020 #define TS_LAST_VALID_PID 8191 0021 #define TS_FILL_BYTE 0xff /* the byte used in packet stuffing */ 0022 0023 struct vidtv_mpeg_ts_adaption { 0024 u8 length; 0025 struct { 0026 u8 extension:1; 0027 u8 private_data:1; 0028 u8 splicing_point:1; 0029 u8 OPCR:1; 0030 u8 PCR:1; 0031 u8 priority:1; 0032 u8 random_access:1; 0033 u8 discontinued:1; 0034 } __packed; 0035 u8 data[]; 0036 } __packed; 0037 0038 struct vidtv_mpeg_ts { 0039 u8 sync_byte; 0040 __be16 bitfield; /* tei: 1, payload_start:1 priority: 1, pid:13 */ 0041 struct { 0042 u8 continuity_counter:4; 0043 u8 payload:1; 0044 u8 adaptation_field:1; 0045 u8 scrambling:2; 0046 } __packed; 0047 } __packed; 0048 0049 /** 0050 * struct pcr_write_args - Arguments for the pcr_write_into function. 0051 * @dest_buf: The buffer to write into. 0052 * @dest_offset: The byte offset into the buffer. 0053 * @pid: The TS PID for the PCR packets. 0054 * @buf_sz: The size of the buffer in bytes. 0055 * @continuity_counter: The TS continuity_counter. 0056 * @pcr: A sample from the system clock. 0057 */ 0058 struct pcr_write_args { 0059 void *dest_buf; 0060 u32 dest_offset; 0061 u16 pid; 0062 u32 buf_sz; 0063 u8 *continuity_counter; 0064 u64 pcr; 0065 }; 0066 0067 /** 0068 * struct null_packet_write_args - Arguments for the null_write_into function 0069 * @dest_buf: The buffer to write into. 0070 * @dest_offset: The byte offset into the buffer. 0071 * @buf_sz: The size of the buffer in bytes. 0072 * @continuity_counter: The TS continuity_counter. 0073 */ 0074 struct null_packet_write_args { 0075 void *dest_buf; 0076 u32 dest_offset; 0077 u32 buf_sz; 0078 u8 *continuity_counter; 0079 }; 0080 0081 /* Increment the continuity counter */ 0082 void vidtv_ts_inc_cc(u8 *continuity_counter); 0083 0084 /** 0085 * vidtv_ts_null_write_into - Write a TS null packet into a buffer. 0086 * @args: the arguments to use when writing. 0087 * 0088 * This function will write a null packet into a buffer. This is usually used to 0089 * pad TS streams. 0090 * 0091 * Return: The number of bytes written into the buffer. 0092 */ 0093 u32 vidtv_ts_null_write_into(struct null_packet_write_args args); 0094 0095 /** 0096 * vidtv_ts_pcr_write_into - Write a PCR packet into a buffer. 0097 * @args: the arguments to use when writing. 0098 * 0099 * This function will write a PCR packet into a buffer. This is used to 0100 * synchronize the clocks between encoders and decoders. 0101 * 0102 * Return: The number of bytes written into the buffer. 0103 */ 0104 u32 vidtv_ts_pcr_write_into(struct pcr_write_args args); 0105 0106 #endif //VIDTV_TS_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |