Revision e63a3628 libavformat/nuv.c

View differences:

libavformat/nuv.c
62 62
        return 1; // no codec data needed
63 63
    while (!url_feof(pb)) {
64 64
        int size, subtype;
65
        frametype = get_byte(pb);
65
        frametype = avio_r8(pb);
66 66
        switch (frametype) {
67 67
            case NUV_EXTRADATA:
68
                subtype = get_byte(pb);
68
                subtype = avio_r8(pb);
69 69
                url_fskip(pb, 6);
70
                size = PKTSIZE(get_le32(pb));
70
                size = PKTSIZE(avio_rl32(pb));
71 71
                if (vst && subtype == 'R') {
72 72
                    vst->codec->extradata_size = size;
73 73
                    vst->codec->extradata = av_malloc(size);
74
                    get_buffer(pb, vst->codec->extradata, size);
74
                    avio_read(pb, vst->codec->extradata, size);
75 75
                    size = 0;
76 76
                    if (!myth)
77 77
                        return 1;
......
79 79
                break;
80 80
            case NUV_MYTHEXT:
81 81
                url_fskip(pb, 7);
82
                size = PKTSIZE(get_le32(pb));
82
                size = PKTSIZE(avio_rl32(pb));
83 83
                if (size != 128 * 4)
84 84
                    break;
85
                get_le32(pb); // version
85
                avio_rl32(pb); // version
86 86
                if (vst) {
87
                    vst->codec->codec_tag = get_le32(pb);
87
                    vst->codec->codec_tag = avio_rl32(pb);
88 88
                    vst->codec->codec_id =
89 89
                        ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag);
90 90
                    if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G'))
......
93 93
                    url_fskip(pb, 4);
94 94

  
95 95
                if (ast) {
96
                    ast->codec->codec_tag = get_le32(pb);
97
                    ast->codec->sample_rate = get_le32(pb);
98
                    ast->codec->bits_per_coded_sample = get_le32(pb);
99
                    ast->codec->channels = get_le32(pb);
96
                    ast->codec->codec_tag = avio_rl32(pb);
97
                    ast->codec->sample_rate = avio_rl32(pb);
98
                    ast->codec->bits_per_coded_sample = avio_rl32(pb);
99
                    ast->codec->channels = avio_rl32(pb);
100 100
                    ast->codec->codec_id =
101 101
                        ff_wav_codec_get_id(ast->codec->codec_tag,
102 102
                                         ast->codec->bits_per_coded_sample);
......
112 112
                break;
113 113
            default:
114 114
                url_fskip(pb, 7);
115
                size = PKTSIZE(get_le32(pb));
115
                size = PKTSIZE(avio_rl32(pb));
116 116
                break;
117 117
        }
118 118
        url_fskip(pb, size);
......
128 128
    int is_mythtv, width, height, v_packs, a_packs;
129 129
    int stream_nr = 0;
130 130
    AVStream *vst = NULL, *ast = NULL;
131
    get_buffer(pb, id_string, 12);
131
    avio_read(pb, id_string, 12);
132 132
    is_mythtv = !memcmp(id_string, "MythTVVideo", 12);
133 133
    url_fskip(pb, 5); // version string
134 134
    url_fskip(pb, 3); // padding
135
    width = get_le32(pb);
136
    height = get_le32(pb);
137
    get_le32(pb); // unused, "desiredwidth"
138
    get_le32(pb); // unused, "desiredheight"
139
    get_byte(pb); // 'P' == progressive, 'I' == interlaced
135
    width = avio_rl32(pb);
136
    height = avio_rl32(pb);
137
    avio_rl32(pb); // unused, "desiredwidth"
138
    avio_rl32(pb); // unused, "desiredheight"
139
    avio_r8(pb); // 'P' == progressive, 'I' == interlaced
140 140
    url_fskip(pb, 3); // padding
141
    aspect = av_int2dbl(get_le64(pb));
141
    aspect = av_int2dbl(avio_rl64(pb));
142 142
    if (aspect > 0.9999 && aspect < 1.0001)
143 143
        aspect = 4.0 / 3.0;
144
    fps = av_int2dbl(get_le64(pb));
144
    fps = av_int2dbl(avio_rl64(pb));
145 145

  
146 146
    // number of packets per stream type, -1 means unknown, e.g. streaming
147
    v_packs = get_le32(pb);
148
    a_packs = get_le32(pb);
149
    get_le32(pb); // text
147
    v_packs = avio_rl32(pb);
148
    a_packs = avio_rl32(pb);
149
    avio_rl32(pb); // text
150 150

  
151
    get_le32(pb); // keyframe distance (?)
151
    avio_rl32(pb); // keyframe distance (?)
152 152

  
153 153
    if (v_packs) {
154 154
        ctx->v_id = stream_nr++;
......
198 198
    while (!url_feof(pb)) {
199 199
        int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
200 200
        uint64_t pos = url_ftell(pb);
201
        ret = get_buffer(pb, hdr, HDRSIZE);
201
        ret = avio_read(pb, hdr, HDRSIZE);
202 202
        if (ret < HDRSIZE)
203 203
            return ret < 0 ? ret : AVERROR(EIO);
204 204
        frametype = hdr[0];
......
225 225
                pkt->pts = AV_RL32(&hdr[4]);
226 226
                pkt->stream_index = ctx->v_id;
227 227
                memcpy(pkt->data, hdr, copyhdrsize);
228
                ret = get_buffer(pb, pkt->data + copyhdrsize, size);
228
                ret = avio_read(pb, pkt->data + copyhdrsize, size);
229 229
                if (ret < 0) {
230 230
                    av_free_packet(pkt);
231 231
                    return ret;

Also available in: Unified diff