[FFmpeg-soc] [soc]: r3461 - in mxf: mxf.h mxfdec.c mxfenc.c

spyfeng subversion at mplayerhq.hu
Tue Aug 19 17:51:24 CEST 2008


Author: spyfeng
Date: Tue Aug 19 17:51:24 2008
New Revision: 3461

Log:
#ifndef DEBUG, define PRINT_KEY as  NULL.
so, remove #ifdef DEBUG and #endif lines


Modified:
   mxf/mxf.h
   mxf/mxfdec.c
   mxf/mxfenc.c

Modified: mxf/mxf.h
==============================================================================
--- mxf/mxf.h	(original)
+++ mxf/mxf.h	Tue Aug 19 17:51:24 2008
@@ -20,7 +20,6 @@
  */
 #ifndef FFMPEG_MXF_H
 #define FFMPEG_MXF_H
-
 #include "avformat.h"
 #include "libavcodec/bytestream.h"
 
@@ -64,7 +63,11 @@ extern const MXFDataDefinitionUL ff_mxf_
 extern const MXFCodecUL ff_mxf_codec_uls[];
 extern const MXFCodecUL ff_mxf_essence_container_uls[];
 
+#ifndef DEBUG
+#define PRINT_KEY(pc, s, x)
+#else
 #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, \
                              (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])
+#endif
 
 #endif /* FFMPEG_MXF_H */

Modified: mxf/mxfdec.c
==============================================================================
--- mxf/mxfdec.c	(original)
+++ mxf/mxfdec.c	Tue Aug 19 17:51:24 2008
@@ -299,9 +299,7 @@ static int mxf_read_packet(AVFormatConte
     while (!url_feof(s->pb)) {
         if (klv_read_packet(&klv, s->pb) < 0)
             return -1;
-#ifdef DEBUG
         PRINT_KEY(s, "read packet", klv.key);
-#endif
         if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) {
             int res = mxf_decrypt_triplet(s, pkt, &klv);
             if (res < 0) {
@@ -726,9 +724,7 @@ static int mxf_parse_structural_metadata
             return -1;
         }
 
-#ifdef DEBUG
         PRINT_KEY(mxf->fc, "data definition   ul", source_track->sequence->data_definition_ul);
-#endif
         st->codec->codec_type = mxf_get_codec_type(ff_mxf_data_definition_uls, &source_track->sequence->data_definition_ul);
 
         source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref, AnyType);
@@ -753,10 +749,8 @@ static int mxf_parse_structural_metadata
             av_log(mxf->fc, AV_LOG_INFO, "source track %d: stream %d, no descriptor found\n", source_track->track_id, st->index);
             continue;
         }
-#ifdef DEBUG
         PRINT_KEY(mxf->fc, "essence codec     ul", descriptor->essence_codec_ul);
         PRINT_KEY(mxf->fc, "essence container ul", descriptor->essence_container_ul);
-#endif
         essence_container_ul = &descriptor->essence_container_ul;
         /* HACK: replacing the original key with mxf_encrypted_essence_container
          * is not allowed according to s429-6, try to find correct information anyway */
@@ -860,9 +854,7 @@ static int mxf_read_local_tags(MXFContex
                 if (local_tag == tag) {
                     memcpy(uid, mxf->local_tags+i*18+2, 16);
                     dprintf(mxf->fc, "local tag 0x%04X\n", local_tag);
-#ifdef DEBUG
                     PRINT_KEY(mxf->fc, "uid", uid);
-#endif
                 }
             }
         }
@@ -893,9 +885,7 @@ static int mxf_read_header(AVFormatConte
 
         if (klv_read_packet(&klv, s->pb) < 0)
             return -1;
-#ifdef DEBUG
         PRINT_KEY(s, "read header", klv.key);
-#endif
         if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) ||
             IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
             /* FIXME avoid seek */

Modified: mxf/mxfenc.c
==============================================================================
--- mxf/mxfenc.c	(original)
+++ mxf/mxfenc.c	Tue Aug 19 17:51:24 2008
@@ -280,11 +280,9 @@ static int mxf_write_essence_container_r
         for (i = 0; i < count; i++) {
             put_buffer(pb, ff_mxf_essence_container_uls[essence_container_ul_sign[i]].uid, 16);
         }
-#ifdef DEBUG
         av_log(s,AV_LOG_DEBUG, "essence container count:%d\n", count);
         for (i = 0; i < count; i++)
             PRINT_KEY(s, "essence container ul:\n", ff_mxf_essence_container_uls[essence_container_ul_sign[i]].uid);
-#endif
     }
     return mxf->essence_container_count;
 }
@@ -295,17 +293,13 @@ static int mxf_write_preface(AVFormatCon
     ByteIOContext *pb = s->pb;
 
     mxf_write_metadata_key(pb, 0x012f00);
-#ifdef DEBUG
     PRINT_KEY(s, "preface key", pb->buf_ptr - 16);
-#endif
     klv_encode_ber_length(pb, 130 + 16 * mxf->essence_container_count);
 
     // write preface set uid
     mxf_write_local_tag(pb, 16, 0x3C0A);
     mxf_write_uuid(pb, Preface, 0);
-#ifdef DEBUG
     PRINT_KEY(s, "preface uid", pb->buf_ptr - 16);
-#endif
 
     // write create date as unknown
     mxf_write_local_tag(pb, 8, 0x3B02);
@@ -343,9 +337,7 @@ static int mxf_write_identification(AVFo
     int length, company_name_len, product_name_len, version_string_len;
 
     mxf_write_metadata_key(pb, 0x013000);
-#ifdef DEBUG
     PRINT_KEY(s, "identification key", pb->buf_ptr - 16);
-#endif
     company_name_len = sizeof("FFmpeg");
     product_name_len = sizeof("OP1a Muxer");
 
@@ -359,9 +351,7 @@ static int mxf_write_identification(AVFo
     // write uid
     mxf_write_local_tag(pb, 16, 0x3C0A);
     mxf_write_uuid(pb, Identification, 0);
-#ifdef DEBUG
     PRINT_KEY(s, "identification uid", pb->buf_ptr - 16);
-#endif
     // write generation uid
     mxf_write_local_tag(pb, 16, 0x3C09);
     mxf_write_uuid(pb, Identification, 1);
@@ -392,17 +382,13 @@ static int mxf_write_content_storage(AVF
     ByteIOContext *pb = s->pb;
 
     mxf_write_metadata_key(pb, 0x011800);
-#ifdef DEBUG
     PRINT_KEY(s, "content storage key", pb->buf_ptr - 16);
-#endif
     klv_encode_ber_length(pb, 64);
 
     // write uid
     mxf_write_local_tag(pb, 16, 0x3C0A);
     mxf_write_uuid(pb, ContentStorage, 0);
-#ifdef DEBUG
     PRINT_KEY(s, "content storage uid", pb->buf_ptr - 16);
-#endif
     // write package reference
     mxf_write_local_tag(pb, 16 * 2 + 8, 0x1901);
     mxf_write_refs_count(pb, 2);
@@ -418,26 +404,20 @@ static int mxf_write_package(AVFormatCon
 
     if (type == MaterialPackage) {
         mxf_write_metadata_key(pb, 0x013600);
-#ifdef DEBUG
-    PRINT_KEY(s, "Material Package key", pb->buf_ptr - 16);
-#endif
+        PRINT_KEY(s, "Material Package key", pb->buf_ptr - 16);
         klv_encode_ber_length(pb, 92 + 16 * s->nb_streams);
     }
     else {
         mxf_write_metadata_key(pb, 0x013700);
-#ifdef DEBUG
-    PRINT_KEY(s, "Source Package key", pb->buf_ptr - 16);
-#endif
+        PRINT_KEY(s, "Source Package key", pb->buf_ptr - 16);
         klv_encode_ber_length(pb, 112 + 16 * s->nb_streams); // 20 bytes length for descriptor reference
     }
 
     // write uid
     mxf_write_local_tag(pb, 16, 0x3C0A);
     mxf_write_uuid(pb, type, 0);
-#ifdef DEBUG
     av_log(s,AV_LOG_DEBUG, "package type:%d\n", type);
     PRINT_KEY(s, "package uid", pb->buf_ptr - 16);
-#endif
 
     // write package umid
     mxf_write_local_tag(pb, 32, 0x4401);
@@ -446,9 +426,7 @@ static int mxf_write_package(AVFormatCon
     } else {
         mxf_write_umid(pb, SourcePackage, 0);
     }
-#ifdef DEBUG
     PRINT_KEY(s, "package umid second part", pb->buf_ptr - 16);
-#endif
     // write create date
     mxf_write_local_tag(pb, 8, 0x4405);
     put_be64(pb, 0);
@@ -480,9 +458,7 @@ static int mxf_write_track(AVFormatConte
     int i = 0;
 
     mxf_write_metadata_key(pb, 0x013b00);
-#ifdef DEBUG
     PRINT_KEY(s, "track key", pb->buf_ptr - 16);
-#endif
     klv_encode_ber_length(pb, 80);
 
     st = s->streams[stream_index];
@@ -491,9 +467,7 @@ static int mxf_write_track(AVFormatConte
     // write track uid
     mxf_write_local_tag(pb, 16, 0x3C0A);
     mxf_write_uuid(pb, type == MaterialPackage ? Track : Track + 0xf0, stream_index);
-#ifdef DEBUG
     PRINT_KEY(s, "track uid", pb->buf_ptr - 16);
-#endif
     // write track id
     mxf_write_local_tag(pb, 4, 0x4801);
     put_be32(pb, stream_index);
@@ -552,9 +526,7 @@ static int mxf_write_sequence(AVFormatCo
     AVStream *st;
 
     mxf_write_metadata_key(pb, 0x010f00);
-#ifdef DEBUG
     PRINT_KEY(s, "sequence key", pb->buf_ptr - 16);
-#endif
     klv_encode_ber_length(pb, 80);
 
     st = s->streams[stream_index];
@@ -562,9 +534,7 @@ static int mxf_write_sequence(AVFormatCo
     mxf_write_local_tag(pb, 16, 0x3C0A);
     mxf_write_uuid(pb, type == MaterialPackage ? Sequence: Sequence + 0xf0, stream_index);
 
-#ifdef DEBUG
     PRINT_KEY(s, "sequence uid", pb->buf_ptr - 16);
-#endif
     mxf_write_common_fields(pb, st);
 
     // write structural component
@@ -581,9 +551,7 @@ static int mxf_write_structural_componen
     int i;
 
     mxf_write_metadata_key(pb, 0x011100);
-#ifdef DEBUG
     PRINT_KEY(s, "sturctural component key", pb->buf_ptr - 16);
-#endif
     klv_encode_ber_length(pb, 108);
 
     st = s->streams[stream_index];
@@ -592,9 +560,7 @@ static int mxf_write_structural_componen
     mxf_write_local_tag(pb, 16, 0x3C0A);
     mxf_write_uuid(pb, type == MaterialPackage ? SourceClip: SourceClip + 0xf0, stream_index);
 
-#ifdef DEBUG
     PRINT_KEY(s, "structural component uid", pb->buf_ptr - 16);
-#endif
     mxf_write_common_fields(pb, st);
 
     // write start_position
@@ -625,16 +591,12 @@ static int mxf_write_multi_descriptor(AV
     int i;
 
     mxf_write_metadata_key(pb, 0x014400);
-#ifdef DEBUG
     PRINT_KEY(s, "multiple descriptor key", pb->buf_ptr - 16);
-#endif
     klv_encode_ber_length(pb, 64 + 16 * s->nb_streams);
 
     mxf_write_local_tag(pb, 16, 0x3C0A);
     mxf_write_uuid(pb, MultipleDescriptor, 0);
-#ifdef DEBUG
     PRINT_KEY(s, "multi_desc uid", pb->buf_ptr - 16);
-#endif
     // write sample rate
     // SMPTE377M D.1 says this field is necessary,
     // but mxf.c actually do not read the field,so we set 0 as default.



More information about the FFmpeg-soc mailing list