]> git.sesse.net Git - vlc/blobdiff - modules/codec/avcodec/subtitle.c
Codec/vorbis: follow tremor API change.
[vlc] / modules / codec / avcodec / subtitle.c
index cea176782fd3b574469bdae70e0a1b9fe81ac902..205e02b80c949977ac2b896b8611590acee35ef1 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc_common.h>
 #include <vlc_codec.h>
 #include <vlc_avcodec.h>
-#include <vlc_osd.h>
 
 /* ffmpeg header */
 #ifdef HAVE_LIBAVCODEC_AVCODEC_H
@@ -67,6 +66,7 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
     /* */
     switch (codec_id) {
     case CODEC_ID_HDMV_PGS_SUBTITLE:
+    case CODEC_ID_XSUB:
         break;
     default:
         msg_Warn(dec, "refusing to decode non validated subtitle codec");
@@ -239,7 +239,7 @@ static subpicture_region_t *ConvertRegionRGBA(AVSubtitleRect *ffregion)
  */
 static subpicture_t *ConvertSubtitle(decoder_t *dec, AVSubtitle *ffsub, mtime_t pts)
 {
-    subpicture_t *spu = decoder_NewSubpicture(dec);
+    subpicture_t *spu = decoder_NewSubpicture(dec, NULL);
     if (!spu)
         return NULL;
 
@@ -262,7 +262,7 @@ static subpicture_t *ConvertSubtitle(decoder_t *dec, AVSubtitle *ffsub, mtime_t
         //msg_Err(dec, "SUBS RECT[%d]: %dx%d @%dx%d",
         //         i, rec->w, rec->h, rec->x, rec->y);
 
-        subpicture_region_t *region;
+        subpicture_region_t *region = NULL;
         switch (ffsub->format) {
         case 0:
             region = ConvertRegionRGBA(rec);
@@ -276,13 +276,11 @@ static subpicture_t *ConvertSubtitle(decoder_t *dec, AVSubtitle *ffsub, mtime_t
             *region_next = region;
             region_next = &region->p_next;
         }
-        /* Free AVSubtitleRect
-         * FIXME isn't there an avcodec function ? */
-        free(rec->pict.data[0]); /* Plane */
-        free(rec->pict.data[1]); /* Palette */
-        free(rec);
+        /* Free AVSubtitleRect */
+        avpicture_free(&rec->pict);
+        av_free(rec);
     }
-    free(ffsub->rects);
+    av_free(ffsub->rects);
 
     return spu;
 }