[Ffmpeg-cvslog] CVS: ffmpeg/libavformat audio.c, 1.29, 1.30 grab.c, 1.41, 1.42 grab_bktr.c, 1.6, 1.7 v4l2.c, 1.4, 1.5 img.c, 1.43, 1.44 raw.c, 1.68, 1.69 rtsp.c, 1.26, 1.27 utils.c, 1.180, 1.181 img2.c, 1.21, 1.22

Michael Niedermayer CVS michael
Sat Mar 11 01:22:24 CET 2006


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv24613

Modified Files:
	audio.c grab.c grab_bktr.c v4l2.c img.c raw.c rtsp.c utils.c 
	img2.c 
Log Message:
simplify AVFormatParameters NULL checks


Index: audio.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/audio.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- audio.c	1 Feb 2006 11:31:33 -0000	1.29
+++ audio.c	11 Mar 2006 00:22:21 -0000	1.30
@@ -217,7 +217,7 @@
     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);

Index: grab.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/grab.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- grab.c	1 Feb 2006 11:31:33 -0000	1.41
+++ grab.c	11 Mar 2006 00:22:21 -0000	1.42
@@ -68,7 +68,7 @@
     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;

Index: grab_bktr.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/grab_bktr.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- grab_bktr.c	1 Feb 2006 11:31:33 -0000	1.6
+++ grab_bktr.c	11 Mar 2006 00:22:21 -0000	1.7
@@ -245,7 +245,7 @@
     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;

Index: v4l2.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/v4l2.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- v4l2.c	28 Feb 2006 11:28:09 -0000	1.4
+++ v4l2.c	11 Mar 2006 00:22:21 -0000	1.5
@@ -384,7 +384,7 @@
     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;

Index: img.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/img.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- img.c	12 Jan 2006 22:43:23 -0000	1.43
+++ img.c	11 Mar 2006 00:22:21 -0000	1.44
@@ -120,7 +120,7 @@
         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 @@
     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 @@
     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);

Index: raw.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/raw.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- raw.c	1 Mar 2006 20:09:44 -0000	1.68
+++ raw.c	11 Mar 2006 00:22:21 -0000	1.69
@@ -48,7 +48,7 @@
     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 @@
         default:
             return -1;
         }
-    } else {
-        return -1;
-    }
     return 0;
 }
 
@@ -289,7 +286,7 @@
 
     /* 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 ||

Index: rtsp.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/rtsp.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- rtsp.c	12 Jan 2006 22:43:25 -0000	1.26
+++ rtsp.c	11 Mar 2006 00:22:21 -0000	1.27
@@ -994,7 +994,7 @@
     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) {

Index: utils.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/utils.c,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -d -r1.180 -r1.181
--- utils.c	1 Mar 2006 11:29:55 -0000	1.180
+++ utils.c	11 Mar 2006 00:22:21 -0000	1.181
@@ -465,6 +465,12 @@
 {
     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) {

Index: img2.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/img2.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- img2.c	19 Jan 2006 23:36:50 -0000	1.21
+++ img2.c	11 Mar 2006 00:22:21 -0000	1.22
@@ -187,13 +187,13 @@
         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;
     }





More information about the ffmpeg-cvslog mailing list