~ubuntu-branches/ubuntu/utopic/ffmpeg-debian/utopic

« back to all changes in this revision

Viewing changes to libavformat/mtv.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-01-20 09:20:53 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120092053-izz63p40hc98qfgp
Tags: 3:0.svn20090119-1ubuntu1
* merge from debian. LP: #318501
* new version fixes CVE-2008-3230, LP: #253767

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
typedef struct MTVDemuxContext {
38
38
 
39
 
    unsigned int        file_size;         ///< filesize, not always right
40
 
    unsigned int        segments;          ///< number of 512 byte segments
41
 
    unsigned int        audio_identifier;  ///< 'MP3' on all files I have seen
42
 
    unsigned int        audio_br;          ///< bitrate of audio chanel (mp3)
43
 
    unsigned int        img_colorfmt;      ///< frame colorfmt rgb 565/555
44
 
    unsigned int        img_bpp;           ///< frame bits per pixel
45
 
    unsigned int        img_width;         //
46
 
    unsigned int        img_height;        //
47
 
    unsigned int        img_segment_size;  ///< size of image segment
48
 
    unsigned int        video_fps;         //
49
 
    unsigned int        full_segment_size;
 
39
    unsigned int file_size;         ///< filesize, not always right
 
40
    unsigned int segments;          ///< number of 512 byte segments
 
41
    unsigned int audio_identifier;  ///< 'MP3' on all files I have seen
 
42
    unsigned int audio_br;          ///< bitrate of audio chanel (mp3)
 
43
    unsigned int img_colorfmt;      ///< frame colorfmt rgb 565/555
 
44
    unsigned int img_bpp;           ///< frame bits per pixel
 
45
    unsigned int img_width;         //
 
46
    unsigned int img_height;        //
 
47
    unsigned int img_segment_size;  ///< size of image segment
 
48
    unsigned int video_fps;         //
 
49
    unsigned int full_segment_size;
50
50
 
51
51
} MTVDemuxContext;
52
52
 
53
53
static int mtv_probe(AVProbeData *p)
54
54
{
55
55
    /* Magic is 'AMV' */
56
 
 
57
56
    if(*(p->buf) != 'A' || *(p->buf+1) != 'M' || *(p->buf+2) != 'V')
58
57
        return 0;
59
58
 
62
61
 
63
62
static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
64
63
{
65
 
    MTVDemuxContext    *mtv = s->priv_data;
66
 
    ByteIOContext      *pb  = s->pb;
67
 
    AVStream           *st;
68
 
    unsigned int        audio_subsegments;
69
 
 
 
64
    MTVDemuxContext *mtv = s->priv_data;
 
65
    ByteIOContext   *pb  = s->pb;
 
66
    AVStream        *st;
 
67
    unsigned int    audio_subsegments;
70
68
 
71
69
    url_fskip(pb, 3);
72
70
    mtv->file_size         = get_le32(pb);
86
84
        mtv->img_segment_size;
87
85
    mtv->video_fps         = (mtv->audio_br / 4) / audio_subsegments;
88
86
 
89
 
    /* FIXME Add sanity check here */
90
 
 
91
 
    /* all systems go! init decoders */
92
 
 
93
 
    /* video - raw rgb565 */
 
87
    // FIXME Add sanity check here
 
88
 
 
89
    // all systems go! init decoders
 
90
 
 
91
    // video - raw rgb565
94
92
 
95
93
    st = av_new_stream(s, VIDEO_SID);
96
94
    if(!st)
105
103
    st->codec->bits_per_coded_sample = mtv->img_bpp;
106
104
    st->codec->sample_rate     = mtv->video_fps;
107
105
 
108
 
    /* audio - mp3 */
 
106
    // audio - mp3
109
107
 
110
108
    st = av_new_stream(s, AUDIO_SID);
111
109
    if(!st)
117
115
    st->codec->bit_rate        = mtv->audio_br;
118
116
    st->need_parsing           = AVSTREAM_PARSE_FULL;
119
117
 
120
 
    /* Jump over header */
 
118
    // Jump over header
121
119
 
122
120
    if(url_fseek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE)
123
121
        return AVERROR(EIO);