]> git.sesse.net Git - vlc/blobdiff - modules/codec/avcodec/subtitle.c
Chromaprint: build statically for Windows
[vlc] / modules / codec / avcodec / subtitle.c
index f3a72e0b8b1dd92e5d8c0842d8f4798204b1e609..a1543efd0db5d285ef6a9338afaf09585290d441 100644 (file)
@@ -1,24 +1,24 @@
 /*****************************************************************************
- * subtitle.c: subtitle decoder using ffmpeg library
+ * subtitle.c: subtitle decoder using libavcodec library
  *****************************************************************************
  * Copyright (C) 2009 Laurent Aimar
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
 #include <vlc_codec.h>
 #include <vlc_avcodec.h>
 
-/* ffmpeg header */
-#ifdef HAVE_LIBAVCODEC_AVCODEC_H
-#   include <libavcodec/avcodec.h>
-#   ifdef HAVE_AVCODEC_VAAPI
-#       include <libavcodec/vaapi.h>
-#   endif
-#else
-#   include <avcodec.h>
-#endif
+#include <libavcodec/avcodec.h>
+#include <libavutil/mem.h>
 
 #include "avcodec.h"
 
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 25, 0 )
-
 struct decoder_sys_t {
     AVCODEC_COMMON_MEMBERS
 };
@@ -63,8 +54,8 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
 
     /* */
     switch (codec_id) {
-    case CODEC_ID_HDMV_PGS_SUBTITLE:
-    case CODEC_ID_XSUB:
+    case AV_CODEC_ID_HDMV_PGS_SUBTITLE:
+    case AV_CODEC_ID_XSUB:
         break;
     default:
         msg_Warn(dec, "refusing to decode non validated subtitle codec");
@@ -92,22 +83,17 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
     /* */
     int ret;
     vlc_avcodec_lock();
-#if LIBAVCODEC_VERSION_MAJOR < 54
-    ret = avcodec_open(context, codec);
-#else
     ret = avcodec_open2(context, codec, NULL /* options */);
-#endif
+    vlc_avcodec_unlock();
     if (ret < 0) {
-        vlc_avcodec_unlock();
         msg_Err(dec, "cannot open codec (%s)", namecodec);
         free(context->extradata);
         free(sys);
         return VLC_EGENERIC;
     }
-    vlc_avcodec_unlock();
 
     /* */
-    msg_Dbg(dec, "ffmpeg codec (%s) started", namecodec);
+    msg_Dbg(dec, "libavcodec codec (%s) started", namecodec);
     dec->fmt_out.i_cat = SPU_ES;
 
     return VLC_SUCCESS;
@@ -192,7 +178,7 @@ void EndSubtitleDec(decoder_t *dec)
 }
 
 /**
- * Convert a RGBA ffmpeg region to our format.
+ * Convert a RGBA libavcodec region to our format.
  */
 static subpicture_region_t *ConvertRegionRGBA(AVSubtitleRect *ffregion)
 {
@@ -239,7 +225,7 @@ static subpicture_region_t *ConvertRegionRGBA(AVSubtitleRect *ffregion)
 }
 
 /**
- * Convert a ffmpeg subtitle to our format.
+ * Convert a libavcodec subtitle to our format.
  */
 static subpicture_t *ConvertSubtitle(decoder_t *dec, AVSubtitle *ffsub, mtime_t pts)
 {
@@ -289,4 +275,3 @@ static subpicture_t *ConvertSubtitle(decoder_t *dec, AVSubtitle *ffsub, mtime_t
     return spu;
 }
 
-#endif