]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavcodec/tiffenc.c
Started attempt to fix seek handling - still not completed
[frescor/ffmpeg.git] / libavcodec / tiffenc.c
index d7e881dafbda271a33a611de470a0487bcd41cc1..1bc3c82c7e013dcdf402edb88c9a86c3cf35a226 100644 (file)
  * You should have received a copy of the GNU Lesser General Public
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  */
 
 /**
  * TIFF image encoder
- * @file tiffenc.c
+ * @file libavcodec/tiffenc.c
  * @author Bartlomiej Wolowiec
  */
 #include "avcodec.h"
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
 #include <zlib.h>
 #endif
 #include "bytestream.h"
@@ -134,7 +133,7 @@ static void add_entry1(TiffEncoderContext * s,
                        enum TiffTags tag, enum TiffTypes type, int val){
     uint16_t w = val;
     uint32_t dw= val;
-    add_entry(s, tag, type, 1, type == TIFF_SHORT ? &w : &dw);
+    add_entry(s, tag, type, 1, type == TIFF_SHORT ? (void *)&w : (void *)&dw);
 }
 
 /**
@@ -152,7 +151,7 @@ static int encode_strip(TiffEncoderContext * s, const int8_t * src,
 {
 
     switch (compr) {
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
     case TIFF_DEFLATE:
     case TIFF_ADOBE_DEFLATE:
         {
@@ -223,13 +222,14 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
     *p = *pict;
     p->pict_type = FF_I_TYPE;
     p->key_frame = 1;
+    avctx->coded_frame= &s->picture;
 
     s->compr = TIFF_PACKBITS;
     if (avctx->compression_level == 0) {
         s->compr = TIFF_RAW;
     } else if(avctx->compression_level == 2) {
         s->compr = TIFF_LZW;
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
     } else if ((avctx->compression_level >= 3)) {
         s->compr = TIFF_DEFLATE;
 #endif
@@ -315,7 +315,7 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
         }
     }
 
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
     if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE) {
         uint8_t *zbuf;
         int zlen, zn;
@@ -402,6 +402,8 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
     add_entry(s, TIFF_XRES,              TIFF_RATIONAL, 1,      res);
     add_entry(s, TIFF_YRES,              TIFF_RATIONAL, 1,      res);
     add_entry1(s,TIFF_RES_UNIT,          TIFF_SHORT,            2);
+
+    if(!(avctx->flags & CODEC_FLAG_BITEXACT))
     add_entry(s, TIFF_SOFTWARE_NAME,     TIFF_STRING,
               strlen(LIBAVCODEC_IDENT) + 1, LIBAVCODEC_IDENT);
 
@@ -454,7 +456,7 @@ AVCodec tiff_encoder = {
                               PIX_FMT_MONOBLACK, PIX_FMT_MONOWHITE,
                               PIX_FMT_YUV420P, PIX_FMT_YUV422P,
                               PIX_FMT_YUV444P, PIX_FMT_YUV410P,
-                              PIX_FMT_YUV411P
-                              -1}
-
+                              PIX_FMT_YUV411P,
+                              PIX_FMT_NONE},
+    .long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
 };