cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

vidtv_s302m.h (2648B)


      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.
      6 *
      7 * This file contains the code for an AES3 (also known as AES/EBU) encoder.
      8 * It is based on EBU Tech 3250 and SMPTE 302M technical documents.
      9 *
     10 * This encoder currently supports 16bit AES3 subframes using 16bit signed
     11 * integers.
     12 *
     13 * Note: AU stands for Access Unit, and AAU stands for Audio Access Unit
     14 *
     15 * Copyright (C) 2020 Daniel W. S. Almeida
     16 */
     17
     18#ifndef VIDTV_S302M_H
     19#define VIDTV_S302M_H
     20
     21#include <linux/types.h>
     22
     23#include "vidtv_encoder.h"
     24
     25/* see SMPTE 302M 2007 clause 7.3 */
     26#define VIDTV_S302M_BUF_SZ 65024
     27
     28/* see ETSI TS 102 154 v.1.2.1 clause 7.3.5 */
     29#define VIDTV_S302M_FORMAT_IDENTIFIER 0x42535344
     30
     31/**
     32 * struct vidtv_s302m_ctx - s302m encoder context.
     33 * @enc: A pointer to the containing encoder structure.
     34 * @frame_index: The current frame in a block
     35 * @au_count: The total number of access units encoded up to now
     36 * @last_duration: Duration of the tone currently being played
     37 * @note_offset: Position at the music tone array
     38 * @last_tone: Tone currently being played
     39 */
     40struct vidtv_s302m_ctx {
     41	struct vidtv_encoder *enc;
     42	u32 frame_index;
     43	u32 au_count;
     44	int last_duration;
     45	unsigned int note_offset;
     46	enum musical_notes last_tone;
     47};
     48
     49/*
     50 * struct vidtv_smpte_s302m_es - s302m MPEG Elementary Stream header.
     51 *
     52 * See SMPTE 302M 2007 table 1.
     53 */
     54struct vidtv_smpte_s302m_es {
     55	/*
     56	 *
     57	 * audio_packet_size:16;
     58	 * num_channels:2;
     59	 * channel_identification:8;
     60	 * bits_per_sample:2; // 0x0 for 16bits
     61	 * zero:4;
     62	 */
     63	__be32 bitfield;
     64} __packed;
     65
     66struct vidtv_s302m_frame_16 {
     67	u8 data[5];
     68} __packed;
     69
     70/**
     71 * struct vidtv_s302m_encoder_init_args - Args for the s302m encoder.
     72 *
     73 * @name: A name to identify this particular instance
     74 * @src_buf: The source buffer, encoder will default to a sine wave if this is NULL.
     75 * @src_buf_sz: The size of the source buffer.
     76 * @es_pid: The MPEG Elementary Stream PID to use.
     77 * @sync: Attempt to synchronize audio with this video encoder, if not NULL.
     78 * @last_sample_cb: A callback called when the encoder runs out of data.
     79 * @head: Add to this chain
     80 */
     81struct vidtv_s302m_encoder_init_args {
     82	char *name;
     83	void *src_buf;
     84	u32 src_buf_sz;
     85	u16 es_pid;
     86	struct vidtv_encoder *sync;
     87	void (*last_sample_cb)(u32 sample_no);
     88
     89	struct vidtv_encoder *head;
     90};
     91
     92struct vidtv_encoder
     93*vidtv_s302m_encoder_init(struct vidtv_s302m_encoder_init_args args);
     94
     95void vidtv_s302m_encoder_destroy(struct vidtv_encoder *encoder);
     96
     97#endif /* VIDTV_S302M_H */