]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Use enum typers instead of int.
authorbenoit <benoit@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 2 Oct 2008 16:03:00 +0000 (16:03 +0000)
committerbenoit <benoit@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 2 Oct 2008 16:03:00 +0000 (16:03 +0000)
Patch by Diego 'Flameeyes' Pettenò: flameeyes gmail

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15517 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavdevice/audio.c
libavformat/aiff.c
libavformat/asf.c
libavformat/au.c
libavformat/mov.c
libavformat/mpeg.c
libavformat/mpegts.c
libavformat/rtsp.c
libavformat/segafilm.c
libavformat/sol.c
libavformat/westwood.c

index 1cb3d69409018be7cf72cc108893aa726a8facdb..8520a5f3ea7c5b1e792cc78a45af828793f825a1 100644 (file)
@@ -46,7 +46,7 @@ typedef struct {
     int sample_rate;
     int channels;
     int frame_size; /* in bytes ! */
-    int codec_id;
+    enum CodecID codec_id;
     unsigned int flip_left : 1;
     uint8_t buffer[AUDIO_BLOCK_SIZE];
     int buffer_ptr;
index 911814bf92701844617f2c6d5e29feda9f31f09b..3a4bf9f9dd01784227fd2d66bc866bf85aabac54 100644 (file)
@@ -46,7 +46,7 @@ static const AVCodecTag codec_aiff_tags[] = {
 #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 @@ static int aiff_codec_get_id(int bps)
         return CODEC_ID_PCM_S32BE;
 
     /* bigger than 32 isn't allowed  */
-    return 0;
+    return CODEC_ID_NONE;
 }
 
 /* returns the size of the found tag */
index b837e7689160f54da5e96c1359970e7a2ff861b5..e8b91446094f1f99178f0c4db2c8cce980b429a1 100644 (file)
@@ -197,7 +197,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
             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;
index 3dfd31e761489d482e38e360b0313dfc65f8239f..ffb26ed54e1b56e3d8f391c65a32ce2a16c14f3c 100644 (file)
@@ -122,7 +122,8 @@ static int au_read_header(AVFormatContext *s,
     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 */
index 79db9fc52ca5933884cb13f3ab09378b6e34d4bf..27ddb1c7185931d408f69caa628253d9ba88ec2a 100644 (file)
@@ -676,7 +676,7 @@ static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
  * 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 @@ static int mov_get_lpcm_codec_id(int bps, int flags)
             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)
index 289be8caf6c612b018c2fa594c6d0db311773b3c..ec89d5a9a22680d7cf9df4a820f474a337da994c 100644 (file)
@@ -409,7 +409,9 @@ static int mpegps_read_packet(AVFormatContext *s,
 {
     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:
index 80b604c5ae6c9f353b11c73a401d17698f4f6fa2..9f41d396a9b7ab702e0fab411cbe6d1e29c76292 100644 (file)
@@ -934,7 +934,8 @@ static void mpegts_push_data(MpegTSFilter *filter,
 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:
index b1fafedf016f92088c2b777985364428565f8cec..413aadde9529f052b4d3b818b86c430f58ff8b9b 100644 (file)
@@ -389,7 +389,8 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
     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;
index 4bc46c2773fd3889728f26a9e5804e3d42e28746..1ea296db9500bafcc29ae2eb415413808ea6057a 100644 (file)
@@ -46,12 +46,12 @@ typedef struct FilmDemuxContext {
     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 @@ static int film_read_header(AVFormatContext *s,
         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 @@ static int film_read_header(AVFormatContext *s,
     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) {
index 775b4e0adf266ac1d8e5c56fb2d1088e7601edc5..8b680be74208bdcdb2b29bd71dcf6c22eec302d5 100644 (file)
@@ -47,7 +47,7 @@ static int sol_probe(AVProbeData *p)
 #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 @@ static int sol_read_header(AVFormatContext *s,
     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 */
index 600863e8377c9012535ce6b6fd99934476e123c6..d88199d6902e8bd1a3e225ef72e8e929f9b9d26e 100644 (file)
@@ -66,7 +66,7 @@ typedef struct WsAudDemuxContext {
     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;