110 #define MODE_MATROSKAv2 0x01
111 #define MODE_WEBM 0x02
115 #define MAX_TRACKS 126
167 #define MAX_SEEKENTRY_SIZE 21
171 #define MAX_CUETRACKPOS_SIZE 42
174 #define MAX_CUEPOINT_SIZE(num_tracks) 12 + MAX_CUETRACKPOS_SIZE * num_tracks
177 #define OPUS_SEEK_PREROLL 80000000
181 return (
av_log2(
id + 1) - 1) / 7 + 1;
209 while ((num + 1) >> bytes * 7)
229 bytes = needed_bytes;
234 num |= 1ULL << bytes * 7;
235 for (i = bytes - 1; i >= 0; i--)
248 for (i = bytes - 1; i >= 0; i--)
255 uint64_t
tmp = 2*(val < 0 ? val^-1 :
val);
257 while (tmp>>=8) bytes++;
261 for (i = bytes - 1; i >= 0; i--)
310 uint64_t expectedsize)
450 if (numelements > 0) {
532 currentpos = seekhead->
filepos;
552 int64_t cluster_pos, int64_t relative_pos, int64_t
duration)
590 uint64_t
pts = entry->
pts;
594 for (j = 0; j < num_tracks; j++)
595 tracks[j].has_cue = 0;
598 av_assert0(tracknum>=0 && tracknum<num_tracks);
610 for (j = 0; j < num_tracks; j++)
611 tracks[j].has_cue = 0;
614 av_assert0(tracknum>=0 && tracknum<num_tracks);
636 const uint8_t *header_start[3];
638 int first_header_size;
642 first_header_size = 30;
644 first_header_size = 42;
647 first_header_size, header_start, header_len) < 0) {
653 for (j = 0; j < 2; j++) {
656 for (j = 0; j < 3; j++)
657 avio_write(pb, header_start[j], header_len[j]);
691 av_dict_set(&dict,
"WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0);
694 if (len >= ((1<<24) - 4))
726 "Error parsing AAC extradata, unable to determine samplerate.\n");
757 "Invalid extradata found, ALAC expects a 36-byte "
777 int native_id,
int qt_id)
781 int ret, codecpriv_size;
800 for(i = 0; i < 0x5a - 8; i++)
845 int side_data_size = 0;
846 int ret, colorinfo_size;
912 if (colorinfo_size) {
914 avio_write(pb, colorinfo_ptr, colorinfo_size);
923 int side_data_size = 0;
928 if (side_data_size) {
931 int ret, projection_size;
979 if (spherical->
pitch)
986 if (projection_size) {
988 avio_write(pb, projection_ptr, projection_size);
1000 switch (field_order) {
1014 switch (field_order) {
1049 int stereo_mode = atoi(tag->
value);
1057 if (stereo_mode < MATROSKA_VIDEO_STEREOMODE_TYPE_NB &&
1058 stereo_mode != 10 && stereo_mode != 12) {
1071 switch (stereo->
type) {
1123 "The specified stereo mode is not valid.\n");
1135 int i,
AVIOContext *pb,
int default_stream_exists)
1144 int output_sample_rate = 0;
1145 int display_width_div = 1;
1146 int display_height_div = 1;
1184 }
else if (tag && tag->
value) {
1199 codec_id =
"D_WEBVTT/CAPTIONS";
1202 codec_id =
"D_WEBVTT/DESCRIPTIONS";
1205 codec_id =
"D_WEBVTT/METADATA";
1208 codec_id =
"D_WEBVTT/SUBTITLES";
1227 av_log(s,
AV_LOG_ERROR,
"Raw RGB is not supported Natively in Matroska, you can use AVI or NUT or\n"
1228 "If you would like to store it anyway using VFW mode, enable allow_raw_vfw (-allow_raw_vfw 1)\n");
1238 if (codecdelay < 0) {
1258 "Only VP8 or VP9 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.\n");
1262 switch (par->codec_type) {
1264 mkv->have_video = 1;
1267 if( st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0
1283 else if (!native_id) {
1286 mkv->tracks[i].write_dts = 1;
1287 s->internal->avoid_negative_ts_use_pts = 0;
1301 &display_height_div);
1313 if (st->sample_aspect_ratio.num) {
1314 int64_t d_width =
av_rescale(par->width, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
1315 if (d_width > INT_MAX) {
1319 if (d_width != par->width || display_width_div != 1 || display_height_div != 1) {
1320 if (mkv->mode ==
MODE_WEBM || display_width_div != 1 || display_height_div != 1) {
1326 par->width * (int64_t)st->sample_aspect_ratio.num,
1327 par->height * (int64_t)st->sample_aspect_ratio.den,
1334 }
else if (display_width_div != 1 || display_height_div != 1) {
1341 uint32_t color_space =
av_le2ne32(par->codec_tag);
1363 if (output_sample_rate)
1382 av_log(
s,
AV_LOG_ERROR,
"Only audio, video, and subtitles are supported for Matroska.\n");
1387 mkv->tracks[i].codecpriv_offset =
avio_tell(pb);
1402 int i, ret, default_stream_exists = 0;
1442 if (ret < 0)
return ret;
1445 if (ret < 0)
return ret;
1456 if (chapterstart < 0 || chapterstart > chapterend || chapterend < 0) {
1458 "Invalid chapter start (%"PRId64
") or end (%"PRId64
").\n",
1459 chapterstart, chapterend);
1494 if ((p = strrchr(p,
'-')) &&
1502 else if (*p >=
'a' && *p <=
'z')
1519 unsigned int elementid,
unsigned int uid,
1529 if (ret < 0)
return ret;
1601 if (ret < 0)
return ret;
1614 if (ret < 0)
return ret;
1649 if (ret < 0)
return ret;
1693 if (ret < 0)
return ret;
1696 if (ret < 0)
return ret;
1703 const char *mimetype =
NULL;
1724 mimetype = t->
value;
1740 "it cannot be deduced from the codec id.\n", i);
1780 if (explicitDuration && (
av_parse_time(&us, explicitDuration->
value, 1) == 0) && us > 0) {
1781 av_log(s,
AV_LOG_DEBUG,
"get_metadata_duration found duration in context metadata: %" PRId64
"\n", us);
1790 max =
FFMAX(max, us);
1804 int64_t creation_time;
1824 "The Matroska muxer does not yet support muxing %s\n",
1864 if (ret < 0)
goto fail;
1882 uint32_t segment_uid[4];
1887 for (i = 0; i < 4; i++)
1893 const char *ident =
"Lavf";
1900 int64_t date_utc = (creation_time - 978307200000000LL) * 1000;
1902 AV_WB64(date_utc_buf, date_utc);
1915 av_log(s,
AV_LOG_DEBUG,
"Write early duration from recording time = %" PRIu64
"\n", scaledDuration);
1916 }
else if (metadata_duration > 0) {
1919 av_log(s,
AV_LOG_DEBUG,
"Write early duration from metadata = %" PRIu64
"\n", scaledDuration);
1996 int size = pkt_size + 4;
2043 memcpy(dst + offset, src, header.
blocksize);
2059 unsigned int blockid,
AVPacket *
pkt,
int keyframe)
2066 uint64_t additional_id = 0;
2067 int64_t discard_padding = 0;
2069 ebml_master block_group, block_additions, block_more;
2072 "pts %" PRId64
", dts %" PRId64
", duration %" PRId64
", keyframe %d\n",
2102 if (side_data && side_data_size >= 10) {
2112 additional_id =
AV_RB64(side_data);
2114 side_data_size -= 8;
2117 if ((side_data_size && additional_id == 1) || discard_padding) {
2125 avio_w8(pb, 0x80 | track_number);
2129 if (data != pkt->
data)
2138 if (discard_padding) {
2142 if (side_data_size && additional_id == 1) {
2152 if ((side_data_size && additional_id == 1) || discard_padding) {
2161 int id_size, settings_size,
size;
2164 const int flags = 0;
2174 size = id_size + 1 + settings_size + 1 + pkt->
size;
2177 "pts %" PRId64
", dts %" PRId64
", duration %" PRId64
", flags %d\n",
2187 avio_printf(pb,
"%.*s\n%.*s\n%.*s", id_size,
id, settings_size, settings, pkt->
size, pkt->
data);
2203 "Starting new cluster at offset %" PRIu64
" bytes, "
2204 "pts %" PRIu64
"dts %" PRIu64
"\n",
2208 "pts %" PRIu64
"dts %" PRIu64
"\n",
2219 int side_data_size = 0, ret;
2242 memcpy(codecpriv_par->
extradata, side_data, side_data_size);
2268 int64_t relative_packet_pos;
2279 if ((int16_t)cluster_time != cluster_time) {
2301 if (ret < 0)
return ret;
2310 #if FF_API_CONVERGENCE_DURATION
2347 int64_t cluster_time;
2349 int start_new_cluster;
2369 start_new_cluster = keyframe;
2374 start_new_cluster = 1;
2379 cluster_size > 4 * 1024))) {
2380 start_new_cluster = 1;
2382 start_new_cluster = 0;
2385 if (mkv->
cluster_pos != -1 && start_new_cluster) {
2398 mkv->
is_dash ? start_new_cluster : 0);
2402 "Could not write cached audio packet ret:%d\n", ret);
2426 "Flushing cluster at offset %" PRIu64
" bytes\n",
2441 int64_t currentpos, cuespos;
2450 "Could not write cached audio packet ret:%d\n", ret);
2477 "Insufficient space reserved for cues: %d "
2478 "(needed: %" PRId64
").\n",
2483 if (cues_end < cuespos + mkv->reserve_cues_space)
2485 (cues_end - cuespos));
2521 char duration_string[20] =
"";
2528 snprintf(duration_string, 20,
"%02d:%02d:%012.9f",
2529 (
int) duration_sec / 3600, ((
int) duration_sec / 60) % 60,
2530 fmod(duration_sec, 60));
2634 #define OFFSET(x) offsetof(MatroskaMuxContext, x)
2635 #define FLAGS AV_OPT_FLAG_ENCODING_PARAM
2637 {
"reserve_index_space",
"Reserve a given amount of space (in bytes) at the beginning of the file for the index (cues).",
OFFSET(reserve_cues_space),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX,
FLAGS },
2638 {
"cluster_size_limit",
"Store at most the provided amount of bytes in a cluster. ",
OFFSET(cluster_size_limit),
AV_OPT_TYPE_INT , { .i64 = -1 }, -1, INT_MAX,
FLAGS },
2639 {
"cluster_time_limit",
"Store at most the provided number of milliseconds in a cluster.",
OFFSET(cluster_time_limit),
AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX,
FLAGS },
2640 {
"dash",
"Create a WebM file conforming to WebM DASH specification",
OFFSET(is_dash),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1,
FLAGS },
2641 {
"dash_track_number",
"Track number for the DASH stream",
OFFSET(dash_track_number),
AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 127,
FLAGS },
2644 {
"write_crc32",
"write a CRC32 element inside every Level 1 element",
OFFSET(write_crc),
AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1,
FLAGS },
2648 #if CONFIG_MATROSKA_MUXER
2649 static const AVClass matroska_class = {
2659 .mime_type =
"video/x-matroska",
2660 .extensions =
"mkv",
2662 .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
2664 .video_codec = CONFIG_LIBX264_ENCODER ?
2679 .priv_class = &matroska_class,
2683 #if CONFIG_WEBM_MUXER
2684 static const AVClass webm_class = {
2694 .mime_type =
"video/webm",
2695 .extensions =
"webm",
2707 .priv_class = &webm_class,
2711 #if CONFIG_MATROSKA_AUDIO_MUXER
2712 static const AVClass mka_class = {
2721 .mime_type =
"audio/x-matroska",
2722 .extensions =
"mka",
2724 .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
2725 AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3,
2737 .priv_class = &mka_class,
unsigned int nb_chapters
Number of chapters in AVChapter array.
static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_cue)
int32_t pitch
Rotation around the right vector [-90, 90].
#define MATROSKA_ID_SEEKPREROLL
void av_sha_final(AVSHA *ctx, uint8_t *digest)
Finish hashing and output digest value.
#define MATROSKA_ID_VIDEOPROJECTIONPOSEYAW
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
enum AVChromaLocation chroma_location
void avio_wb64(AVIOContext *s, uint64_t val)
static int mkv_write_vtt_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
const char const char void * val
#define MATROSKA_ID_BLOCKADDID
#define MATROSKA_ID_TRACKDEFAULTDURATION
void avio_wl16(AVIOContext *s, unsigned int val)
static void put_ebml_size_unknown(AVIOContext *pb, int bytes)
Write an EBML size meaning "unknown size".
enum AVColorTransferCharacteristic color_trc
#define MATROSKA_ID_VIDEOFLAGINTERLACED
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MATROSKA_ID_VIDEOCOLOR_GX
#define MATROSKA_ID_DATEUTC
int sizebytes
how many bytes were reserved for the size
#define MAX_TRACKS
Maximum number of tracks allowed in a Matroska file (with track numbers in range 1 to 126 (inclusive)...
The optional first identifier line of a WebVTT cue.
void av_sha_update(AVSHA *ctx, const uint8_t *data, unsigned int len)
Update hash value.
#define MATROSKA_ID_TRACKFLAGLACING
#define MATROSKA_ID_TRACKENTRY
#define MATROSKA_ID_VIDEODISPLAYHEIGHT
static void mkv_start_new_cluster(AVFormatContext *s, AVPacket *pkt)
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
int64_t cluster_pos
file offset of the cluster containing the block
ptrdiff_t const GLvoid * data
int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int flags)
Write WAVEFORMAT header structure.
static int mkv_init(struct AVFormatContext *s)
ebml_master tracks_master
#define MATROSKA_ID_VIDEOPROJECTIONPOSEROLL
#define MATROSKA_ID_CUETRACKPOSITION
#define MATROSKA_ID_CODECPRIVATE
av_cold int av_sha_init(AVSHA *ctx, int bits)
Initialize SHA-1 or SHA-2 hashing.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
static av_cold int init(AVCodecContext *avctx)
#define MATROSKA_ID_AUDIOBITDEPTH
#define MATROSKA_ID_TRACKFLAGDEFAULT
static const AVCodecTag additional_subtitle_tags[]
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
static int mkv_write_attachments(AVFormatContext *s)
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection...
static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStream *st)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
#define MATROSKA_ID_TAGTARGETS_ATTACHUID
int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out, int *size, int filter_ps, int *ps_count)
Writes Annex B formatted HEVC NAL units to a data buffer.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define MATROSKA_ID_FILEDATA
AVFormatInternal * internal
An opaque field for libavformat internal usage.
#define EBML_ID_DOCTYPEREADVERSION
#define MATROSKA_ID_BLOCKREFERENCE
static int mkv_write_header(AVFormatContext *s)
#define MATROSKA_ID_TRACKTYPE
enum AVMediaType codec_type
#define MATROSKA_ID_TAGTARGETS_CHAPTERUID
int ff_flac_is_native_layout(uint64_t channel_layout)
int64_t duration
duration of the block according to time base
static av_always_inline uint64_t av_double2int(double f)
Reinterpret a double as a 64-bit integer.
#define MATROSKA_ID_VIDEOCOLOR_RX
Video represents a sphere mapped on a flat surface using equirectangular projection.
#define MATROSKA_ID_MUXINGAPP
int64_t cluster_time_limit
#define MATROSKA_ID_AUDIOCHANNELS
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
#define MATROSKA_ID_VIDEOPROJECTIONTYPE
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
#define MATROSKA_ID_CUECLUSTERPOSITION
#define MATROSKA_ID_VIDEOCOLOR_LUMINANCEMAX
int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
Converts AVChromaLocation to swscale x/y chroma position.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
#define MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ
Views are next to each other.
#define MATROSKA_ID_EDITIONFLAGDEFAULT
#define MATROSKA_ID_CLUSTERTIMECODE
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
This struct describes the properties of an encoded stream.
#define MATROSKA_ID_CHAPTERTIMEEND
enum AVColorSpace color_space
int64_t pos
absolute offset in the file where the master's elements start
MatroskaVideoStereoModeType
Mastering display metadata (based on SMPTE-2086:2014).
#define MATROSKA_ID_FILEDESC
int64_t cluster_pos
file offset of the current cluster
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static const AVCodecTag additional_audio_tags[]
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
void avio_wl32(AVIOContext *s, unsigned int val)
#define MATROSKA_ID_VIDEOCOLOR_BX
#define MATROSKA_ID_CHAPLANG
static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int elementid, unsigned int uid, ebml_master *tags)
#define MATROSKA_ID_TRACKLANGUAGE
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
Stereo 3D type: this structure describes how two videos are packed within a single video surface...
const AVCodecTag ff_codec_movvideo_tags[]
static int ebml_id_size(unsigned int id)
#define OPUS_SEEK_PREROLL
Seek preroll value for opus.
int ff_mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mode)
static av_cold int end(AVCodecContext *avctx)
int id
unique ID to identify the chapter
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#define MATROSKA_ID_TIMECODESCALE
static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int native_id, int qt_id)
#define MATROSKA_ID_SIMPLEBLOCK
#define MATROSKA_ID_EDITIONFLAGHIDDEN
int nb_side_data
The number of elements in the AVStream.side_data array.
void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type)
Mark the written bytestream as a specific type.
uint8_t * av_stream_get_side_data(const AVStream *stream, enum AVPacketSideDataType type, int *size)
Get side information from stream.
#define MATROSKA_ID_BLOCKMORE
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
AVStream ** streams
A list of all streams in the file.
#define MATROSKA_ID_CUERELATIVEPOSITION
A point in the output bytestream where a demuxer can start parsing (for non self synchronizing bytest...
#define MATROSKA_ID_AUDIOOUTSAMPLINGFREQ
#define MATROSKA_ID_VIDEOCOLOR
Public header for CRC hash function implementation.
int initial_padding
Audio only.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int flags
Flags modifying the (de)muxer behaviour.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static int64_t mkv_write_cues(AVFormatContext *s, mkv_cues *cues, mkv_track *tracks, int num_tracks)
#define MATROSKA_ID_VIDEODISPLAYWIDTH
#define MATROSKA_ID_BLOCKADDITIONS
#define AV_LOG_VERBOSE
Detailed information.
static int start_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, MatroskaMuxContext *mkv, ebml_master *master, unsigned int elementid, uint64_t expectedsize)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static const uint8_t header[24]
#define MATROSKA_ID_TRACKNUMBER
#define MATROSKA_ID_VIDEOCOLOR_WHITEY
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
Views are alternated temporally.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
#define MATROSKA_ID_SEGMENTUID
uint64_t channel_layout
Audio only.
static void put_ebml_num(AVIOContext *pb, uint64_t num, int bytes)
Write a number in EBML variable length format.
static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int elementid, uint64_t filepos)
int64_t segment_offset
the file offset to the beginning of the segment
struct AVOutputFormat * oformat
The output container format.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static int get_aac_sample_rates(AVFormatContext *s, AVCodecParameters *par, int *sample_rate, int *output_sample_rate)
#define MATROSKA_ID_TRACKUID
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static int mkv_write_simpletag(AVIOContext *pb, AVDictionaryEntry *t)
#define MATROSKA_ID_VIDEOSTEREOMODE
uint32_t chapter_id_offset
AVCodecID
Identify the syntax and semantics of the bitstream.
static int mkv_write_tags(AVFormatContext *s)
#define MATROSKA_ID_VIDEOCOLOR_BY
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
AVDictionary * metadata
Metadata that applies to the whole file.
int flags
Additional information about the frame packing.
#define MATROSKA_ID_BLOCKDURATION
#define EBML_ID_EBMLREADVERSION
#define MAX_CUETRACKPOS_SIZE
per-cuepoint-track - 5 1-byte EBML IDs, 5 1-byte EBML sizes, 4 8-byte uint max
#define MATROSKA_ID_VIDEOCOLOR_WHITEX
static void end_ebml_master_crc32_preliminary(AVIOContext *pb, AVIOContext **dyn_cp, MatroskaMuxContext *mkv, ebml_master master)
Complete ebml master whithout destroying the buffer, allowing for later updates.
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
int reserved_size
-1 if appending to file
#define MATROSKA_ID_CLUSTER
const char * ff_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace)
Convert a language code to a target codespace.
#define MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVColorPrimaries color_primaries
#define MATROSKA_ID_FILEMIMETYPE
#define MATROSKA_ID_WRITINGAPP
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int ff_isom_write_hvcc(AVIOContext *pb, const uint8_t *data, int size, int ps_array_completeness)
Writes HEVC extradata (parameter sets, declarative SEI NAL units) to the provided AVIOContext...
const char *const ff_matroska_video_stereo_mode[MATROSKA_VIDEO_STEREOMODE_TYPE_NB]
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
static int mkv_blockgroup_size(int pkt_size)
enum AVMediaType codec_type
General type of the encoded data.
static int ebml_num_size(uint64_t num)
Calculate how many bytes are needed to represent a given number in EBML.
enum AVPacketSideDataType type
enum AVMediaType avcodec_get_type(enum AVCodecID codec_id)
Get the type of the given codec.
static int mkv_write_chapters(AVFormatContext *s)
static int mkv_check_tag(AVDictionary *m, unsigned int elementid)
#define EBML_ID_EBMLMAXIDLENGTH
#define MATROSKA_ID_CHAPTERFLAGHIDDEN
static const uint8_t offset[127][2]
void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, const AVCodecTag *tags, int for_asf, int ignore_extradata)
const AVCodecTag ff_codec_wav_tags[]
static mkv_seekhead * mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset, int numelements)
Initialize a mkv_seekhead element to be ready to index level 1 Matroska elements. ...
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
void avcodec_parameters_free(AVCodecParameters **par)
Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied p...
static void * av_mallocz_array(size_t nmemb, size_t size)
int flags
A combination of AV_PKT_FLAG values.
int extradata_size
Size of the extradata content in bytes.
const CodecMime ff_mkv_mime_tags[]
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
uint32_t bound_bottom
Distance from the bottom edge.
Views are packed per line, as if interlaced.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
int void avio_flush(AVIOContext *s)
Force flushing of buffered data.
#define MATROSKA_ID_VIDEOCOLOR_LUMINANCEMIN
audio channel layout utility functions
#define EBML_ID_EBMLVERSION
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
void ffio_fill(AVIOContext *s, int b, int count)
#define AV_TIME_BASE
Internal time base represented as integer.
#define MATROSKA_ID_TAGTARGETS
const AVCodecTag ff_codec_bmp_tags[]
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
#define MATROSKA_ID_TAGNAME
static int put_wv_codecpriv(AVIOContext *pb, AVCodecParameters *par)
static void mkv_free(MatroskaMuxContext *mkv)
Free the members allocated in the mux context.
#define MATROSKA_ID_CHAPTERFLAGENABLED
static int64_t mkv_write_seekhead(AVIOContext *pb, MatroskaMuxContext *mkv)
Write the seek head to the file and free it.
static int64_t get_metadata_duration(AVFormatContext *s)
static int write_trailer(AVFormatContext *s1)
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
uint32_t bound_right
Distance from the right edge.
int ff_wv_parse_header(WvHeader *wv, const uint8_t *data)
Parse a WavPack block header.
#define MATROSKA_ID_SIMPLETAG
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
static int mkv_check_new_extra_data(AVFormatContext *s, AVPacket *pkt)
int ff_flac_write_header(AVIOContext *pb, uint8_t *extradata, int extradata_size, int last_block)
int avoid_negative_ts
Avoid negative timestamps during muxing.
#define MATROSKA_ID_CHAPTERATOM
int avpriv_split_xiph_headers(const uint8_t *extradata, int extradata_size, int first_header_size, const uint8_t *header_start[3], int header_len[3])
Split a single extradata buffer into the three headers that most Xiph codecs use. ...
int32_t yaw
Rotation around the up vector [-180, 180].
enum AVColorRange color_range
Video only.
Opaque data information usually sparse.
#define MATROSKA_ID_VIDEOCOLORSPACE
#define MATROSKA_ID_CHAPTERS
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
#define MATROSKA_ID_AUDIOSAMPLINGFREQ
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
static void end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, MatroskaMuxContext *mkv, ebml_master master)
Views are packed per column.
uint32_t padding
Number of pixels to pad from the edge of each cube face.
static int mkv_add_cuepoint(mkv_cues *cues, int stream, int tracknum, int64_t ts, int64_t cluster_pos, int64_t relative_pos, int64_t duration)
static void put_ebml_float(AVIOContext *pb, unsigned int elementid, double val)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static void put_ebml_string(AVIOContext *pb, unsigned int elementid, const char *str)
int64_t end
chapter start/end time in time_base units
static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, int i, AVIOContext *pb, int default_stream_exists)
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
enum AVStereo3DType type
How views are packed within the video.
#define MATROSKA_ID_VIDEOCOLORMATRIXCOEFF
char * av_strdup(const char *s)
Duplicate a string.
#define MATROSKA_ID_TRACKFLAGFORCED
#define MATROSKA_ID_VIDEOCOLORPRIMARIES
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
#define MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
#define MATROSKA_ID_SEEKID
AVIOContext * pb
I/O context.
void avio_w8(AVIOContext *s, int b)
Public header for SHA-1 & SHA-256 hash function implementations.
#define MATROSKA_ID_BLOCK
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define MATROSKA_ID_TAGTARGETS_TRACKUID
static const EbmlSyntax ebml_header[]
#define MATROSKA_ID_TAGLANG
static int mkv_check_tag_name(const char *name, unsigned int elementid)
struct AVSHA * av_sha_alloc(void)
Allocate an AVSHA context.
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
#define MATROSKA_ID_TRACKS
Data found in BlockAdditional element of matroska container.
#define MATROSKA_ID_TRACKNAME
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define MATROSKA_ID_SEEKENTRY
static const char * format
Describe the class of an AVClass context structure.
#define MATROSKA_ID_EDITIONENTRY
#define FF_COMPLIANCE_NORMAL
#define MAX_CUEPOINT_SIZE(num_tracks)
per-cuepoint - 2 1-byte EBML IDs, 2 1-byte EBML sizes, 8-byte uint max
#define MATROSKA_ID_BLOCKGROUP
#define MATROSKA_ID_VIDEOPIXELHEIGHT
int32_t roll
Rotation around the forward vector [-180, 180].
static int mkv_write_tracks(AVFormatContext *s)
Rational number (pair of numerator and denominator).
static void put_ebml_uint(AVIOContext *pb, unsigned int elementid, uint64_t val)
#define MATROSKA_ID_CUEDURATION
#define MATROSKA_ID_CUETIME
Recommmends skipping the specified number of samples.
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
#define MATROSKA_ID_VIDEOCOLORTRANSFERCHARACTERISTICS
#define MATROSKA_ID_TITLE
#define MATROSKA_ID_TRACKVIDEO
static int mkv_strip_wavpack(const uint8_t *src, uint8_t **pdst, int *size)
This structure describes how to handle spherical videos, outlining information about projection...
static void put_ebml_id(AVIOContext *pb, unsigned int id)
#define MATROSKA_ID_VIDEOPROJECTION
#define MATROSKA_ID_VIDEOCOLORMASTERINGMETA
#define MATROSKA_ID_VIDEOPROJECTIONPRIVATE
static void put_ebml_sint(AVIOContext *pb, unsigned int elementid, int64_t val)
#define MATROSKA_ID_ATTACHMENTS
static int64_t pts
Global timestamp for the audio frames.
void avio_wb16(AVIOContext *s, unsigned int val)
int64_t * stream_duration_offsets
#define MATROSKA_ID_CHAPTERDISPLAY
static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par)
int bits_per_raw_sample
This is the number of valid bits in each output sample.
#define MATROSKA_ID_FILENAME
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
#define MATROSKA_ID_BLOCKADDITIONAL
uint32_t bound_top
Distance from the top edge.
const AVMetadataConv ff_mkv_metadata_conv[]
#define MATROSKA_ID_CODECID
static const AVCodecTag additional_video_tags[]
static int put_flac_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par)
#define MATROSKA_ID_VIDEOFIELDORDER
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
int sample_rate
Audio only.
#define MATROSKA_ID_VIDEOALPHAMODE
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
static int mkv_write_trailer(AVFormatContext *s)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_RB64
static int mkv_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
attribute_deprecated int64_t convergence_duration
#define MATROSKA_ID_CUETRACK
#define MATROSKA_ID_SEEKPOSITION
int64_t last_track_timestamp[MAX_TRACKS]
#define MATROSKA_ID_CODECDELAY
#define FF_DISABLE_DEPRECATION_WARNINGS
#define MATROSKA_ID_CHAPTERTIMESTART
common internal api header.
#define MATROSKA_ID_VIDEOCOLORRANGE
static void put_ebml_binary(AVIOContext *pb, unsigned int elementid, const void *buf, int size)
enum AVSphericalProjection projection
Projection type.
Utilties for rational number calculation.
int ffio_init_context(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Video is not stereoscopic (and metadata has to be there).
Views are packed in a checkerboard-like structure per pixel.
static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, unsigned int blockid, AVPacket *pkt, int keyframe)
static int mkv_write_flush_packet(AVFormatContext *s, AVPacket *pkt)
int disposition
AV_DISPOSITION_* bit field.
static void put_ebml_void(AVIOContext *pb, uint64_t size)
Write a void element of a given size.
AVRational time_base
time base in which the start/end timestamps are specified
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8:ctx->simd_f=cpy8;break;}}if(HAVE_YASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){intplanes=out->planar?out->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
#define MATROSKA_ID_SEGMENT
int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int bit_size, int sync_extension)
Parse MPEG-4 systems extradata from a raw buffer to retrieve audio configuration. ...
The optional settings (rendering instructions) that immediately follow the timestamp specifier of a W...
#define MATROSKA_ID_SEEKHEAD
A point in the output bytestream where a decoder can start decoding (i.e.
mkv_attachments * attachments
#define FF_ENABLE_DEPRECATION_WARNINGS
#define MATROSKA_ID_POINTENTRY
mkv_seekhead_entry * entries
static int mkv_write_native_codecprivate(AVFormatContext *s, AVCodecParameters *par, AVIOContext *dyn_cp)
static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb, AVStream *st, int mode, int *h_width, int *h_height)
#define MATROSKA_ID_FILEUID
static int mkv_write_tag_targets(AVFormatContext *s, unsigned int elementid, unsigned int uid, ebml_master *tags, ebml_master *tag)
void * priv_data
Format private data.
#define MATROSKA_ID_CHAPTERUID
Views are on top of each other.
static void write_header(FFV1Context *f)
uint32_t bound_left
Distance from the left edge.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
int64_t relative_pos
relative offset from the position of the cluster containing the block
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
#define MATROSKA_ID_VIDEODISPLAYUNIT
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
static const AVOption options[]
#define EBML_ID_EBMLMAXSIZELENGTH
void avio_wb32(AVIOContext *s, unsigned int val)
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
#define MATROSKA_ID_CHAPSTRING
#define MATROSKA_ID_TAGSTRING
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key, ignoring the suffix of the found key string.
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
const CodecMime ff_mkv_image_mime_tags[]
AVCodecParameters * codecpar
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
#define MATROSKA_ID_DURATION
#define MAX_SEEKENTRY_SIZE
2 bytes * 3 for EBML IDs, 3 1-byte EBML lengths, 8 bytes for 64 bit offset, 4 bytes for target EBML I...
static mkv_cues * mkv_start_cues(int64_t segment_offset)
#define EBML_ID_DOCTYPEVERSION
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
static void end_ebml_master(AVIOContext *pb, ebml_master master)
#define MATROSKA_ID_ATTACHEDFILE
#define MATROSKA_ID_VIDEOCOLOR_GY
static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid, uint64_t expectedsize)
mkv_seekhead * main_seekhead
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data.
int64_t * stream_durations
static void mkv_write_field_order(AVIOContext *pb, int mode, enum AVFieldOrder field_order)
mode
Use these values in ebur128_init (or'ed).
#define MATROSKA_ID_VIDEOCOLOR_RY
static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance)
static void put_xiph_size(AVIOContext *pb, int size)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define MATROSKA_ID_VIDEOPIXELWIDTH
int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
#define MATROSKA_ID_TRACKAUDIO
#define AV_NOPTS_VALUE
Undefined timestamp value.
const CodecTags ff_mkv_codec_tags[]
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2
#define MATROSKA_ID_DISCARDPADDING
#define FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX
Tell ff_put_wav_header() to use WAVEFORMATEX even for PCM codecs.
static int mkv_write_video_projection(AVFormatContext *s, AVIOContext *pb, AVStream *st)
int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.