changeset 4761:4effe3bde31b libavcodec

support for the THP game format by Marco Gerards, mgerards xs4all nl
author diego
date Sun, 01 Apr 2007 14:28:48 +0000
parents e82ceaa9c386
children 4d346a3ea729
files allcodecs.c avcodec.h mjpeg.c
diffstat 3 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/allcodecs.c	Sun Apr 01 11:40:36 2007 +0000
+++ b/allcodecs.c	Sun Apr 01 14:28:48 2007 +0000
@@ -130,6 +130,7 @@
     REGISTER_DECODER(SVQ3, svq3);
     REGISTER_ENCDEC (TARGA, targa);
     REGISTER_DECODER(THEORA, theora);
+    REGISTER_DECODER(THP, thp);
     REGISTER_DECODER(TIERTEXSEQVIDEO, tiertexseqvideo);
     REGISTER_DECODER(TIFF, tiff);
     REGISTER_DECODER(TRUEMOTION1, truemotion1);
--- a/avcodec.h	Sun Apr 01 11:40:36 2007 +0000
+++ b/avcodec.h	Sun Apr 01 14:28:48 2007 +0000
@@ -158,6 +158,7 @@
     CODEC_ID_FFH264,
     CODEC_ID_DXA,
     CODEC_ID_DNXHD,
+    CODEC_ID_THP,
 
     /* various pcm "codecs" */
     CODEC_ID_PCM_S16LE= 0x10000,
@@ -2329,6 +2330,7 @@
 extern AVCodec svq3_decoder;
 extern AVCodec targa_decoder;
 extern AVCodec theora_decoder;
+extern AVCodec thp_decoder;
 extern AVCodec tiertexseqvideo_decoder;
 extern AVCodec tiff_decoder;
 extern AVCodec truemotion1_decoder;
--- a/mjpeg.c	Sun Apr 01 11:40:36 2007 +0000
+++ b/mjpeg.c	Sun Apr 01 14:28:48 2007 +0000
@@ -2044,6 +2044,8 @@
                         uint8_t x = *(src++);
 
                         *(dst++) = x;
+                        if (avctx->codec_id != CODEC_ID_THP)
+                        {
                         if (x == 0xff)
                         {
                             while(src<buf_end && x == 0xff)
@@ -2054,6 +2056,7 @@
                             else if (x)
                                 break;
                         }
+                        }
                     }
                     init_get_bits(&s->gb, s->buffer, (dst - s->buffer)*8);
 
@@ -2583,6 +2586,19 @@
     NULL
 };
 
+AVCodec thp_decoder = {
+    "thp",
+    CODEC_TYPE_VIDEO,
+    CODEC_ID_THP,
+    sizeof(MJpegDecodeContext),
+    mjpeg_decode_init,
+    NULL,
+    mjpeg_decode_end,
+    mjpeg_decode_frame,
+    CODEC_CAP_DR1,
+    NULL
+};
+
 AVCodec mjpegb_decoder = {
     "mjpegb",
     CODEC_TYPE_VIDEO,