fix some signedness warnings
[ffmpeg.git] / libavformat / asf.c
index 587c139..7759927 100644 (file)
@@ -705,7 +705,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
             /* return packet */
             if (asf_st->ds_span > 1) {
                 /* packet descrambling */
-                char* newdata = av_malloc(asf_st->pkt.size);
+                uint8_t *newdata = av_malloc(asf_st->pkt.size);
                 if (newdata) {
                     int offset = 0;
                     while (offset < asf_st->pkt.size) {
@@ -823,7 +823,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
             assert((asf_st->packet_pos - s->data_offset) % asf->packet_size == 0);
             pos= asf_st->packet_pos;
 
-            av_add_index_entry(s->streams[i], pos, pkt->size, pts, pos - start_pos[i] + 1, AVINDEX_KEYFRAME);
+            av_add_index_entry(s->streams[i], pos, pts, pkt->size, pos - start_pos[i] + 1, AVINDEX_KEYFRAME);
             start_pos[i]= asf_st->packet_pos + 1;
 
             if(pkt->stream_index == stream_index)
@@ -868,6 +868,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
 
             av_add_index_entry(s->streams[stream_index], pos, index_pts, asf->packet_size, 0, AVINDEX_KEYFRAME);
         }
+        asf->index_read= 1;
     }
     url_fseek(&s->pb, current_pos, SEEK_SET);
 }
@@ -882,10 +883,10 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
     if (asf->packet_size <= 0)
         return -1;
 
-    if (!st->index_entries)
+    if (!asf->index_read)
         asf_build_simple_index(s, stream_index);
 
-    if(!st->index_entries){
+    if(!(asf->index_read && st->index_entries)){
         if(av_seek_frame_binary(s, stream_index, pts, flags)<0)
             return -1;
     }else{