[FFmpeg-cvslog] r9801 - in trunk/libavformat: gxf.c gxf.h gxfenc.c

aurel subversion
Thu Jul 26 15:01:09 CEST 2007


Author: aurel
Date: Thu Jul 26 15:01:09 2007
New Revision: 9801

Log:
replaces hardcoded values by the equivalent enum definitions

Modified:
   trunk/libavformat/gxf.c
   trunk/libavformat/gxf.h
   trunk/libavformat/gxfenc.c

Modified: trunk/libavformat/gxf.c
==============================================================================
--- trunk/libavformat/gxf.c	(original)
+++ trunk/libavformat/gxf.c	Thu Jul 26 15:01:09 2007
@@ -20,33 +20,7 @@
  */
 #include "avformat.h"
 #include "common.h"
-
-typedef enum {
-    PKT_MAP = 0xbc,
-    PKT_MEDIA = 0xbf,
-    PKT_EOS = 0xfb,
-    PKT_FLT = 0xfc,
-    PKT_UMF = 0xfd
-} pkt_type_t;
-
-typedef enum {
-    MAT_NAME = 0x40,
-    MAT_FIRST_FIELD = 0x41,
-    MAT_LAST_FIELD = 0x42,
-    MAT_MARK_IN = 0x43,
-    MAT_MARK_OUT = 0x44,
-    MAT_SIZE = 0x45
-} mat_tag_t;
-
-typedef enum {
-    TRACK_NAME = 0x4c,
-    TRACK_AUX = 0x4d,
-    TRACK_VER = 0x4e,
-    TRACK_MPG_AUX = 0x4f,
-    TRACK_FPS = 0x50,
-    TRACK_LINES = 0x51,
-    TRACK_FPF = 0x52
-} track_tag_t;
+#include "gxf.h"
 
 typedef struct {
     int64_t first_field;

Modified: trunk/libavformat/gxf.h
==============================================================================
--- trunk/libavformat/gxf.h	(original)
+++ trunk/libavformat/gxf.h	Thu Jul 26 15:01:09 2007
@@ -31,4 +31,23 @@ typedef enum {
     PKT_UMF = 0xfd
 } pkt_type_t;
 
+typedef enum {
+    MAT_NAME        = 0x40,
+    MAT_FIRST_FIELD = 0x41,
+    MAT_LAST_FIELD  = 0x42,
+    MAT_MARK_IN     = 0x43,
+    MAT_MARK_OUT    = 0x44,
+    MAT_SIZE        = 0x45,
+} mat_tag_t;
+
+typedef enum {
+    TRACK_NAME      = 0x4c,
+    TRACK_AUX       = 0x4d,
+    TRACK_VER       = 0x4e,
+    TRACK_MPG_AUX   = 0x4f,
+    TRACK_FPS       = 0x50,
+    TRACK_LINES     = 0x51,
+    TRACK_FPF       = 0x52,
+} track_tag_t;
+
 #endif /* FFMPEG_GXF_H */

Modified: trunk/libavformat/gxfenc.c
==============================================================================
--- trunk/libavformat/gxfenc.c	(original)
+++ trunk/libavformat/gxfenc.c	Thu Jul 26 15:01:09 2007
@@ -187,7 +187,7 @@ static int gxf_write_mpeg_auxiliary(Byte
                     (float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop,
                     ctx->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, ctx->first_gop_closed == 1,
                     ctx->codec->height / 16);
-    put_byte(pb, 0x4F);
+    put_byte(pb, TRACK_MPG_AUX);
     put_byte(pb, size + 1);
     put_buffer(pb, (uint8_t *)buffer, size + 1);
     return size + 3;
@@ -217,7 +217,7 @@ static int gxf_write_track_description(B
     put_be16(pb, 0); /* size */
 
     /* media file name */
-    put_byte(pb, 0x4C);
+    put_byte(pb, TRACK_NAME);
     put_byte(pb, strlen(ES_NAME_PATTERN) + 3);
     put_tag(pb, ES_NAME_PATTERN);
     put_be16(pb, stream->media_info);
@@ -225,7 +225,7 @@ static int gxf_write_track_description(B
 
     if (stream->codec->codec_id != CODEC_ID_MPEG2VIDEO) {
         /* auxiliary information */
-        put_byte(pb, 0x4D);
+        put_byte(pb, TRACK_AUX);
         put_byte(pb, 8);
         if (stream->codec->codec_id == CODEC_ID_NONE)
             gxf_write_timecode_auxiliary(pb, stream);
@@ -234,7 +234,7 @@ static int gxf_write_track_description(B
     }
 
     /* file system version */
-    put_byte(pb, 0x4E);
+    put_byte(pb, TRACK_VER);
     put_byte(pb, 4);
     put_be32(pb, 0);
 
@@ -242,17 +242,17 @@ static int gxf_write_track_description(B
         gxf_write_mpeg_auxiliary(pb, stream);
 
     /* frame rate */
-    put_byte(pb, 0x50);
+    put_byte(pb, TRACK_FPS);
     put_byte(pb, 4);
     put_be32(pb, stream->frame_rate_index);
 
     /* lines per frame */
-    put_byte(pb, 0x51);
+    put_byte(pb, TRACK_LINES);
     put_byte(pb, 4);
     put_be32(pb, stream->lines_index);
 
     /* fields per frame */
-    put_byte(pb, 0x52);
+    put_byte(pb, TRACK_FPF);
     put_byte(pb, 4);
     put_be32(pb, stream->fields);
 
@@ -272,33 +272,33 @@ static int gxf_write_material_data_secti
         filename++;
     else
         filename = ctx->fc->filename;
-    put_byte(pb, 0x40);
+    put_byte(pb, MAT_NAME);
     put_byte(pb, strlen(SERVER_PATH) + strlen(filename) + 1);
     put_tag(pb, SERVER_PATH);
     put_tag(pb, filename);
     put_byte(pb, 0);
 
     /* first field */
-    put_byte(pb, 0x41);
+    put_byte(pb, MAT_FIRST_FIELD);
     put_byte(pb, 4);
     put_be32(pb, 0);
 
     /* last field */
-    put_byte(pb, 0x42);
+    put_byte(pb, MAT_LAST_FIELD);
     put_byte(pb, 4);
     put_be32(pb, ctx->nb_frames);
 
     /* reserved */
-    put_byte(pb, 0x43);
+    put_byte(pb, MAT_MARK_IN);
     put_byte(pb, 4);
     put_be32(pb, 0);
 
-    put_byte(pb, 0x44);
+    put_byte(pb, MAT_MARK_OUT);
     put_byte(pb, 4);
     put_be32(pb, ctx->nb_frames);
 
     /* estimated size */
-    put_byte(pb, 0x45);
+    put_byte(pb, MAT_SIZE);
     put_byte(pb, 4);
     put_be32(pb, url_fsize(pb) / 1024);
 




More information about the ffmpeg-cvslog mailing list