~phatforge/libav/fixup

« back to all changes in this revision

Viewing changes to libavformat/vc1test.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
 * VC1 Test Bitstreams Format Demuxer
3
3
 * Copyright (c) 2006, 2008 Konstantin Shishkov
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
 
44
44
static int vc1t_read_header(AVFormatContext *s,
45
45
                           AVFormatParameters *ap)
46
46
{
47
 
    ByteIOContext *pb = s->pb;
 
47
    AVIOContext *pb = s->pb;
48
48
    AVStream *st;
49
49
    int frames;
50
50
    uint32_t fps;
51
51
 
52
 
    frames = get_le24(pb);
53
 
    if(get_byte(pb) != 0xC5 || get_le32(pb) != 4)
 
52
    frames = avio_rl24(pb);
 
53
    if(avio_r8(pb) != 0xC5 || avio_rl32(pb) != 4)
54
54
        return -1;
55
55
 
56
56
    /* init video codec */
63
63
 
64
64
    st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE);
65
65
    st->codec->extradata_size = VC1_EXTRADATA_SIZE;
66
 
    get_buffer(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
67
 
    st->codec->height = get_le32(pb);
68
 
    st->codec->width = get_le32(pb);
69
 
    if(get_le32(pb) != 0xC)
 
66
    avio_read(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
 
67
    st->codec->height = avio_rl32(pb);
 
68
    st->codec->width = avio_rl32(pb);
 
69
    if(avio_rl32(pb) != 0xC)
70
70
        return -1;
71
 
    url_fskip(pb, 8);
72
 
    fps = get_le32(pb);
 
71
    avio_skip(pb, 8);
 
72
    fps = avio_rl32(pb);
73
73
    if(fps == 0xFFFFFFFF)
74
74
        av_set_pts_info(st, 32, 1, 1000);
75
75
    else{
87
87
static int vc1t_read_packet(AVFormatContext *s,
88
88
                           AVPacket *pkt)
89
89
{
90
 
    ByteIOContext *pb = s->pb;
 
90
    AVIOContext *pb = s->pb;
91
91
    int frame_size;
92
92
    int keyframe = 0;
93
93
    uint32_t pts;
94
94
 
95
 
    if(url_feof(pb))
 
95
    if(pb->eof_reached)
96
96
        return AVERROR(EIO);
97
97
 
98
 
    frame_size = get_le24(pb);
99
 
    if(get_byte(pb) & 0x80)
 
98
    frame_size = avio_rl24(pb);
 
99
    if(avio_r8(pb) & 0x80)
100
100
        keyframe = 1;
101
 
    pts = get_le32(pb);
 
101
    pts = avio_rl32(pb);
102
102
    if(av_get_packet(pb, pkt, frame_size) < 0)
103
103
        return AVERROR(EIO);
104
104
    if(s->streams[0]->time_base.den == 1000)
109
109
    return pkt->size;
110
110
}
111
111
 
112
 
AVInputFormat vc1t_demuxer = {
 
112
AVInputFormat ff_vc1t_demuxer = {
113
113
    "vc1test",
114
114
    NULL_IF_CONFIG_SMALL("VC-1 test bitstream format"),
115
115
    0,