[FFmpeg-soc] mxfenc.c version 0.0.5
Michael Niedermayer
michaelni at gmx.at
Sun Aug 3 18:02:08 CEST 2008
On Sun, Aug 03, 2008 at 10:58:15PM +0800, zhentan feng wrote:
> Hi
>
> 2008/8/3 Michael Niedermayer <michaelni at gmx.at>
>
> > On Sat, Aug 02, 2008 at 11:26:38PM +0800, zhentan feng wrote:
> > > Hi,
> > > I fixed the bugs and modified some structs according to the former
> > reviews,
> > > and test the code by valgrind and elminated the mem leaks.
> > >
> > > here is new version attached below.
> > [...]
> > > #define DEBUG
> > >
> > > #include "libavutil/random.h"
> > > #include "avformat.h"
> > > #include "libavcodec/bytestream.h"
> > >
> >
> > > typedef uint8_t UID[16];
> > > typedef uint8_t UMID[32];
> > >
> > > enum MXFMetadataSetType {
> > > MaterialPackage,
> > > SourcePackage,
> > > };
> > >
> > > typedef struct {
> > > UID key;
> > > offset_t offset;
> > > uint64_t length;
> > > } KLVPacket;
> > >
> > > typedef struct {
> > > UID uid;
> > > unsigned matching_len;
> > > enum CodecID id;
> > > } MXFCodecUL;
> >
> > These are also in mxf.c, maybe its time to factor out common things into a
> > common header?
>
>
> IIRC,Baptiste said he will extract the common code.
ok, thats fine as well
[...]
>
>
>
> >
> > [...]
> > > static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len)
> > > {
> > > // Determine the best BER size
> > > int size = 0;
> > > uint64_t tmp = len;
> > > if (len < 128) {
> > > //short form
> > > put_byte(pb, len);
> > > return 1;
> > > }
> > >
> >
> > > while (tmp) {
> > > tmp >>= 8;
> > > size ++;
> > > }
> >
> > size= av_log2(tmp)>>3;
> >
>
> Reimar.Doeffinge mentioned this former.
> but the type of len is uint64_t,
> it seems don't compatible with av_log2() param.
> Is it necessary to implement av_log2_64bit() in common.h?
It does not appear that klv_encode_ber_length() is currently used for
anything that could be larger than 32bit. packets arent and the stuff in
the header shouldnt either, the filesize could certainly but that isnt
stored with klv_encode_ber_length().
I do not know mxf at all so maybe there are some future things planned
in the muxer that would need a 64bit len?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20080803/b0ed688b/attachment.pgp>
More information about the FFmpeg-soc
mailing list