Commit 982b157f authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*: Added the video scale option to the streamout dialog box.

  Added a nasty hack to reset LC_NUMERIC to "C" because the stream output MRL parsing can't deal with "," in floating point numbers.
* modules/codec/ffmpeg/encoder.c: sanity checks.
* modules/stream_out/transcode.c: sanity checks.
parent 9ea087d2
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* encoder.c: video and audio encoder using the ffmpeg library * encoder.c: video and audio encoder using the ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: encoder.c,v 1.19 2003/12/07 12:11:13 gbazin Exp $ * $Id: encoder.c,v 1.20 2003/12/14 21:03:27 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -175,6 +175,14 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -175,6 +175,14 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
if( p_enc->fmt_in.i_cat == VIDEO_ES ) if( p_enc->fmt_in.i_cat == VIDEO_ES )
{ {
if( !p_enc->fmt_in.video.i_width || !p_enc->fmt_in.video.i_height )
{
msg_Warn( p_enc, "invalid size %ix%i", p_enc->fmt_in.video.i_width,
p_enc->fmt_in.video.i_height );
free( p_sys );
return VLC_EGENERIC;
}
p_context->width = p_enc->fmt_in.video.i_width; p_context->width = p_enc->fmt_in.video.i_width;
p_context->height = p_enc->fmt_in.video.i_height; p_context->height = p_enc->fmt_in.video.i_height;
...@@ -256,6 +264,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -256,6 +264,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
if( avcodec_open( p_context, p_codec ) ) if( avcodec_open( p_context, p_codec ) )
{ {
msg_Err( p_enc, "cannot open encoder" ); msg_Err( p_enc, "cannot open encoder" );
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
msg_Warn( p_enc, "stereo mode selected (codec limitation)" ); msg_Warn( p_enc, "stereo mode selected (codec limitation)" );
...@@ -263,6 +272,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -263,6 +272,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
else else
{ {
msg_Err( p_enc, "cannot open encoder" ); msg_Err( p_enc, "cannot open encoder" );
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* streamout.cpp : wxWindows plugin for vlc * streamout.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: streamout.cpp,v 1.38 2003/12/10 11:04:25 courmisch Exp $ * $Id: streamout.cpp,v 1.39 2003/12/14 21:03:27 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -68,6 +68,7 @@ enum ...@@ -68,6 +68,7 @@ enum
EncapsulationRadio7_Event, EncapsulationRadio8_Event, EncapsulationRadio7_Event, EncapsulationRadio8_Event,
VideoTranscEnable_Event, VideoTranscCodec_Event, VideoTranscBitrate_Event, VideoTranscEnable_Event, VideoTranscCodec_Event, VideoTranscBitrate_Event,
VideoTranscScale_Event,
AudioTranscEnable_Event, AudioTranscCodec_Event, AudioTranscBitrate_Event, AudioTranscEnable_Event, AudioTranscCodec_Event, AudioTranscBitrate_Event,
AudioTranscChans_Event, AudioTranscChans_Event,
...@@ -128,6 +129,8 @@ BEGIN_EVENT_TABLE(SoutDialog, wxDialog) ...@@ -128,6 +129,8 @@ BEGIN_EVENT_TABLE(SoutDialog, wxDialog)
EVT_TEXT(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange) EVT_TEXT(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange)
EVT_COMBOBOX(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange) EVT_COMBOBOX(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange)
EVT_TEXT(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange) EVT_TEXT(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange)
EVT_COMBOBOX(VideoTranscScale_Event, SoutDialog::OnTranscodingChange)
EVT_TEXT(VideoTranscScale_Event, SoutDialog::OnTranscodingChange)
EVT_COMBOBOX(AudioTranscChans_Event, SoutDialog::OnTranscodingChange) EVT_COMBOBOX(AudioTranscChans_Event, SoutDialog::OnTranscodingChange)
EVT_TEXT(AudioTranscChans_Event, SoutDialog::OnTranscodingChange) EVT_TEXT(AudioTranscChans_Event, SoutDialog::OnTranscodingChange)
...@@ -252,6 +255,7 @@ void SoutDialog::UpdateMRL() ...@@ -252,6 +255,7 @@ void SoutDialog::UpdateMRL()
{ {
transcode += wxT("vcodec=") + video_codec_combo->GetValue(); transcode += wxT("vcodec=") + video_codec_combo->GetValue();
transcode += wxT(",vb=") + video_bitrate_combo->GetValue(); transcode += wxT(",vb=") + video_bitrate_combo->GetValue();
transcode += wxT(",scale=") + video_scale_combo->GetValue();
if( audio_transc_checkbox->IsChecked() ) transcode += wxT(","); if( audio_transc_checkbox->IsChecked() ) transcode += wxT(",");
} }
if( audio_transc_checkbox->IsChecked() ) if( audio_transc_checkbox->IsChecked() )
...@@ -638,8 +642,19 @@ wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent ) ...@@ -638,8 +642,19 @@ wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent )
wxT("32"), wxT("32"),
wxT("16") wxT("16")
}; };
static const wxString vscales_array[] =
{
wxT("0.25"),
wxT("0.5"),
wxT("0.75"),
wxT("1"),
wxT("1.25"),
wxT("1.5"),
wxT("1.75"),
wxT("2")
};
wxFlexGridSizer *video_sizer = new wxFlexGridSizer( 4, 1, 20 ); wxFlexGridSizer *video_sizer = new wxFlexGridSizer( 6, 1, 20 );
video_transc_checkbox = video_transc_checkbox =
new wxCheckBox( panel, VideoTranscEnable_Event, wxU(_("Video codec"))); new wxCheckBox( panel, VideoTranscEnable_Event, wxU(_("Video codec")));
video_codec_combo = video_codec_combo =
...@@ -653,6 +668,12 @@ wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent ) ...@@ -653,6 +668,12 @@ wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent )
new wxComboBox( panel, VideoTranscBitrate_Event, wxT("1024"), new wxComboBox( panel, VideoTranscBitrate_Event, wxT("1024"),
wxPoint(20,25), wxDefaultSize, wxPoint(20,25), wxDefaultSize,
WXSIZEOF(vbitrates_array), vbitrates_array ); WXSIZEOF(vbitrates_array), vbitrates_array );
wxStaticText *scale_label =
new wxStaticText( panel, -1, wxU(_("Scale")));
video_scale_combo =
new wxComboBox( panel, VideoTranscScale_Event, wxT("1"),
wxPoint(20,25), wxDefaultSize,
WXSIZEOF(vscales_array), vscales_array );
video_sizer->Add( video_transc_checkbox, 0, video_sizer->Add( video_transc_checkbox, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL ); wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
video_sizer->Add( video_codec_combo, 1, video_sizer->Add( video_codec_combo, 1,
...@@ -661,6 +682,10 @@ wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent ) ...@@ -661,6 +682,10 @@ wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent )
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL ); wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
video_sizer->Add( video_bitrate_combo, 1, video_sizer->Add( video_bitrate_combo, 1,
wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL ); wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
video_sizer->Add( scale_label, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
video_sizer->Add( video_scale_combo, 1,
wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
/* Create audio transcoding checkox */ /* Create audio transcoding checkox */
static const wxString acodecs_array[] = static const wxString acodecs_array[] =
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.cpp : wxWindows plugin for vlc * wxwindows.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: wxwindows.cpp,v 1.35 2003/10/15 12:24:14 gbazin Exp $ * $Id: wxwindows.cpp,v 1.36 2003/12/14 21:03:27 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -259,6 +259,10 @@ bool Instance::OnInit() ...@@ -259,6 +259,10 @@ bool Instance::OnInit()
* provided facilities (eg. open file dialog) */ * provided facilities (eg. open file dialog) */
locale.Init( wxLANGUAGE_DEFAULT ); locale.Init( wxLANGUAGE_DEFAULT );
/* FIXME: The stream output mrl parsing uses ',' already so we want to
* keep the default '.' for floating point numbers. */
setlocale( LC_NUMERIC, "C" );
/* Make an instance of your derived frame. Passing NULL (the default value /* Make an instance of your derived frame. Passing NULL (the default value
* of Frame's constructor is NULL) as the frame doesn't have a parent * of Frame's constructor is NULL) as the frame doesn't have a parent
* since it is the first window */ * since it is the first window */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.78 2003/12/13 00:45:49 rocky Exp $ * $Id: wxwindows.h,v 1.79 2003/12/14 21:03:27 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -613,6 +613,7 @@ private: ...@@ -613,6 +613,7 @@ private:
wxComboBox *video_bitrate_combo; wxComboBox *video_bitrate_combo;
wxComboBox *audio_bitrate_combo; wxComboBox *audio_bitrate_combo;
wxComboBox *audio_channels_combo; wxComboBox *audio_channels_combo;
wxComboBox *video_scale_combo;
}; };
/* Subtitles File Dialog */ /* Subtitles File Dialog */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* transcode.c * transcode.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: transcode.c,v 1.63 2003/12/08 13:02:40 gbazin Exp $ * $Id: transcode.c,v 1.64 2003/12/14 21:03:27 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -1052,6 +1052,7 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, ...@@ -1052,6 +1052,7 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream,
#endif #endif
#if LIBAVCODEC_BUILD >= 4687 #if LIBAVCODEC_BUILD >= 4687
if( id->ff_dec_c->height )
id->p_encoder->fmt_in.video.i_aspect = VOUT_ASPECT_FACTOR * id->p_encoder->fmt_in.video.i_aspect = VOUT_ASPECT_FACTOR *
( av_q2d(id->ff_dec_c->sample_aspect_ratio) * ( av_q2d(id->ff_dec_c->sample_aspect_ratio) *
id->ff_dec_c->width / id->ff_dec_c->height ); id->ff_dec_c->width / id->ff_dec_c->height );
...@@ -1222,7 +1223,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, ...@@ -1222,7 +1223,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
int i_height = id->ff_dec_c->height - p_sys->i_crop_top - int i_height = id->ff_dec_c->height - p_sys->i_crop_top -
p_sys->i_crop_bottom; p_sys->i_crop_bottom;
if( id->f_dst.video.i_width <= 0 && id->f_dst.video.i_height <= 0 ) if( id->f_dst.video.i_width <= 0 && id->f_dst.video.i_height <= 0
&& p_sys->f_scale )
{ {
/* Apply the scaling */ /* Apply the scaling */
id->f_dst.video.i_width = i_width * p_sys->f_scale; id->f_dst.video.i_width = i_width * p_sys->f_scale;
......
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