aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-17 12:37:04 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-17 12:44:31 +0200
commit3f760214b44bff702f3701a0b13627b3c7153f6f (patch)
treeb630363b1c614381ffcf691ab67fcd7bebd2b7fd /libavformat/utils.c
parent4149981b376d010f99864dc54ff2f7013ccf0a9f (diff)
parent68b467742092364f9306283f40effde2c12efe08 (diff)
downloadffmpeg-3f760214b44bff702f3701a0b13627b3c7153f6f.tar.gz
Merge commit '68b467742092364f9306283f40effde2c12efe08'
* commit '68b467742092364f9306283f40effde2c12efe08': lavf: Make probe_codec return an error code Conflicts: libavformat/utils.c A failure to reallocate should not free the array as it is used to probe the codec. And failure to reallocate if the following probe succeeds isnt a fatal error for probe_codec(). Thus this is only partially merged to ensure probing still is attempted with the data available. Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index ca8d845395..3f08528a6a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -579,7 +579,7 @@ static void force_codec_ids(AVFormatContext *s, AVStream *st)
}
}
-static void probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
+static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
{
if(st->request_probe>0){
AVProbeData *pd = &st->probe_data;
@@ -622,11 +622,12 @@ no_packet:
force_codec_ids(s, st);
}
}
+ return 0;
}
int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
{
- int ret, i;
+ int ret, i, err;
AVStream *st;
for(;;){
@@ -635,8 +636,10 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
if (pktl) {
*pkt = pktl->pkt;
st = s->streams[pkt->stream_index];
- if (s->raw_packet_buffer_remaining_size <= 0)
- probe_codec(s, st, NULL);
+ if (s->raw_packet_buffer_remaining_size <= 0) {
+ if ((err = probe_codec(s, st, NULL)) < 0)
+ return err;
+ }
if(st->request_probe <= 0){
s->raw_packet_buffer = pktl->next;
s->raw_packet_buffer_remaining_size += pkt->size;
@@ -655,7 +658,8 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
for (i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
if (st->probe_packets) {
- probe_codec(s, st, NULL);
+ if ((err = probe_codec(s, st, NULL)) < 0)
+ return err;
}
av_assert0(st->request_probe <= 0);
}
@@ -695,7 +699,8 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
add_to_pktbuf(&s->raw_packet_buffer, pkt, &s->raw_packet_buffer_end);
s->raw_packet_buffer_remaining_size -= pkt->size;
- probe_codec(s, st, pkt);
+ if ((err = probe_codec(s, st, pkt)) < 0)
+ return err;
}
}