~ubuntu-branches/ubuntu/vivid/libav/vivid

« back to all changes in this revision

Viewing changes to libavformat/rl2.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:
69
69
/**
70
70
 * read rl2 header data and setup the avstreams
71
71
 * @param s demuxer context
72
 
 * @param ap format parameters
73
72
 * @return 0 on success, AVERROR otherwise
74
73
 */
75
 
static av_cold int rl2_read_header(AVFormatContext *s,
76
 
                            AVFormatParameters *ap)
 
74
static av_cold int rl2_read_header(AVFormatContext *s)
77
75
{
78
76
    AVIOContext *pb = s->pb;
79
77
    AVStream *st;
109
107
    rate = avio_rl16(pb);
110
108
    channels = avio_rl16(pb);
111
109
    def_sound_size = avio_rl16(pb);
 
110
    if (!channels || channels > 42) {
 
111
        av_log(s, AV_LOG_ERROR, "Invalid number of channels: %d\n", channels);
 
112
        return AVERROR_INVALIDDATA;
 
113
    }
112
114
 
113
115
    /** setup video stream */
114
116
    st = avformat_new_stream(s, NULL);
116
118
         return AVERROR(ENOMEM);
117
119
 
118
120
    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
119
 
    st->codec->codec_id = CODEC_ID_RL2;
 
121
    st->codec->codec_id = AV_CODEC_ID_RL2;
120
122
    st->codec->codec_tag = 0;  /* no fourcc */
121
123
    st->codec->width = 320;
122
124
    st->codec->height = 200;
145
147
        if (!st)
146
148
            return AVERROR(ENOMEM);
147
149
        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
148
 
        st->codec->codec_id = CODEC_ID_PCM_U8;
 
150
        st->codec->codec_id = AV_CODEC_ID_PCM_U8;
149
151
        st->codec->codec_tag = 1;
150
152
        st->codec->channels = channels;
151
153
        st->codec->bits_per_coded_sample = 8;
288
290
 
289
291
AVInputFormat ff_rl2_demuxer = {
290
292
    .name           = "rl2",
291
 
    .long_name      = NULL_IF_CONFIG_SMALL("RL2 format"),
 
293
    .long_name      = NULL_IF_CONFIG_SMALL("RL2"),
292
294
    .priv_data_size = sizeof(Rl2DemuxContext),
293
295
    .read_probe     = rl2_probe,
294
296
    .read_header    = rl2_read_header,
295
297
    .read_packet    = rl2_read_packet,
296
298
    .read_seek      = rl2_read_seek,
297
299
};
298