~ubuntu-branches/ubuntu/precise/libav/precise-updates

« back to all changes in this revision

Viewing changes to libavformat/flic.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:30:00 UTC
  • mfrom: (1.2.8) (1.1.13 experimental)
  • Revision ID: package-import@ubuntu.com-20120112223000-cmfo7w78q13i2fd9
Tags: 4:0.8~beta2-1ubuntu1
* Merge from debian, remaining changes:
  - don't build against libdirac, lame, libopenjpeg, librtmp, 
    x264, and xvid  (all in universe)

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include "libavutil/intreadwrite.h"
35
35
#include "libavutil/audioconvert.h"
36
36
#include "avformat.h"
 
37
#include "internal.h"
37
38
 
38
39
#define FLIC_FILE_MAGIC_1 0xAF11
39
40
#define FLIC_FILE_MAGIC_2 0xAF12
105
106
        speed = FLIC_DEFAULT_SPEED;
106
107
 
107
108
    /* initialize the decoder streams */
108
 
    st = av_new_stream(s, 0);
 
109
    st = avformat_new_stream(s, NULL);
109
110
    if (!st)
110
111
        return AVERROR(ENOMEM);
111
112
    flic->video_stream_index = st->index;
145
146
     */
146
147
    if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) {
147
148
        /* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */
148
 
        ast = av_new_stream(s, 1);
 
149
        ast = avformat_new_stream(s, NULL);
149
150
        if (!ast)
150
151
            return AVERROR(ENOMEM);
151
152
 
167
168
        /* Since the header information is incorrect we have to figure out the
168
169
         * framerate using block_align and the fact that the audio is 22050 Hz.
169
170
         * We usually have two cases: 2205 -> 10 fps and 1470 -> 15 fps */
170
 
        av_set_pts_info(st, 64, ast->codec->block_align, FLIC_TFTD_SAMPLE_RATE);
171
 
        av_set_pts_info(ast, 64, 1, FLIC_TFTD_SAMPLE_RATE);
 
171
        avpriv_set_pts_info(st, 64, ast->codec->block_align, FLIC_TFTD_SAMPLE_RATE);
 
172
        avpriv_set_pts_info(ast, 64, 1, FLIC_TFTD_SAMPLE_RATE);
172
173
    } else if (AV_RL16(&header[0x10]) == FLIC_CHUNK_MAGIC_1) {
173
 
        av_set_pts_info(st, 64, FLIC_MC_SPEED, 70);
 
174
        avpriv_set_pts_info(st, 64, FLIC_MC_SPEED, 70);
174
175
 
175
176
        /* rewind the stream since the first chunk is at offset 12 */
176
177
        avio_seek(pb, 12, SEEK_SET);
182
183
        memcpy(st->codec->extradata, header, 12);
183
184
 
184
185
    } else if (magic_number == FLIC_FILE_MAGIC_1) {
185
 
        av_set_pts_info(st, 64, speed, 70);
 
186
        avpriv_set_pts_info(st, 64, speed, 70);
186
187
    } else if ((magic_number == FLIC_FILE_MAGIC_2) ||
187
188
               (magic_number == FLIC_FILE_MAGIC_3)) {
188
 
        av_set_pts_info(st, 64, speed, 1000);
 
189
        avpriv_set_pts_info(st, 64, speed, 1000);
189
190
    } else {
190
191
        av_log(s, AV_LOG_INFO, "Invalid or unsupported magic chunk in file\n");
191
192
        return AVERROR_INVALIDDATA;
261
262
}
262
263
 
263
264
AVInputFormat ff_flic_demuxer = {
264
 
    "flic",
265
 
    NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation format"),
266
 
    sizeof(FlicDemuxContext),
267
 
    flic_probe,
268
 
    flic_read_header,
269
 
    flic_read_packet,
 
265
    .name           = "flic",
 
266
    .long_name      = NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation format"),
 
267
    .priv_data_size = sizeof(FlicDemuxContext),
 
268
    .read_probe     = flic_probe,
 
269
    .read_header    = flic_read_header,
 
270
    .read_packet    = flic_read_packet,
270
271
};