Revision e356fc57 libavformat/wtv.c

View differences:

libavformat/wtv.c
539 539
    } else {
540 540
        av_freep(&buf);
541 541
        av_log(s, AV_LOG_WARNING, "unsupported metadata entry; key:%s, type:%d, length:0x%x\n", key, type, length);
542
        url_fskip(pb, length);
542
        avio_seek(pb, length, SEEK_CUR);
543 543
        return;
544 544
    }
545 545

  
......
582 582
    WtvContext *wtv = s->priv_data;
583 583
    AVIOContext *pb = wtv->pb;
584 584

  
585
    url_fskip(pb, 72);  // picture aspect ratio is unreliable
585
    avio_seek(pb, 72, SEEK_CUR);  // picture aspect ratio is unreliable
586 586
    ff_get_bmp_header(pb, st);
587 587

  
588 588
    return 72 + 40;
......
658 658

  
659 659
        if (size < 32) {
660 660
            av_log(s, AV_LOG_WARNING, "format buffer size underflow\n");
661
            url_fskip(pb, size);
661
            avio_seek(pb, size, SEEK_CUR);
662 662
            return NULL;
663 663
        }
664 664

  
665
        url_fskip(pb, size - 32);
665
        avio_seek(pb, size - 32, SEEK_CUR);
666 666
        ff_get_guid(pb, &actual_subtype);
667 667
        ff_get_guid(pb, &actual_formattype);
668 668
        avio_seek(pb, -size, SEEK_CUR);
669 669

  
670 670
        st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32);
671
        url_fskip(pb, 32);
671
        avio_seek(pb, 32, SEEK_CUR);
672 672
        return st;
673 673
    } else if (!ff_guidcmp(mediatype, mediatype_audio)) {
674 674
        st = new_stream(s, st, sid, AVMEDIA_TYPE_AUDIO);
......
679 679
        } else {
680 680
            if (ff_guidcmp(formattype, format_none))
681 681
                av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
682
            url_fskip(pb, size);
682
            avio_seek(pb, size, SEEK_CUR);
683 683
        }
684 684

  
685 685
        if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) {
......
701 701
            return NULL;
702 702
        if (!ff_guidcmp(formattype, format_videoinfo2)) {
703 703
            int consumed = parse_videoinfoheader2(s, st);
704
            url_fskip(pb, FFMAX(size - consumed, 0));
704
            avio_seek(pb, FFMAX(size - consumed, 0), SEEK_CUR);
705 705
        } else if (!ff_guidcmp(formattype, format_mpeg2_video)) {
706 706
            int consumed = parse_videoinfoheader2(s, st);
707
            url_fskip(pb, FFMAX(size - consumed, 0));
707
            avio_seek(pb, FFMAX(size - consumed, 0), SEEK_CUR);
708 708
        } else {
709 709
            if (ff_guidcmp(formattype, format_none))
710 710
                av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
711
            url_fskip(pb, size);
711
            avio_seek(pb, size, SEEK_CUR);
712 712
        }
713 713

  
714 714
        if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) {
......
726 726
            return NULL;
727 727
        if (ff_guidcmp(formattype, format_none))
728 728
            av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
729
        url_fskip(pb, size);
729
        avio_seek(pb, size, SEEK_CUR);
730 730
        st->codec->codec_id = CODEC_ID_DVB_SUBTITLE;
731 731
        return st;
732 732
    } else if (!ff_guidcmp(mediatype, mediatype_mstvcaption) &&
......
736 736
            return NULL;
737 737
        if (ff_guidcmp(formattype, format_none))
738 738
            av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
739
        url_fskip(pb, size);
739
        avio_seek(pb, size, SEEK_CUR);
740 740
        st->codec->codec_id   = CODEC_ID_DVB_TELETEXT;
741 741
        return st;
742 742
    } else if (!ff_guidcmp(mediatype, mediatype_mpeg2_sections) &&
743 743
               !ff_guidcmp(subtype, mediasubtype_mpeg2_sections)) {
744 744
        if (ff_guidcmp(formattype, format_none))
745 745
            av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
746
        url_fskip(pb, size);
746
        avio_seek(pb, size, SEEK_CUR);
747 747
        return NULL;
748 748
    }
749 749

  
750 750
    av_log(s, AV_LOG_WARNING, "unknown media type, mediatype:"PRI_GUID
751 751
                              ", subtype:"PRI_GUID", formattype:"PRI_GUID"\n",
752 752
                              ARG_GUID(mediatype), ARG_GUID(subtype), ARG_GUID(formattype));
753
    url_fskip(pb, size);
753
    avio_seek(pb, size, SEEK_CUR);
754 754
    return NULL;
755 755
}
756 756

  
......
779 779
        if (len < 32)
780 780
            break;
781 781
        sid = avio_rl32(pb) & 0x7FFF;
782
        url_fskip(pb, 8);
782
        avio_seek(pb, 8, SEEK_CUR);
783 783
        consumed = 32;
784 784

  
785 785
        if (!ff_guidcmp(g, stream_guid)) {
786 786
            if (ff_find_stream_index(s, sid) < 0) {
787 787
                ff_asf_guid mediatype, subtype, formattype;
788 788
                int size;
789
                url_fskip(pb, 28);
789
                avio_seek(pb, 28, SEEK_CUR);
790 790
                ff_get_guid(pb, &mediatype);
791 791
                ff_get_guid(pb, &subtype);
792
                url_fskip(pb, 12);
792
                avio_seek(pb, 12, SEEK_CUR);
793 793
                ff_get_guid(pb, &formattype);
794 794
                size = avio_rl32(pb);
795 795
                parse_media_type(s, 0, sid, mediatype, subtype, formattype, size);
......
800 800
            if (stream_index >= 0 && !((WtvStream*)s->streams[stream_index]->priv_data)->seen_data) {
801 801
                ff_asf_guid mediatype, subtype, formattype;
802 802
                int size;
803
                url_fskip(pb, 12);
803
                avio_seek(pb, 12, SEEK_CUR);
804 804
                ff_get_guid(pb, &mediatype);
805 805
                ff_get_guid(pb, &subtype);
806
                url_fskip(pb, 12);
806
                avio_seek(pb, 12, SEEK_CUR);
807 807
                ff_get_guid(pb, &formattype);
808 808
                size = avio_rl32(pb);
809 809
                parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size);
......
822 822
                const uint8_t *pbuf = buf;
823 823
                int buf_size;
824 824

  
825
                url_fskip(pb, 8);
825
                avio_seek(pb, 8, SEEK_CUR);
826 826
                consumed += 8;
827 827
                if (!ff_guidcmp(g, EVENTID_CtxADescriptorSpanningEvent) ||
828 828
                    !ff_guidcmp(g, EVENTID_CSDescriptorSpanningEvent)) {
829
                    url_fskip(pb, 6);
829
                    avio_seek(pb, 6, SEEK_CUR);
830 830
                    consumed += 6;
831 831
                }
832 832

  
......
840 840
            if (stream_index >= 0) {
841 841
                AVStream *st = s->streams[stream_index];
842 842
                int audio_type;
843
                url_fskip(pb, 8);
843
                avio_seek(pb, 8, SEEK_CUR);
844 844
                audio_type = avio_r8(pb);
845 845
                if (audio_type == 2)
846 846
                    st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
......
851 851
        } else if (!ff_guidcmp(g, EVENTID_DVBScramblingControlSpanningEvent)) {
852 852
            int stream_index = ff_find_stream_index(s, sid);
853 853
            if (stream_index >= 0) {
854
                url_fskip(pb, 12);
854
                avio_seek(pb, 12, SEEK_CUR);
855 855
                if (avio_rl32(pb))
856 856
                    av_log(s, AV_LOG_WARNING, "DVB scrambled stream detected (st:%d), decoding will likely fail\n", stream_index);
857 857
                consumed += 16;
......
861 861
            if (stream_index >= 0) {
862 862
                AVStream *st = s->streams[stream_index];
863 863
                uint8_t language[4];
864
                url_fskip(pb, 12);
864
                avio_seek(pb, 12, SEEK_CUR);
865 865
                avio_read(pb, language, 3);
866 866
                if (language[0]) {
867 867
                    language[3] = 0;
......
874 874
        } else if (!ff_guidcmp(g, timestamp_guid)) {
875 875
            int stream_index = ff_find_stream_index(s, sid);
876 876
            if (stream_index >= 0) {
877
                url_fskip(pb, 8);
877
                avio_seek(pb, 8, SEEK_CUR);
878 878
                wtv->pts = avio_rl64(pb);
879 879
                consumed += 16;
880 880
                if (wtv->pts == -1)
......
885 885
                        wtv->epoch = wtv->pts;
886 886
                if (mode == SEEK_TO_PTS && wtv->pts >= seekts) {
887 887
#define WTV_PAD8(x) (((x) + 7) & ~7)
888
                    url_fskip(pb, WTV_PAD8(len) - consumed);
888
                    avio_seek(pb, WTV_PAD8(len) - consumed, SEEK_CUR);
889 889
                    return 0;
890 890
                }
891 891
                }
......
923 923
        } else
924 924
            av_log(s, AV_LOG_WARNING, "unsupported chunk:"PRI_GUID"\n", ARG_GUID(g));
925 925

  
926
        url_fskip(pb, WTV_PAD8(len) - consumed);
926
        avio_seek(pb, WTV_PAD8(len) - consumed, SEEK_CUR);
927 927
    }
928 928
    return AVERROR_EOF;
929 929
}
......
954 954
    wtv->last_valid_pts = AV_NOPTS_VALUE;
955 955

  
956 956
    /* read root directory sector */
957
    url_fskip(s->pb, 0x30);
957
    avio_seek(s->pb, 0x30, SEEK_CUR);
958 958
    root_size = avio_rl32(s->pb);
959 959
    if (root_size > sizeof(root)) {
960 960
        av_log(s, AV_LOG_ERROR, "root directory size exceeds sector size\n");
961 961
        return AVERROR_INVALIDDATA;
962 962
    }
963
    url_fskip(s->pb, 4);
963
    avio_seek(s->pb, 4, SEEK_CUR);
964 964
    root_sector = avio_rl32(s->pb);
965 965

  
966 966
    avio_seek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET);
......
1047 1047
        return ret;
1048 1048
    pkt->stream_index = stream_index;
1049 1049
    pkt->pts          = wtv->pts;
1050
    url_fskip(pb, WTV_PAD8(len) - len);
1050
    avio_seek(pb, WTV_PAD8(len) - len, SEEK_CUR);
1051 1051
    return 0;
1052 1052
}
1053 1053

  

Also available in: Unified diff