Update of /cvsroot/xine/xine-lib/src/demuxers
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv429

Modified Files:
        demux_flv.c 
Log Message:
Parse framerate information.
Send bitmap info header to the decoder.
Notify decoder about key frames.


Index: demux_flv.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/demuxers/demux_flv.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- demux_flv.c 15 Dec 2006 11:31:28 -0000      1.12
+++ demux_flv.c 15 Dec 2006 14:33:20 -0000      1.13
@@ -63,11 +63,15 @@
   unsigned char        flags;
   off_t                start;  /* in bytes */
   off_t                size;   /* in bytes */
-  unsigned int         length; /* in ms */
   
   unsigned char        got_video;
   unsigned char        got_audio;
   
+  unsigned int         length; /* in ms */
+  int                  width;
+  int                  height;
+  double               framerate;
+  
   unsigned int         cur_pts;
   
   int64_t              last_pts[2];
@@ -205,10 +209,15 @@
           this->length = val * 1000.0;
         }
         else if (!strcmp(key, "width")) {
-          _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, val);
+          this->width = val;
+          _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, 
this->width);
         }
         else if (!strcmp(key, "height")) {
-          _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, val);
+          this->height = val;
+          _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, 
this->height);
+        }
+        else if (!strcmp(key, "framerate")) {
+          this->framerate = val;
         }
       }
       tmp += 8;
@@ -294,6 +303,7 @@
   unsigned char  tag_type;
   unsigned int   remaining_bytes;
   unsigned int   buf_type = 0;
+  unsigned int   buf_flags = 0;
   int64_t        pts;
  
   while (1) {
@@ -351,6 +361,7 @@
           buf->size = 0; /* no extra data */
           buf->type = buf_type;
           fifo->put(fifo, buf);
+          
           this->got_audio = 1;
         }
         break;
@@ -377,16 +388,27 @@
             break;
         }
         
+        if ((buffer[0] >> 4) == 0x01)
+          buf_flags = BUF_FLAG_KEYFRAME;
+        
         fifo = this->video_fifo;        
         if (!this->got_video) {
+          xine_bmiheader *bih;
           /* send init info to video decoder; send the bitmapinfo header to 
the decoder
-           * primarily as a formality since there is no real data inside */
+           * primarily as a formality since there is no real data inside */    
      
           buf = fifo->buffer_pool_alloc(fifo);
-          buf->decoder_flags = 
BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END;
-          buf->decoder_info[0] = 7470;  /* initial duration */
-          buf->size = 0; /* no extra data */
+          buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_STDHEADER |
+                               BUF_FLAG_FRAMERATE | BUF_FLAG_FRAME_END;
+          buf->decoder_info[0] = 90000.0 / (this->framerate ? : 12.0);
+          bih = (xine_bmiheader *) buf->content;
+          memset(bih, 0, sizeof(xine_bmiheader));
+          bih->biSize = sizeof(xine_bmiheader);
+          bih->biWidth = this->width;
+          bih->biHeight = this->height;
+          buf->size = sizeof(xine_bmiheader);
           buf->type = buf_type;
           fifo->put(fifo, buf);
+          
           this->got_video = 1;
         }
         break;
@@ -420,6 +442,7 @@
         buf->size = remaining_bytes;
       remaining_bytes -= buf->size;
 
+      buf->decoder_flags = buf_flags;
       if (!remaining_bytes)
         buf->decoder_flags |= BUF_FLAG_FRAME_END;
 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog

Reply via email to