Revision 87ad63c0

View differences:

libavformat/avidec.c
87 87
}
88 88
#endif
89 89

  
90
static int get_riff(AVIContext *avi, ByteIOContext *pb)
90
static int get_riff(AVFormatContext *s, ByteIOContext *pb)
91 91
{
92
    AVIContext *avi = s->priv_data;
92 93
    char header[8];
93 94
    int i;
94 95

  
......
105 106
        return -1;
106 107

  
107 108
    if(header[7] == 0x19)
108
        av_log(NULL, AV_LOG_INFO, "This file has been generated by a totally broken muxer.\n");
109
        av_log(s, AV_LOG_INFO, "This file has been generated by a totally broken muxer.\n");
109 110

  
110 111
    return 0;
111 112
}
......
247 248

  
248 249
    avi->stream_index= -1;
249 250

  
250
    if (get_riff(avi, pb) < 0)
251
    if (get_riff(s, avi, pb) < 0)
251 252
        return -1;
252 253

  
253 254
    avi->fsize = url_fsize(pb);
......
407 408
            get_le32(pb); /* quality */
408 409
            ast->sample_size = get_le32(pb); /* sample ssize */
409 410
            ast->cum_len *= FFMAX(1, ast->sample_size);
410
//            av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size);
411
//            av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size);
411 412

  
412 413
            switch(tag1) {
413 414
            case MKTAG('v', 'i', 'd', 's'):
......
659 660
                ts /= ast->sample_size;
660 661
            ts= av_rescale(ts, AV_TIME_BASE * (int64_t)st->time_base.num, st->time_base.den);
661 662

  
662
//            av_log(NULL, AV_LOG_DEBUG, "%"PRId64" %d/%d %"PRId64"\n", ts, st->time_base.num, st->time_base.den, ast->frame_offset);
663
//            av_log(s, AV_LOG_DEBUG, "%"PRId64" %d/%d %"PRId64"\n", ts, st->time_base.num, st->time_base.den, ast->frame_offset);
663 664
            if(ts < best_ts && st->nb_index_entries){
664 665
                best_ts= ts;
665 666
                best_st= st;
......
680 681
                                      * FFMAX(1, best_ast->sample_size);
681 682
        }
682 683

  
683
//        av_log(NULL, AV_LOG_DEBUG, "%d\n", i);
684
//        av_log(s, AV_LOG_DEBUG, "%d\n", i);
684 685
        if(i>=0){
685 686
            int64_t pos= best_st->index_entries[i].pos;
686 687
            pos += best_ast->packet_size - best_ast->remaining;
687 688
            url_fseek(s->pb, pos + 8, SEEK_SET);
688
//        av_log(NULL, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos);
689
//        av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos);
689 690

  
690 691
            assert(best_ast->remaining <= best_ast->packet_size);
691 692

  
......
734 735
//                pkt->dts += ast->start;
735 736
            if(ast->sample_size)
736 737
                pkt->dts /= ast->sample_size;
737
//av_log(NULL, AV_LOG_DEBUG, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, avi->stream_index, size);
738
//av_log(s, AV_LOG_DEBUG, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, avi->stream_index, size);
738 739
            pkt->stream_index = avi->stream_index;
739 740

  
740 741
            if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
......
777 778
        size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24);
778 779

  
779 780
        n= get_stream_idx(d+2);
780
//av_log(NULL, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n);
781
//av_log(s, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n);
781 782
        if(i + size > avi->fsize || d[0]<0)
782 783
            continue;
783 784

  
......
787 788
           ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
788 789
           ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
789 790
            url_fskip(pb, size);
790
//av_log(NULL, AV_LOG_DEBUG, "SKIP\n");
791
//av_log(s, AV_LOG_DEBUG, "SKIP\n");
791 792
            goto resync;
792 793
        }
793 794

  
......
846 847
                         (d[2] == 'd' && d[3] == 'c') ||
847 848
                         (d[2] == 'w' && d[3] == 'b')*/) {
848 849

  
849
//av_log(NULL, AV_LOG_DEBUG, "OK\n");
850
//av_log(s, AV_LOG_DEBUG, "OK\n");
850 851
                if(d[2]*256+d[3] == ast->prefix)
851 852
                    ast->prefix_count++;
852 853
                else{
......
895 896
        pos = get_le32(pb);
896 897
        len = get_le32(pb);
897 898
#if defined(DEBUG_SEEK)
898
        av_log(NULL, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
899
        av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
899 900
               i, tag, flags, pos, len);
900 901
#endif
901 902
        if(i==0 && pos > avi->movi_list)
......
910 911
        ast = st->priv_data;
911 912

  
912 913
#if defined(DEBUG_SEEK)
913
        av_log(NULL, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len);
914
        av_log(s, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len);
914 915
#endif
915 916
        if(last_pos == pos)
916 917
            avi->non_interleaved= 1;
......
1011 1012
    pos = st->index_entries[index].pos;
1012 1013
    timestamp = st->index_entries[index].timestamp;
1013 1014

  
1014
//    av_log(NULL, AV_LOG_DEBUG, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp);
1015
//    av_log(s, AV_LOG_DEBUG, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp);
1015 1016

  
1016 1017
    if (CONFIG_DV_DEMUXER && avi->dv_demux) {
1017 1018
        /* One and only one real stream for DV in AVI, and it has video  */
......
1054 1055
                index++;
1055 1056
        }
1056 1057

  
1057
//        av_log(NULL, AV_LOG_DEBUG, "%"PRId64" %d %"PRId64"\n", timestamp, index, st2->index_entries[index].timestamp);
1058
//        av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %"PRId64"\n", timestamp, index, st2->index_entries[index].timestamp);
1058 1059
        /* extract the current frame number */
1059 1060
        ast2->frame_offset = st2->index_entries[index].timestamp;
1060 1061
        if(ast2->sample_size)

Also available in: Unified diff