changeset 5653:25eca7e2cf64 libavformat

Add flag so muxers not needing width/height can signal this. Add this flag to img2 (fixes -vcodec copy to image2 in some cases)
author michael
date Fri, 12 Feb 2010 20:35:29 +0000
parents 7878a002f87d
children 2f09b8dc4e08
files avformat.h img2.c utils.c
diffstat 3 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/avformat.h	Fri Feb 12 11:31:35 2010 +0000
+++ b/avformat.h	Fri Feb 12 20:35:29 2010 +0000
@@ -242,6 +242,7 @@
 #define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */
 #define AVFMT_TS_DISCONT    0x0200 /**< Format allows timestamp discontinuities. */
 #define AVFMT_VARIABLE_FPS  0x0400 /**< Format allows variable fps. */
+#define AVFMT_NODIMENSIONS  0x0800 /**< Format does not need width/height */
 
 typedef struct AVOutputFormat {
     const char *name;
--- a/img2.c	Fri Feb 12 11:31:35 2010 +0000
+++ b/img2.c	Fri Feb 12 20:35:29 2010 +0000
@@ -446,7 +446,7 @@
     img_write_header,
     img_write_packet,
     NULL,
-    .flags= AVFMT_NOTIMESTAMPS | AVFMT_NOFILE
+    .flags= AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE
 };
 #endif
 #if CONFIG_IMAGE2PIPE_MUXER
@@ -460,6 +460,6 @@
     CODEC_ID_MJPEG,
     img_write_header,
     img_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS
+    .flags= AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS
 };
 #endif
--- a/utils.c	Fri Feb 12 11:31:35 2010 +0000
+++ b/utils.c	Fri Feb 12 20:35:29 2010 +0000
@@ -2546,7 +2546,7 @@
                 av_log(s, AV_LOG_ERROR, "time base not set\n");
                 return -1;
             }
-            if(st->codec->width<=0 || st->codec->height<=0){
+            if((st->codec->width<=0 || st->codec->height<=0) && !(s->oformat->flags & AVFMT_NODIMENSIONS)){
                 av_log(s, AV_LOG_ERROR, "dimensions not set\n");
                 return -1;
             }