replaces hardcoded values by the equivalent enum definitions

Originally committed as revision 9801 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Aurelien Jacobs 2007-07-26 13:01:09 +00:00
parent 4d8243d362
commit b1dc5beb12
3 changed files with 33 additions and 40 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -187,7 +187,7 @@ static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, GXFStreamContext *ctx)
(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(ByteIOContext *pb, GXFStreamContext *stre
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(ByteIOContext *pb, GXFStreamContext *stre
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(ByteIOContext *pb, GXFStreamContext *stre
}
/* 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(ByteIOContext *pb, GXFStreamContext *stre
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_section(ByteIOContext *pb, GXFContext *ctx)
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);