summaryrefslogtreecommitdiff
path: root/libavformat/flvdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-02 12:18:48 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-02 12:19:21 +0200
commit67291ffd6390be85962dd440e1a73c32e5e5ba78 (patch)
tree745cd2e0c0b17f90e0196070da4eafeb43220378 /libavformat/flvdec.c
parentae48547a5296f7aa5518d934325aeaddbdad2cd5 (diff)
parentf900f35ac8db4ac30df6fda1c27502c2ef9e6ba5 (diff)
Merge commit 'f900f35ac8db4ac30df6fda1c27502c2ef9e6ba5'
* commit 'f900f35ac8db4ac30df6fda1c27502c2ef9e6ba5': flvdec: Eliminate completely silly goto Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r--libavformat/flvdec.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index e51a3f0371..1941c5ffee 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -654,35 +654,32 @@ static void clear_index_entries(AVFormatContext *s, int64_t pos)
static int flv_data_packet(AVFormatContext *s, AVPacket *pkt,
int64_t dts, int64_t next)
{
- int ret = AVERROR_INVALIDDATA, i;
AVIOContext *pb = s->pb;
AVStream *st = NULL;
AMFDataType type;
char buf[20];
- int length;
+ int ret, i, length;
type = avio_r8(pb);
if (type == AMF_DATA_TYPE_MIXEDARRAY)
avio_seek(pb, 4, SEEK_CUR);
else if (type != AMF_DATA_TYPE_OBJECT)
- goto out;
+ return AVERROR_INVALIDDATA;
amf_get_string(pb, buf, sizeof(buf));
if (strcmp(buf, "type") || avio_r8(pb) != AMF_DATA_TYPE_STRING)
- goto out;
+ return AVERROR_INVALIDDATA;
amf_get_string(pb, buf, sizeof(buf));
// FIXME parse it as codec_id
amf_get_string(pb, buf, sizeof(buf));
if (strcmp(buf, "text") || avio_r8(pb) != AMF_DATA_TYPE_STRING)
- goto out;
+ return AVERROR_INVALIDDATA;
length = avio_rb16(pb);
ret = av_get_packet(s->pb, pkt, length);
- if (ret < 0) {
- ret = AVERROR(EIO);
- goto out;
- }
+ if (ret < 0)
+ return AVERROR(EIO);
for (i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
@@ -693,7 +690,7 @@ static int flv_data_packet(AVFormatContext *s, AVPacket *pkt,
if (i == s->nb_streams) {
st = create_stream(s, AVMEDIA_TYPE_DATA);
if (!st)
- goto out;
+ return AVERROR_INVALIDDATA;
st->codec->codec_id = AV_CODEC_ID_TEXT;
}
@@ -706,7 +703,6 @@ static int flv_data_packet(AVFormatContext *s, AVPacket *pkt,
avio_seek(s->pb, next + 4, SEEK_SET);
-out:
return ret;
}