summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libavformat/audio.c2
-rw-r--r--libavformat/grab.c2
-rw-r--r--libavformat/grab_bktr.c2
-rw-r--r--libavformat/img.c6
-rw-r--r--libavformat/img2.c4
-rw-r--r--libavformat/raw.c7
-rw-r--r--libavformat/rtsp.c2
-rw-r--r--libavformat/utils.c6
-rw-r--r--libavformat/v4l2.c2
9 files changed, 18 insertions, 15 deletions
diff --git a/libavformat/audio.c b/libavformat/audio.c
index a9e9c7f..9a45952 100644
--- a/libavformat/audio.c
+++ b/libavformat/audio.c
@@ -217,7 +217,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
AVStream *st;
int ret;
- if (!ap || ap->sample_rate <= 0 || ap->channels <= 0)
+ if (ap->sample_rate <= 0 || ap->channels <= 0)
return -1;
st = av_new_stream(s1, 0);
diff --git a/libavformat/grab.c b/libavformat/grab.c
index 15d8dbb..8b81183 100644
--- a/libavformat/grab.c
+++ b/libavformat/grab.c
@@ -68,7 +68,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
const char *video_device;
int j;
- if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
+ if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
return -1;
width = ap->width;
diff --git a/libavformat/grab_bktr.c b/libavformat/grab_bktr.c
index 3c63256..119a411 100644
--- a/libavformat/grab_bktr.c
+++ b/libavformat/grab_bktr.c
@@ -245,7 +245,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
int format = -1;
const char *video_device;
- if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
+ if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
return -1;
width = ap->width;
diff --git a/libavformat/img.c b/libavformat/img.c
index addcae6..1943c51 100644
--- a/libavformat/img.c
+++ b/libavformat/img.c
@@ -120,7 +120,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
return -ENOMEM;
}
- if (ap && ap->image_format)
+ if (ap->image_format)
s->img_fmt = ap->image_format;
pstrcpy(s->path, sizeof(s->path), s1->filename);
@@ -133,7 +133,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
else
s->is_pipe = 1;
- if (!ap || !ap->time_base.num) {
+ if (!ap->time_base.num) {
st->codec->time_base= (AVRational){1,25};
} else {
st->codec->time_base= ap->time_base;
@@ -255,7 +255,7 @@ static int img_set_parameters(AVFormatContext *s, AVFormatParameters *ap)
int i;
/* find output image format */
- if (ap && ap->image_format) {
+ if (ap->image_format) {
img_fmt = ap->image_format;
} else {
img_fmt = guess_image_format(s->filename);
diff --git a/libavformat/img2.c b/libavformat/img2.c
index e38c694..0f6ce6b 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -187,13 +187,13 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->need_parsing= 1;
}
- if (!ap || !ap->time_base.num) {
+ if (!ap->time_base.num) {
av_set_pts_info(st, 60, 1, 25);
} else {
av_set_pts_info(st, 60, ap->time_base.num, ap->time_base.den);
}
- if(ap && ap->width && ap->height){
+ if(ap->width && ap->height){
st->codec->width = ap->width;
st->codec->height= ap->height;
}
diff --git a/libavformat/raw.c b/libavformat/raw.c
index 5a007ca..d1e01f2 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -48,7 +48,7 @@ static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
st = av_new_stream(s, 0);
if (!st)
return AVERROR_NOMEM;
- if (ap) {
+
id = s->iformat->value;
if (id == CODEC_ID_RAWVIDEO) {
st->codec->codec_type = CODEC_TYPE_VIDEO;
@@ -74,9 +74,6 @@ static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
default:
return -1;
}
- } else {
- return -1;
- }
return 0;
}
@@ -289,7 +286,7 @@ static int video_read_header(AVFormatContext *s,
/* for mjpeg, specify frame rate */
/* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
- if (ap && ap->time_base.num) {
+ if (ap->time_base.num) {
av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
} else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
st->codec->codec_id == CODEC_ID_MPEG4 ||
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index a29fdfc..31af3c9 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -994,7 +994,7 @@ static int rtsp_read_header(AVFormatContext *s,
rt->state = RTSP_STATE_IDLE;
rt->seek_timestamp = 0; /* default is to start stream at position
zero */
- if (ap && ap->initial_pause) {
+ if (ap->initial_pause) {
/* do not start immediately */
} else {
if (rtsp_read_play(s) < 0) {
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 10c3a4a..15a4a5e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -465,6 +465,12 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
{
int err;
AVFormatContext *ic;
+ AVFormatParameters default_ap;
+
+ if(!ap){
+ ap=&default_ap;
+ memset(ap, 0, sizeof(default_ap));
+ }
ic = av_alloc_format_context();
if (!ic) {
diff --git a/libavformat/v4l2.c b/libavformat/v4l2.c
index a445c6d..7aa98df 100644
--- a/libavformat/v4l2.c
+++ b/libavformat/v4l2.c
@@ -384,7 +384,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
uint32_t desired_format, capabilities;
const char *video_device;
- if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
+ if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
av_log(s1, AV_LOG_ERROR, "Missing/Wrong parameters\n");
return -1;
OpenPOWER on IntegriCloud