]> git.sesse.net Git - vlc/commitdiff
* modules/gui/wxwindows/*: Added the video scale option to the streamout dialog box.
authorGildas Bazin <gbazin@videolan.org>
Sun, 14 Dec 2003 21:03:27 +0000 (21:03 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 14 Dec 2003 21:03:27 +0000 (21:03 +0000)
  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.

modules/codec/ffmpeg/encoder.c
modules/gui/wxwindows/streamout.cpp
modules/gui/wxwindows/wxwindows.cpp
modules/gui/wxwindows/wxwindows.h
modules/stream_out/transcode.c

index 8e33375dda0cb93d6b6983154890dbae40971091..59ac3889ea492ba5fdd1fbd5c5c67d3f74f6539b 100644 (file)
@@ -2,7 +2,7 @@
  * encoder.c: video and audio encoder using the ffmpeg library
  *****************************************************************************
  * 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>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -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.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->height = p_enc->fmt_in.video.i_height;
 
@@ -256,6 +264,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
             if( avcodec_open( p_context, p_codec ) )
             {
                 msg_Err( p_enc, "cannot open encoder" );
+                free( p_sys );
                 return VLC_EGENERIC;
             }
             msg_Warn( p_enc, "stereo mode selected (codec limitation)" );
@@ -263,6 +272,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
         else
         {
             msg_Err( p_enc, "cannot open encoder" );
+            free( p_sys );
             return VLC_EGENERIC;
         }
     }
index 6866304af090473f8b3caccc75ee25923f0539b8..6127fb26bff50d6ea4919d05ea169d142ae386d2 100644 (file)
@@ -2,7 +2,7 @@
  * streamout.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * 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>
  *
@@ -68,6 +68,7 @@ enum
     EncapsulationRadio7_Event, EncapsulationRadio8_Event,
 
     VideoTranscEnable_Event, VideoTranscCodec_Event, VideoTranscBitrate_Event,
+    VideoTranscScale_Event,
     AudioTranscEnable_Event, AudioTranscCodec_Event, AudioTranscBitrate_Event,
     AudioTranscChans_Event,
 
@@ -128,6 +129,8 @@ BEGIN_EVENT_TABLE(SoutDialog, wxDialog)
     EVT_TEXT(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange)
     EVT_COMBOBOX(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_TEXT(AudioTranscChans_Event, SoutDialog::OnTranscodingChange)
 
@@ -252,6 +255,7 @@ void SoutDialog::UpdateMRL()
         {
             transcode += wxT("vcodec=") + video_codec_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() )
@@ -638,8 +642,19 @@ wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent )
         wxT("32"),
         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 =
         new wxCheckBox( panel, VideoTranscEnable_Event, wxU(_("Video codec")));
     video_codec_combo =
@@ -653,6 +668,12 @@ wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent )
         new wxComboBox( panel, VideoTranscBitrate_Event, wxT("1024"),
                         wxPoint(20,25), wxDefaultSize,
                         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,
                       wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
     video_sizer->Add( video_codec_combo, 1,
@@ -661,6 +682,10 @@ wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent )
                       wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
     video_sizer->Add( video_bitrate_combo, 1,
                       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 */
     static const wxString acodecs_array[] =
index 5350c88ae81c0ee3acd133acd0610448c94eb070..cbd50ead7b8b6be9aee99210ffc5098b22f144a6 100644 (file)
@@ -2,7 +2,7 @@
  * wxwindows.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * 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>
  *
@@ -259,6 +259,10 @@ bool Instance::OnInit()
      * provided facilities (eg. open file dialog) */
     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
      * of Frame's constructor is NULL) as the frame doesn't have a parent
      * since it is the first window */
index 84b810cb84dcace76cf2a6007437958c3ef00d3f..3222544a8fd85d59bc84ded416b16c2f03f8f29e 100644 (file)
@@ -2,7 +2,7 @@
  * wxwindows.h: private wxWindows interface description
  *****************************************************************************
  * 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>
  *
@@ -613,6 +613,7 @@ private:
     wxComboBox *video_bitrate_combo;
     wxComboBox *audio_bitrate_combo;
     wxComboBox *audio_channels_combo;
+    wxComboBox *video_scale_combo;
 };
 
 /* Subtitles File Dialog */
index e532aa5b83ba438d5a065afd0168c3e1de4517f0..13f1c95d4393891b60b149d24af6b7999488c1e0 100644 (file)
@@ -2,7 +2,7 @@
  * transcode.c
  *****************************************************************************
  * 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>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -1052,6 +1052,7 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream,
 #endif
 
 #if LIBAVCODEC_BUILD >= 4687
+        if( id->ff_dec_c->height )
         id->p_encoder->fmt_in.video.i_aspect = VOUT_ASPECT_FACTOR *
             ( av_q2d(id->ff_dec_c->sample_aspect_ratio) *
               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,
             int i_height = id->ff_dec_c->height - p_sys->i_crop_top -
                            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 */
                 id->f_dst.video.i_width = i_width * p_sys->f_scale;