summaryrefslogtreecommitdiff
path: root/libavformat/tty.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-06-05 02:33:59 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-06-05 03:00:31 +0200
commit46eb300d016b69b5fedb0410df98e3c698090c8c (patch)
tree7aa230d9098654e1ce94bc32c2cfb8f1463e9e3b /libavformat/tty.c
parent124a9edb5f172ce36b11fd0d6ccc9f15cc51f322 (diff)
parent594fbe42c6b21aef76b938ce97524fa92a48e7a0 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: ARM: remove MULL inline asm mathops: use MUL64 macro where it forms part of other ops tty: factorise returning error codes. rawdec: add framerate private option. x11grab: add framerate private option. fbdev,v4l2: remove some forgotten uses of AVFormatParameters.time_base. bktr: don't error when AVFormatParameters.time_base isn't set. cmdutils: add missing const qualifier Skip headers not designed to work standalone during 'make checkheaders'. Add missing #includes to make headers self-contained. musepack: remove unnecessary #include from mpcdata.h musepack: remove extraneous mpcdata.h inclusions Fix error check in av_file_map() Conflicts: cmdutils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/tty.c')
-rw-r--r--libavformat/tty.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libavformat/tty.c b/libavformat/tty.c
index 8340218bd2..bf426f64b6 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -73,21 +73,20 @@ static int read_header(AVFormatContext *avctx,
AVFormatParameters *ap)
{
TtyDemuxContext *s = avctx->priv_data;
- int width = 0, height = 0, ret;
+ int width = 0, height = 0, ret = 0;
AVStream *st = av_new_stream(avctx, 0);
- if (!st)
- return AVERROR(ENOMEM);
+
+ if (!st) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
st->codec->codec_tag = 0;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_ANSI;
- if (s->video_size) {
- ret = av_parse_video_size(&width, &height, s->video_size);
- av_freep(&s->video_size);
- if (ret < 0) {
- av_log (avctx, AV_LOG_ERROR, "Couldn't parse video size.\n");
- return ret;
- }
+ if (s->video_size && (ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
+ av_log (avctx, AV_LOG_ERROR, "Couldn't parse video size.\n");
+ goto fail;
}
#if FF_API_FORMAT_PARAMETERS
if (ap->width > 0)
@@ -121,7 +120,9 @@ static int read_header(AVFormatContext *avctx,
avio_seek(avctx->pb, 0, SEEK_SET);
}
- return 0;
+fail:
+ av_freep(&s->video_size);
+ return ret;
}
static int read_packet(AVFormatContext *avctx, AVPacket *pkt)