[Ffmpeg-cvslog] CVS: ffmpeg/libavformat avformat.h, 1.124, 1.125 utils.c, 1.151, 1.152

Michael Niedermayer CVS michael
Mon Jun 27 02:04:06 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv181/libavformat

Modified Files:
	avformat.h utils.c 
Log Message:
support changing in bitstream global headers into extradata style and back


Index: avformat.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avformat.h,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- avformat.h	25 Jun 2005 09:04:08 -0000	1.124
+++ avformat.h	27 Jun 2005 00:04:03 -0000	1.125
@@ -42,6 +42,7 @@
 #define PKT_FLAG_KEY   0x0001
 
 void av_destruct_packet_nofree(AVPacket *pkt);
+void av_destruct_packet(AVPacket *pkt);
 
 /* initialize optional fields of a packet */
 static inline void av_init_packet(AVPacket *pkt)

Index: utils.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/utils.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- utils.c	5 Jun 2005 11:09:50 -0000	1.151
+++ utils.c	27 Jun 2005 00:04:03 -0000	1.152
@@ -165,7 +165,7 @@
 /**
  * Default packet destructor 
  */
-static void av_destruct_packet(AVPacket *pkt)
+void av_destruct_packet(AVPacket *pkt)
 {
     av_free(pkt->data);
     pkt->data = NULL; pkt->size = 0;
@@ -834,7 +834,7 @@
         /* select current input stream component */
         st = s->cur_st;
         if (st) {
-            if (!st->parser) {
+            if (!st->need_parsing || !st->parser) {
                 /* no parsing needed: we just output the packet as is */
                 /* raw data support */
                 *pkt = s->cur_pkt;
@@ -876,7 +876,7 @@
                 /* return the last frames, if any */
                 for(i = 0; i < s->nb_streams; i++) {
                     st = s->streams[i];
-                    if (st->parser) {
+                    if (st->parser && st->need_parsing) {
                         av_parser_parse(st->parser, &st->codec, 
                                         &pkt->data, &pkt->size, 
                                         NULL, 0, 
@@ -1742,6 +1742,10 @@
             if(!st->codec.time_base.num)
                 st->codec.time_base= st->time_base;
         }
+        //only for the split stuff
+        if (!st->parser) {
+            st->parser = av_parser_init(st->codec.codec_id);
+        }
     }
 
     for(i=0;i<MAX_STREAMS;i++){
@@ -1762,6 +1766,8 @@
             if(   st->codec.time_base.den >= 1000LL*st->codec.time_base.num
                && duration_count[i]<20 && st->codec.codec_type == CODEC_TYPE_VIDEO)
                 break;
+            if(st->parser && st->parser->parser->split && !st->codec.extradata)
+                break;
         }
         if (i == ic->nb_streams) {
             /* NOTE: if the format has no header, then we need to read
@@ -1841,6 +1847,15 @@
             }
             last_dts[pkt->stream_index]= pkt->dts;
         }
+        if(st->parser && st->parser->parser->split && !st->codec.extradata){
+            int i= st->parser->parser->split(&st->codec, pkt->data, pkt->size);
+            if(i){
+                st->codec.extradata_size= i;
+                st->codec.extradata= av_malloc(st->codec.extradata_size);
+                memcpy(st->codec.extradata, pkt->data, st->codec.extradata_size);
+            }
+        }
+        
         /* if still no information, we try to open the codec and to
            decompress the frame. We try to avoid that in most cases as
            it takes longer and uses more memory. For MPEG4, we need to





More information about the ffmpeg-cvslog mailing list