~ubuntu-branches/ubuntu/precise/mplayer2/precise-proposed

« back to all changes in this revision

Viewing changes to ffmpeg-mt/libavformat/libnut.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2011-04-21 09:21:39 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110421092139-7a21foqroxvir3wr
Tags: 2.0-54-gd33877a-1
* New upstream version
* Bug fix: "internal MP3 decoder miscompiles with gcc 4.6", thanks to
  Norbert Preining (Closes: #623279). Fixed by no longer using internal
  mp3lib copy.
* drop build host specific optimizations

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * NUT (de)muxing via libnut
3
3
 * copyright (c) 2006 Oded Shimon <ods15@ods15.dyndns.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
 
46
46
 
47
47
#if CONFIG_LIBNUT_MUXER
48
48
static int av_write(void * h, size_t len, const uint8_t * buf) {
49
 
    ByteIOContext * bc = h;
50
 
    put_buffer(bc, buf, len);
51
 
    //put_flush_packet(bc);
 
49
    AVIOContext * bc = h;
 
50
    avio_write(bc, buf, len);
 
51
    //avio_flush(bc);
52
52
    return len;
53
53
}
54
54
 
55
55
static int nut_write_header(AVFormatContext * avf) {
56
56
    NUTContext * priv = avf->priv_data;
57
 
    ByteIOContext * bc = avf->pb;
 
57
    AVIOContext * bc = avf->pb;
58
58
    nut_muxer_opts_tt mopts = {
59
59
        .output = {
60
60
            .priv = bc,
137
137
}
138
138
 
139
139
static int nut_write_trailer(AVFormatContext * avf) {
140
 
    ByteIOContext * bc = avf->pb;
 
140
    AVIOContext * bc = avf->pb;
141
141
    NUTContext * priv = avf->priv_data;
142
142
    int i;
143
143
 
144
144
    nut_muxer_uninit_reorder(priv->nut);
145
 
    put_flush_packet(bc);
 
145
    avio_flush(bc);
146
146
 
147
147
    for(i = 0; priv->s[i].type != -1; i++ ) av_freep(&priv->s[i].fourcc);
148
148
    av_freep(&priv->s);
150
150
    return 0;
151
151
}
152
152
 
153
 
AVOutputFormat libnut_muxer = {
 
153
AVOutputFormat ff_libnut_muxer = {
154
154
    "libnut",
155
155
    "nut format",
156
156
    "video/x-nut",
172
172
}
173
173
 
174
174
static size_t av_read(void * h, size_t len, uint8_t * buf) {
175
 
    ByteIOContext * bc = h;
176
 
    return get_buffer(bc, buf, len);
 
175
    AVIOContext * bc = h;
 
176
    return avio_read(bc, buf, len);
177
177
}
178
178
 
179
179
static off_t av_seek(void * h, long long pos, int whence) {
180
 
    ByteIOContext * bc = h;
 
180
    AVIOContext * bc = h;
181
181
    if (whence == SEEK_END) {
182
 
        pos = url_fsize(bc) + pos;
 
182
        pos = avio_size(bc) + pos;
183
183
        whence = SEEK_SET;
184
184
    }
185
 
    return url_fseek(bc, pos, whence);
 
185
    return avio_seek(bc, pos, whence);
186
186
}
187
187
 
188
188
static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
189
189
    NUTContext * priv = avf->priv_data;
190
 
    ByteIOContext * bc = avf->pb;
 
190
    AVIOContext * bc = avf->pb;
191
191
    nut_demuxer_opts_tt dopts = {
192
192
        .input = {
193
193
            .priv = bc,
272
272
    if (pd.flags & NUT_FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY;
273
273
    pkt->pts = pd.pts;
274
274
    pkt->stream_index = pd.stream;
275
 
    pkt->pos = url_ftell(avf->pb);
 
275
    pkt->pos = avio_tell(avf->pb);
276
276
 
277
277
    ret = nut_read_frame(priv->nut, &pd.len, pkt->data);
278
278
 
297
297
    return 0;
298
298
}
299
299
 
300
 
AVInputFormat libnut_demuxer = {
 
300
AVInputFormat ff_libnut_demuxer = {
301
301
    "libnut",
302
302
    NULL_IF_CONFIG_SMALL("NUT format"),
303
303
    sizeof(NUTContext),