* ffmpeg.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: ffmpeg.c,v 1.12 2002/10/28 06:26:11 fenrir Exp $
+ * $Id: ffmpeg.c,v 1.25 2003/02/20 01:52:46 sigmunau Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
#include <vlc/decoder.h>
#include <vlc/input.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h> /* getpid() */
-#endif
-
-#include <errno.h>
#include <string.h>
#ifdef HAVE_SYS_TIMES_H
*****************************************************************************/
#define ERROR_RESILIENCE_LONGTEXT \
- "ffmpeg can make errors resiliences. \n"\
+ "ffmpeg can make errors resiliences. \n" \
"Nevertheless, with buggy encoder (like ISO MPEG-4 encoder from M$) " \
"this will produce a lot of errors.\n" \
"Valid range is -1 to 99 (-1 disable all errors resiliences)."
#define POSTPROCESSING_Q_LONGTEXT \
"Quality of post processing\n"\
"Valid range is 0 to 6\n" \
- "( Overridden by others setting)"
+ "(Overridden by others setting)"
#define POSTPROCESSING_AQ_LONGTEXT \
- "Post processing quality is selected upon time left" \
+ "Post processing quality is selected upon time left " \
"but no more than requested quality\n" \
"Not yet implemented !"
-#define WORAROUND_BUG_LONGTEXT \
+#define WORKAROUND_BUGS_LONGTEXT \
"Try to fix some bugs\n" \
"1 autodetect\n" \
"2 old msmpeg4\n" \
"64 Qpel chroma"
vlc_module_begin();
- add_category_hint( N_("Ffmpeg"), NULL );
+ add_category_hint( N_("ffmpeg"), NULL, VLC_FALSE );
+#if LIBAVCODEC_BUILD >= 4615
+ add_bool( "ffmpeg-dr", 0, NULL,
+ "direct rendering",
+ "direct rendering", VLC_TRUE );
+#endif
#if LIBAVCODEC_BUILD >= 4611
add_integer ( "ffmpeg-error-resilience", -1, NULL,
- "error resilience", ERROR_RESILIENCE_LONGTEXT );
- add_integer ( "ffmpeg-workaround-bugs", 0, NULL,
- "workaround bugs", WORAROUND_BUG_LONGTEXT );
+ "error resilience", ERROR_RESILIENCE_LONGTEXT, VLC_TRUE );
+ add_integer ( "ffmpeg-workaround-bugs", 1, NULL,
+ "workaround bugs", WORKAROUND_BUGS_LONGTEXT, VLC_FALSE );
#endif
- add_bool( "ffmpeg-hurry-up", 0, NULL, "hurry up", HURRY_UP_LONGTEXT );
+ add_bool( "ffmpeg-hurry-up", 0, NULL, "hurry up", HURRY_UP_LONGTEXT, VLC_FALSE );
- add_category_hint( N_("Post processing"), NULL );
+ add_category_hint( N_("Post processing"), NULL, VLC_FALSE );
add_module( "ffmpeg-pp", "postprocessing",NULL, NULL,
- N_( "ffmpeg postprocessing module" ), NULL );
+ N_( "ffmpeg postprocessing module" ), NULL, VLC_FALSE );
add_integer( "ffmpeg-pp-q", 0, NULL,
- "post processing quality", POSTPROCESSING_Q_LONGTEXT );
+ "post processing quality", POSTPROCESSING_Q_LONGTEXT, VLC_FALSE );
add_bool( "ffmpeg-pp-auto", 0, NULL,
- "auto-level Post processing quality", POSTPROCESSING_AQ_LONGTEXT );
+ "auto-level Post processing quality", POSTPROCESSING_AQ_LONGTEXT, VLC_FALSE );
add_bool( "ffmpeg-db-yv", 0, NULL,
"force vertical luminance deblocking",
- "force vertical luminance deblocking (override other settings)" );
+ "force vertical luminance deblocking (override other settings)", VLC_TRUE );
add_bool( "ffmpeg-db-yh", 0, NULL,
"force horizontal luminance deblocking",
- "force horizontal luminance deblocking (override other settings)" );
+ "force horizontal luminance deblocking (override other settings)", VLC_TRUE );
add_bool( "ffmpeg-db-cv", 0, NULL,
"force vertical chrominance deblocking",
- "force vertical chrominance deblocking (override other settings)" );
+ "force vertical chrominance deblocking (override other settings)", VLC_TRUE );
add_bool( "ffmpeg-db-ch", 0, NULL,
"force horizontal chrominance deblocking",
- "force horizontal chrominance deblocking (override other settings) " );
+ "force horizontal chrominance deblocking (override other settings) ", VLC_TRUE );
add_bool( "ffmpeg-dr-y", 0, NULL,
"force luminance deringing",
- "force luminance deringing (override other settings)" );
+ "force luminance deringing (override other settings)", VLC_TRUE );
add_bool( "ffmpeg-dr-c", 0, NULL,
"force chrominance deringing",
- "force chrominance deringing (override other settings)" );
+ "force chrominance deringing (override other settings)", VLC_TRUE );
set_description( _("ffmpeg audio/video decoder((MS)MPEG4,SVQ1,H263,WMV,WMA)") );
set_capability( "decoder", 70 );
avcodec_register_all();
b_ffmpeginit = 1;
- msg_Dbg( p_decoder->p_fifo, "library ffmpeg initialized" );
+ msg_Dbg( p_decoder->p_fifo, "libavcodec initialized (interface "
+ LIBAVCODEC_BUILD_STR ")" );
}
else
{
- msg_Dbg( p_decoder->p_fifo, "library ffmpeg already initialized" );
+ msg_Dbg( p_decoder->p_fifo, "libavcodec already initialized" );
}
/* *** determine codec type *** */
}
p_decoder->pts = 0;
+ p_decoder->p_buffer = NULL;
+ p_decoder->i_buffer = 0;
+ p_decoder->i_buffer_size = 0;
+
return( i_result );
}
if( p_decoder->p_context != NULL)
{
- FREE( p_decoder->p_context->quant_store );
FREE( p_decoder->p_context->extradata );
avcodec_close( p_decoder->p_context );
msg_Dbg( p_decoder->p_fifo,
* locales Functions
*****************************************************************************/
-void E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes )
+int E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes )
{
int i_copy;
int i_count;
{
memset( p_buf, 0, i_max - i_count );
}
+ return( i_count );
}
switch( i_fourcc )
{
+#if 0
+ /* XXX don't use it */
+ case FOURCC_mpgv:
+ i_cat = VIDEO_ES;
+ i_codec = CODEC_ID_MPEG1VIDEO;
+ psz_name = "MPEG-1/2 Video";
+ break;
+#endif
#if LIBAVCODEC_BUILD >= 4608
case FOURCC_DIV1:
case FOURCC_div1:
i_codec = CODEC_ID_WMV2;
psz_name ="Windows Media Video 2";
break;
+ case FOURCC_MJPG:
+ case FOURCC_mjpg:
+ case FOURCC_mjpa:
+ case FOURCC_jpeg:
+ case FOURCC_JPEG:
+ case FOURCC_JFIF:
+ i_cat = VIDEO_ES;
+ i_codec = CODEC_ID_MJPEG;
+ psz_name = "Motion JPEG";
+ break;
+#if LIBAVCODEC_BUILD >= 4640
+ case FOURCC_mjpb:
+ i_cat = VIDEO_ES;
+ i_codec = CODEC_ID_MJPEGB;
+ psz_name = "Motion JPEG B";
+ break;
+#endif
+ case FOURCC_dvsl:
+ case FOURCC_dvsd:
+ case FOURCC_DVSD:
+ case FOURCC_dvhd:
+ case FOURCC_dvc:
+ case FOURCC_dvp:
+ i_cat = VIDEO_ES;
+ i_codec = CODEC_ID_DVVIDEO;
+ psz_name = "DV video";
+ break;
+
+#if LIBAVCODEC_BUILD >= 4655
+ case FOURCC_dvau:
+ i_cat = AUDIO_ES;
+ i_codec = CODEC_ID_DVAUDIO;
+ psz_name = "DV audio";
+ break;
+#endif
#if LIBAVCODEC_BUILD >= 4632
case FOURCC_WMA1:
i_codec = CODEC_ID_WMAV2;
psz_name ="Windows Media Audio 2";
break;
-
-
+#endif
default:
i_cat = UNKNOWN_ES;
i_codec = CODEC_ID_NONE;
psz_name = NULL;
break;
-#endif
-
}
if( i_codec != CODEC_ID_NONE )