]> git.sesse.net Git - vlc/blobdiff - modules/codec/avcodec/avcodec.h
decoder: remove decoder_LinkPicture()
[vlc] / modules / codec / avcodec / avcodec.h
index ce3a44bbcd0156b8065a62fca1730afb4d18ce32..b187169657cc3c56e1aae9e2c3f6d67fed932a83 100644 (file)
@@ -1,38 +1,35 @@
 /*****************************************************************************
  * avcodec.h: decoder and encoder using libavcodec
  *****************************************************************************
- * Copyright (C) 2001-2008 the VideoLAN team
+ * Copyright (C) 2001-2008 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
- * 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 "chroma.h"
+#include "avcommon.h"
+
 /* VLC <-> avcodec tables */
 int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
-                    int *pi_ffmpeg_codec, const char **ppsz_name );
-int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
+                    unsigned *pi_ffmpeg_codec, const char **ppsz_name );
+int GetVlcFourcc( unsigned i_ffmpeg_codec, int *pi_cat,
                   vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
-int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc );
-int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt );
-int GetVlcChroma( video_format_t *fmt, const int i_ffmpeg_chroma );
-
-
-picture_t * DecodeVideo    ( decoder_t *, block_t ** );
-aout_buffer_t * DecodeAudio( decoder_t *, block_t ** );
+vlc_fourcc_t GetVlcAudioFormat( int i_sample_fmt );
 
 /* Video encoder module */
 int  OpenEncoder ( vlc_object_t * );
@@ -46,31 +43,29 @@ void CloseAudioEncoder( vlc_object_t * );
 int  OpenDeinterlace( vlc_object_t * );
 void CloseDeinterlace( vlc_object_t * );
 
-void InitLibavcodec( vlc_object_t *p_object );
-
 /* Video Decoder */
-int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
-                  AVCodec *p_codec, int i_codec_id, const char *psz_namecodec );
+int InitVideoDec( decoder_t *, AVCodecContext *, const AVCodec * );
 void EndVideoDec( decoder_t *p_dec );
 
 /* Audio Decoder */
-int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
-                  AVCodec *p_codec, int i_codec_id, const char *psz_namecodec );
-void EndAudioDec( decoder_t *p_dec );
+int InitAudioDec( decoder_t *, AVCodecContext *, const AVCodec * );
 
-/* Avcodec global lock */
-extern vlc_mutex_t avcodec_lock;
+/* Subtitle Decoder */
+int InitSubtitleDec( decoder_t *, AVCodecContext *, const AVCodec * );
+
+/* Initialize decoder */
+int ffmpeg_OpenCodec( decoder_t *p_dec );
+void ffmpeg_CloseCodec( decoder_t *p_dec );
 
 /*****************************************************************************
  * Module descriptor help strings
  *****************************************************************************/
 #define DR_TEXT N_("Direct rendering")
 /* FIXME Does somebody who knows what it does, explain */
-#define DR_LONGTEXT N_("Direct rendering")
 
 #define ERROR_TEXT N_("Error resilience")
 #define ERROR_LONGTEXT N_( \
-    "Ffmpeg can do error resilience.\n" \
+    "libavcodec can do error resilience.\n" \
     "However, with a buggy encoder (such as the ISO MPEG-4 encoder from M$) " \
     "this can produce a lot of errors.\n" \
     "Valid values range from 0 to 4 (0 disables all errors resilience).")
@@ -94,6 +89,10 @@ extern vlc_mutex_t avcodec_lock;
     "when there is not enough time. It's useful with low CPU power " \
     "but it can produce distorted pictures.")
 
+#define FAST_TEXT N_("Allow speed tricks")
+#define FAST_LONGTEXT N_( \
+    "Allow non specification compliant speedup tricks. Faster but error-prone.")
+
 #define SKIP_FRAME_TEXT N_("Skip frame (default=0)")
 #define SKIP_FRAME_LONGTEXT N_( \
     "Force skipping of frames to speed up decoding " \
@@ -101,35 +100,33 @@ extern vlc_mutex_t avcodec_lock;
 
 #define SKIP_IDCT_TEXT N_("Skip idct (default=0)")
 #define SKIP_IDCT_LONGTEXT N_( \
-    "Force skipping of idct to speed up decoding for frame types" \
+    "Force skipping of idct to speed up decoding for frame types " \
     "(-1=None, 0=Default, 1=B-frames, 2=P-frames, 3=B+P frames, 4=all frames)." )
 
 #define DEBUG_TEXT N_( "Debug mask" )
-#define DEBUG_LONGTEXT N_( "Set ffmpeg debug mask" )
-
-/* TODO: Use a predefined list, with 0,1,2,4,7 */
-#define VISMV_TEXT N_( "Visualize motion vectors" )
-#define VISMV_LONGTEXT N_( \
-    "You can overlay the motion vectors (arrows showing how the images move) "\
-    "on the image. This value is a mask, based on these values:\n"\
-    "1 - visualize forward predicted MVs of P frames\n" \
-    "2 - visualize forward predicted MVs of B frames\n" \
-    "4 - visualize backward predicted MVs of B frames\n" \
-    "To visualize all vectors, the value should be 7." )
-
-#define LOWRES_TEXT N_( "Low resolution decoding" )
-#define LOWRES_LONGTEXT N_( "Only decode a low resolution version of " \
-    "the video. This requires less processing power" )
+#define DEBUG_LONGTEXT N_( "Set FFmpeg debug mask" )
+
+#define CODEC_TEXT N_( "Codec name" )
+#define CODEC_LONGTEXT N_( "Internal libavcodec codec name" )
 
 #define SKIPLOOPF_TEXT N_( "Skip the loop filter for H.264 decoding" )
 #define SKIPLOOPF_LONGTEXT N_( "Skipping the loop filter (aka deblocking) " \
     "usually has a detrimental effect on quality. However it provides a big " \
     "speedup for high definition streams." )
 
+#define HW_TEXT N_("Hardware decoding")
+#define HW_LONGTEXT N_("This allows hardware decoding when available.")
+
+#define VDA_PIX_FMT_TEXT N_("VDA output pixel format")
+#define VDA_PIX_FMT_LONGTEXT N_("The pixel format for output image buffers.")
+
+#define THREADS_TEXT N_( "Threads" )
+#define THREADS_LONGTEXT N_( "Number of threads used for decoding, 0 meaning auto" )
+
 /*
  * Encoder options
  */
-#define ENC_CFG_PREFIX "sout-ffmpeg-"
+#define ENC_CFG_PREFIX "sout-avcodec-"
 
 #define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
 #define ENC_KEYINT_LONGTEXT N_( "Number of frames " \
@@ -209,7 +206,7 @@ extern vlc_mutex_t avcodec_lock;
 
 #define ENC_STRICT_TEXT N_( "Strict standard compliance" )
 #define ENC_STRICT_LONGTEXT N_( "Force a strict standard " \
-  "compliance when encoding (accepted values: -1, 0, 1)." )
+  "compliance when encoding (accepted values: -2 to 2)." )
 
 #define ENC_LUMI_MASKING_TEXT N_( "Luminance masking" )
 #define ENC_LUMI_MASKING_LONGTEXT N_( "Raise the quantizer for " \
@@ -237,21 +234,22 @@ extern vlc_mutex_t avcodec_lock;
   "the PSNR isn't much changed (default: 0.0). The H264 specification " \
   "recommends 7." )
 
-#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
 #define ENC_PROFILE_TEXT N_( "Specify AAC audio profile to use" )
 #define ENC_PROFILE_LONGTEXT N_( "Specify the AAC audio profile to use " \
    "for encoding the audio bitstream. It takes the following options: " \
-   "main, low, ssr (not supported) and ltp (default: main)" )
-#endif
+   "main, low, ssr (not supported),ltp, hev1, hev2 (default: low). " \
+   "hev1 and hev2 are currently supported only with libfdk-aac enabled libavcodec" )
 
-#define FFMPEG_COMMON_MEMBERS   \
-    int i_cat;                  \
-    int i_codec_id;             \
-    const char *psz_namecodec;  \
+#define AVCODEC_COMMON_MEMBERS   \
     AVCodecContext *p_context;  \
-    AVCodec        *p_codec;
+    const AVCodec  *p_codec;    \
+    bool b_delayed_open;
 
 #ifndef AV_VERSION_INT
 #   define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
 #endif
 
+#if defined(FF_THREAD_FRAME)
+#   define HAVE_AVCODEC_MT
+#endif
+