[FFmpeg-cvslog] r24699 - trunk/libavformat/mmst.c

rbultje subversion
Thu Aug 5 00:33:38 CEST 2010


Author: rbultje
Date: Thu Aug  5 00:33:38 2010
New Revision: 24699

Log:
Remove is_playing variable.

Patch by Zhentan Feng <spyfeng gmail com>.

Modified:
   trunk/libavformat/mmst.c

Modified: trunk/libavformat/mmst.c
==============================================================================
--- trunk/libavformat/mmst.c	Thu Aug  5 00:32:43 2010	(r24698)
+++ trunk/libavformat/mmst.c	Thu Aug  5 00:33:38 2010	(r24699)
@@ -124,7 +124,6 @@ typedef struct {
     /*@}*/
 
     int stream_num;                      ///< stream numbers.
-    int is_playing;
 } MMSContext;
 
 /** Create MMST command packet header */
@@ -552,7 +551,7 @@ static int read_mms_packet(MMSContext *m
     int size_to_copy;
 
     do {
-        if(mms->asf_header_read_size < mms->asf_header_size && !mms->is_playing) {
+        if(mms->asf_header_read_size < mms->asf_header_size) {
             /* Read from ASF header buffer */
             size_to_copy= FFMIN(buf_size,
                                 mms->asf_header_size - mms->asf_header_read_size);
@@ -563,7 +562,6 @@ static int read_mms_packet(MMSContext *m
                    size_to_copy, mms->asf_header_size - mms->asf_header_read_size);
             if (mms->asf_header_size == mms->asf_header_read_size) {
                 av_freep(&mms->asf_header);
-                mms->is_playing = 1;
             }
         } else if(mms->remaining_in_len) {
             /* Read remaining packet data to buffer.
@@ -701,6 +699,15 @@ static int mms_open(URLContext *h, const
     if (!mms->asf_packet_len || !mms->stream_num)
         goto fail;
 
+    clear_stream_buffers(mms);
+    err = mms_safe_send_recv(mms, send_stream_selection_request, SC_PKT_STREAM_ID_ACCEPTED);
+    if (err)
+        goto fail;
+    // send media packet request
+    err = mms_safe_send_recv(mms, send_media_packet_request, SC_PKT_MEDIA_PKT_FOLLOWS);
+    if (err) {
+        goto fail;
+    }
     dprintf(NULL, "Leaving open (success)\n");
     return 0;
 fail:
@@ -714,23 +721,7 @@ static int mms_read(URLContext *h, uint8
 {
     /* TODO: see tcp.c:tcp_read() about a possible timeout scheme */
     MMSContext *mms = h->priv_data;
-    int result = 0;
 
-    /* Since we read the header at open(), this shouldn't be possible */
-    assert(mms->header_parsed);
-
-    if (!mms->is_playing) {
-        dprintf(NULL, "mms_read() before play().\n");
-        clear_stream_buffers(mms);
-        result = mms_safe_send_recv(mms, send_stream_selection_request, SC_PKT_STREAM_ID_ACCEPTED);
-        if (result)
-            return result;
-        // send media packet request
-        result = mms_safe_send_recv(mms, send_media_packet_request, SC_PKT_MEDIA_PKT_FOLLOWS);
-        if (result) {
-            return result;
-        }
-    }
     return read_mms_packet(mms, buf, size);
 }
 



More information about the ffmpeg-cvslog mailing list