You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
255 lines
6.4 KiB
Rust
255 lines
6.4 KiB
Rust
use ffmpeg_sys_next::{
|
|
AVClass, AVCodecParameters, AVFormatContext, AVIOContext, AVPacket, AVStream,
|
|
};
|
|
use std::fmt::{Debug, Error, Formatter};
|
|
use std::os::raw::{c_char, c_float, c_int, c_long, c_uint, c_void};
|
|
|
|
#[allow(non_camel_case_types)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
#[repr(i32)]
|
|
pub enum MOVEncryptionScheme {
|
|
MOV_ENC_NONE = 0,
|
|
MOV_ENC_CENC_AES_CTR,
|
|
}
|
|
|
|
#[allow(non_camel_case_types)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
#[repr(i32)]
|
|
pub enum MOVPrftBox {
|
|
MOV_PRFT_NONE = 0,
|
|
MOV_PRFT_SRC_WALLCLOCK,
|
|
MOV_PRFT_SRC_PTS,
|
|
MOV_PRFT_NB,
|
|
}
|
|
|
|
const MOV_SYNC_SAMPLE: u32 = 0x0001;
|
|
const MOV_PARTIAL_SYNC_SAMPLE: u32 = 0x0002;
|
|
const MOV_DISPOSABLE_SAMPLE: u32 = 0x0004;
|
|
|
|
#[derive(Debug, Clone)]
|
|
#[repr(C)]
|
|
pub struct AVProducerReferenceTime {
|
|
pub wallclock: i64,
|
|
pub flags: c_int,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
#[repr(C)]
|
|
pub struct MOVIentry {
|
|
pub pos: u64,
|
|
pub dts: i64,
|
|
pub pts: i64,
|
|
pub size: c_uint,
|
|
pub samples_in_chunk: c_uint,
|
|
///< Chunk number if the current entry is a chunk start otherwise 0
|
|
pub chunk_num: c_uint,
|
|
pub entries: c_uint,
|
|
pub cts: c_int,
|
|
pub flags: u32,
|
|
pub prft: AVProducerReferenceTime,
|
|
}
|
|
|
|
const MOV_TRACK_CTTS: u32 = 0x0001;
|
|
const MOV_TRACK_STPS: u32 = 0x0002;
|
|
const MOV_TRACK_ENABLED: u32 = 0x0004;
|
|
|
|
const MOV_TIMECODE_FLAG_DROPFRAME: u32 = 0x0001;
|
|
const MOV_TIMECODE_FLAG_24HOURSMAX: u32 = 0x0002;
|
|
const MOV_TIMECODE_FLAG_ALLOWNEGATIVE: u32 = 0x0004;
|
|
|
|
#[derive(Debug, Clone)]
|
|
#[repr(C)]
|
|
pub struct HintSample {
|
|
pub data: *mut u8,
|
|
pub size: c_int,
|
|
pub sample_number: c_int,
|
|
pub offset: c_int,
|
|
pub own_data: c_int,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
#[repr(C)]
|
|
pub struct HintSampleQueue {
|
|
pub size: c_int,
|
|
pub len: c_int,
|
|
pub samples: *mut HintSample,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
#[repr(C)]
|
|
pub struct MOVFragmentInfo {
|
|
pub offset: i64,
|
|
pub time: i64,
|
|
pub duration: i64,
|
|
pub tfrf_offset: i64,
|
|
pub size: c_int,
|
|
}
|
|
|
|
#[derive(Clone, Debug)]
|
|
#[repr(C)]
|
|
pub struct MOVMuxCencContext {
|
|
aes_ctr: *mut c_void,
|
|
pub auxiliary_info: *mut u8,
|
|
pub auxiliary_info_size: isize,
|
|
pub auxiliary_info_alloc_size: isize,
|
|
pub auxiliary_info_entries: u32,
|
|
|
|
/* subsample support */
|
|
pub use_subsamples: c_int,
|
|
pub subsample_count: i16,
|
|
pub auxiliary_info_subsample_start: isize,
|
|
pub auxiliary_info_sizes: *mut u8,
|
|
pub auxiliary_info_sizes_alloc_size: isize,
|
|
}
|
|
|
|
#[derive(Clone, Debug)]
|
|
#[repr(C)]
|
|
pub struct MOVTrack {
|
|
pub mode: c_int,
|
|
pub entry: c_int,
|
|
pub timescale: c_uint,
|
|
pub time: u64,
|
|
pub track_duration: i64,
|
|
pub last_sample_is_subtitle_end: c_int,
|
|
pub sample_count: c_long,
|
|
pub sample_size: c_long,
|
|
pub chunk_count: c_long,
|
|
pub has_keyframes: c_int,
|
|
pub has_disposable: c_int,
|
|
pub flags: u32,
|
|
pub timecode_flags: u32,
|
|
pub language: c_int,
|
|
pub track_id: c_int,
|
|
///< stsd fourcc
|
|
pub tag: c_int,
|
|
pub st: *mut AVStream,
|
|
pub par: *mut AVCodecParameters,
|
|
pub multichannel_as_mono: c_int,
|
|
|
|
pub vos_len: c_int,
|
|
pub vos_data: *mut u8,
|
|
pub cluster: *mut MOVIentry,
|
|
pub cluster_capacity: c_uint,
|
|
pub audio_vbr: c_int,
|
|
///< active picture (w/o VBI) height for D-10/IMX
|
|
pub height: c_int,
|
|
pub tref_tag: u32,
|
|
///< trackID of the referenced track
|
|
pub tref_id: c_int,
|
|
pub start_dts: i64,
|
|
pub start_cts: i64,
|
|
pub end_pts: i64,
|
|
pub end_reliable: c_int,
|
|
pub dts_shift: i64,
|
|
|
|
///< the track that hints this track, -1 if no hint track is set
|
|
pub hint_track: c_int,
|
|
///< the track that this hint (or tmcd) track describes
|
|
pub src_track: c_int,
|
|
///< the format context for the hinting rtp muxer
|
|
pub rtp_ctx: *mut AVFormatContext,
|
|
pub prev_rtp_ts: u32,
|
|
pub cur_rtp_ts_unwrapped: i64,
|
|
pub max_packet_size: u32,
|
|
|
|
pub default_duration: i64,
|
|
pub default_sample_flags: u32,
|
|
pub default_size: u32,
|
|
|
|
pub sample_queue: HintSampleQueue,
|
|
pub cover_image: AVPacket,
|
|
pub mdat_buf: *mut AVIOContext,
|
|
pub data_offset: i64,
|
|
pub frag_start: i64,
|
|
pub frag_discont: c_int,
|
|
pub entries_flushed: c_int,
|
|
|
|
pub nb_frag_info: c_int,
|
|
pub frag_info: *mut MOVFragmentInfo,
|
|
pub frag_info_capacity: c_uint,
|
|
|
|
pub vc1_info: VC1Info,
|
|
|
|
pub eac3_priv: *mut c_void,
|
|
pub cenc: MOVMuxCencContext,
|
|
pub palette: Palette,
|
|
pub pal_done: c_int,
|
|
|
|
pub is_unaligned_qt_rgb: c_int,
|
|
}
|
|
|
|
#[repr(C)]
|
|
#[derive(Clone)]
|
|
pub struct Palette([u32; 256]);
|
|
|
|
impl Debug for Palette {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
|
|
f.write_str("Palette")?;
|
|
f.debug_list().entries(&self.0[..]).finish()
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
#[repr(C)]
|
|
pub struct VC1Info {
|
|
pub first_packet_seq: c_int,
|
|
pub first_packet_entry: c_int,
|
|
pub first_packet_seen: c_int,
|
|
pub first_frag_written: c_int,
|
|
pub packet_seq: c_int,
|
|
pub packet_entry: c_int,
|
|
pub slices: c_int,
|
|
}
|
|
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct MOVMuxContext {
|
|
pub av_class: *const AVClass,
|
|
pub mode: c_int,
|
|
pub time: i64,
|
|
pub nb_streams: c_int,
|
|
///< number of new created tmcd track based on metadata (aka not data copy)
|
|
pub nb_meta_tmcd: c_int,
|
|
///< qt chapter track number
|
|
pub chapter_track: c_int,
|
|
pub mdat_pos: i64,
|
|
pub mdat_size: u64,
|
|
pub tracks: *mut MOVTrack,
|
|
pub flags: c_int,
|
|
pub rtp_flags: c_int,
|
|
pub iods_skip: c_int,
|
|
pub iods_video_profile: c_int,
|
|
pub iods_audio_profile: c_int,
|
|
pub moov_written: c_int,
|
|
pub fragments: c_int,
|
|
pub max_fragment_duration: c_int,
|
|
pub min_fragment_duration: c_int,
|
|
pub max_fragment_size: c_int,
|
|
pub ism_lookahead: c_int,
|
|
pub mdat_buf: *mut AVIOContext,
|
|
pub first_trun: c_int,
|
|
pub video_track_timescale: c_int,
|
|
///< 0 for disabled, -1 for automatic, size otherwise
|
|
pub reserved_moov_size: c_int,
|
|
pub reserved_header_pos: i64,
|
|
pub major_brand: *mut c_char,
|
|
pub per_stream_grouping: c_int,
|
|
pub fc: *mut AVFormatContext,
|
|
pub use_editlist: c_int,
|
|
pub gamma: c_float,
|
|
pub frag_interleave: c_int,
|
|
pub missing_duration_warned: c_int,
|
|
pub encryption_scheme_str: *mut c_char,
|
|
pub encryption_scheme: MOVEncryptionScheme,
|
|
pub encryption_key: *mut u8,
|
|
pub encryption_key_len: c_int,
|
|
pub encryption_kid: *mut u8,
|
|
pub encryption_kid_len: c_int,
|
|
pub need_rewrite_extradata: c_int,
|
|
pub use_stream_ids_as_track_ids: c_int,
|
|
pub track_ids_ok: c_int,
|
|
pub write_tmcd: c_int,
|
|
pub write_prft: MOVPrftBox,
|
|
pub empty_hdlr_name: c_int,
|
|
}
|