/*****************************************************************************
* 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 );
-void GetVlcAudioFormat( vlc_fourcc_t *, unsigned *pi_bits, int i_sample_fmt );
-
-picture_t * DecodeVideo ( decoder_t *, block_t ** );
-aout_buffer_t * DecodeAudio( decoder_t *, block_t ** );
-subpicture_t *DecodeSubtitle( decoder_t *p_dec, block_t ** );
+vlc_fourcc_t GetVlcAudioFormat( int i_sample_fmt );
/* Video encoder module */
int OpenEncoder ( 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 * );
/* Subtitle Decoder */
-int InitSubtitleDec( decoder_t *p_dec, AVCodecContext *p_context,
- AVCodec *p_codec, int i_codec_id, const char *psz_namecodec );
-void EndSubtitleDec( decoder_t *p_dec );
+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).")
#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 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) " \
#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 " \
#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 " \
#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)" )
+ "main, low, ssr (not supported),ltp, hev1, hev2 (default: low). " \
+ "hev1 and hev2 are currently supported only with libfdk-aac enabled libavcodec" )
#define AVCODEC_COMMON_MEMBERS \
- int i_cat; \
- int i_codec_id; \
- const char *psz_namecodec; \
AVCodecContext *p_context; \
- AVCodec *p_codec; \
+ const AVCodec *p_codec; \
bool b_delayed_open;
#ifndef AV_VERSION_INT
# define HAVE_AVCODEC_MT
#endif
-/* Uncomment it to enable compilation with vaapi/dxva2 (you also must change the build
- * system) */
-//#define HAVE_AVCODEC_VAAPI 1
-//#define HAVE_AVCODEC_DXVA2 1