~ubuntu-branches/ubuntu/oneiric/libav/oneiric

« back to all changes in this revision

Viewing changes to libavformat/vqf.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2011-04-19 15:04:55 UTC
  • mfrom: (1.2.1 upstream)
  • mto: (1.3.4 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20110419150455-c1nac6gjm3t2aa4n
Tags: 4:0.7~b1-1
* New upstream version
* bump SONAME and SHLIBS
* configure flags --disable-stripping was removed upstream
* the MAINTAINERS file was removed upstream
* remove patch disable-configuration-warning.patch
* drop avfilter confflags, it is enable by default in 0.7
* libfaad wrapper has been removed upstream
* also update the *contents* of the lintian overrides

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * VQF demuxer
3
3
 * Copyright (c) 2009 Vitor Sessak
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
 
54
54
    buf = av_malloc(len+1);
55
55
    if (!buf)
56
56
        return;
57
 
    get_buffer(s->pb, buf, len);
 
57
    avio_read(s->pb, buf, len);
58
58
    buf[len] = 0;
59
59
    av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL);
60
60
}
72
72
    if (!st)
73
73
        return AVERROR(ENOMEM);
74
74
 
75
 
    url_fskip(s->pb, 12);
 
75
    avio_skip(s->pb, 12);
76
76
 
77
 
    header_size = get_be32(s->pb);
 
77
    header_size = avio_rb32(s->pb);
78
78
 
79
79
    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
80
80
    st->codec->codec_id   = CODEC_ID_TWINVQ;
82
82
 
83
83
    do {
84
84
        int len;
85
 
        chunk_tag = get_le32(s->pb);
 
85
        chunk_tag = avio_rl32(s->pb);
86
86
 
87
87
        if (chunk_tag == MKTAG('D','A','T','A'))
88
88
            break;
89
89
 
90
 
        len = get_be32(s->pb);
 
90
        len = avio_rb32(s->pb);
91
91
 
92
92
        if ((unsigned) len > INT_MAX/2) {
93
93
            av_log(s, AV_LOG_ERROR, "Malformed header\n");
98
98
 
99
99
        switch(chunk_tag){
100
100
        case MKTAG('C','O','M','M'):
101
 
            st->codec->channels = get_be32(s->pb) + 1;
102
 
            read_bitrate        = get_be32(s->pb);
103
 
            rate_flag           = get_be32(s->pb);
104
 
            url_fskip(s->pb, len-12);
 
101
            st->codec->channels = avio_rb32(s->pb) + 1;
 
102
            read_bitrate        = avio_rb32(s->pb);
 
103
            rate_flag           = avio_rb32(s->pb);
 
104
            avio_skip(s->pb, len-12);
105
105
 
106
106
            st->codec->bit_rate              = read_bitrate*1000;
107
107
            st->codec->bits_per_coded_sample = 16;
140
140
            av_log(s, AV_LOG_ERROR, "Unknown chunk: %c%c%c%c\n",
141
141
                   ((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1],
142
142
                   ((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]);
143
 
            url_fskip(s->pb, FFMIN(len, header_size));
 
143
            avio_skip(s->pb, FFMIN(len, header_size));
144
144
            break;
145
145
        }
146
146
 
200
200
    int ret;
201
201
    int size = (c->frame_bit_len - c->remaining_bits + 7)>>3;
202
202
 
203
 
    pkt->pos          = url_ftell(s->pb);
 
203
    pkt->pos          = avio_tell(s->pb);
204
204
    pkt->stream_index = 0;
205
205
 
206
206
    if (av_new_packet(pkt, size+2) < 0)
208
208
 
209
209
    pkt->data[0] = 8 - c->remaining_bits; // Number of bits to skip
210
210
    pkt->data[1] = c->last_frame_bits;
211
 
    ret = get_buffer(s->pb, pkt->data+2, size);
 
211
    ret = avio_read(s->pb, pkt->data+2, size);
212
212
 
213
213
    if (ret<=0) {
214
214
        av_free_packet(pkt);
240
240
    st->cur_dts = av_rescale(pos, st->time_base.den,
241
241
                             st->codec->bit_rate * (int64_t)st->time_base.num);
242
242
 
243
 
    if ((ret = url_fseek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0)
 
243
    if ((ret = avio_seek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0)
244
244
        return ret;
245
245
 
246
246
    c->remaining_bits = -7 - ((pos-7)&7);
247
247
    return 0;
248
248
}
249
249
 
250
 
AVInputFormat vqf_demuxer = {
 
250
AVInputFormat ff_vqf_demuxer = {
251
251
    "vqf",
252
252
    NULL_IF_CONFIG_SMALL("Nippon Telegraph and Telephone Corporation (NTT) TwinVQ"),
253
253
    sizeof(VqfContext),