]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/tiffenc.c
Move the AVCodecContext options definition to a dedicated file, reduce
[ffmpeg] / libavcodec / tiffenc.c
index 0cf7c3b8dbc666b8f2eaa135cf8d9528e3f26008..c44045435bbe5fb6bb228d750f2cd71c0ce95704 100644 (file)
@@ -17,7 +17,6 @@
  * 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
- *
  */
 
 /**
@@ -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);
 }
 
 /**
@@ -223,6 +222,7 @@ 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) {
@@ -281,7 +281,7 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
         return -1;
     }
     if (!is_yuv)
-    s->bpp_tab_size = (s->bpp >> 3);
+        s->bpp_tab_size = (s->bpp >> 3);
 
     if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE || s->compr == TIFF_LZW)
         //best choose for DEFLATE
@@ -332,8 +332,8 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
                 j += s->subsampling[1] - 1;
             }
             else
-            memcpy(zbuf + j * bytes_per_row,
-                   p->data[0] + j * p->linesize[0], bytes_per_row);
+                memcpy(zbuf + j * bytes_per_row,
+                       p->data[0] + j * p->linesize[0], bytes_per_row);
             zn += bytes_per_row;
         }
         n = encode_strip(s, zbuf, ptr, zn, s->compr);
@@ -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"),
 };