FFmpeg
|
#include <stdint.h>
#include "avc.h"
#include "hevc.h"
#include "avformat.h"
#include "avio_internal.h"
#include "avlanguage.h"
#include "flacenc.h"
#include "internal.h"
#include "isom.h"
#include "matroska.h"
#include "riff.h"
#include "subtitles.h"
#include "vorbiscomment.h"
#include "wv.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/dict.h"
#include "libavutil/intfloat.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/lfg.h"
#include "libavutil/mastering_display_metadata.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/random_seed.h"
#include "libavutil/rational.h"
#include "libavutil/samplefmt.h"
#include "libavutil/sha.h"
#include "libavutil/stereo3d.h"
#include "libavcodec/xiph.h"
#include "libavcodec/mpeg4audio.h"
#include "libavcodec/internal.h"
Go to the source code of this file.
Data Structures | |
struct | ebml_master |
struct | mkv_seekhead_entry |
struct | mkv_seekhead |
struct | mkv_cuepoint |
struct | mkv_cues |
struct | mkv_track |
struct | MatroskaMuxContext |
Macros | |
#define | MODE_MATROSKAv2 0x01 |
#define | MODE_WEBM 0x02 |
#define | MAX_TRACKS 126 |
Maximum number of tracks allowed in a Matroska file (with track numbers in range 1 to 126 (inclusive) More... | |
#define | MAX_SEEKENTRY_SIZE 21 |
2 bytes * 3 for EBML IDs, 3 1-byte EBML lengths, 8 bytes for 64 bit offset, 4 bytes for target EBML ID More... | |
#define | MAX_CUETRACKPOS_SIZE 42 |
per-cuepoint-track - 5 1-byte EBML IDs, 5 1-byte EBML sizes, 4 8-byte uint max More... | |
#define | MAX_CUEPOINT_SIZE(num_tracks) 12 + MAX_CUETRACKPOS_SIZE * num_tracks |
per-cuepoint - 2 1-byte EBML IDs, 2 1-byte EBML sizes, 8-byte uint max More... | |
#define | OPUS_SEEK_PREROLL 80000000 |
Seek preroll value for opus. More... | |
#define | OFFSET(x) offsetof(MatroskaMuxContext, x) |
#define | FLAGS AV_OPT_FLAG_ENCODING_PARAM |
Functions | |
static int | ebml_id_size (unsigned int id) |
static void | put_ebml_id (AVIOContext *pb, unsigned int id) |
static void | put_ebml_size_unknown (AVIOContext *pb, int bytes) |
Write an EBML size meaning "unknown size". More... | |
static int | ebml_num_size (uint64_t num) |
Calculate how many bytes are needed to represent a given number in EBML. More... | |
static void | put_ebml_num (AVIOContext *pb, uint64_t num, int bytes) |
Write a number in EBML variable length format. More... | |
static void | put_ebml_uint (AVIOContext *pb, unsigned int elementid, uint64_t val) |
static void | put_ebml_sint (AVIOContext *pb, unsigned int elementid, int64_t val) |
static void | put_ebml_float (AVIOContext *pb, unsigned int elementid, double val) |
static void | put_ebml_binary (AVIOContext *pb, unsigned int elementid, const void *buf, int size) |
static void | put_ebml_string (AVIOContext *pb, unsigned int elementid, const char *str) |
static void | put_ebml_void (AVIOContext *pb, uint64_t size) |
Write a void element of a given size. More... | |
static ebml_master | start_ebml_master (AVIOContext *pb, unsigned int elementid, uint64_t expectedsize) |
static void | end_ebml_master (AVIOContext *pb, ebml_master master) |
static void | put_xiph_size (AVIOContext *pb, int size) |
static void | mkv_free (MatroskaMuxContext *mkv) |
Free the members allocated in the mux context. More... | |
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. More... | |
static int | mkv_add_seekhead_entry (mkv_seekhead *seekhead, unsigned int elementid, uint64_t filepos) |
static int64_t | mkv_write_seekhead (AVIOContext *pb, MatroskaMuxContext *mkv) |
Write the seek head to the file and free it. More... | |
static mkv_cues * | mkv_start_cues (int64_t segment_offset) |
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 int64_t | mkv_write_cues (AVFormatContext *s, mkv_cues *cues, mkv_track *tracks, int num_tracks) |
static int | put_xiph_codecpriv (AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par) |
static int | put_wv_codecpriv (AVIOContext *pb, AVCodecParameters *par) |
static int | put_flac_codecpriv (AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par) |
static int | get_aac_sample_rates (AVFormatContext *s, AVCodecParameters *par, int *sample_rate, int *output_sample_rate) |
static int | mkv_write_native_codecprivate (AVFormatContext *s, AVCodecParameters *par, AVIOContext *dyn_cp) |
static int | mkv_write_codecprivate (AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int native_id, int qt_id) |
static int | mkv_write_video_color (AVIOContext *pb, AVCodecParameters *par, AVStream *st) |
static void | mkv_write_field_order (AVIOContext *pb, enum AVFieldOrder field_order) |
static int | mkv_write_stereo_mode (AVFormatContext *s, AVIOContext *pb, AVStream *st, int mode, int *h_width, int *h_height) |
static int | mkv_write_track (AVFormatContext *s, MatroskaMuxContext *mkv, int i, AVIOContext *pb, int default_stream_exists) |
static int | mkv_write_tracks (AVFormatContext *s) |
static int | mkv_write_chapters (AVFormatContext *s) |
static int | mkv_write_simpletag (AVIOContext *pb, AVDictionaryEntry *t) |
static int | mkv_write_tag_targets (AVFormatContext *s, unsigned int elementid, unsigned int uid, ebml_master *tags, ebml_master *tag) |
static int | mkv_write_tag (AVFormatContext *s, AVDictionary *m, unsigned int elementid, unsigned int uid, ebml_master *tags) |
static int | mkv_check_tag (AVDictionary *m) |
static int | mkv_write_tags (AVFormatContext *s) |
static int | mkv_write_attachments (AVFormatContext *s) |
static int | mkv_write_header (AVFormatContext *s) |
static int | mkv_blockgroup_size (int pkt_size) |
static int | mkv_strip_wavpack (const uint8_t *src, uint8_t **pdst, int *size) |
static void | mkv_write_block (AVFormatContext *s, AVIOContext *pb, unsigned int blockid, AVPacket *pkt, int keyframe) |
static int | mkv_write_vtt_blocks (AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) |
static void | mkv_flush_dynbuf (AVFormatContext *s) |
static void | mkv_start_new_cluster (AVFormatContext *s, AVPacket *pkt) |
static int | mkv_write_packet_internal (AVFormatContext *s, AVPacket *pkt, int add_cue) |
static int | mkv_write_packet (AVFormatContext *s, AVPacket *pkt) |
static int | mkv_write_flush_packet (AVFormatContext *s, AVPacket *pkt) |
static int | mkv_write_trailer (AVFormatContext *s) |
static int | mkv_query_codec (enum AVCodecID codec_id, int std_compliance) |
static int | mkv_init (struct AVFormatContext *s) |
static int | mkv_check_bitstream (struct AVFormatContext *s, const AVPacket *pkt) |
Variables | |
static const AVCodecTag | additional_audio_tags [] |
static const AVCodecTag | additional_video_tags [] |
static const AVCodecTag | additional_subtitle_tags [] |
static const AVOption | options [] |
#define MODE_MATROSKAv2 0x01 |
Definition at line 97 of file matroskaenc.c.
Referenced by mkv_write_header().
#define MODE_WEBM 0x02 |
Definition at line 98 of file matroskaenc.c.
Referenced by mkv_write_header(), mkv_write_stereo_mode(), mkv_write_track(), and mkv_write_trailer().
#define MAX_TRACKS 126 |
Maximum number of tracks allowed in a Matroska file (with track numbers in range 1 to 126 (inclusive)
Definition at line 102 of file matroskaenc.c.
#define MAX_SEEKENTRY_SIZE 21 |
2 bytes * 3 for EBML IDs, 3 1-byte EBML lengths, 8 bytes for 64 bit offset, 4 bytes for target EBML ID
Definition at line 146 of file matroskaenc.c.
Referenced by mkv_start_seekhead(), and mkv_write_seekhead().
#define MAX_CUETRACKPOS_SIZE 42 |
per-cuepoint-track - 5 1-byte EBML IDs, 5 1-byte EBML sizes, 4 8-byte uint max
Definition at line 150 of file matroskaenc.c.
Referenced by mkv_write_cues().
#define MAX_CUEPOINT_SIZE | ( | num_tracks | ) | 12 + MAX_CUETRACKPOS_SIZE * num_tracks |
per-cuepoint - 2 1-byte EBML IDs, 2 1-byte EBML sizes, 8-byte uint max
Definition at line 153 of file matroskaenc.c.
Referenced by mkv_write_cues().
#define OPUS_SEEK_PREROLL 80000000 |
Seek preroll value for opus.
Definition at line 156 of file matroskaenc.c.
#define OFFSET | ( | x | ) | offsetof(MatroskaMuxContext, x) |
Definition at line 2277 of file matroskaenc.c.
#define FLAGS AV_OPT_FLAG_ENCODING_PARAM |
Definition at line 2278 of file matroskaenc.c.
|
static |
Definition at line 158 of file matroskaenc.c.
Referenced by mkv_write_seekhead(), and put_ebml_id().
|
static |
Definition at line 163 of file matroskaenc.c.
Referenced by mkv_write_block(), mkv_write_seekhead(), mkv_write_vtt_blocks(), put_ebml_binary(), put_ebml_float(), put_ebml_sint(), put_ebml_uint(), put_ebml_void(), and start_ebml_master().
|
static |
Write an EBML size meaning "unknown size".
bytes | The number of bytes the size should occupy (maximum: 8). |
Definition at line 175 of file matroskaenc.c.
Referenced by start_ebml_master().
|
static |
Calculate how many bytes are needed to represent a given number in EBML.
Definition at line 185 of file matroskaenc.c.
Referenced by mkv_blockgroup_size(), put_ebml_num(), and start_ebml_master().
|
static |
Write a number in EBML variable length format.
bytes | The number of bytes that need to be used to write the number. If zero, any number of bytes can be used. |
Definition at line 199 of file matroskaenc.c.
Referenced by end_ebml_master(), mkv_write_block(), mkv_write_seekhead(), mkv_write_vtt_blocks(), put_ebml_binary(), put_ebml_float(), put_ebml_sint(), put_ebml_uint(), and put_ebml_void().
|
static |
Definition at line 218 of file matroskaenc.c.
Referenced by mkv_write_attachments(), mkv_write_block(), mkv_write_chapters(), mkv_write_cues(), mkv_write_field_order(), mkv_write_header(), mkv_write_packet_internal(), mkv_write_seekhead(), mkv_write_stereo_mode(), mkv_write_tag_targets(), mkv_write_track(), mkv_write_video_color(), and mkv_write_vtt_blocks().
|
static |
Definition at line 231 of file matroskaenc.c.
Referenced by mkv_write_block().
|
static |
Definition at line 244 of file matroskaenc.c.
Referenced by mkv_write_trailer(), and mkv_write_video_color().
|
static |
Definition at line 251 of file matroskaenc.c.
Referenced by mkv_write_attachments(), mkv_write_codecprivate(), mkv_write_header(), mkv_write_trailer(), and put_ebml_string().
|
static |
Definition at line 259 of file matroskaenc.c.
Referenced by mkv_write_attachments(), mkv_write_chapters(), mkv_write_header(), mkv_write_simpletag(), mkv_write_tags(), and mkv_write_track().
|
static |
Write a void element of a given size.
Useful for reserving space in the file to be written to later.
size | The number of bytes to reserve, which must be at least 2. |
Definition at line 271 of file matroskaenc.c.
Referenced by mkv_start_seekhead(), mkv_write_header(), mkv_write_seekhead(), mkv_write_tags(), and mkv_write_trailer().
|
static |
Definition at line 288 of file matroskaenc.c.
Referenced by mkv_write_attachments(), mkv_write_block(), mkv_write_chapters(), mkv_write_cues(), mkv_write_header(), mkv_write_packet_internal(), mkv_write_seekhead(), mkv_write_simpletag(), mkv_write_tag_targets(), mkv_write_tags(), mkv_write_track(), mkv_write_tracks(), mkv_write_video_color(), and mkv_write_vtt_blocks().
|
static |
Definition at line 297 of file matroskaenc.c.
Referenced by mkv_start_new_cluster(), mkv_write_attachments(), mkv_write_block(), mkv_write_chapters(), mkv_write_cues(), mkv_write_flush_packet(), mkv_write_header(), mkv_write_packet_internal(), mkv_write_seekhead(), mkv_write_simpletag(), mkv_write_tag(), mkv_write_tag_targets(), mkv_write_tags(), mkv_write_tracks(), mkv_write_trailer(), mkv_write_video_color(), and mkv_write_vtt_blocks().
|
static |
Definition at line 307 of file matroskaenc.c.
Referenced by put_xiph_codecpriv().
|
static |
Free the members allocated in the mux context.
Definition at line 316 of file matroskaenc.c.
Referenced by mkv_write_header(), and mkv_write_trailer().
|
static |
Initialize a mkv_seekhead element to be ready to index level 1 Matroska elements.
If a maximum number of elements is specified, enough space will be reserved at the current file location to write a seek head of that size.
segment_offset | The absolute offset to the position in the file where the segment begins. |
numelements | The maximum number of elements that will be indexed by this seek head, 0 if unlimited. |
Definition at line 341 of file matroskaenc.c.
Referenced by mkv_write_header().
|
static |
Definition at line 362 of file matroskaenc.c.
Referenced by mkv_write_attachments(), mkv_write_chapters(), mkv_write_header(), mkv_write_tag_targets(), mkv_write_tracks(), and mkv_write_trailer().
|
static |
Write the seek head to the file and free it.
If a maximum number of elements was specified to mkv_start_seekhead(), the seek head will be written at the location reserved for it. Otherwise, it is written at the current location in the file.
Definition at line 390 of file matroskaenc.c.
Referenced by mkv_write_header(), and mkv_write_trailer().
|
static |
Definition at line 435 of file matroskaenc.c.
Referenced by mkv_write_header().
|
static |
Definition at line 445 of file matroskaenc.c.
Referenced by mkv_write_packet_internal().
|
static |
Definition at line 468 of file matroskaenc.c.
Referenced by mkv_write_trailer().
|
static |
Definition at line 525 of file matroskaenc.c.
Referenced by mkv_write_native_codecprivate().
|
static |
Definition at line 553 of file matroskaenc.c.
Referenced by mkv_write_native_codecprivate().
|
static |
Definition at line 562 of file matroskaenc.c.
Referenced by mkv_write_native_codecprivate().
|
static |
Definition at line 609 of file matroskaenc.c.
Referenced by mkv_write_track().
|
static |
Definition at line 626 of file matroskaenc.c.
Referenced by mkv_write_codecprivate().
|
static |
Definition at line 666 of file matroskaenc.c.
|
static |
Definition at line 735 of file matroskaenc.c.
|
static |
Definition at line 793 of file matroskaenc.c.
|
static |
Definition at line 832 of file matroskaenc.c.
|
static |
Definition at line 930 of file matroskaenc.c.
Referenced by mkv_write_tracks().
|
static |
Definition at line 1176 of file matroskaenc.c.
Referenced by mkv_write_header().
|
static |
Definition at line 1201 of file matroskaenc.c.
Referenced by mkv_write_header(), and mkv_write_trailer().
|
static |
Definition at line 1253 of file matroskaenc.c.
Referenced by mkv_write_tag().
|
static |
Definition at line 1287 of file matroskaenc.c.
Referenced by mkv_write_tag(), and mkv_write_tags().
|
static |
Definition at line 1310 of file matroskaenc.c.
Referenced by mkv_write_tags().
|
static |
Definition at line 1338 of file matroskaenc.c.
Referenced by mkv_write_tags().
|
static |
Definition at line 1349 of file matroskaenc.c.
Referenced by mkv_write_header().
|
static |
Definition at line 1406 of file matroskaenc.c.
Referenced by mkv_write_header().
|
static |
Definition at line 1490 of file matroskaenc.c.
|
static |
Definition at line 1664 of file matroskaenc.c.
Referenced by mkv_write_packet_internal(), and mkv_write_vtt_blocks().
Definition at line 1675 of file matroskaenc.c.
Referenced by mkv_write_block().
|
static |
Definition at line 1728 of file matroskaenc.c.
Referenced by mkv_write_packet_internal().
|
static |
Definition at line 1827 of file matroskaenc.c.
Referenced by mkv_write_packet_internal().
|
static |
Definition at line 1865 of file matroskaenc.c.
Referenced by mkv_start_new_cluster(), mkv_write_flush_packet(), and mkv_write_trailer().
|
static |
Definition at line 1880 of file matroskaenc.c.
Referenced by mkv_write_packet(), and mkv_write_packet_internal().
|
static |
Definition at line 1902 of file matroskaenc.c.
Referenced by mkv_write_packet(), and mkv_write_trailer().
|
static |
Definition at line 1992 of file matroskaenc.c.
Referenced by mkv_write_flush_packet().
|
static |
Definition at line 2067 of file matroskaenc.c.
|
static |
Definition at line 2091 of file matroskaenc.c.
|
static |
Definition at line 2197 of file matroskaenc.c.
|
static |
Definition at line 2214 of file matroskaenc.c.
|
static |
Definition at line 2231 of file matroskaenc.c.
|
static |
Definition at line 2246 of file matroskaenc.c.
|
static |
Definition at line 2262 of file matroskaenc.c.
|
static |
Definition at line 2271 of file matroskaenc.c.
|
static |
Definition at line 2279 of file matroskaenc.c.