Commit 5669a2c5 authored by gbazin's avatar gbazin

* modules/gui/wxwindows/*: added new codecs for stream output.
   Added ffmpeg postproc to menus.
* modules/codec/ffmpeg/*: allow switching postproc filters on the fly.
parent 38d4a3f7
......@@ -2,7 +2,7 @@
* ffmpeg.h: decoder using the ffmpeg library
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ffmpeg.h,v 1.28 2003/11/16 21:07:31 gbazin Exp $
* $Id: ffmpeg.h,v 1.29 2003/11/23 20:37:04 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -62,7 +62,7 @@ int E_(OpenAudioEncoder) ( vlc_object_t * );
void E_(CloseAudioEncoder)( vlc_object_t * );
/* Postprocessing module */
int E_(OpenPostproc)( decoder_t *, void ** );
void *E_(OpenPostproc)( decoder_t *, vlc_bool_t * );
int E_(InitPostproc)( decoder_t *, void *, int, int, int );
int E_(PostprocPict)( decoder_t *, void *, picture_t *, AVFrame * );
void E_(ClosePostproc)( decoder_t *, void * );
......
......@@ -2,7 +2,7 @@
* postprocess.c: video postprocessing using the ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: postprocess.c,v 1.3 2003/11/22 23:39:14 fenrir Exp $
* $Id: postprocess.c,v 1.4 2003/11/23 20:37:04 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -51,61 +51,63 @@ typedef struct video_postproc_sys_t
pp_context_t *pp_context;
pp_mode_t *pp_mode;
vlc_bool_t *pb_pp;
int i_width;
int i_height;
} video_postproc_sys_t;
static int PPQCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data );
/*****************************************************************************
* OpenPostproc: probe and open the postproc
*****************************************************************************/
int E_(OpenPostproc)( decoder_t *p_dec, void **pp_data )
void *E_(OpenPostproc)( decoder_t *p_dec, vlc_bool_t *pb_pp )
{
video_postproc_sys_t **pp_sys = (video_postproc_sys_t **)pp_data;
pp_mode_t *pp_mode;
vlc_value_t val;
/* ***** Load post processing if enabled ***** */
var_Create( p_dec, "ffmpeg-pp-q", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-pp-q", &val );
if( val.i_int > 0 )
{
int i_quality = val.i_int;
char *psz_name = config_GetPsz( p_dec, "ffmpeg-pp-name" );
if( !psz_name )
{
psz_name = strdup( "default" );
}
else if( *psz_name == '\0' )
{
free( psz_name );
psz_name = strdup( "default" );
}
pp_mode = pp_get_mode_by_name_and_quality( psz_name, i_quality );
video_postproc_sys_t *p_sys;
vlc_value_t val, val_orig, text;
if( !pp_mode )
{
msg_Err( p_dec, "failed geting mode for postproc" );
}
else
{
msg_Info( p_dec, "postprocessing activated" );
}
free( psz_name );
p_sys = malloc( sizeof(video_postproc_sys_t) );
p_sys->pp_context = NULL;
*pp_sys = malloc( sizeof(video_postproc_sys_t) );
(*pp_sys)->pp_context = NULL;
(*pp_sys)->pp_mode = pp_mode;
*pb_pp = VLC_FALSE;
p_sys->pb_pp = pb_pp;
return VLC_SUCCESS;
}
else
/* Create object variable if not already done */
if( var_Type( p_dec, "ffmpeg-pp-q" ) == 0 )
{
msg_Dbg( p_dec, "no postprocessing enabled" );
return VLC_EGENERIC;
var_Create( p_dec, "ffmpeg-pp-q",
VLC_VAR_INTEGER | VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT );
text.psz_string = _("Post-Processing");
var_Change( p_dec, "ffmpeg-pp-q", VLC_VAR_SETTEXT, &text, NULL );
var_Get( p_dec, "ffmpeg-pp-q", &val_orig );
var_Change( p_dec, "ffmpeg-pp-q", VLC_VAR_DELCHOICE, &val_orig, NULL );
val.i_int = 0; text.psz_string = _("Disable");
var_Change( p_dec, "ffmpeg-pp-q", VLC_VAR_ADDCHOICE, &val, &text );
val.i_int = 1; text.psz_string = _("1 (Lowest)");
var_Change( p_dec, "ffmpeg-pp-q", VLC_VAR_ADDCHOICE, &val, &text );
val.i_int = 2;
var_Change( p_dec, "ffmpeg-pp-q", VLC_VAR_ADDCHOICE, &val, NULL );
val.i_int = 3;
var_Change( p_dec, "ffmpeg-pp-q", VLC_VAR_ADDCHOICE, &val, NULL );
val.i_int = 4;
var_Change( p_dec, "ffmpeg-pp-q", VLC_VAR_ADDCHOICE, &val, NULL );
val.i_int = 5;
var_Change( p_dec, "ffmpeg-pp-q", VLC_VAR_ADDCHOICE, &val, NULL );
val.i_int = 6; text.psz_string = _("6 (Highest)");
var_Change( p_dec, "ffmpeg-pp-q", VLC_VAR_ADDCHOICE, &val, &text );
var_AddCallback( p_dec, "ffmpeg-pp-q", PPQCallback, p_sys );
}
/* ***** Load post processing if enabled ***** */
var_Get( p_dec, "ffmpeg-pp-q", &val );
var_Set( p_dec, "ffmpeg-pp-q", val_orig );
return p_sys;
}
/*****************************************************************************
......@@ -195,6 +197,59 @@ void E_(ClosePostproc)( decoder_t *p_dec, void *p_data )
pp_free_mode( p_sys->pp_mode );
if( p_sys->pp_context ) pp_free_context( p_sys->pp_context );
}
var_DelCallback( p_dec, "ffmpeg-pp-q", PPQCallback, p_sys );
}
/*****************************************************************************
* object variables callbacks: a bunch of object variables are used by the
* interfaces to interact with the decoder.
*****************************************************************************/
static int PPQCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
decoder_t *p_dec = (decoder_t *)p_this;
video_postproc_sys_t *p_sys = (video_postproc_sys_t *)p_data;
if( newval.i_int > 0 )
{
int i_quality = newval.i_int;
char *psz_name = config_GetPsz( p_dec, "ffmpeg-pp-name" );
pp_mode_t *pp_mode;
if( !psz_name )
{
psz_name = strdup( "default" );
}
else if( *psz_name == '\0' )
{
free( psz_name );
psz_name = strdup( "default" );
}
pp_mode = pp_get_mode_by_name_and_quality( psz_name, i_quality );
if( !pp_mode )
{
msg_Err( p_dec, "failed geting mode for postproc" );
newval.i_int = 0;
}
else
{
msg_Dbg( p_dec, "postprocessing enabled" );
}
free( psz_name );
p_sys->pp_mode = pp_mode;
}
else
{
msg_Dbg( p_dec, "postprocessing disabled" );
}
*p_sys->pb_pp = newval.i_int;
return VLC_SUCCESS;
}
#endif /* LIBAVCODEC_PP */
......@@ -2,7 +2,7 @@
* video.c: video decoder using the ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: video.c,v 1.50 2003/11/23 13:15:27 gbazin Exp $
* $Id: video.c,v 1.51 2003/11/23 20:37:04 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -76,6 +76,8 @@ struct decoder_sys_t
/* Postprocessing handle */
void *p_pp;
vlc_bool_t b_pp;
vlc_bool_t b_pp_async;
vlc_bool_t b_pp_init;
};
......@@ -161,7 +163,7 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
p_pic = p_dec->pf_vout_buffer_new( p_dec );
#ifdef LIBAVCODEC_PP
if( p_sys->p_pp && !p_sys->b_pp_init )
if( p_sys->p_pp && p_sys->b_pp && !p_sys->b_pp_init )
{
E_(InitPostproc)( p_dec, p_sys->p_pp, p_context->width,
p_context->height, p_context->pix_fmt );
......@@ -254,12 +256,8 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
#ifdef LIBAVCODEC_PP
p_sys->p_pp = NULL;
p_dec->p_sys->b_pp_init = VLC_FALSE;
if( E_(OpenPostproc)( p_dec, &p_sys->p_pp ) == VLC_SUCCESS )
{
/* for now we cannot do postproc and dr */
p_sys->b_direct_rendering = 0;
}
p_sys->b_pp = p_sys->b_pp_async = p_sys->b_pp_init = VLC_FALSE;
p_sys->p_pp = E_(OpenPostproc)( p_dec, &p_sys->b_pp_async );
#endif
/* ffmpeg doesn't properly release old pictures when frames are skipped */
......@@ -402,6 +400,9 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
* Do the actual decoding now
*/
/* Check if post-processing was enabled */
p_sys->b_pp = p_sys->b_pp_async;
/* Don't forget that ffmpeg requires a little more bytes
* that the real frame size */
if( p_block->i_buffer > 0 )
......@@ -470,7 +471,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
continue;
}
if( !p_sys->b_direct_rendering )
if( !p_sys->b_direct_rendering || p_sys->b_pp )
{
/* Get a new picture */
p_pic = ffmpeg_NewPictBuf( p_dec, p_sys->p_context );
......@@ -558,7 +559,7 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
int i_src_stride, i_dst_stride;
#ifdef LIBAVCODEC_PP
if( p_sys->p_pp )
if( p_sys->p_pp && p_sys->b_pp )
E_(PostprocPict)( p_dec, p_sys->p_pp, p_pic, p_ff_pic );
else
#endif
......@@ -642,7 +643,7 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
p_sys->input_pts = p_sys->input_dts = 0;
/* Not much to do in indirect rendering mode */
if( !p_sys->b_direct_rendering )
if( !p_sys->b_direct_rendering || p_sys->b_pp )
{
return avcodec_default_get_buffer( p_context, p_ff_pic );
}
......
......@@ -2,7 +2,7 @@
* menus.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: menus.cpp,v 1.24 2003/11/02 12:22:45 gbazin Exp $
* $Id: menus.cpp,v 1.25 2003/11/23 20:37:04 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -136,6 +136,8 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
FIND_ANYWHERE );
if( p_object != NULL )
{
vlc_object_t *p_dec_obj;
ppsz_varnames[i] = "fullscreen";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "deinterlace";
......@@ -150,6 +152,17 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "x11-on-top";
pi_objects[i++] = p_object->i_object_id;
p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,
VLC_OBJECT_DECODER,
FIND_PARENT );
if( p_dec_obj != NULL )
{
ppsz_varnames[i] = "ffmpeg-pp-q";
pi_objects[i++] = p_dec_obj->i_object_id;
vlc_object_release( p_dec_obj );
}
vlc_object_release( p_object );
}
......@@ -276,6 +289,8 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
FIND_ANYWHERE );
if( p_object != NULL )
{
vlc_object_t *p_dec_obj;
ppsz_varnames[i] = "fullscreen";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "deinterlace";
......@@ -291,6 +306,18 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
ppsz_varnames[i] = "x11-on-top";
pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object );
p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,
VLC_OBJECT_DECODER,
FIND_PARENT );
if( p_dec_obj != NULL )
{
ppsz_varnames[i] = "ffmpeg-pp-q";
pi_objects[i++] = p_dec_obj->i_object_id;
vlc_object_release( p_dec_obj );
}
vlc_object_release( p_object );
}
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
......
......@@ -2,7 +2,7 @@
* streamout.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: streamout.cpp,v 1.35 2003/11/05 20:06:36 gbazin Exp $
* $Id: streamout.cpp,v 1.36 2003/11/23 20:37:04 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -660,6 +660,8 @@ wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent )
wxT("mp3"),
wxT("a52"),
wxT("vorb")
wxT("flac")
wxT("spx")
};
static const wxString abitrates_array[] =
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment