FFmpeg
|
#include <inttypes.h>
#include "libavutil/aes.h"
#include "libavutil/avassert.h"
#include "libavutil/mathematics.h"
#include "libavcodec/bytestream.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/timecode.h"
#include "avformat.h"
#include "internal.h"
#include "mxf.h"
Go to the source code of this file.
Data Structures | |
struct | MXFPartition |
struct | MXFCryptoContext |
struct | MXFStructuralComponent |
struct | MXFSequence |
struct | MXFTimecodeComponent |
struct | MXFTrack |
struct | MXFDescriptor |
struct | MXFIndexTableSegment |
struct | MXFPackage |
struct | MXFMetadataSet |
struct | MXFIndexTable |
struct | MXFContext |
struct | MXFMetadataReadTableEntry |
Macros | |
#define | MXF_TFF 1 |
#define | MXF_BFF 2 |
#define | IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y))) |
#define | SET_STR_METADATA(pb, name, str) |
#define | SET_UID_METADATA(pb, name, var, str) |
#define | SET_TS_METADATA(pb, name, var, str) |
Typedefs | |
typedef int | MXFMetadataReadFunc (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
Enumerations | |
enum | MXFPartitionType { Header, BodyPartition, Footer } |
enum | MXFOP { OP1a = 1, OP1b, OP1c, OP2a, OP2b, OP2c, OP3a, OP3b, OP3c, OPAtom, OPSONYOpt } |
enum | MXFWrappingScheme { Frame, Clip } |
Functions | |
static int | mxf_read_close (AVFormatContext *s) |
static int64_t | klv_decode_ber_length (AVIOContext *pb) |
static int | mxf_read_sync (AVIOContext *pb, const uint8_t *key, unsigned size) |
static int | klv_read_packet (KLVPacket *klv, AVIOContext *pb) |
static int | mxf_get_stream_index (AVFormatContext *s, KLVPacket *klv) |
static int | mxf_get_d10_aes3_packet (AVIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length) |
static int | mxf_decrypt_triplet (AVFormatContext *s, AVPacket *pkt, KLVPacket *klv) |
static int | mxf_read_primer_pack (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static int | mxf_read_partition_pack (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static int | mxf_add_metadata_set (MXFContext *mxf, void *metadata_set) |
static int | mxf_read_cryptographic_context (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static int | mxf_read_content_storage (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static int | mxf_read_source_clip (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static int | mxf_read_material_package (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static int | mxf_read_timecode_component (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static int | mxf_read_track (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static int | mxf_read_sequence (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static int | mxf_read_source_package (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static int | mxf_read_index_entry_array (AVIOContext *pb, MXFIndexTableSegment *segment) |
static int | mxf_read_index_table_segment (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static void | mxf_read_pixel_layout (AVIOContext *pb, MXFDescriptor *descriptor) |
static int | mxf_read_generic_descriptor (void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
static int | mxf_match_uid (const UID key, const UID uid, int len) |
static const MXFCodecUL * | mxf_get_codec_ul (const MXFCodecUL *uls, UID *uid) |
static void * | mxf_resolve_strong_ref (MXFContext *mxf, UID *strong_ref, enum MXFMetadataSetType type) |
static int | mxf_get_sorted_table_segments (MXFContext *mxf, int *nb_sorted_segments, MXFIndexTableSegment ***sorted_segments) |
static int | mxf_absolute_bodysid_offset (MXFContext *mxf, int body_sid, int64_t offset, int64_t *offset_out) |
Computes the absolute file offset of the given essence container offset. | |
static int64_t | mxf_essence_container_end (MXFContext *mxf, int body_sid) |
Returns the end position of the essence container with given BodySID, or zero if unknown. | |
static int | mxf_edit_unit_absolute_offset (MXFContext *mxf, MXFIndexTable *index_table, int64_t edit_unit, int64_t *edit_unit_out, int64_t *offset_out, int nag) |
static int | mxf_compute_ptses_fake_index (MXFContext *mxf, MXFIndexTable *index_table) |
static int | mxf_compute_index_tables (MXFContext *mxf) |
Sorts and collects index table segments into index tables. | |
static int | mxf_is_intra_only (MXFDescriptor *descriptor) |
static int | mxf_add_timecode_metadata (AVDictionary **pm, const char *key, AVTimecode *tc) |
static int | mxf_parse_structural_metadata (MXFContext *mxf) |
static int | mxf_read_utf16_string (AVIOContext *pb, int size, char **str) |
static int | mxf_uid_to_str (UID uid, char **str) |
static int | mxf_timestamp_to_str (uint64_t timestamp, char **str) |
static int | mxf_read_identification_metadata (void *arg, AVIOContext *pb, int tag, int size, UID _uid, int64_t klv_offset) |
static int | mxf_read_local_tags (MXFContext *mxf, KLVPacket *klv, MXFMetadataReadFunc *read_child, int ctx_size, enum MXFMetadataSetType type) |
static int | mxf_seek_to_previous_partition (MXFContext *mxf) |
Seeks to the previous partition, if possible. | |
static int | mxf_parse_handle_essence (MXFContext *mxf) |
Called when essence is encountered. | |
static int | mxf_parse_handle_partition_or_eof (MXFContext *mxf) |
Called when the next partition or EOF is encountered. | |
static void | mxf_compute_essence_containers (MXFContext *mxf) |
Figures out the proper offset and length of the essence container in each partition. | |
static int64_t | round_to_kag (int64_t position, int kag_size) |
static int | is_pcm (enum AVCodecID codec_id) |
static void | mxf_handle_small_eubc (AVFormatContext *s) |
Deal with the case where for some audio atoms EditUnitByteCount is very small (2, 4..). | |
static void | mxf_read_random_index_pack (AVFormatContext *s) |
static int | mxf_read_header (AVFormatContext *s) |
static int64_t | mxf_set_current_edit_unit (MXFContext *mxf, int64_t current_offset) |
Sets mxf->current_edit_unit based on what offset we're currently at. | |
static int | mxf_compute_sample_count (MXFContext *mxf, int stream_index, uint64_t *sample_count) |
static int | mxf_set_audio_pts (MXFContext *mxf, AVCodecContext *codec, AVPacket *pkt) |
static int | mxf_read_packet_old (AVFormatContext *s, AVPacket *pkt) |
static int | mxf_read_packet (AVFormatContext *s, AVPacket *pkt) |
static int | mxf_probe (AVProbeData *p) |
static int | mxf_read_seek (AVFormatContext *s, int stream_index, int64_t sample_time, int flags) |
Variables | |
static const uint8_t | mxf_header_partition_pack_key [] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 } |
static const uint8_t | mxf_essence_element_key [] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 } |
static const uint8_t | mxf_avid_essence_element_key [] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0e,0x04,0x03,0x01 } |
static const uint8_t | mxf_system_item_key [] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x03,0x01,0x04 } |
static const uint8_t | mxf_klv_key [] = { 0x06,0x0e,0x2b,0x34 } |
static const uint8_t | mxf_crypto_source_container_ul [] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 } |
static const uint8_t | mxf_encrypted_triplet_key [] = { 0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 } |
static const uint8_t | mxf_encrypted_essence_container [] = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0b,0x01,0x00 } |
static const uint8_t | mxf_random_index_pack_key [] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00 } |
static const uint8_t | mxf_sony_mpeg4_extradata [] = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00 } |
static const MXFCodecUL | mxf_picture_essence_container_uls [] |
static const MXFCodecUL | mxf_intra_only_essence_container_uls [] |
static const MXFCodecUL | mxf_intra_only_picture_essence_coding_uls [] |
static const MXFCodecUL | mxf_sound_essence_container_uls [] |
static const MXFCodecUL | mxf_data_essence_container_uls [] |
static const char *const | mxf_data_essence_descriptor [] |
static const MXFMetadataReadTableEntry | mxf_metadata_read_table [] |
AVInputFormat | ff_mxf_demuxer |
#define MXF_TFF 1 |
Definition at line 152 of file mxfdec.c.
Referenced by mxf_parse_structural_metadata().
#define MXF_BFF 2 |
Definition at line 153 of file mxfdec.c.
Referenced by mxf_parse_structural_metadata().
Definition at line 267 of file mxfdec.c.
Referenced by mxf_decrypt_triplet(), mxf_parse_structural_metadata(), mxf_read_cryptographic_context(), mxf_read_generic_descriptor(), mxf_read_header(), mxf_read_packet_old(), and mxf_read_random_index_pack().
#define SET_STR_METADATA | ( | pb, | |
name, | |||
str | |||
) |
Definition at line 1775 of file mxfdec.c.
Referenced by mxf_read_identification_metadata().
#define SET_UID_METADATA | ( | pb, | |
name, | |||
var, | |||
str | |||
) |
Definition at line 1781 of file mxfdec.c.
Referenced by mxf_read_identification_metadata().
#define SET_TS_METADATA | ( | pb, | |
name, | |||
var, | |||
str | |||
) |
Definition at line 1788 of file mxfdec.c.
Referenced by mxf_read_identification_metadata().
enum MXFPartitionType |
enum MXFOP |
enum MXFWrappingScheme |
|
static |
Definition at line 2522 of file mxfdec.c.
Referenced by mxf_read_header().
|
static |
Definition at line 269 of file mxfdec.c.
Referenced by klv_read_packet(), and mxf_decrypt_triplet().
|
static |
Definition at line 284 of file mxfdec.c.
Referenced by klv_read_packet(), and mxf_read_header().
|
static |
Definition at line 297 of file mxfdec.c.
Referenced by mxf_read_header(), mxf_read_packet_old(), and mxf_read_random_index_pack().
|
static |
Definition at line 308 of file mxfdec.c.
Referenced by mxf_decrypt_triplet(), and mxf_read_packet_old().
|
static |
Definition at line 323 of file mxfdec.c.
Referenced by mxf_read_packet_old().
|
static |
Definition at line 351 of file mxfdec.c.
Referenced by mxf_read_packet_old().
|
static |
|
static |
|
static |
Definition at line 594 of file mxfdec.c.
Referenced by mxf_read_local_tags().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 758 of file mxfdec.c.
Referenced by mxf_read_index_table_segment().
|
static |
|
static |
Definition at line 818 of file mxfdec.c.
Referenced by mxf_read_generic_descriptor().
|
static |
Definition at line 923 of file mxfdec.c.
Referenced by mxf_get_codec_ul().
|
static |
Definition at line 933 of file mxfdec.c.
Referenced by mxf_is_intra_only(), and mxf_parse_structural_metadata().
|
static |
Definition at line 943 of file mxfdec.c.
Referenced by mxf_parse_structural_metadata().
|
static |
Definition at line 998 of file mxfdec.c.
Referenced by mxf_compute_index_tables().
|
static |
Computes the absolute file offset of the given essence container offset.
Definition at line 1066 of file mxfdec.c.
Referenced by mxf_edit_unit_absolute_offset().
|
static |
Returns the end position of the essence container with given BodySID, or zero if unknown.
Definition at line 1095 of file mxfdec.c.
Referenced by mxf_read_packet().
|
static |
Definition at line 1116 of file mxfdec.c.
Referenced by mxf_read_packet(), mxf_read_seek(), and mxf_set_current_edit_unit().
|
static |
We have this:
x TemporalOffset 0: 0 1: 1 2: 1 3: -2 4: 1 5: 1 6: -2
We want to transform it into this:
x DTS PTS 0: -1 0 1: 0 3 2: 1 1 3: 2 2 4: 3 6 5: 4 4 6: 5 5
We do this by bucket sorting x by x+TemporalOffset[x] into mxf->ptses, then settings mxf->first_dts = -max(TemporalOffset[x]). The latter makes DTS <= PTS.
Definition at line 1164 of file mxfdec.c.
Referenced by mxf_compute_index_tables().
|
static |
Sorts and collects index table segments into index tables.
Also computes PTSes if possible.
Definition at line 1269 of file mxfdec.c.
Referenced by mxf_read_header().
|
static |
Definition at line 1361 of file mxfdec.c.
Referenced by mxf_parse_structural_metadata().
|
static |
Definition at line 1369 of file mxfdec.c.
Referenced by mxf_parse_structural_metadata().
|
static |
Definition at line 1377 of file mxfdec.c.
Referenced by mxf_read_header().
|
static |
|
static |
|
static |
|
static |
Definition at line 1868 of file mxfdec.c.
Referenced by mxf_read_header().
|
static |
Seeks to the previous partition, if possible.
Definition at line 1925 of file mxfdec.c.
Referenced by mxf_parse_handle_essence(), and mxf_parse_handle_partition_or_eof().
|
static |
Called when essence is encountered.
Definition at line 1946 of file mxfdec.c.
Referenced by mxf_read_header().
|
static |
Called when the next partition or EOF is encountered.
Definition at line 1992 of file mxfdec.c.
Referenced by mxf_read_header().
|
static |
Figures out the proper offset and length of the essence container in each partition.
Definition at line 2000 of file mxfdec.c.
Referenced by mxf_read_header().
|
static |
Definition at line 2030 of file mxfdec.c.
Referenced by mxf_read_header().
|
static |
Definition at line 2038 of file mxfdec.c.
Referenced by mxf_handle_small_eubc().
|
static |
Deal with the case where for some audio atoms EditUnitByteCount is very small (2, 4..).
In those cases we should read more than one sample per call to mxf_read_packet().
Definition at line 2049 of file mxfdec.c.
Referenced by mxf_read_header().
|
static |
Definition at line 2074 of file mxfdec.c.
Referenced by mxf_read_header().
|
static |
|
static |
Sets mxf->current_edit_unit based on what offset we're currently at.
Definition at line 2264 of file mxfdec.c.
Referenced by mxf_read_packet_old().
|
static |
Definition at line 2301 of file mxfdec.c.
Referenced by mxf_read_seek().
|
static |
Definition at line 2342 of file mxfdec.c.
Referenced by mxf_read_packet(), and mxf_read_packet_old().
|
static |
Definition at line 2361 of file mxfdec.c.
Referenced by mxf_read_packet().
|
static |
|
static |
|
static |
|
static |
Definition at line 255 of file mxfdec.c.
Referenced by mxf_probe(), and mxf_read_header().
|
static |
Definition at line 256 of file mxfdec.c.
Referenced by mxf_decrypt_triplet(), mxf_get_stream_index(), mxf_read_header(), and mxf_read_packet_old().
|
static |
Definition at line 257 of file mxfdec.c.
Referenced by mxf_read_header(), and mxf_read_packet_old().
|
static |
Definition at line 258 of file mxfdec.c.
Referenced by mxf_read_header().
|
static |
Definition at line 259 of file mxfdec.c.
Referenced by klv_read_packet().
|
static |
Definition at line 261 of file mxfdec.c.
Referenced by mxf_read_cryptographic_context().
|
static |
Definition at line 262 of file mxfdec.c.
Referenced by mxf_read_header(), and mxf_read_packet_old().
|
static |
Definition at line 263 of file mxfdec.c.
Referenced by mxf_parse_structural_metadata().
|
static |
Definition at line 264 of file mxfdec.c.
Referenced by mxf_read_random_index_pack().
|
static |
Definition at line 265 of file mxfdec.c.
Referenced by mxf_read_generic_descriptor().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
AVInputFormat ff_mxf_demuxer |