summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-25 04:00:43 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-25 04:00:43 +0100
commitb008ac18bb6072acb355445436a999c940538d84 (patch)
tree29d0042d7a4d0bc64f452440c2060a13a1e00e51 /libavformat
parent7b9d8703f35585b065c32194b52131b7dd90c710 (diff)
parentd6a77e2b97f3968b99798faeb70e873eb5910849 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: docs: use -bsf:[vas] instead of -[vas]bsf. mpegaudiodec: Prevent premature clipping of mp3 input buffer. lavf: move the packet keyframe setting code. oggenc: free comment header for all codecs lcl: error out if uncompressed input buffer is smaller than framesize. mjpeg: abort decoding if packet is too large. golomb: use HAVE_BITS_REMAINING() macro to prevent infloop on EOF. get_bits: add HAVE_BITS_REMAINING macro. lavf/output-example: use new audio encoding API correctly. lavf/output-example: more proper usage of the new API. tiff: Prevent overreads in the type_sizes array. tiff: Make the TIFF_LONG and TIFF_SHORT types unsigned. apetag: do not leak memory if avio_read() fails apetag: propagate errors. SBR DSP x86: implement SSE sbr_hf_g_filt SBR DSP x86: implement SSE sbr_sum_square_sse SBR DSP: use intptr_t for the ixh parameter. Conflicts: doc/bitstream_filters.texi doc/examples/muxing.c doc/ffmpeg.texi libavcodec/golomb.h libavcodec/x86/Makefile libavformat/oggenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/apetag.c4
-rw-r--r--libavformat/oggenc.c6
-rw-r--r--libavformat/utils.c12
3 files changed, 10 insertions, 12 deletions
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index 7656555125..4d0b8acf08 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -75,6 +75,10 @@ static int ape_tag_read_field(AVFormatContext *s)
if (!value)
return AVERROR(ENOMEM);
c = avio_read(pb, value, size);
+ if (c < 0) {
+ av_free(value);
+ return c;
+ }
value[c] = 0;
av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL);
}
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index c92ee0cfa4..05b4b25a71 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -420,10 +420,10 @@ static int ogg_write_header(AVFormatContext *s)
p = ogg_write_vorbiscomment(7, st->codec->flags & CODEC_FLAG_BITEXACT,
&oggstream->header_len[1], &s->metadata,
framing_bit);
+ oggstream->header[1] = p;
if (!p)
return AVERROR(ENOMEM);
- oggstream->header[1] = p;
bytestream_put_byte(&p, header_type);
bytestream_put_buffer(&p, cstr, 6);
@@ -529,10 +529,8 @@ static int ogg_write_trailer(AVFormatContext *s)
if (st->codec->codec_id == CODEC_ID_FLAC ||
st->codec->codec_id == CODEC_ID_SPEEX) {
av_freep(&oggstream->header[0]);
- av_freep(&oggstream->header[1]);
}
- else
- av_freep(&oggstream->header[1]);
+ av_freep(&oggstream->header[1]);
av_freep(&st->priv_data);
}
return 0;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 16a74f2ad9..51a37bd9e5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1044,14 +1044,6 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
/* update flags */
if(is_intra_only(st->codec))
pkt->flags |= AV_PKT_FLAG_KEY;
- else if (pc) {
- pkt->flags = 0;
- /* keyframe computation */
- if (pc->key_frame == 1)
- pkt->flags |= AV_PKT_FLAG_KEY;
- else if (pc->key_frame == -1 && pc->pict_type == AV_PICTURE_TYPE_I)
- pkt->flags |= AV_PKT_FLAG_KEY;
- }
if (pc)
pkt->convergence_duration = pc->convergence_duration;
}
@@ -1116,6 +1108,10 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
pkt->pts = st->parser->pts;
pkt->dts = st->parser->dts;
pkt->pos = st->parser->pos;
+ if (st->parser->key_frame == 1 ||
+ (st->parser->key_frame == -1 &&
+ st->parser->pict_type == AV_PICTURE_TYPE_I))
+ pkt->flags |= AV_PKT_FLAG_KEY;
if(pkt->data == st->cur_pkt.data && pkt->size == st->cur_pkt.size){
s->cur_st = NULL;
pkt->destruct= st->cur_pkt.destruct;