]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/targa.c
aacenc: mark SBR absent
[ffmpeg] / libavcodec / targa.c
index 633a6961c186639d4428aa22604f303d9d1ad5ab..7f8774ef542b739b743d644aa8898f135155c73f 100644 (file)
  */
 
 #include "libavutil/intreadwrite.h"
+#include "libavcore/imgutils.h"
 #include "avcodec.h"
-
-enum TargaCompr{
-    TGA_NODATA = 0, // no image data
-    TGA_PAL    = 1, // palettized
-    TGA_RGB    = 2, // true-color
-    TGA_BW     = 3, // black & white or grayscale
-    TGA_RLE    = 8, // flag pointing that data is RLE-coded
-};
+#include "targa.h"
 
 typedef struct TargaContext {
     AVFrame picture;
@@ -145,7 +139,7 @@ static int decode_frame(AVCodecContext *avctx,
     if(s->picture.data[0])
         avctx->release_buffer(avctx, &s->picture);
 
-    if(avcodec_check_dimensions(avctx, w, h))
+    if(av_image_check_size(w, h, 0, avctx))
         return -1;
     if(w != avctx->width || h != avctx->height)
         avcodec_set_dimensions(avctx, w, h);
@@ -189,7 +183,6 @@ static int decode_frame(AVCodecContext *avctx,
                 *pal++ = (b << 16) | (g << 8) | r;
             }
             p->palette_has_changed = 1;
-            avctx->palctrl->palette_changed = 0;
         }
     }
     if((compr & (~TGA_RLE)) == TGA_NODATA)
@@ -199,7 +192,7 @@ static int decode_frame(AVCodecContext *avctx,
             targa_decode_rle(avctx, s, buf, dst, avctx->width, avctx->height, stride, bpp);
         else{
             for(y = 0; y < s->height; y++){
-#ifdef WORDS_BIGENDIAN
+#if HAVE_BIGENDIAN
                 if((s->bpp + 1) >> 3 == 2){
                     uint16_t *dst16 = (uint16_t*)dst;
                     for(x = 0; x < s->width; x++)
@@ -244,14 +237,14 @@ static av_cold int targa_end(AVCodecContext *avctx){
 
 AVCodec targa_decoder = {
     "targa",
-    CODEC_TYPE_VIDEO,
+    AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TARGA,
     sizeof(TargaContext),
     targa_init,
     NULL,
     targa_end,
     decode_frame,
-    0,
+    CODEC_CAP_DR1,
     NULL,
     .long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"),
 };