Originally committed as revision 14975 to svn://svn.ffmpeg.org/ffmpeg/trunk
Carl Eugen Hoyos authored on 2008/08/27 00:58:25... | ... |
@@ -109,6 +109,7 @@ OBJS-$(CONFIG_MSNWC_TCP_DEMUXER) += msnwc_tcp.o |
109 | 109 |
OBJS-$(CONFIG_MTV_DEMUXER) += mtv.o |
110 | 110 |
OBJS-$(CONFIG_MVI_DEMUXER) += mvi.o |
111 | 111 |
OBJS-$(CONFIG_MXF_DEMUXER) += mxfdec.o mxf.o |
112 |
+OBJS-$(CONFIG_MXF_MUXER) += mxfenc.o mxf.o |
|
112 | 113 |
OBJS-$(CONFIG_NSV_DEMUXER) += nsvdec.o |
113 | 114 |
OBJS-$(CONFIG_NULL_MUXER) += raw.o |
114 | 115 |
OBJS-$(CONFIG_NUT_DEMUXER) += nutdec.o nut.o riff.o |
... | ... |
@@ -124,7 +124,7 @@ void av_register_all(void) |
124 | 124 |
REGISTER_DEMUXER (MSNWC_TCP, msnwc_tcp); |
125 | 125 |
REGISTER_DEMUXER (MTV, mtv); |
126 | 126 |
REGISTER_DEMUXER (MVI, mvi); |
127 |
- REGISTER_DEMUXER (MXF, mxf); |
|
127 |
+ REGISTER_MUXDEMUX (MXF, mxf); |
|
128 | 128 |
REGISTER_DEMUXER (NSV, nsv); |
129 | 129 |
REGISTER_MUXER (NULL, null); |
130 | 130 |
REGISTER_MUXDEMUX (NUT, nut); |
... | ... |
@@ -63,7 +63,7 @@ typedef struct { |
63 | 63 |
|
64 | 64 |
extern const MXFDataDefinitionUL ff_mxf_data_definition_uls[]; |
65 | 65 |
extern const MXFCodecUL ff_mxf_codec_uls[]; |
66 |
-extern const MXFCodecUL ff_mxf_essence_container_uls[]; |
|
66 |
+extern const MXFCodecUL ff_mxf_essence_container_uls[6]; |
|
67 | 67 |
|
68 | 68 |
#ifdef DEBUG |
69 | 69 |
#define PRINT_KEY(pc, s, x) dprintf(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \ |
... | ... |
@@ -245,6 +245,42 @@ static const MXFDataDefinitionUL *mxf_get_data_definition_ul(enum CodecType type |
245 | 245 |
return uls; |
246 | 246 |
} |
247 | 247 |
|
248 |
+static int mxf_write_essence_container_refs(AVFormatContext *s, int write) |
|
249 |
+{ |
|
250 |
+ ByteIOContext *pb = s->pb; |
|
251 |
+ AVStream *st; |
|
252 |
+ int i, count = 0, j = 0; |
|
253 |
+ const MXFCodecUL *codec_ul; |
|
254 |
+ int essence_container_ul_sign[sizeof(ff_mxf_essence_container_uls) / sizeof(MXFCodecUL)] = { 0 }; |
|
255 |
+ |
|
256 |
+ for (codec_ul = ff_mxf_essence_container_uls; codec_ul->id; codec_ul++) { |
|
257 |
+ for (i = 0; i < s->nb_streams; i++) { |
|
258 |
+ st = s->streams[i]; |
|
259 |
+ if (st->codec->codec_id == codec_ul->id) { |
|
260 |
+ essence_container_ul_sign[count] = j; |
|
261 |
+ count++; |
|
262 |
+ break; |
|
263 |
+ } |
|
264 |
+ } |
|
265 |
+ j++; |
|
266 |
+ // considering WAV/AES3 frame wrapped, when get the first CODEC_ID_PCM_S16LE, break; |
|
267 |
+ // this is a temporary method, when we can get more information, modofy this. |
|
268 |
+ if (codec_ul->id == CODEC_ID_PCM_S16LE) |
|
269 |
+ break; |
|
270 |
+ } |
|
271 |
+ |
|
272 |
+ if (write) { |
|
273 |
+ mxf_write_refs_count(pb, count); |
|
274 |
+ for (i = 0; i < count; i++) { |
|
275 |
+ put_buffer(pb, ff_mxf_essence_container_uls[essence_container_ul_sign[i]].uid, 16); |
|
276 |
+ } |
|
277 |
+ av_log(s,AV_LOG_DEBUG, "essence container count:%d\n", count); |
|
278 |
+ for (i = 0; i < count; i++) |
|
279 |
+ PRINT_KEY(s, "essence container ul:\n", ff_mxf_essence_container_uls[essence_container_ul_sign[i]].uid); |
|
280 |
+ } |
|
281 |
+ return count; |
|
282 |
+} |
|
283 |
+ |
|
248 | 284 |
static void mxf_write_preface(AVFormatContext *s) |
249 | 285 |
{ |
250 | 286 |
MXFContext *mxf = s->priv_data; |