changeset 3967:4fd67f05bad9 libavformat

Use enum typers instead of int. Patch by Diego 'Flameeyes' Petten: flameeyes gmail
author benoit
date Thu, 02 Oct 2008 16:03:00 +0000
parents 4a3372240319
children bf1b4748cd2e
files aiff.c asf.c au.c mov.c mpeg.c mpegts.c rtsp.c segafilm.c sol.c westwood.c
diffstat 10 files changed, 23 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/aiff.c	Thu Oct 02 15:52:04 2008 +0000
+++ b/aiff.c	Thu Oct 02 16:03:00 2008 +0000
@@ -46,7 +46,7 @@
 #define AIFF                    0
 #define AIFF_C_VERSION1         0xA2805140
 
-static int aiff_codec_get_id(int bps)
+static enum CodecID aiff_codec_get_id(int bps)
 {
     if (bps <= 8)
         return CODEC_ID_PCM_S8;
@@ -58,7 +58,7 @@
         return CODEC_ID_PCM_S32BE;
 
     /* bigger than 32 isn't allowed  */
-    return 0;
+    return CODEC_ID_NONE;
 }
 
 /* returns the size of the found tag */
--- a/asf.c	Thu Oct 02 15:52:04 2008 +0000
+++ b/asf.c	Thu Oct 02 16:03:00 2008 +0000
@@ -197,7 +197,8 @@
             asf->hdr.max_bitrate        = get_le32(pb);
             asf->packet_size = asf->hdr.max_pktsize;
         } else if (!memcmp(&g, &stream_header, sizeof(GUID))) {
-            int type, type_specific_size, sizeX;
+            enum CodecType type;
+            int type_specific_size, sizeX;
             uint64_t total_size;
             unsigned int tag1;
             int64_t pos1, pos2, start_time;
--- a/au.c	Thu Oct 02 15:52:04 2008 +0000
+++ b/au.c	Thu Oct 02 16:03:00 2008 +0000
@@ -122,7 +122,8 @@
     int size;
     unsigned int tag;
     ByteIOContext *pb = s->pb;
-    unsigned int id, codec, channels, rate;
+    unsigned int id, channels, rate;
+    enum CodecID codec;
     AVStream *st;
 
     /* check ".snd" header */
--- a/mov.c	Thu Oct 02 15:52:04 2008 +0000
+++ b/mov.c	Thu Oct 02 16:03:00 2008 +0000
@@ -676,7 +676,7 @@
  * Compute codec id for 'lpcm' tag.
  * See CoreAudioTypes and AudioStreamBasicDescription at Apple.
  */
-static int mov_get_lpcm_codec_id(int bps, int flags)
+static enum CodecID mov_get_lpcm_codec_id(int bps, int flags)
 {
     if (flags & 1) { // floating point
         if (flags & 2) { // big endian
@@ -704,7 +704,7 @@
             else if (bps == 32) return CODEC_ID_PCM_S32LE;
         }
     }
-    return 0;
+    return CODEC_ID_NONE;
 }
 
 static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
--- a/mpeg.c	Thu Oct 02 15:52:04 2008 +0000
+++ b/mpeg.c	Thu Oct 02 16:03:00 2008 +0000
@@ -409,7 +409,9 @@
 {
     MpegDemuxContext *m = s->priv_data;
     AVStream *st;
-    int len, startcode, i, type, codec_id = 0, es_type;
+    int len, startcode, i, es_type;
+    enum CodecID codec_id = CODEC_ID_NONE;
+    enum CodecType type;
     int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work
 
  redo:
--- a/mpegts.c	Thu Oct 02 15:52:04 2008 +0000
+++ b/mpegts.c	Thu Oct 02 16:03:00 2008 +0000
@@ -934,7 +934,8 @@
 static AVStream* new_pes_av_stream(PESContext *pes, uint32_t code)
 {
     AVStream *st;
-    int codec_type, codec_id;
+    enum CodecID codec_id;
+    enum CodecType codec_type;
 
     switch(pes->stream_type){
     case STREAM_TYPE_AUDIO_MPEG1:
--- a/rtsp.c	Thu Oct 02 15:52:04 2008 +0000
+++ b/rtsp.c	Thu Oct 02 16:03:00 2008 +0000
@@ -389,7 +389,8 @@
     RTSPState *rt = s->priv_data;
     char buf1[64], st_type[64];
     const char *p;
-    int codec_type, payload_type, i;
+    enum CodecType codec_type;
+    int payload_type, i;
     AVStream *st;
     RTSPStream *rtsp_st;
     struct in_addr sdp_ip;
--- a/segafilm.c	Thu Oct 02 15:52:04 2008 +0000
+++ b/segafilm.c	Thu Oct 02 16:03:00 2008 +0000
@@ -46,12 +46,12 @@
     int video_stream_index;
     int audio_stream_index;
 
-    unsigned int audio_type;
+    enum CodecID audio_type;
     unsigned int audio_samplerate;
     unsigned int audio_bits;
     unsigned int audio_channels;
 
-    unsigned int video_type;
+    enum CodecID video_type;
     unsigned int sample_count;
     film_sample_t *sample_table;
     unsigned int current_sample;
@@ -115,7 +115,7 @@
         else if (film->audio_bits == 16)
             film->audio_type = CODEC_ID_PCM_S16BE;
         else
-            film->audio_type = 0;
+            film->audio_type = CODEC_ID_NONE;
     }
 
     if (AV_RB32(&scratch[0]) != FDSC_TAG)
@@ -124,7 +124,7 @@
     if (AV_RB32(&scratch[8]) == CVID_TAG) {
         film->video_type = CODEC_ID_CINEPAK;
     } else
-        film->video_type = 0;
+        film->video_type = CODEC_ID_NONE;
 
     /* initialize the decoder streams */
     if (film->video_type) {
--- a/sol.c	Thu Oct 02 15:52:04 2008 +0000
+++ b/sol.c	Thu Oct 02 16:03:00 2008 +0000
@@ -47,7 +47,7 @@
 #define SOL_16BIT   4
 #define SOL_STEREO 16
 
-static int sol_codec_id(int magic, int type)
+static enum CodecID sol_codec_id(int magic, int type)
 {
     if (magic == 0x0B8D)
     {
@@ -88,7 +88,8 @@
     int size;
     unsigned int magic,tag;
     ByteIOContext *pb = s->pb;
-    unsigned int id, codec, channels, rate, type;
+    unsigned int id, channels, rate, type;
+    enum CodecID codec;
     AVStream *st;
 
     /* check ".snd" header */
--- a/westwood.c	Thu Oct 02 15:52:04 2008 +0000
+++ b/westwood.c	Thu Oct 02 16:03:00 2008 +0000
@@ -66,7 +66,7 @@
     int audio_samplerate;
     int audio_channels;
     int audio_bits;
-    int audio_type;
+    enum CodecID audio_type;
     int audio_stream_index;
     int64_t audio_frame_counter;
 } WsAudDemuxContext;