~phatforge/libav/fixup

« back to all changes in this revision

Viewing changes to libavformat/avs.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2011-04-30 14:27:42 UTC
  • mfrom: (1.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110430142742-quvblxk1tj6adlh5
Tags: 4:0.7~b1-1ubuntu1
* Merge from debian. Remaining changes:
  - don't build against libfaad, libdirac, librtmp and libopenjpeg
    (all in universe)
  - explicitly --enable-pic on powerpc, cf. LP #654666
  - different arm configure bits that should probably better be
    merged into debian
* Cherry-picked from git: 
  - install doc/APIChanges and refer to them in NEWS.Debian (Closes: #623682)
  - don't try to install non-existing documentation, fixes FTBFS on powerpc

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * AVS demuxer.
3
3
 * Copyright (c) 2006  Aurelien Jacobs <aurel@gnuage.org>
4
4
 *
5
 
 * This file is part of FFmpeg.
 
5
 * This file is part of Libav.
6
6
 *
7
 
 * FFmpeg is free software; you can redistribute it and/or
 
7
 * Libav is free software; you can redistribute it and/or
8
8
 * modify it under the terms of the GNU Lesser General Public
9
9
 * License as published by the Free Software Foundation; either
10
10
 * version 2.1 of the License, or (at your option) any later version.
11
11
 *
12
 
 * FFmpeg is distributed in the hope that it will be useful,
 
12
 * Libav is distributed in the hope that it will be useful,
13
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
15
 * Lesser General Public License for more details.
16
16
 *
17
17
 * You should have received a copy of the GNU Lesser General Public
18
 
 * License along with FFmpeg; if not, write to the Free Software
 
18
 * License along with Libav; if not, write to the Free Software
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
20
 */
21
21
 
61
61
 
62
62
    s->ctx_flags |= AVFMTCTX_NOHEADER;
63
63
 
64
 
    url_fskip(s->pb, 4);
65
 
    avs->width = get_le16(s->pb);
66
 
    avs->height = get_le16(s->pb);
67
 
    avs->bits_per_sample = get_le16(s->pb);
68
 
    avs->fps = get_le16(s->pb);
69
 
    avs->nb_frames = get_le32(s->pb);
 
64
    avio_skip(s->pb, 4);
 
65
    avs->width = avio_rl16(s->pb);
 
66
    avs->height = avio_rl16(s->pb);
 
67
    avs->bits_per_sample = avio_rl16(s->pb);
 
68
    avs->fps = avio_rl16(s->pb);
 
69
    avs->nb_frames = avio_rl32(s->pb);
70
70
    avs->remaining_frame_size = 0;
71
71
    avs->remaining_audio_size = 0;
72
72
 
104
104
    pkt->data[palette_size + 1] = type;
105
105
    pkt->data[palette_size + 2] = size & 0xFF;
106
106
    pkt->data[palette_size + 3] = (size >> 8) & 0xFF;
107
 
    ret = get_buffer(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
 
107
    ret = avio_read(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
108
108
    if (ret < size) {
109
109
        av_free_packet(pkt);
110
110
        return AVERROR(EIO);
123
123
    AvsFormat *avs = s->priv_data;
124
124
    int ret, size;
125
125
 
126
 
    size = url_ftell(s->pb);
 
126
    size = avio_tell(s->pb);
127
127
    ret = voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size);
128
 
    size = url_ftell(s->pb) - size;
 
128
    size = avio_tell(s->pb) - size;
129
129
    avs->remaining_audio_size -= size;
130
130
 
131
131
    if (ret == AVERROR(EIO))
154
154
 
155
155
    while (1) {
156
156
        if (avs->remaining_frame_size <= 0) {
157
 
            if (!get_le16(s->pb))    /* found EOF */
 
157
            if (!avio_rl16(s->pb))    /* found EOF */
158
158
                return AVERROR(EIO);
159
 
            avs->remaining_frame_size = get_le16(s->pb) - 4;
 
159
            avs->remaining_frame_size = avio_rl16(s->pb) - 4;
160
160
        }
161
161
 
162
162
        while (avs->remaining_frame_size > 0) {
163
 
            sub_type = get_byte(s->pb);
164
 
            type = get_byte(s->pb);
165
 
            size = get_le16(s->pb);
 
163
            sub_type = avio_r8(s->pb);
 
164
            type = avio_r8(s->pb);
 
165
            size = avio_rl16(s->pb);
166
166
            avs->remaining_frame_size -= size;
167
167
 
168
168
            switch (type) {
169
169
            case AVS_PALETTE:
170
 
                ret = get_buffer(s->pb, palette, size - 4);
 
170
                ret = avio_read(s->pb, palette, size - 4);
171
171
                if (ret < size - 4)
172
172
                    return AVERROR(EIO);
173
173
                palette_size = size;
204
204
                break;
205
205
 
206
206
            default:
207
 
                url_fskip(s->pb, size - 4);
 
207
                avio_skip(s->pb, size - 4);
208
208
            }
209
209
        }
210
210
    }
215
215
    return 0;
216
216
}
217
217
 
218
 
AVInputFormat avs_demuxer = {
 
218
AVInputFormat ff_avs_demuxer = {
219
219
    "avs",
220
220
    NULL_IF_CONFIG_SMALL("AVS format"),
221
221
    sizeof(AvsFormat),