changeset 4079:82cbec030af5 libavformat

remove _t in typedef for POSIX compatibility
author bcoudurier
date Thu, 11 Dec 2008 20:06:56 +0000
parents a3dab5ebe140
children 8ddf05b864a4
files isom.h mov.c movenc.c
diffstat 3 files changed, 56 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/isom.h	Thu Dec 11 20:02:15 2008 +0000
+++ b/isom.h	Thu Dec 11 20:06:56 2008 +0000
@@ -38,6 +38,6 @@
 typedef struct {
     int count;
     int duration;
-} MOV_stts_t;
+} MOVStts;
 
 #endif /* AVFORMAT_ISOM_H */
--- a/mov.c	Thu Dec 11 20:02:15 2008 +0000
+++ b/mov.c	Thu Dec 11 20:06:56 2008 +0000
@@ -69,18 +69,18 @@
     int first;
     int count;
     int id;
-} MOV_stsc_t;
+} MOVStsc;
 
 typedef struct {
     uint32_t type;
     char *path;
-} MOV_dref_t;
+} MOVDref;
 
 typedef struct {
     uint32_t type;
     int64_t offset;
     int64_t size; /* total size (excluding the size and type fields) */
-} MOV_atom_t;
+} MOVAtom;
 
 struct MOVParseTableEntry;
 
@@ -109,12 +109,12 @@
     unsigned int chunk_count;
     int64_t *chunk_offsets;
     unsigned int stts_count;
-    MOV_stts_t *stts_data;
+    MOVStts *stts_data;
     unsigned int ctts_count;
-    MOV_stts_t *ctts_data;
+    MOVStts *ctts_data;
     unsigned int edit_count; /* number of 'edit' (elst atom) */
     unsigned int sample_to_chunk_sz;
-    MOV_stsc_t *sample_to_chunk;
+    MOVStsc *sample_to_chunk;
     int sample_to_ctime_index;
     int sample_to_ctime_sample;
     unsigned int sample_size;
@@ -131,7 +131,7 @@
     int pseudo_stream_id; ///< -1 means demux all ids
     int16_t audio_cid; ///< stsd audio compression id
     unsigned drefs_count;
-    MOV_dref_t *drefs;
+    MOVDref *drefs;
     int dref_id;
     int wrong_dts; ///< dts are wrong due to negative ctts
 } MOVStreamContext;
@@ -163,15 +163,15 @@
 /* links atom IDs to parse functions */
 typedef struct MOVParseTableEntry {
     uint32_t type;
-    int (*parse)(MOVContext *ctx, ByteIOContext *pb, MOV_atom_t atom);
+    int (*parse)(MOVContext *ctx, ByteIOContext *pb, MOVAtom atom);
 } MOVParseTableEntry;
 
 static const MOVParseTableEntry mov_default_parse_table[];
 
-static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     int64_t total_size = 0;
-    MOV_atom_t a;
+    MOVAtom a;
     int i;
     int err = 0;
 
@@ -232,7 +232,7 @@
     return err;
 }
 
-static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     MOVStreamContext *sc = st->priv_data;
@@ -246,7 +246,7 @@
     sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
 
     for (i = 0; i < sc->drefs_count; i++) {
-        MOV_dref_t *dref = &sc->drefs[i];
+        MOVDref *dref = &sc->drefs[i];
         uint32_t size = get_be32(pb);
         int64_t next = url_ftell(pb) + size - 4;
 
@@ -300,7 +300,7 @@
     return 0;
 }
 
-static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     uint32_t type;
@@ -373,7 +373,7 @@
     { CODEC_ID_NONE,    0 },
 };
 
-static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     int tag, len;
@@ -431,7 +431,7 @@
 }
 
 /* this atom contains actual media data */
-static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     if(atom.size == 0) /* wrong one (MP4) */
         return 0;
@@ -439,7 +439,7 @@
     return 0; /* now go for moov */
 }
 
-static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     uint32_t type = get_le32(pb);
 
@@ -452,7 +452,7 @@
 }
 
 /* this atom should contain all header atoms */
-static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     if (mov_read_default(c, pb, atom) < 0)
         return -1;
@@ -462,14 +462,14 @@
     return 0; /* now go for mdat */
 }
 
-static int mov_read_moof(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_moof(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     c->fragment.moof_offset = url_ftell(pb) - 8;
     dprintf(c->fc, "moof offset %llx\n", c->fragment.moof_offset);
     return mov_read_default(c, pb, atom);
 }
 
-static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     MOVStreamContext *sc = st->priv_data;
@@ -498,7 +498,7 @@
     return 0;
 }
 
-static int mov_read_mvhd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_mvhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     int version = get_byte(pb); /* version */
     get_be24(pb); /* flags */
@@ -534,7 +534,7 @@
     return 0;
 }
 
-static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
 
@@ -554,7 +554,7 @@
     return 0;
 }
 
-static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     int little_endian = get_be16(pb);
@@ -581,7 +581,7 @@
 }
 
 /* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */
-static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     uint64_t size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;
@@ -600,7 +600,7 @@
     return 0;
 }
 
-static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
 
@@ -627,7 +627,7 @@
  * This function reads atom content and puts data in extradata without tag
  * nor size unlike mov_read_extradata.
  */
-static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
 
@@ -643,7 +643,7 @@
     return 0;
 }
 
-static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     MOVStreamContext *sc = st->priv_data;
@@ -708,7 +708,7 @@
     return CODEC_ID_NONE;
 }
 
-static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     MOVStreamContext *sc = st->priv_data;
@@ -723,7 +723,7 @@
         //Parsing Sample description table
         enum CodecID id;
         int dref_id;
-        MOV_atom_t a = { 0, 0, 0 };
+        MOVAtom a = { 0, 0, 0 };
         int64_t start_pos = url_ftell(pb);
         int size = get_be32(pb); /* size */
         uint32_t format = get_le32(pb); /* data format */
@@ -1022,7 +1022,7 @@
     return 0;
 }
 
-static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     MOVStreamContext *sc = st->priv_data;
@@ -1033,13 +1033,13 @@
 
     entries = get_be32(pb);
 
-    if(entries >= UINT_MAX / sizeof(MOV_stsc_t))
+    if(entries >= UINT_MAX / sizeof(*sc->sample_to_chunk))
         return -1;
 
     dprintf(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries);
 
     sc->sample_to_chunk_sz = entries;
-    sc->sample_to_chunk = av_malloc(entries * sizeof(MOV_stsc_t));
+    sc->sample_to_chunk = av_malloc(entries * sizeof(*sc->sample_to_chunk));
     if (!sc->sample_to_chunk)
         return -1;
     for(i=0; i<entries; i++) {
@@ -1050,7 +1050,7 @@
     return 0;
 }
 
-static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     MOVStreamContext *sc = st->priv_data;
@@ -1078,7 +1078,7 @@
     return 0;
 }
 
-static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     MOVStreamContext *sc = st->priv_data;
@@ -1108,7 +1108,7 @@
     return 0;
 }
 
-static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     MOVStreamContext *sc = st->priv_data;
@@ -1119,11 +1119,11 @@
     get_byte(pb); /* version */
     get_be24(pb); /* flags */
     entries = get_be32(pb);
-    if(entries >= UINT_MAX / sizeof(MOV_stts_t))
+    if(entries >= UINT_MAX / sizeof(*sc->stts_data))
         return -1;
 
     sc->stts_count = entries;
-    sc->stts_data = av_malloc(entries * sizeof(MOV_stts_t));
+    sc->stts_data = av_malloc(entries * sizeof(*sc->stts_data));
     if (!sc->stts_data)
         return -1;
     dprintf(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries);
@@ -1153,7 +1153,7 @@
     return 0;
 }
 
-static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     MOVStreamContext *sc = st->priv_data;
@@ -1162,11 +1162,11 @@
     get_byte(pb); /* version */
     get_be24(pb); /* flags */
     entries = get_be32(pb);
-    if(entries >= UINT_MAX / sizeof(MOV_stts_t))
+    if(entries >= UINT_MAX / sizeof(*sc->ctts_data))
         return -1;
 
     sc->ctts_count = entries;
-    sc->ctts_data = av_malloc(entries * sizeof(MOV_stts_t));
+    sc->ctts_data = av_malloc(entries * sizeof(*sc->ctts_data));
     if (!sc->ctts_data)
         return -1;
     dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
@@ -1295,7 +1295,7 @@
     sc->sample_count = st->nb_index_entries;
 }
 
-static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -1370,7 +1370,7 @@
     return 0;
 }
 
-static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     int ret;
     c->itunes_metadata = 1;
@@ -1379,14 +1379,14 @@
     return ret;
 }
 
-static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     url_fskip(pb, 4); // version + flags
     atom.size -= 4;
     return mov_read_default(c, pb, atom);
 }
 
-static int mov_read_trkn(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_trkn(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     get_be32(pb); // type
     get_be32(pb); // unknown
@@ -1395,7 +1395,7 @@
     return 0;
 }
 
-static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     char *str = NULL;
     int size;
@@ -1434,7 +1434,7 @@
     return 0;
 }
 
-static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     int i;
     int width;
@@ -1505,7 +1505,7 @@
     return 0;
 }
 
-static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     MOVFragment *frag = &c->fragment;
     MOVTrackExt *trex = NULL;
@@ -1540,7 +1540,7 @@
     return 0;
 }
 
-static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     MOVTrackExt *trex;
 
@@ -1560,7 +1560,7 @@
     return 0;
 }
 
-static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     MOVFragment *frag = &c->fragment;
     AVStream *st;
@@ -1631,7 +1631,7 @@
 /* this atom should be null (from specs), but some buggy files put the 'moov' atom inside it... */
 /* like the files created with Adobe Premiere 5.0, for samples see */
 /* http://graphics.tudelft.nl/~wouter/publications/soundtests/ */
-static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     int err;
 
@@ -1652,7 +1652,7 @@
     return err;
 }
 
-static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
 #ifdef CONFIG_ZLIB
     ByteIOContext ctx;
@@ -1705,7 +1705,7 @@
 }
 
 /* edit list atom */
-static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     MOVStreamContext *sc = c->fc->streams[c->fc->nb_streams-1]->priv_data;
     int i, edit_count;
@@ -1834,7 +1834,7 @@
     MOVContext *mov = s->priv_data;
     ByteIOContext *pb = s->pb;
     int err;
-    MOV_atom_t atom = { 0, 0, 0 };
+    MOVAtom atom = { 0, 0, 0 };
 
     mov->fc = s;
     /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */
@@ -1887,7 +1887,7 @@
     if (!sample) {
         mov->found_mdat = 0;
         if (!url_is_streamed(s->pb) ||
-            mov_read_default(mov, s->pb, (MOV_atom_t){ 0, 0, INT64_MAX }) < 0 ||
+            mov_read_default(mov, s->pb, (MOVAtom){ 0, 0, INT64_MAX }) < 0 ||
             url_feof(s->pb))
             return -1;
         dprintf(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb));
--- a/movenc.c	Thu Dec 11 20:02:15 2008 +0000
+++ b/movenc.c	Thu Dec 11 20:06:56 2008 +0000
@@ -723,7 +723,7 @@
 
 static int mov_write_ctts_tag(ByteIOContext *pb, MOVTrack *track)
 {
-    MOV_stts_t *ctts_entries;
+    MOVStts *ctts_entries;
     uint32_t entries = 0;
     uint32_t atom_size;
     int i;
@@ -757,7 +757,7 @@
 /* Time to sample atom */
 static int mov_write_stts_tag(ByteIOContext *pb, MOVTrack *track)
 {
-    MOV_stts_t *stts_entries;
+    MOVStts *stts_entries;
     uint32_t entries = -1;
     uint32_t atom_size;
     int i;