~siretart/libav/trusty-security

« back to all changes in this revision

Viewing changes to libavformat/mvi.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:
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
20
 */
21
21
 
 
22
#include "libavutil/channel_layout.h"
22
23
#include "avformat.h"
23
24
#include "internal.h"
24
25
 
36
37
    int video_frame_size;
37
38
} MviDemuxContext;
38
39
 
39
 
static int read_header(AVFormatContext *s, AVFormatParameters *ap)
 
40
static int read_header(AVFormatContext *s)
40
41
{
41
42
    MviDemuxContext *mvi = s->priv_data;
42
43
    AVIOContext *pb = s->pb;
79
80
 
80
81
    avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
81
82
    ast->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
82
 
    ast->codec->codec_id        = CODEC_ID_PCM_U8;
 
83
    ast->codec->codec_id        = AV_CODEC_ID_PCM_U8;
83
84
    ast->codec->channels        = 1;
 
85
    ast->codec->channel_layout  = AV_CH_LAYOUT_MONO;
84
86
    ast->codec->bits_per_coded_sample = 8;
85
87
    ast->codec->bit_rate        = ast->codec->sample_rate * 8;
86
88
 
87
89
    avpriv_set_pts_info(vst, 64, msecs_per_frame, 1000000);
88
90
    vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
89
 
    vst->codec->codec_id   = CODEC_ID_MOTIONPIXELS;
 
91
    vst->codec->codec_id   = AV_CODEC_ID_MOTIONPIXELS;
90
92
 
91
93
    mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? avio_rl16 : avio_rl24;
92
94
 
93
95
    mvi->audio_frame_size   = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count;
 
96
    if (mvi->audio_frame_size <= 1 << MVI_FRAC_BITS - 1) {
 
97
        av_log(s, AV_LOG_ERROR, "Invalid audio_data_size (%d) or frames_count (%d)\n",
 
98
               mvi->audio_data_size, frames_count);
 
99
        return AVERROR_INVALIDDATA;
 
100
    }
 
101
 
94
102
    mvi->audio_size_counter = (ast->codec->sample_rate * 830 / mvi->audio_frame_size - 1) * mvi->audio_frame_size;
95
103
    mvi->audio_size_left    = mvi->audio_data_size;
96
104
 
126
134
 
127
135
AVInputFormat ff_mvi_demuxer = {
128
136
    .name           = "mvi",
129
 
    .long_name      = NULL_IF_CONFIG_SMALL("Motion Pixels MVI format"),
 
137
    .long_name      = NULL_IF_CONFIG_SMALL("Motion Pixels MVI"),
130
138
    .priv_data_size = sizeof(MviDemuxContext),
131
139
    .read_header    = read_header,
132
140
    .read_packet    = read_packet,
133
 
    .extensions = "mvi"
 
141
    .extensions     = "mvi",
134
142
};