Revision 91d19d47 libavformat/asfdec.c

View differences:

libavformat/asfdec.c
221 221
            asf->hdr.min_pktsize        = get_le32(pb);
222 222
            asf->hdr.max_pktsize        = get_le32(pb);
223 223
            asf->hdr.max_bitrate        = get_le32(pb);
224
            asf->packet_size = asf->hdr.max_pktsize;
224
            s->packet_size = asf->hdr.max_pktsize;
225 225
        } else if (!guidcmp(&g, &ff_asf_stream_header)) {
226 226
            enum CodecType type;
227 227
            int type_specific_size, sizeX;
......
595 595
    int rsize = 8;
596 596
    int c, d, e, off;
597 597

  
598
    off= (url_ftell(pb) - s->data_offset) % asf->packet_size + 3;
598
    off= (url_ftell(pb) - s->data_offset) % s->packet_size + 3;
599 599

  
600 600
    c=d=e=-1;
601 601
    while(off-- > 0){
......
625 625
    asf->packet_flags    = c;
626 626
    asf->packet_property = d;
627 627

  
628
    DO_2BITS(asf->packet_flags >> 5, packet_length, asf->packet_size);
628
    DO_2BITS(asf->packet_flags >> 5, packet_length, s->packet_size);
629 629
    DO_2BITS(asf->packet_flags >> 1, padsize, 0); // sequence ignored
630 630
    DO_2BITS(asf->packet_flags >> 3, padsize, 0); // padding length
631 631

  
......
654 654
    if (packet_length < asf->hdr.min_pktsize)
655 655
        padsize += asf->hdr.min_pktsize - packet_length;
656 656
    asf->packet_padsize = padsize;
657
    dprintf(s, "packet: size=%d padsize=%d  left=%d\n", asf->packet_size, asf->packet_padsize, asf->packet_size_left);
657
    dprintf(s, "packet: size=%d padsize=%d  left=%d\n", s->packet_size, asf->packet_padsize, asf->packet_size_left);
658 658
    return 0;
659 659
}
660 660

  
......
835 835

  
836 836
        /* read data */
837 837
        //printf("READ PACKET s:%d  os:%d  o:%d,%d  l:%d   DATA:%p\n",
838
        //       asf->packet_size, asf_st->pkt.size, asf->packet_frag_offset,
838
        //       s->packet_size, asf_st->pkt.size, asf->packet_frag_offset,
839 839
        //       asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data);
840 840
        asf->packet_size_left -= asf->packet_frag_size;
841 841
        if (asf->packet_size_left < 0)
......
978 978

  
979 979
static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit)
980 980
{
981
    ASFContext *asf = s->priv_data;
982 981
    AVPacket pkt1, *pkt = &pkt1;
983 982
    ASFStream *asf_st;
984 983
    int64_t pts;
......
990 989
        start_pos[i]= pos;
991 990
    }
992 991

  
993
    pos= (pos+asf->packet_size-1-s->data_offset)/asf->packet_size*asf->packet_size+ s->data_offset;
992
    pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset;
994 993
    *ppos= pos;
995 994
    url_fseek(s->pb, pos, SEEK_SET);
996 995

  
......
1010 1009

  
1011 1010
            asf_st= s->streams[i]->priv_data;
1012 1011

  
1013
//            assert((asf_st->packet_pos - s->data_offset) % asf->packet_size == 0);
1012
//            assert((asf_st->packet_pos - s->data_offset) % s->packet_size == 0);
1014 1013
            pos= asf_st->packet_pos;
1015 1014

  
1016 1015
            av_add_index_entry(s->streams[i], pos, pts, pkt->size, pos - start_pos[i] + 1, AVINDEX_KEYFRAME);
......
1049 1048
        for (i=0;i<ict;i++){
1050 1049
            int pktnum=get_le32(s->pb);
1051 1050
            int pktct =get_le16(s->pb);
1052
            int64_t pos      = s->data_offset + asf->packet_size*(int64_t)pktnum;
1051
            int64_t pos      = s->data_offset + s->packet_size*(int64_t)pktnum;
1053 1052
            int64_t index_pts= av_rescale(itime, i, 10000);
1054 1053

  
1055 1054
            av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d\n", pktnum, pktct);
1056
            av_add_index_entry(s->streams[stream_index], pos, index_pts, asf->packet_size, 0, AVINDEX_KEYFRAME);
1055
            av_add_index_entry(s->streams[stream_index], pos, index_pts, s->packet_size, 0, AVINDEX_KEYFRAME);
1057 1056
        }
1058 1057
        asf->index_read= 1;
1059 1058
    }
......
1067 1066
    int64_t pos;
1068 1067
    int index;
1069 1068

  
1070
    if (asf->packet_size <= 0)
1069
    if (s->packet_size <= 0)
1071 1070
        return -1;
1072 1071

  
1073 1072
    /* Try using the protocol's read_seek if available */

Also available in: Unified diff