From 3bbc3203657a6937d8df37b1ccd16ffe3d977eee Mon Sep 17 00:00:00 2001 From: kbinani Date: Wed, 29 Jul 2009 17:37:34 +0000 Subject: [PATCH] git-svn-id: http://svn.sourceforge.jp/svnroot/lipsync@9 b1f601f4-4f45-0410-8980-aecacb008692 --- trunk/LipSync/LipSync/Editor/AviOutput.cs | 5 ++ .../LipSync/Editor/AviOutputArguments.cs | 1 + trunk/LipSync/LipSync/Editor/Form1.cs | 48 ++++++++++++------- trunk/LipSync/LipSync/Editor/Form1Util.cs | 5 +- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/trunk/LipSync/LipSync/Editor/AviOutput.cs b/trunk/LipSync/LipSync/Editor/AviOutput.cs index 9b86e8a..e1ed2fb 100644 --- a/trunk/LipSync/LipSync/Editor/AviOutput.cs +++ b/trunk/LipSync/LipSync/Editor/AviOutput.cs @@ -38,9 +38,14 @@ namespace LipSync { } } if ( m_raw_mode ) { + radioVcm.Enabled = false; + radioVfw.Enabled = false; + radioVcm.Checked = true; btnVideoCompression.Enabled = false; txtDescription.Enabled = false; } else { + radioVcm.Enabled = true; + radioVfw.Enabled = true; btnVideoCompression.Enabled = true; txtDescription.Enabled = true; } diff --git a/trunk/LipSync/LipSync/Editor/AviOutputArguments.cs b/trunk/LipSync/LipSync/Editor/AviOutputArguments.cs index a650413..c2b8c02 100644 --- a/trunk/LipSync/LipSync/Editor/AviOutputArguments.cs +++ b/trunk/LipSync/LipSync/Editor/AviOutputArguments.cs @@ -27,6 +27,7 @@ namespace LipSync { public string FileNameParser; public System.Drawing.Imaging.ImageFormat ImageFormat; public bool UseVfwEncoder = true; + public bool IsRawMode = false; } } diff --git a/trunk/LipSync/LipSync/Editor/Form1.cs b/trunk/LipSync/LipSync/Editor/Form1.cs index fc28fd0..d07c687 100644 --- a/trunk/LipSync/LipSync/Editor/Form1.cs +++ b/trunk/LipSync/LipSync/Editor/Form1.cs @@ -191,7 +191,7 @@ namespace LipSync { Thread m_stdout; Process m_ffmpeg; Process m_mencoder; - bool m_is_rawmode = false; + //bool m_is_rawmode = false; private int m_current_frame = 0; private MediaPlayer m_player; private ZorderItem m_editing_item = null; @@ -1746,6 +1746,7 @@ namespace LipSync { private void bgWorkAvi_DoWork( object sender, DoWorkEventArgs e ) { IAviWriter writer = null; AviOutputArguments args = (AviOutputArguments)e.Argument; + bool is_raw_mode = args.IsRawMode; if ( File.Exists( args.AviFile ) ) { File.Delete( args.AviFile ); } @@ -1772,17 +1773,33 @@ namespace LipSync { Bitmap bmp = null; if ( args.UseVfwEncoder ) { bmp = new Bitmap( size.Width, size.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb ); - AviWriterVfw awvfw = new AviWriterVfw(); - bool ret = awvfw.Open( args.AviFile, - AppManager.SaveData.DwScale, - AppManager.SaveData.DwRate, - size.Width, - size.Height, - Process.GetCurrentProcess().MainWindowHandle ); - if ( !ret ) { - return; + if ( is_raw_mode ) { + AviWriterVcm awvcm = new AviWriterVcm(); + bool ret = awvcm.Open( args.AviFile, + AppManager.SaveData.DwScale, + AppManager.SaveData.DwRate, + size.Width, + size.Height, + !is_raw_mode, + args.IsTransparent, + Process.GetCurrentProcess().MainWindowHandle ); + if ( !ret ) { + return; + } + writer = awvcm; + } else { + AviWriterVfw awvfw = new AviWriterVfw(); + bool ret = awvfw.Open( args.AviFile, + AppManager.SaveData.DwScale, + AppManager.SaveData.DwRate, + size.Width, + size.Height, + Process.GetCurrentProcess().MainWindowHandle ); + if ( !ret ) { + return; + } + writer = awvfw; } - writer = awvfw; } else { bmp = args.IsTransparent ? new Bitmap( size.Width, size.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb ) : @@ -1793,7 +1810,7 @@ namespace LipSync { AppManager.SaveData.DwRate, size.Width, size.Height, - !m_is_rawmode, + !is_raw_mode, args.IsTransparent, Process.GetCurrentProcess().MainWindowHandle ); if ( !ret ) { @@ -2237,8 +2254,7 @@ namespace LipSync { StopMusic(); } initializeFirstEntry(); - m_is_rawmode = false; - ShowDialogCore(); + showDialogCore( false ); } private void menuFileOutputRawAvi_Click( object sender, EventArgs e ) { @@ -2246,8 +2262,7 @@ namespace LipSync { StopMusic(); } initializeFirstEntry(); - m_is_rawmode = true; - ShowDialogCore(); + showDialogCore( true ); } #endregion @@ -3663,6 +3678,7 @@ namespace LipSync { long start_frame; AviOutputArguments args = (AviOutputArguments)e.Argument; + bool is_raw_mode = args.IsRawMode; if ( args.StartSpecified ) { start_frame = (long)(args.Start * AppManager.SaveData.FrameRate); } else { diff --git a/trunk/LipSync/LipSync/Editor/Form1Util.cs b/trunk/LipSync/LipSync/Editor/Form1Util.cs index f1027f7..61e7b65 100644 --- a/trunk/LipSync/LipSync/Editor/Form1Util.cs +++ b/trunk/LipSync/LipSync/Editor/Form1Util.cs @@ -1971,12 +1971,13 @@ namespace LipSync { } } - private void ShowDialogCore() { - using ( AviOutput aviOutput = new AviOutput( m_is_rawmode ) ) { + private void showDialogCore( bool is_raw_mode ) { + using ( AviOutput aviOutput = new AviOutput( is_raw_mode ) ) { if ( aviOutput.ShowDialog() == DialogResult.OK ) { AviWriting = true; m_avi_cancel = false; AviOutputArguments args = aviOutput.Arguments; + args.IsRawMode = is_raw_mode; bgWorkAvi.RunWorkerAsync( args ); } }