comparison mxfenc.c @ 4345:8e3538adb529 libavformat

more flexible mapping selection
author bcoudurier
date Mon, 02 Feb 2009 10:54:10 +0000
parents 582124bb2c15
children 0a142b4b841e
comparison
equal deleted inserted replaced
4344:582124bb2c15 4345:8e3538adb529
73 73
74 typedef struct { 74 typedef struct {
75 UID container_ul; 75 UID container_ul;
76 UID element_ul; 76 UID element_ul;
77 UID codec_ul; 77 UID codec_ul;
78 enum CodecID id;
79 void (*write_desc)(); 78 void (*write_desc)();
80 } MXFContainerEssenceEntry; 79 } MXFContainerEssenceEntry;
80
81 static const struct {
82 enum CodecID id;
83 int index;
84 } mxf_essence_mappings[] = {
85 { CODEC_ID_MPEG2VIDEO, 0 },
86 { CODEC_ID_PCM_S16LE, 1 },
87 { 0 }
88 };
81 89
82 static void mxf_write_wav_desc(AVFormatContext *s, AVStream *st); 90 static void mxf_write_wav_desc(AVFormatContext *s, AVStream *st);
83 static void mxf_write_aes3_desc(AVFormatContext *s, AVStream *st); 91 static void mxf_write_aes3_desc(AVFormatContext *s, AVStream *st);
84 static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st); 92 static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st);
85 93
86 static const MXFContainerEssenceEntry mxf_essence_container_uls[] = { 94 static const MXFContainerEssenceEntry mxf_essence_container_uls[] = {
87 { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, 95 { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 },
88 { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x15,0x01,0x05,0x00 }, 96 { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x15,0x01,0x05,0x00 },
89 { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x00,0x00,0x00 }, 97 { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x00,0x00,0x00 },
90 CODEC_ID_MPEG2VIDEO, mxf_write_mpegvideo_desc }, 98 mxf_write_mpegvideo_desc },
91 { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x03,0x00 }, 99 { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x03,0x00 },
92 { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x16,0x01,0x03,0x00 }, 100 { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x16,0x01,0x03,0x00 },
93 { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, 101 { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
94 CODEC_ID_PCM_S16LE, mxf_write_aes3_desc }, 102 mxf_write_aes3_desc },
95 { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 }, 103 { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 },
96 { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x16,0x01,0x01,0x00 }, 104 { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x16,0x01,0x01,0x00 },
97 { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, 105 { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
98 CODEC_ID_PCM_S16LE, mxf_write_wav_desc }, 106 mxf_write_wav_desc },
99 { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 107 { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
100 { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 108 { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
101 { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 109 { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
102 CODEC_ID_NONE, NULL }, 110 NULL },
103 }; 111 };
104 112
105 typedef struct MXFContext { 113 typedef struct MXFContext {
106 int64_t footer_partition_offset; 114 int64_t footer_partition_offset;
107 int essence_container_count; 115 int essence_container_count;
262 * Get essence container ul index 270 * Get essence container ul index
263 */ 271 */
264 static int mxf_get_essence_container_ul_index(enum CodecID id) 272 static int mxf_get_essence_container_ul_index(enum CodecID id)
265 { 273 {
266 int i; 274 int i;
267 for (i = 0; i < FF_ARRAY_ELEMS(mxf_essence_container_uls); i++) 275 for (i = 0; mxf_essence_mappings[i].id; i++)
268 if (mxf_essence_container_uls[i].id == id) 276 if (mxf_essence_mappings[i].id == id)
269 return i; 277 return mxf_essence_mappings[i].index;
270 return -1; 278 return -1;
271 } 279 }
272 280
273 static void mxf_write_primer_pack(AVFormatContext *s) 281 static void mxf_write_primer_pack(AVFormatContext *s)
274 { 282 {