~ubuntu-branches/ubuntu/trusty/libav/trusty-proposed

« back to all changes in this revision

Viewing changes to libavformat/sol.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2013-10-22 23:24:08 UTC
  • mfrom: (1.3.36 sid)
  • Revision ID: package-import@ubuntu.com-20131022232408-b8tvvn4pyzri9mi3
Tags: 6:9.10-1ubuntu1
* Build all -extra flavors from this source package, as libav got demoted
  from main to universe, cf LP: #1243235
* Simplify debian/rules to follow exactly the code that debian executes
* New upstream (LP: #1180288) fixes lots of security issues (LP: #1242802)
* Merge from unstable, remaining changes:
  - build-depend on libtiff5-dev rather than libtiff4-dev,
    avoids FTBFS caused by imlib
  - follow the regular debian codepaths

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 * Based on documents from Game Audio Player and own research
24
24
 */
25
25
 
 
26
#include "libavutil/channel_layout.h"
26
27
#include "libavutil/intreadwrite.h"
27
28
#include "avformat.h"
28
29
#include "internal.h"
47
48
#define SOL_16BIT   4
48
49
#define SOL_STEREO 16
49
50
 
50
 
static enum CodecID sol_codec_id(int magic, int type)
 
51
static enum AVCodecID sol_codec_id(int magic, int type)
51
52
{
52
53
    if (magic == 0x0B8D)
53
54
    {
54
 
        if (type & SOL_DPCM) return CODEC_ID_SOL_DPCM;
55
 
        else return CODEC_ID_PCM_U8;
 
55
        if (type & SOL_DPCM) return AV_CODEC_ID_SOL_DPCM;
 
56
        else return AV_CODEC_ID_PCM_U8;
56
57
    }
57
58
    if (type & SOL_DPCM)
58
59
    {
59
 
        if (type & SOL_16BIT) return CODEC_ID_SOL_DPCM;
60
 
        else if (magic == 0x0C8D) return CODEC_ID_SOL_DPCM;
61
 
        else return CODEC_ID_SOL_DPCM;
 
60
        if (type & SOL_16BIT) return AV_CODEC_ID_SOL_DPCM;
 
61
        else if (magic == 0x0C8D) return AV_CODEC_ID_SOL_DPCM;
 
62
        else return AV_CODEC_ID_SOL_DPCM;
62
63
    }
63
 
    if (type & SOL_16BIT) return CODEC_ID_PCM_S16LE;
64
 
    return CODEC_ID_PCM_U8;
 
64
    if (type & SOL_16BIT) return AV_CODEC_ID_PCM_S16LE;
 
65
    return AV_CODEC_ID_PCM_U8;
65
66
}
66
67
 
67
68
static int sol_codec_type(int magic, int type)
82
83
    return 2;
83
84
}
84
85
 
85
 
static int sol_read_header(AVFormatContext *s,
86
 
                          AVFormatParameters *ap)
 
86
static int sol_read_header(AVFormatContext *s)
87
87
{
88
88
    unsigned int magic,tag;
89
89
    AVIOContext *pb = s->pb;
90
90
    unsigned int id, channels, rate, type;
91
 
    enum CodecID codec;
 
91
    enum AVCodecID codec;
92
92
    AVStream *st;
93
93
 
94
94
    /* check ".snd" header */
105
105
    codec = sol_codec_id(magic, type);
106
106
    channels = sol_channels(magic, type);
107
107
 
108
 
    if (codec == CODEC_ID_SOL_DPCM)
 
108
    if (codec == AV_CODEC_ID_SOL_DPCM)
109
109
        id = sol_codec_type(magic, type);
110
110
    else id = 0;
111
111
 
117
117
    st->codec->codec_tag = id;
118
118
    st->codec->codec_id = codec;
119
119
    st->codec->channels = channels;
 
120
    st->codec->channel_layout = channels == 1 ? AV_CH_LAYOUT_MONO :
 
121
                                                AV_CH_LAYOUT_STEREO;
120
122
    st->codec->sample_rate = rate;
121
123
    avpriv_set_pts_info(st, 64, 1, rate);
122
124
    return 0;
144
146
 
145
147
AVInputFormat ff_sol_demuxer = {
146
148
    .name           = "sol",
147
 
    .long_name      = NULL_IF_CONFIG_SMALL("Sierra SOL format"),
 
149
    .long_name      = NULL_IF_CONFIG_SMALL("Sierra SOL"),
148
150
    .read_probe     = sol_probe,
149
151
    .read_header    = sol_read_header,
150
152
    .read_packet    = sol_read_packet,
151
 
    .read_seek      = pcm_read_seek,
 
153
    .read_seek      = ff_pcm_read_seek,
152
154
};