libavformat/mxf.c File Reference

#include "avformat.h"
#include "aes.h"
#include "bytestream.h"

Go to the source code of this file.

Data Structures

struct  MXFCryptoContext
struct  MXFStructuralComponent
struct  MXFSequence
struct  MXFTrack
struct  MXFDescriptor
struct  MXFPackage
struct  MXFMetadataSet
struct  MXFContext
struct  KLVPacket
struct  MXFCodecUL
struct  MXFDataDefinitionUL
struct  MXFMetadataReadTableEntry

Defines

#define IS_KLV_KEY(x, y)   (!memcmp(x, y, sizeof(y)))
#define PRINT_KEY(pc, s, x)

Typedefs

typedef uint8_t UID [16]

Enumerations

enum  MXFMetadataSetType {
  AnyType, MaterialPackage, SourcePackage, SourceClip,
  TimecodeComponent, Sequence, MultipleDescriptor, Descriptor,
  Track, CryptoContext
}
enum  MXFWrappingScheme { Frame, Clip }

Functions

static int64_t klv_decode_ber_length (ByteIOContext *pb)
static int mxf_read_sync (ByteIOContext *pb, const uint8_t *key, unsigned size)
static int klv_read_packet (KLVPacket *klv, ByteIOContext *pb)
static int mxf_get_stream_index (AVFormatContext *s, KLVPacket *klv)
static int mxf_get_d10_aes3_packet (ByteIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length)
static int mxf_decrypt_triplet (AVFormatContext *s, AVPacket *pkt, KLVPacket *klv)
static int mxf_read_packet (AVFormatContext *s, AVPacket *pkt)
static int mxf_read_primer_pack (MXFContext *mxf)
static int mxf_add_metadata_set (MXFContext *mxf, void *metadata_set)
static int mxf_read_cryptographic_context (MXFCryptoContext *cryptocontext, ByteIOContext *pb, int tag, int size, UID uid)
static int mxf_read_content_storage (MXFContext *mxf, ByteIOContext *pb, int tag)
static int mxf_read_source_clip (MXFStructuralComponent *source_clip, ByteIOContext *pb, int tag)
static int mxf_read_material_package (MXFPackage *package, ByteIOContext *pb, int tag)
static int mxf_read_track (MXFTrack *track, ByteIOContext *pb, int tag)
static int mxf_read_sequence (MXFSequence *sequence, ByteIOContext *pb, int tag)
static int mxf_read_source_package (MXFPackage *package, ByteIOContext *pb, int tag)
static void mxf_read_pixel_layout (ByteIOContext *pb, MXFDescriptor *descriptor)
static int mxf_read_generic_descriptor (MXFDescriptor *descriptor, ByteIOContext *pb, int tag, int size, UID uid)
static int mxf_match_uid (const UID key, const UID uid, int len)
static const MXFCodecULmxf_get_codec_ul (const MXFCodecUL *uls, UID *uid)
static enum CodecType mxf_get_codec_type (const MXFDataDefinitionUL *uls, UID *uid)
static void * mxf_resolve_strong_ref (MXFContext *mxf, UID *strong_ref, enum MXFMetadataSetType type)
static int mxf_parse_structural_metadata (MXFContext *mxf)
static int mxf_read_local_tags (MXFContext *mxf, KLVPacket *klv, int(*read_child)(), int ctx_size, enum MXFMetadataSetType type)
static int mxf_read_header (AVFormatContext *s, AVFormatParameters *ap)
static int mxf_read_close (AVFormatContext *s)
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_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_sony_mpeg4_extradata [] = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00 }
static const MXFDataDefinitionUL mxf_data_definition_uls []
static const MXFCodecUL mxf_codec_uls []
static const MXFCodecUL mxf_picture_essence_container_uls []
static const MXFCodecUL mxf_sound_essence_container_uls []
static const
MXFMetadataReadTableEntry 
mxf_metadata_read_table []
AVInputFormat mxf_demuxer


Define Documentation

#define IS_KLV_KEY ( x,
 )     (!memcmp(x, y, sizeof(y)))

#define PRINT_KEY ( pc,
s,
 ) 

Value:

dprintf(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \
                             (x)[0], (x)[1], (x)[2], (x)[3], (x)[4], (x)[5], (x)[6], (x)[7], (x)[8], (x)[9], (x)[10], (x)[11], (x)[12], (x)[13], (x)[14], (x)[15])

Definition at line 187 of file mxf.c.

Referenced by mxf_parse_structural_metadata(), mxf_read_header(), mxf_read_local_tags(), and mxf_read_packet().


Typedef Documentation

typedef uint8_t UID[16]

Definition at line 52 of file mxf.c.


Enumeration Type Documentation

Enumerator:
AnyType 
MaterialPackage 
SourcePackage 
SourceClip 
TimecodeComponent 
Sequence 
MultipleDescriptor 
Descriptor 
Track 
CryptoContext 

Definition at line 54 of file mxf.c.

Enumerator:
Frame 
Clip 

Definition at line 152 of file mxf.c.


Function Documentation

static int64_t klv_decode_ber_length ( ByteIOContext pb  )  [static]

Definition at line 190 of file mxf.c.

Referenced by klv_read_packet(), and mxf_decrypt_triplet().

static int klv_read_packet ( KLVPacket klv,
ByteIOContext pb 
) [static]

Definition at line 218 of file mxf.c.

Referenced by mxf_read_header(), and mxf_read_packet().

static int mxf_add_metadata_set ( MXFContext mxf,
void *  metadata_set 
) [static]

Definition at line 393 of file mxf.c.

Referenced by mxf_read_local_tags().

static int mxf_decrypt_triplet ( AVFormatContext s,
AVPacket pkt,
KLVPacket klv 
) [static]

Definition at line 272 of file mxf.c.

Referenced by mxf_read_packet().

static enum CodecType mxf_get_codec_type ( const MXFDataDefinitionUL uls,
UID uid 
) [static]

Definition at line 686 of file mxf.c.

Referenced by mxf_parse_structural_metadata().

static const MXFCodecUL* mxf_get_codec_ul ( const MXFCodecUL uls,
UID uid 
) [static]

Definition at line 676 of file mxf.c.

Referenced by mxf_parse_structural_metadata().

static int mxf_get_d10_aes3_packet ( ByteIOContext pb,
AVStream st,
AVPacket pkt,
int64_t  length 
) [static]

Definition at line 244 of file mxf.c.

Referenced by mxf_read_packet().

static int mxf_get_stream_index ( AVFormatContext s,
KLVPacket klv 
) [static]

Definition at line 229 of file mxf.c.

Referenced by mxf_decrypt_triplet(), and mxf_read_packet().

static int mxf_match_uid ( const UID  key,
const UID  uid,
int  len 
) [static]

Definition at line 666 of file mxf.c.

Referenced by mxf_get_codec_type(), and mxf_get_codec_ul().

static int mxf_parse_structural_metadata ( MXFContext mxf  )  [static]

Definition at line 711 of file mxf.c.

Referenced by mxf_read_header().

static int mxf_probe ( AVProbeData p  )  [static]

Definition at line 1027 of file mxf.c.

static int mxf_read_close ( AVFormatContext s  )  [static]

Definition at line 998 of file mxf.c.

static int mxf_read_content_storage ( MXFContext mxf,
ByteIOContext pb,
int  tag 
) [static]

Definition at line 412 of file mxf.c.

static int mxf_read_cryptographic_context ( MXFCryptoContext cryptocontext,
ByteIOContext pb,
int  tag,
int  size,
UID  uid 
) [static]

Definition at line 403 of file mxf.c.

static int mxf_read_generic_descriptor ( MXFDescriptor descriptor,
ByteIOContext pb,
int  tag,
int  size,
UID  uid 
) [static]

Definition at line 558 of file mxf.c.

static int mxf_read_header ( AVFormatContext s,
AVFormatParameters ap 
) [static]

Definition at line 956 of file mxf.c.

static int mxf_read_local_tags ( MXFContext mxf,
KLVPacket klv,
int(*)()  read_child,
int  ctx_size,
enum MXFMetadataSetType  type 
) [static]

Definition at line 914 of file mxf.c.

Referenced by mxf_read_header().

static int mxf_read_material_package ( MXFPackage package,
ByteIOContext pb,
int  tag 
) [static]

Definition at line 450 of file mxf.c.

static int mxf_read_packet ( AVFormatContext s,
AVPacket pkt 
) [static]

Definition at line 331 of file mxf.c.

static void mxf_read_pixel_layout ( ByteIOContext pb,
MXFDescriptor descriptor 
) [static]

Definition at line 535 of file mxf.c.

Referenced by mxf_read_generic_descriptor().

static int mxf_read_primer_pack ( MXFContext mxf  )  [static]

Definition at line 373 of file mxf.c.

static int mxf_read_seek ( AVFormatContext s,
int  stream_index,
int64_t  sample_time,
int  flags 
) [static]

Definition at line 1045 of file mxf.c.

static int mxf_read_sequence ( MXFSequence sequence,
ByteIOContext pb,
int  tag 
) [static]

Definition at line 487 of file mxf.c.

static int mxf_read_source_clip ( MXFStructuralComponent source_clip,
ByteIOContext pb,
int  tag 
) [static]

Definition at line 429 of file mxf.c.

static int mxf_read_source_package ( MXFPackage package,
ByteIOContext pb,
int  tag 
) [static]

Definition at line 510 of file mxf.c.

static int mxf_read_sync ( ByteIOContext pb,
const uint8_t key,
unsigned  size 
) [static]

Definition at line 205 of file mxf.c.

Referenced by klv_read_packet(), and mxf_read_header().

static int mxf_read_track ( MXFTrack track,
ByteIOContext pb,
int  tag 
) [static]

Definition at line 467 of file mxf.c.

static void* mxf_resolve_strong_ref ( MXFContext mxf,
UID strong_ref,
enum MXFMetadataSetType  type 
) [static]

Definition at line 696 of file mxf.c.

Referenced by mxf_parse_structural_metadata().


Variable Documentation

const MXFCodecUL mxf_codec_uls[] [static]

Initial value:

 {
    
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x01,0x11,0x00 }, 14, CODEC_ID_MPEG2VIDEO }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x01 }, 14, CODEC_ID_MPEG2VIDEO }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x03,0x03,0x00 }, 14, CODEC_ID_MPEG2VIDEO }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x04,0x02,0x00 }, 14, CODEC_ID_MPEG2VIDEO }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x20,0x02,0x03 }, 14,      CODEC_ID_MPEG4 }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x01,0x02,0x00 }, 13,    CODEC_ID_DVVIDEO }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x07,0x04,0x01,0x02,0x02,0x03,0x01,0x01,0x00 }, 14,   CODEC_ID_JPEG2000 }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x01,0x7F,0x00,0x00,0x00 }, 13,   CODEC_ID_RAWVIDEO }, 
    
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, 13,  CODEC_ID_PCM_S16LE }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x7F,0x00,0x00,0x00 }, 13,  CODEC_ID_PCM_S16LE },
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x07,0x04,0x02,0x02,0x01,0x7E,0x00,0x00,0x00 }, 13,  CODEC_ID_PCM_S16BE }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x04,0x04,0x02,0x02,0x02,0x03,0x01,0x01,0x00 }, 15,   CODEC_ID_PCM_ALAW }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x01,0x00 }, 15,        CODEC_ID_AC3 },
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x05,0x00 }, 15,        CODEC_ID_MP2 }, 
  
    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,       CODEC_ID_NONE },
}

Definition at line 628 of file mxf.c.

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]

Definition at line 180 of file mxf.c.

Referenced by mxf_read_cryptographic_context().

Initial value:

 {
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x01,0x03,0x02,0x02,0x01,0x00,0x00,0x00 }, CODEC_TYPE_VIDEO },
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x01,0x03,0x02,0x02,0x02,0x00,0x00,0x00 }, CODEC_TYPE_AUDIO },
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x05,0x01,0x03,0x02,0x02,0x02,0x02,0x00,0x00 }, CODEC_TYPE_AUDIO },
    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  CODEC_TYPE_DATA },
}

Definition at line 621 of file mxf.c.

Initial value:

Definition at line 1060 of file mxf.c.

const uint8_t mxf_encrypted_essence_container[] = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0b,0x01,0x00 } [static]

Definition at line 182 of file mxf.c.

Referenced by mxf_parse_structural_metadata().

const uint8_t mxf_encrypted_triplet_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 } [static]

Definition at line 181 of file mxf.c.

Referenced by mxf_read_header(), and mxf_read_packet().

const uint8_t mxf_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 } [static]

Definition at line 177 of file mxf.c.

Referenced by mxf_decrypt_triplet(), mxf_get_stream_index(), mxf_read_header(), and mxf_read_packet().

const uint8_t mxf_header_partition_pack_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 } [static]

Definition at line 176 of file mxf.c.

Referenced by mxf_probe(), and mxf_read_header().

const uint8_t mxf_klv_key[] = { 0x06,0x0e,0x2b,0x34 } [static]

Definition at line 178 of file mxf.c.

Referenced by klv_read_packet().

Initial value:

 {
    { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x05,0x01,0x00 }, mxf_read_primer_pack },
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x18,0x00 }, mxf_read_content_storage, 0, AnyType },
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x37,0x00 }, mxf_read_source_package, sizeof(MXFPackage), SourcePackage },
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x36,0x00 }, mxf_read_material_package, sizeof(MXFPackage), MaterialPackage },
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x0F,0x00 }, mxf_read_sequence, sizeof(MXFSequence), Sequence },
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x11,0x00 }, mxf_read_source_clip, sizeof(MXFStructuralComponent), SourceClip },
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x44,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), MultipleDescriptor },
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x42,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, 
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x28,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, 
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x29,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, 
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x51,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, 
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x48,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, 
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x47,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, 
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x3A,0x00 }, mxf_read_track, sizeof(MXFTrack), Track }, 
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x3B,0x00 }, mxf_read_track, sizeof(MXFTrack), Track }, 
    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x04,0x01,0x02,0x02,0x00,0x00 }, mxf_read_cryptographic_context, sizeof(MXFCryptoContext), CryptoContext },
    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, NULL, 0, AnyType },
}

Definition at line 894 of file mxf.c.

Initial value:

 {
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, 14, CODEC_ID_MPEG2VIDEO }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x41,0x01 }, 14,    CODEC_ID_DVVIDEO }, 
    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,       CODEC_ID_NONE },
}

Definition at line 649 of file mxf.c.

const uint8_t mxf_sony_mpeg4_extradata[] = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00 } [static]

Definition at line 183 of file mxf.c.

Referenced by mxf_read_generic_descriptor().

Initial value:

 {
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 }, 14, CODEC_ID_PCM_S16LE }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x40,0x01 }, 14,       CODEC_ID_MP2 }, 
    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x01,0x01 }, 14, CODEC_ID_PCM_S16LE }, 
    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,      CODEC_ID_NONE },
}

Definition at line 655 of file mxf.c.


Generated on Fri Oct 3 22:47:00 2008 for ffmpeg by  doxygen 1.5.6