[Ffmpeg-cvslog] r8742 - in trunk/libavformat: asf.c avformat.h avidec.c flvdec.c gxf.c img2.c matroska.c mov.c mp3.c mpeg.c mpegts.c mtv.c mxf.c nsvdec.c raw.c rtp.c swf.c utils.c wav.c

aurel subversion
Sun Apr 15 15:51:57 CEST 2007


Author: aurel
Date: Sun Apr 15 15:51:57 2007
New Revision: 8742

Modified:
   trunk/libavformat/asf.c
   trunk/libavformat/avformat.h
   trunk/libavformat/avidec.c
   trunk/libavformat/flvdec.c
   trunk/libavformat/gxf.c
   trunk/libavformat/img2.c
   trunk/libavformat/matroska.c
   trunk/libavformat/mov.c
   trunk/libavformat/mp3.c
   trunk/libavformat/mpeg.c
   trunk/libavformat/mpegts.c
   trunk/libavformat/mtv.c
   trunk/libavformat/mxf.c
   trunk/libavformat/nsvdec.c
   trunk/libavformat/raw.c
   trunk/libavformat/rtp.c
   trunk/libavformat/swf.c
   trunk/libavformat/utils.c
   trunk/libavformat/wav.c

Log:
add an enum for need_parsing

Modified: trunk/libavformat/asf.c
==============================================================================
--- trunk/libavformat/asf.c	(original)
+++ trunk/libavformat/asf.c	Sun Apr 15 15:51:57 2007
@@ -260,7 +260,7 @@ static int asf_read_header(AVFormatConte
                     st->codec->codec_id = CODEC_ID_NONE;
                     st->codec->codec_tag = 0;
                 }
-                st->need_parsing = 1;
+                st->need_parsing = AVSTREAM_PARSE_FULL;
                 /* We have to init the frame size at some point .... */
                 pos2 = url_ftell(pb);
                 if (gsize >= (pos2 + 8 - pos1 + 24)) {
@@ -337,7 +337,7 @@ static int asf_read_header(AVFormatConte
                 st->codec->codec_tag = tag1;
                 st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1);
                 if(tag1 == MKTAG('D', 'V', 'R', ' '))
-                    st->need_parsing = 1;
+                    st->need_parsing = AVSTREAM_PARSE_FULL;
             }
             pos2 = url_ftell(pb);
             url_fskip(pb, gsize - (pos2 - pos1 + 24));

Modified: trunk/libavformat/avformat.h
==============================================================================
--- trunk/libavformat/avformat.h	(original)
+++ trunk/libavformat/avformat.h	Sun Apr 15 15:51:57 2007
@@ -253,6 +253,13 @@ typedef struct AVInputFormat {
     struct AVInputFormat *next;
 } AVInputFormat;
 
+enum AVStreamParseType {
+    AVSTREAM_PARSE_NONE,
+    AVSTREAM_PARSE_FULL,       /**< full parsing and repack */
+    AVSTREAM_PARSE_HEADERS,    /**< only parse headers, don't repack */
+    AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on packet boundary */
+};
+
 typedef struct AVIndexEntry {
     int64_t pos;
     int64_t timestamp;
@@ -309,8 +316,7 @@ typedef struct AVStream {
     char language[4]; /** ISO 639 3-letter language code (empty string if undefined) */
 
     /* av_read_frame() support */
-#define AVSTREAM_PARSE_TIMESTAMPS 3    /**< full parsing and interpolation of timestamps for frames not starting on packet boundary */
-    int need_parsing;                  ///< 1->full parsing needed, 2->only parse headers dont repack, 3->full parsing and interpolate timestamps
+    enum AVStreamParseType need_parsing;
     struct AVCodecParserContext *parser;
 
     int64_t cur_dts;

Modified: trunk/libavformat/avidec.c
==============================================================================
--- trunk/libavformat/avidec.c	(original)
+++ trunk/libavformat/avidec.c	Sun Apr 15 15:51:57 2007
@@ -442,7 +442,7 @@ static int avi_read_header(AVFormatConte
                     st->codec->codec_type = CODEC_TYPE_VIDEO;
                     st->codec->codec_tag = tag1;
                     st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1);
-                    st->need_parsing = 2; //only parse headers dont do slower repacketization, this is needed to get the pict type which is needed for generating correct pts
+                    st->need_parsing = AVSTREAM_PARSE_HEADERS; // this is needed to get the pict type which is needed for generating correct pts
 //                    url_fskip(pb, size - 5 * 4);
                     break;
                 case CODEC_TYPE_AUDIO:
@@ -456,7 +456,7 @@ static int avi_read_header(AVFormatConte
                     st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;
                     /* ADTS header is in extradata, AAC without header must be stored as exact frames, parser not needed and it will fail */
                     if (st->codec->codec_id == CODEC_ID_AAC && st->codec->extradata_size)
-                        st->need_parsing = 0;
+                        st->need_parsing = AVSTREAM_PARSE_NONE;
                     /* AVI files with Xan DPCM audio (wrongly) declare PCM
                      * audio in the header but have Axan as stream_code_tag. */
                     if (st->codec->stream_codec_tag == ff_get_fourcc("Axan")){

Modified: trunk/libavformat/flvdec.c
==============================================================================
--- trunk/libavformat/flvdec.c	(original)
+++ trunk/libavformat/flvdec.c	Sun Apr 15 15:51:57 2007
@@ -47,7 +47,7 @@ static void flv_set_audio_codec(AVFormat
         case FLV_CODECID_PCM_LE:
             acodec->codec_id = acodec->bits_per_sample == 8 ? CODEC_ID_PCM_S8 : CODEC_ID_PCM_S16LE; break;
         case FLV_CODECID_ADPCM: acodec->codec_id = CODEC_ID_ADPCM_SWF;                              break;
-        case FLV_CODECID_MP3  : acodec->codec_id = CODEC_ID_MP3      ; astream->need_parsing = 1  ; break;
+        case FLV_CODECID_MP3  : acodec->codec_id = CODEC_ID_MP3      ; astream->need_parsing = AVSTREAM_PARSE_FULL; break;
         case FLV_CODECID_NELLYMOSER_8HZ_MONO:
             acodec->sample_rate = 8000; //in case metadata does not otherwise declare samplerate
         case FLV_CODECID_NELLYMOSER:

Modified: trunk/libavformat/gxf.c
==============================================================================
--- trunk/libavformat/gxf.c	(original)
+++ trunk/libavformat/gxf.c	Sun Apr 15 15:51:57 2007
@@ -128,13 +128,13 @@ static int get_sindex(AVFormatContext *s
         case 20:
             st->codec->codec_type = CODEC_TYPE_VIDEO;
             st->codec->codec_id = CODEC_ID_MPEG2VIDEO;
-            st->need_parsing = 2; // get keyframe flag etc.
+            st->need_parsing = AVSTREAM_PARSE_HEADERS; //get keyframe flag etc.
             break;
         case 22:
         case 23:
             st->codec->codec_type = CODEC_TYPE_VIDEO;
             st->codec->codec_id = CODEC_ID_MPEG1VIDEO;
-            st->need_parsing = 2; // get keyframe flag etc.
+            st->need_parsing = AVSTREAM_PARSE_HEADERS; //get keyframe flag etc.
             break;
         case 9:
             st->codec->codec_type = CODEC_TYPE_AUDIO;

Modified: trunk/libavformat/img2.c
==============================================================================
--- trunk/libavformat/img2.c	(original)
+++ trunk/libavformat/img2.c	Sun Apr 15 15:51:57 2007
@@ -190,7 +190,7 @@ static int img_read_header(AVFormatConte
         s->is_pipe = 0;
     else{
         s->is_pipe = 1;
-        st->need_parsing= 1;
+        st->need_parsing = AVSTREAM_PARSE_FULL;
     }
 
     if (!ap->time_base.num) {

Modified: trunk/libavformat/matroska.c
==============================================================================
--- trunk/libavformat/matroska.c	(original)
+++ trunk/libavformat/matroska.c	Sun Apr 15 15:51:57 2007
@@ -2354,7 +2354,7 @@ matroska_read_header (AVFormatContext   
                           st->codec->height * videotrack->display_width,
                           st->codec-> width * videotrack->display_height,
                           255);
-                st->need_parsing = 2;
+                st->need_parsing = AVSTREAM_PARSE_HEADERS;
             } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
                 MatroskaAudioTrack *audiotrack = (MatroskaAudioTrack *)track;
 

Modified: trunk/libavformat/mov.c
==============================================================================
--- trunk/libavformat/mov.c	(original)
+++ trunk/libavformat/mov.c	Sun Apr 15 15:51:57 2007
@@ -927,7 +927,7 @@ static int mov_read_stsd(MOVContext *c, 
     case CODEC_ID_MP2:
     case CODEC_ID_MP3:
         st->codec->codec_type = CODEC_TYPE_AUDIO; /* force type after stsd for m1a hdlr */
-        st->need_parsing = 1;
+        st->need_parsing = AVSTREAM_PARSE_FULL;
         break;
     default:
         break;

Modified: trunk/libavformat/mp3.c
==============================================================================
--- trunk/libavformat/mp3.c	(original)
+++ trunk/libavformat/mp3.c	Sun Apr 15 15:51:57 2007
@@ -292,7 +292,7 @@ static int mp3_read_header(AVFormatConte
 
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_MP3;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
 
     /* try to get the TAG */
     if (!url_is_streamed(&s->pb)) {

Modified: trunk/libavformat/mpeg.c
==============================================================================
--- trunk/libavformat/mpeg.c	(original)
+++ trunk/libavformat/mpeg.c	Sun Apr 15 15:51:57 2007
@@ -1690,7 +1690,7 @@ static int mpegps_read_packet(AVFormatCo
     st->codec->codec_type = type;
     st->codec->codec_id = codec_id;
     if (codec_id != CODEC_ID_PCM_S16BE)
-        st->need_parsing = 1;
+        st->need_parsing = AVSTREAM_PARSE_FULL;
  found:
     if(st->discard >= AVDISCARD_ALL)
         goto skip;

Modified: trunk/libavformat/mpegts.c
==============================================================================
--- trunk/libavformat/mpegts.c	(original)
+++ trunk/libavformat/mpegts.c	Sun Apr 15 15:51:57 2007
@@ -961,7 +961,7 @@ static AVStream* new_pes_av_stream(PESCo
         st->priv_data = pes;
         st->codec->codec_type = codec_type;
         st->codec->codec_id = codec_id;
-        st->need_parsing = 1;
+        st->need_parsing = AVSTREAM_PARSE_FULL;
         pes->st = st;
     }
     return st;

Modified: trunk/libavformat/mtv.c
==============================================================================
--- trunk/libavformat/mtv.c	(original)
+++ trunk/libavformat/mtv.c	Sun Apr 15 15:51:57 2007
@@ -117,7 +117,7 @@ static int mtv_read_header(AVFormatConte
     st->codec->codec_type      = CODEC_TYPE_AUDIO;
     st->codec->codec_id        = CODEC_ID_MP3;
     st->codec->bit_rate        = mtv->audio_br;
-    st->need_parsing=1;
+    st->need_parsing           = AVSTREAM_PARSE_FULL;
 
     /* Jump over header */
 

Modified: trunk/libavformat/mxf.c
==============================================================================
--- trunk/libavformat/mxf.c	(original)
+++ trunk/libavformat/mxf.c	Sun Apr 15 15:51:57 2007
@@ -812,7 +812,7 @@ static int mxf_parse_structural_metadata
             st->codec->width = descriptor->width;
             st->codec->height = descriptor->height;
             st->codec->bits_per_sample = descriptor->bits_per_sample; /* Uncompressed */
-            st->need_parsing = 2; /* only parse headers */
+            st->need_parsing = AVSTREAM_PARSE_HEADERS;
         } else if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
             container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul);
             if (st->codec->codec_id == CODEC_ID_NONE)
@@ -834,12 +834,12 @@ static int mxf_parse_structural_metadata
                 if (descriptor->essence_container_ul[13] == 0x01) /* D-10 Mapping */
                     st->codec->channels = 8; /* force channels to 8 */
             } else if (st->codec->codec_id == CODEC_ID_MP2) {
-                st->need_parsing = 1;
+                st->need_parsing = AVSTREAM_PARSE_FULL;
             }
         }
         if (container_ul && container_ul->wrapping == Clip) {
             dprintf(mxf->fc, "stream %d: clip wrapped essence\n", st->index);
-            st->need_parsing = 1;
+            st->need_parsing = AVSTREAM_PARSE_FULL;
         }
     }
     return 0;

Modified: trunk/libavformat/nsvdec.c
==============================================================================
--- trunk/libavformat/nsvdec.c	(original)
+++ trunk/libavformat/nsvdec.c	Sun Apr 15 15:51:57 2007
@@ -474,7 +474,7 @@ static int nsv_parse_NSVs_header(AVForma
             st->codec->codec_tag = atag;
             st->codec->codec_id = codec_get_id(nsv_codec_audio_tags, atag);
 
-            st->need_parsing = 1; /* for PCM we will read a chunk later and put correct info */
+            st->need_parsing = AVSTREAM_PARSE_FULL; /* for PCM we will read a chunk later and put correct info */
 
             /* set timebase to common denominator of ms and framerate */
             av_set_pts_info(st, 64, 1, framerate.num*1000);
@@ -626,7 +626,7 @@ null_chunk_retry:
             asize-=4;
             PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate));
             if (fill_header) {
-                st[NSV_ST_AUDIO]->need_parsing = 0; /* we know everything */
+                st[NSV_ST_AUDIO]->need_parsing = AVSTREAM_PARSE_NONE; /* we know everything */
                 if (bps != 16) {
                     PRINT(("NSV AUDIO bit/sample != 16 (%d)!!!\n", bps));
                 }

Modified: trunk/libavformat/raw.c
==============================================================================
--- trunk/libavformat/raw.c	(original)
+++ trunk/libavformat/raw.c	Sun Apr 15 15:51:57 2007
@@ -218,7 +218,7 @@ static int ac3_read_header(AVFormatConte
 
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_AC3;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
     /* the parameters will be extracted from the compressed bitstream */
     return 0;
 }
@@ -233,7 +233,7 @@ static int shorten_read_header(AVFormatC
         return AVERROR_NOMEM;
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_SHORTEN;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
     /* the parameters will be extracted from the compressed bitstream */
     return 0;
 }
@@ -249,7 +249,7 @@ static int flac_read_header(AVFormatCont
         return AVERROR_NOMEM;
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_FLAC;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
     /* the parameters will be extracted from the compressed bitstream */
     return 0;
 }
@@ -266,7 +266,7 @@ static int dts_read_header(AVFormatConte
 
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_DTS;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
     /* the parameters will be extracted from the compressed bitstream */
     return 0;
 }
@@ -283,7 +283,7 @@ static int aac_read_header(AVFormatConte
 
     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_AAC;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
     /* the parameters will be extracted from the compressed bitstream */
     return 0;
 }
@@ -300,7 +300,7 @@ static int video_read_header(AVFormatCon
 
     st->codec->codec_type = CODEC_TYPE_VIDEO;
     st->codec->codec_id = s->iformat->value;
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
 
     /* for mjpeg, specify frame rate */
     /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/

Modified: trunk/libavformat/rtp.c
==============================================================================
--- trunk/libavformat/rtp.c	(original)
+++ trunk/libavformat/rtp.c	Sun Apr 15 15:51:57 2007
@@ -469,7 +469,7 @@ RTPDemuxContext *rtp_parse_open(AVFormat
         case CODEC_ID_MP3:
         case CODEC_ID_MPEG4:
         case CODEC_ID_H264:
-            st->need_parsing = 1;
+            st->need_parsing = AVSTREAM_PARSE_FULL;
             break;
         default:
             break;

Modified: trunk/libavformat/swf.c
==============================================================================
--- trunk/libavformat/swf.c	(original)
+++ trunk/libavformat/swf.c	Sun Apr 15 15:51:57 2007
@@ -681,7 +681,7 @@ static int swf_read_header(AVFormatConte
             ast->codec->channels = 1 + (v&1);
             ast->codec->codec_type = CODEC_TYPE_AUDIO;
             ast->codec->codec_id = codec_get_id(swf_audio_codec_tags, (v>>4) & 15);
-            ast->need_parsing = 1;
+            ast->need_parsing = AVSTREAM_PARSE_FULL;
             sample_rate_code= (v>>2) & 3;
             if (!sample_rate_code)
                 return AVERROR_IO;

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Sun Apr 15 15:51:57 2007
@@ -782,8 +782,8 @@ static int av_read_frame_internal(AVForm
                 st->parser = av_parser_init(st->codec->codec_id);
                 if (!st->parser) {
                     /* no parser available : just output the raw packets */
-                    st->need_parsing = 0;
-                }else if(st->need_parsing == 2){
+                    st->need_parsing = AVSTREAM_PARSE_NONE;
+                }else if(st->need_parsing == AVSTREAM_PARSE_HEADERS){
                     st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
                 }
                 if(st->parser && (s->iformat->flags & AVFMT_GENERIC_INDEX)){
@@ -1704,7 +1704,7 @@ int av_find_stream_info(AVFormatContext 
         //only for the split stuff
         if (!st->parser) {
             st->parser = av_parser_init(st->codec->codec_id);
-            if(st->need_parsing == 2 && st->parser){
+            if(st->need_parsing == AVSTREAM_PARSE_HEADERS && st->parser){
                 st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
             }
         }
@@ -1907,7 +1907,7 @@ int av_find_stream_info(AVFormatContext 
             if (st->codec->codec_id == CODEC_ID_NONE) {
                 codec_identified[st->index] = set_codec_from_probe_data(st, &(probe_data[st->index]), 0);
                 if (codec_identified[st->index]) {
-                    st->need_parsing = 1;
+                    st->need_parsing = AVSTREAM_PARSE_FULL;
                 }
             }
             if(!st->codec->bits_per_sample)

Modified: trunk/libavformat/wav.c
==============================================================================
--- trunk/libavformat/wav.c	(original)
+++ trunk/libavformat/wav.c	Sun Apr 15 15:51:57 2007
@@ -179,7 +179,7 @@ static int wav_read_header(AVFormatConte
         return AVERROR_NOMEM;
 
     get_wav_header(pb, st->codec, size);
-    st->need_parsing = 1;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
 
     av_set_pts_info(st, 64, 1, st->codec->sample_rate);
 




More information about the ffmpeg-cvslog mailing list