[FFmpeg-soc] MXF muxer version 0.0.4

zhentan feng spyfeng at gmail.com
Mon Aug 25 17:38:39 CEST 2008


Hi

2008/8/25 Michael Niedermayer <michaelni at gmx.at>

> [...]
>
> > Index: libavformat/mxfenc.c
> > ===================================================================
> > --- libavformat/mxfenc.c      (revision 14965)
> > +++ libavformat/mxfenc.c      (working copy)
> > @@ -245,6 +245,42 @@
> >      return uls;
> >  }
> >
> > +static int mxf_write_essence_container_refs(AVFormatContext *s, int
> write)
> > +{
> > +    ByteIOContext *pb = s->pb;
> > +    AVStream *st;
> > +    int i, count = 0, j = 0;
> > +    int essence_container_ul_sign[1024] = { 0 };
>
> this doesnt solve the problem
> the size of this array should match that of ff_mxf_essence_container_uls
>

here is the patch from svn soc:

Modified: mxf/mxf.h
==============================
================================================
--- mxf/mxf.h   (original)
+++ mxf/mxf.h   Mon Aug 25 17:04:16 2008
@@ -63,7 +63,7 @@ typedef struct {

 extern const MXFDataDefinitionUL ff_mxf_data_definition_uls[];
 extern const MXFCodecUL ff_mxf_codec_uls[];
-extern const MXFCodecUL ff_mxf_essence_container_uls[];
+extern const MXFCodecUL ff_mxf_essence_container_uls[6];

 #ifdef DEBUG
 #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, \

Modified: mxf/mxfenc.c
==============================================================================
--- mxf/mxfenc.c        (original)
+++ mxf/mxfenc.c        Mon Aug 25 17:04:16 2008
@@ -250,8 +250,8 @@ static int mxf_write_essence_container_r
    ByteIOContext *pb = s->pb;
    AVStream *st;
    int i, count = 0, j = 0;
-    int essence_container_ul_sign[1024] = { 0 };
    const MXFCodecUL *codec_ul;
+    int essence_container_ul_sign[sizeof(ff_mxf_essence_container_uls) /
sizeof(MXFCodecUL)] = { 0 };

    for (codec_ul = ff_mxf_essence_container_uls; codec_ul->id; codec_ul++)
{
        for (i = 0; i < s->nb_streams; i++) {



>
>
> [...]
>
> > @@ -612,8 +634,8 @@
> >      put_be32(pb, st->codec->height);
> >
> >      mxf_write_local_tag(pb, 8, 0x320E);
> > -    put_be32(pb, st->codec->height * st->sample_aspect_ratio.den);
> > -    put_be32(pb, st->codec->width  * st->sample_aspect_ratio.num);
> > +    put_be32(pb, st->codec->height *
> st->codec->sample_aspect_ratio.den);
> > +    put_be32(pb, st->codec->width * st->codec->sample_aspect_ratio.num);
> >
> >      // tmp write, will modified later
> >      mxf_write_local_tag(pb, 16, 0x3201);
>
> This should not be needed
> st->sample_aspect_ratio and st->codec->sample_aspect_ratio should be
> identical
> if they are not, then there is a bug elsewhere in libavformat
>

yes, I use an old version ffmpeg, so st->sample_aspect_ratio is error for
that.
now I move to latest work copy.

>
>
>
> > @@ -773,6 +795,20 @@
> >      return -1;
> >  }
> >
> > +static int mux_write_packet(AVFormatContext *s, AVPacket *pkt)
> > +{
> > +    ByteIOContext *pb = s->pb;
> > +    AVStream *st = s->streams[pkt->stream_index];
> > +    MXFStreamContext *sc = st->priv_data;
> > +
> > +    put_buffer(pb, sc->track_essence_element_key, 16); // write key
> > +    klv_encode_ber_length(pb, pkt->size); // write length
> > +    put_buffer(pb, pkt->data, pkt->size); // write value
> > +
> > +    put_flush_packet(pb);
> > +    return 0;
> > +}
> > +
> >  static void mxf_update_header_partition(AVFormatContext *s, int64_t
> footer_partition_offset)
> >  {
> >      MXFContext *mxf = s->priv_data;
>
> ok
>

once the ok-ed parts are committed, I'll submit new patch with ffmpeg trunk.
thanks very much.
-- 
Best wishes~



More information about the FFmpeg-soc mailing list