~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavformat/westwood.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:23:28 UTC
  • mfrom: (0.4.7 sid)
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20120112222328-8jqdyodym3p84ygu
Tags: 2:1.0~rc4.dfsg1+svn34540-1
* New upstream snapshot
* upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
#include "libavutil/intreadwrite.h"
37
37
#include "avformat.h"
 
38
#include "internal.h"
38
39
 
39
40
#define AUD_HEADER_SIZE 12
40
41
#define AUD_CHUNK_PREAMBLE_SIZE 8
144
145
    wsaud->audio_bits = (((header[10] & 0x2) >> 1) + 1) * 8;
145
146
 
146
147
    /* initialize the audio decoder stream */
147
 
    st = av_new_stream(s, 0);
 
148
    st = avformat_new_stream(s, NULL);
148
149
    if (!st)
149
150
        return AVERROR(ENOMEM);
150
 
    av_set_pts_info(st, 33, 1, wsaud->audio_samplerate);
 
151
    avpriv_set_pts_info(st, 33, 1, wsaud->audio_samplerate);
151
152
    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
152
153
    st->codec->codec_id = wsaud->audio_type;
153
154
    st->codec->codec_tag = 0;  /* no tag */
221
222
    unsigned int chunk_size;
222
223
 
223
224
    /* initialize the video decoder stream */
224
 
    st = av_new_stream(s, 0);
 
225
    st = avformat_new_stream(s, NULL);
225
226
    if (!st)
226
227
        return AVERROR(ENOMEM);
227
 
    av_set_pts_info(st, 33, 1, VQA_FRAMERATE);
 
228
    avpriv_set_pts_info(st, 33, 1, VQA_FRAMERATE);
228
229
    wsvqa->video_stream_index = st->index;
229
230
    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
230
231
    st->codec->codec_id = CODEC_ID_WS_VQA;
247
248
 
248
249
    /* initialize the audio decoder stream for VQA v1 or nonzero samplerate */
249
250
    if (AV_RL16(&header[24]) || (AV_RL16(&header[0]) == 1 && AV_RL16(&header[2]) == 1)) {
250
 
        st = av_new_stream(s, 0);
 
251
        st = avformat_new_stream(s, NULL);
251
252
        if (!st)
252
253
            return AVERROR(ENOMEM);
253
 
        av_set_pts_info(st, 33, 1, VQA_FRAMERATE);
 
254
        avpriv_set_pts_info(st, 33, 1, VQA_FRAMERATE);
254
255
        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
255
256
        if (AV_RL16(&header[0]) == 1)
256
257
            st->codec->codec_id = CODEC_ID_WESTWOOD_SND1;
325
326
        chunk_size = AV_RB32(&preamble[4]);
326
327
        skip_byte = chunk_size & 0x01;
327
328
 
 
329
        if ((chunk_type == SND2_TAG || chunk_type == SND1_TAG) && wsvqa->audio_channels == 0) {
 
330
            av_log(s, AV_LOG_ERROR, "audio chunk without any audio header information found\n");
 
331
            return AVERROR_INVALIDDATA;
 
332
        }
 
333
 
328
334
        if ((chunk_type == SND1_TAG) || (chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) {
329
335
 
330
336
            if (av_new_packet(pkt, chunk_size))
368
374
 
369
375
#if CONFIG_WSAUD_DEMUXER
370
376
AVInputFormat ff_wsaud_demuxer = {
371
 
    "wsaud",
372
 
    NULL_IF_CONFIG_SMALL("Westwood Studios audio format"),
373
 
    sizeof(WsAudDemuxContext),
374
 
    wsaud_probe,
375
 
    wsaud_read_header,
376
 
    wsaud_read_packet,
 
377
    .name           = "wsaud",
 
378
    .long_name      = NULL_IF_CONFIG_SMALL("Westwood Studios audio format"),
 
379
    .priv_data_size = sizeof(WsAudDemuxContext),
 
380
    .read_probe     = wsaud_probe,
 
381
    .read_header    = wsaud_read_header,
 
382
    .read_packet    = wsaud_read_packet,
377
383
};
378
384
#endif
379
385
#if CONFIG_WSVQA_DEMUXER
380
386
AVInputFormat ff_wsvqa_demuxer = {
381
 
    "wsvqa",
382
 
    NULL_IF_CONFIG_SMALL("Westwood Studios VQA format"),
383
 
    sizeof(WsVqaDemuxContext),
384
 
    wsvqa_probe,
385
 
    wsvqa_read_header,
386
 
    wsvqa_read_packet,
 
387
    .name           = "wsvqa",
 
388
    .long_name      = NULL_IF_CONFIG_SMALL("Westwood Studios VQA format"),
 
389
    .priv_data_size = sizeof(WsVqaDemuxContext),
 
390
    .read_probe     = wsvqa_probe,
 
391
    .read_header    = wsvqa_read_header,
 
392
    .read_packet    = wsvqa_read_packet,
387
393
};
388
394
#endif