]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/targaenc.c
mkvenc: Write TrackTimecodeScale
[ffmpeg] / libavcodec / targaenc.c
index 958ae50553928b74edcf278e939aa323bbeccd23..82d7fe359956ef5e411094ee366e002bb7a9b4bc 100644 (file)
@@ -18,6 +18,8 @@
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
+#include "libavutil/intreadwrite.h"
 #include "avcodec.h"
 #include "rle.h"
 
@@ -74,7 +76,7 @@ static int targa_encode_frame(AVCodecContext *avctx,
                               unsigned char *outbuf,
                               int buf_size, void *data){
     AVFrame *p = data;
-    int bpp, picsize, datasize;
+    int bpp, picsize, datasize = -1;
     uint8_t *out;
 
     if(avctx->width > 0xffff || avctx->height > 0xffff) {
@@ -118,7 +120,8 @@ static int targa_encode_frame(AVCodecContext *avctx,
     out = outbuf + 18;  /* skip past the header we just output */
 
     /* try RLE compression */
-    datasize = targa_encode_rle(out, picsize, p, bpp, avctx->width, avctx->height);
+    if (avctx->coder_type != FF_CODER_TYPE_RAW)
+        datasize = targa_encode_rle(out, picsize, p, bpp, avctx->width, avctx->height);
 
     /* if that worked well, mark the picture as RLE compressed */
     if(datasize >= 0)
@@ -155,6 +158,6 @@ AVCodec targa_encoder = {
     .priv_data_size = sizeof(TargaContext),
     .init = targa_encode_init,
     .encode = targa_encode_frame,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555, PIX_FMT_GRAY8, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555, PIX_FMT_GRAY8, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("Truevision Targa image"),
 };