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

« back to all changes in this revision

Viewing changes to libavformat/flvdec.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler, Jonas Smedegaard, Reinhard Tartler
  • Date: 2013-03-02 14:34:27 UTC
  • mfrom: (1.5.6)
  • mto: (1.3.35 sid)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: package-import@ubuntu.com-20130302143427-wdmprnbkkccte051
Tags: 6:9.3-1
[ Jonas Smedegaard ]
* Stop using CDBS.

[ Reinhard Tartler ]
* Imported Upstream version 9.2 (never uploaded, though)
* Imported Upstream version 9.3:
  - Fixes CVE-2013-0894
* drop 02-fix-build-on-non-armv5te.patch, merged upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
201
201
    return 0;
202
202
}
203
203
 
204
 
static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid) {
 
204
static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid, int read) {
205
205
    AVCodecContext *vcodec = vstream->codec;
206
206
    switch(flv_codecid) {
207
207
        case FLV_CODECID_H263  : vcodec->codec_id = AV_CODEC_ID_FLV1   ; break;
211
211
        case FLV_CODECID_VP6A  :
212
212
            if(flv_codecid == FLV_CODECID_VP6A)
213
213
                vcodec->codec_id = AV_CODEC_ID_VP6A;
214
 
            if(vcodec->extradata_size != 1) {
215
 
                vcodec->extradata_size = 1;
216
 
                vcodec->extradata = av_malloc(1);
 
214
            if (read) {
 
215
                if (vcodec->extradata_size != 1) {
 
216
                    vcodec->extradata = av_malloc(1);
 
217
                    if (vcodec->extradata)
 
218
                        vcodec->extradata_size = 1;
 
219
                }
 
220
                if (vcodec->extradata)
 
221
                    vcodec->extradata[0] = avio_r8(s->pb);
 
222
                else
 
223
                    avio_skip(s->pb, 1);
217
224
            }
218
 
            vcodec->extradata[0] = avio_r8(s->pb);
219
225
            return 1; // 1 byte body size adjustment for flv_read_packet()
220
226
        case FLV_CODECID_H264:
221
227
            vcodec->codec_id = AV_CODEC_ID_H264;
408
414
                st->codec->codec_id = AV_CODEC_ID_TEXT;
409
415
            } else if (flv->trust_metadata) {
410
416
                if (!strcmp(key, "videocodecid") && vcodec) {
411
 
                    flv_set_video_codec(s, vstream, num_val);
 
417
                    flv_set_video_codec(s, vstream, num_val, 0);
412
418
                } else
413
419
                if (!strcmp(key, "audiocodecid") && acodec) {
414
420
                    flv_set_audio_codec(s, astream, acodec, num_val);
766
772
            sample_rate = ctx.sample_rate;
767
773
        }
768
774
    }else{
769
 
        size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK);
 
775
        size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK, 1);
770
776
    }
771
777
 
772
778
    if (st->codec->codec_id == AV_CODEC_ID_AAC ||