View Full Version : MeGUI development
Sharktooth
20th January 2006, 21:02
CVS Update:
0.2.3.2035
Fixed some x264 CC warnings
0.2.3.2034
Encoders paths have now their own tab in Settings (changes by dimzon)
@dimzon: please update the assemblyinfo version and the changelog the next time you commit some changesl, thanks:)
Doom9
20th January 2006, 21:40
Putting a try/catch block in CalculateBitrate() just because you're calling into an unknown library that might throw something I wouldn't use try/catch unless I knew the library would thrown an exception.. if it's not part of the API description then the normal thing to do (imho) is assume there are no exceptions or that whatever might be caused will be handled internally.. so the api description would mention what exception can be thrown, or return a value of -1 (as an example) to indicate something has gone wrong internally.
And by the way, about the dgdecode path.. it stands to reason that those opening d2v's in MeGUI have created their d2v's in MeGUI.. and unpacked the entire zip to a directory and configured the dgindex path there.. plus then copied the dll. So having it two places would be nothing special but rather the standard scenario.
Doom9
20th January 2006, 22:03
@dimzon: when I compile I get two warnings in AudioEncoder telling me the Thread.Resume/Suspend is back? Didn't I eliminate that with my latest CVS update? I cannot open any but the baseAudioConfigurationDialog in the GUI designer.. once again, choice or error? I thought visual inheritance wouldn't deny the ability to use the GUI designer. Here's the full error message I'm getting:
The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: lameConfigurationDialog --- The base class 'MeGUI.baseAudioConfigurationDialog' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.
Where is the distinction made if avisynth or besweet is to be used for audio encoding and where can this be configured?
And perhaps most importantly.. where do I get neroraw.exe?
Another thing: the FAAC config dialog seems to default to CBR but doesn't have a bitrate set.. it should have 128 kbit/s preset. And should it say kbit/s at least for CBR and something for VBR as well? Okay, that's my fault actually.. seems the original didn't have those indications either.
last but not least.. I can't seem to encode anything.. here's the log
The current job contains errors. Skipping chained jobs
Starting job job1 at 22:02:54
Job is an audio job. Commandline:
-core( -input "D:\DVDs\DVDVolume\VIDEO_TS\residentevil AC3 T01 3_2ch 448Kbps DELAY 0ms.ac3" -output "D:\DVDs\DVDVolume\VIDEO_TS\residentevil AC3 T01 3_2ch 448Kbps DELAY 0ms.mp4" -logfile "D:\DVDs\DVDVolume\VIDEO_TS\residentevil AC3 T01 3_2ch 448Kbps DELAY 0ms.besweet.log" ) -azid( -cbr 128 ) -ota( -g max )
successfully started encoding
Processing ended at 22:02:54
----------------------------------------------------------------------------------------------------------
Log for job job1
Error:
System.ApplicationException: Can't find audio stream!
at MeGUI.DimzonEncoder.encode()And that's bs.. the audio stream is properly configured.
Oh, the new jobs are also not being loaded upon startup.. and the commandline (not shown...), seems to be the besweet commandline
@update: debugging the code I found that the settings object is not being properly propagated.. the DimzonEncoder seems to think my faac.exe has no path associated with it even though I've properly configured it.
Richard Berg
20th January 2006, 22:08
so the api description would mention what exception can be thrown, or return a value of -1 (as an example) to indicate something has gone wrong internally.
Doesn't matter. You still wouldn't want to put a try/catch there. In fact, you might consider throwing an exception if you received -1 from the API.
Richard Berg
20th January 2006, 22:09
@anyone -- what does setting the Avisynth plugin dir in Settings -> Path do? Any reason we shouldn't pull it from the registry?
Doom9
20th January 2006, 22:23
I also believe you got lame's cbr and abr mixed up:
case BitrateManagementMode.ABR:
m_commandLine = "-b " + m.Bitrate + " --cbr -h --silent - \"{0}\"";
break;
case BitrateManagementMode.CBR:
m_commandLine = "--abr " + m.Bitrate + " -h --silent - \"{0}\"";
break;
--abr smells like abr, not cbr..
And what's up with if (priority == ProcessPriority.IDLE)
m_encoderThread.Priority = ThreadPriority.Lowest;
There's a ThreadPriority.Idle, isn't there?
Doom9
20th January 2006, 22:31
and I have no clue how to debug this thing.. I set a breakpoint in your encoder start, it starts a thread with threadstart parameter encode so I put a breakpoint in the encode method, only to find it never gets there..
Are you cleaning up after the encoder? Because if you create a file in the temp folder.. you better.. the automated cleanup after encoding isn't capable of finding that file. I actually meant to suggest that the file have the same name as the audio, just with avs appended.. so you clearly know whom it belongs to.
Also, as far as audio input goes.. enabling everything isn't such a good idea.. most filetypes aren't audio so it should only support those that we can handle.
Also, there's already a class wrapping AVIFile.. it would make sense that you use this one and make changes where needed (without breaking current functionality of course.. make sure you test encoding and avisynth script preview)
And some more things: I think your encoder should derive from audioencoder, or at least be called from it so there's a common path it goes through.. just like the 3 video encoders and 3 muxers use a common class. That also allows easy switching of encoders.
How about using the commandlinegenerator to generate encoder commandlines?
Last but not least I have to ask the dreaded question "how well did you test this?" I mean.. encoding doesn't even get to the point where it would fail because the encoder paths are not being propagated..
dimzon
21st January 2006, 10:46
@dimzon: please update the assemblyinfo version and the changelog the next time you commit some changesl, thanks:)
Hi, happy to see your health is better.
Isn't possible to get changelog automatically via CVS?
dimzon
21st January 2006, 11:49
when I compile I get two warnings in AudioEncoder telling me the Thread.Resume/Suspend is back?
Don't worry I will eluminate it later. This is my code from BeHappy.
By the way
Are you shure Your current encoder.pause implementation really pauses external process? I do not think so, maybe I'm wrong? You only pauses StdOut/StdErr reading from it, isn't it. It means encoding still work...
I cannot open any but the baseAudioConfigurationDialog in the GUI designer.. once again, choice or error?
I have yet checked it - everything is fine? Maybe this error is VS Express (I'm using full version now)
The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: lameConfigurationDialog --- The base class 'MeGUI.baseAudioConfigurationDialog' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.
Does you compile project in VS before???
Where is the distinction made if avisynth or besweet is to be used for audio encoding and where can this be configured?
This is not exists yet. If you want to switch to BeSweet just replace aEnc= new DimzonEncoder() by aEnc= new AudioEncoder() @ Form1.cs
And perhaps most importantly.. where do I get neroraw.exe?
As I said before you need BeHappy.Extension.Encoder.Nero7AAC.exe from BeHappy - use it instead of neroraw. I plan to remove BeHappy-related code from it && rename to neroraw a bit later.
Another thing: the FAAC config dialog seems to default to CBR but doesn't have a bitrate set.. it should have 128 kbit/s preset. And should it say kbit/s at least for CBR and something for VBR as well? Okay, that's my fault actually.. seems the original didn't have those indications either.
Will be fixed later
last but not least.. I can't seem to encode anything.. here's the log
It means there are error @ avisynth script. You need NicAudio plugin for ac3/dts, MPASource for mp3
Oh, the new jobs are also not being loaded upon startup.. and the commandline (not shown...), seems to be the besweet commandline
I do not touch job-related commadline generation, your old code invoked there
debugging the code I found that the settings object is not being properly propagated.. the DimzonEncoder seems to think my faac.exe has no path associated with it even though I've properly configured it.
No, it does...
I also believe you got lame's cbr and abr mixed up
Thanx, Fixed
And what's up with if (priority == ProcessPriority.IDLE)
m_encoderThread.Priority = ThreadPriority.Lowest;
There's a ThreadPriority.Idle, isn't there?
No, look @ enum ThreadPriority@ MSDN - there are no ThreadPriority.Idle
and I have no clue how to debug this thing...
Place breakpoint @ DimzonEncoder::encode - everything is fine (I'm using VS2005 Proffessional Edition).
Are you cleaning up after the encoder? Because if you create a file in the temp folder..
Yes! Definitly everything is cleaned up (even uncomplete output if exception is occured)
I actually meant to suggest that the file have the same name as the audio, just with avs appended...
No. Name is obtained like:
System.IO.Path.GetTempPath() + "encode-" + Guid.NewGuid().ToString("N") + ".avs";
I'm strongly prefer using Guid's to avoid ANY conflicts.
Also, as far as audio input goes.. enabling everything isn't such a good idea.. most filetypes aren't audio so it should only support those that we can handle.
Really we need (I think) such filter:
All Supported Files (*.mp3,....)| *.mp3... | All files (*.*) | *.*
Bcz theoretically you can try to use any file via DirectShowSource. (RealAudio/WMA/AVI etc)
Also, there's already a class wrapping AVIFile.. it would make sense that you use this one and make changes where needed (without breaking current functionality of course.. make sure you test encoding and avisynth script preview)
Yes, i know, as i say before - this still reque refactoring. And I want to write direct avisynth.dll wrapper to got better error diagnostics (instead audio stream not found) in nearest future so i decide do not spent time to refactoring AVIFile usage now - it will be removed anycase when my wrapper will be done.
And some more things: I think your encoder should derive from audioencoder, or at least be called from it so there's a common path it goes through.. just like the 3 video encoders and 3 muxers use a common class. That also allows easy switching of encoders.
Current audio processing consist of 2 step's:
Decoding && DSP
Encoding
So AudioEncoder is not a valid name. I propose AudioJobHandler. I believe using AviSynth for Decoding && DSP is enought so we does not need polyphormism @ this point. Encoding in current impementation perform via command-line encoders via StdIn. In future is possible to define AudioEncoder class with such methods:
public interface IAudioEncoder
{
void Init(string outputFileName, int samplerate, int channels, int bitsPerSample);
void Done();
void Abort();
}
How about using the commandlinegenerator to generate encoder commandlines?
It will be used later (i do not want to change it until first initial commit. and I don't like it bcz this is one class wich knows about every commandline tool)
Last but not least I have to ask the dreaded question "how well did you test this?" I mean.. encoding doesn't even get to the point where it would fail because the encoder paths are not being propagated..
No, they was. I really don't understand why this code doesn't for for you. Try to extrac && compile fresh sources http://www.mytempdir.com/398686 @ clear folder
I'm waiting for your response!
max-holz
21st January 2006, 11:54
Where could I find neroraw.exe? I see this exe in the new program files tab of rev 2035.
The Link
21st January 2006, 12:08
Dimzon wrote in his posting above yours:
As I said before you need BeHappy.Extension.Encoder.Nero7AAC.exe from BeHappy - use it instead of neroraw. I plan to remove BeHappy-related code from it && rename to neroraw a bit later.
Doom9
21st January 2006, 13:08
I have yet checked it - everything is fine? Maybe this error is VS Express (I'm using full version now)I have VS 2k5 standard installed on this machine. However, today it seems to work.
Are you shure Your current encoder.pause implementation really pauses external process? I do not think so, maybe I'm wrong? You only pauses StdOut/StdErr reading from it, isn't it. It means encoding still work...Well.. stopping the reading of these outputs seems to do the trick.. it's not like you can tell an external process to just go to sleep (it starts with the problem that there's no processpriority.sleep) x264 takes a bit longer to react, but all the others pause instantaneously.
As I said before you need BeHappy.Extension.Encoder.Nero7AAC.exe from BeHappyI downloaded your latest Behappy release (December 29th).. there's no nero7aac.exe in it.
No, look @ enum ThreadPriority@ MSDN - there are no ThreadPriority.IdleOops, I mistook that for processpriority.idle (which does exist obviously since I'm using it for every encoder)
Place breakpoint @ DimzonEncoder::encode In the third encoding attempt it finally breaked there.. that was after I posted here.
Try to extrac && compile fresh sources I did that.. I used what you posted, opened that whole project and compiled.. there's no code from anyplace else.
Another few thoughts: every one of my encoders and muxers performs a check if the required files are there (executable).. before putting a line into the script that requires a plugin, in sticking with the current scheme of encoders, it should check if that plugin does exist (you do have to configure your avisynth plugin path in the settings.. so you know where to look - and in addition I think we could read that path from the registry so it would be pre-configured if the MeGUISettings object holds an empty string for that property)
void Init(string outputFileName, int samplerate, int channels, int bitsPerSample);
void Done();
void Abort();
Do you know all those properties? I certainly don't know them for a besweet encoder. And what does Done() do? What about pause/resume?
Really we need (I think) such filter:Well.. you can add the all files for completeness sake, but it should never be the default. The default filter should open just what kind of input types are supported (naturally you could name an mp3 audio.doc but that's not something we need to handle).
so i decide do not spent time to refactoring AVIFile usage nowWhy would you need to refactor it? I think it'll probably be enough to just add a few properties that work for audio since currently there's only video related stuff. And with all your critizizing of my code, I'm a bit surprised to see that the new audio encoder is at least as bad architecture wise.. I hope you'll understand where I might feel a bit miffed by that.. you don't go around critizizing and trying to make everybody change if you then don't live up to the standard yourself.
dimzon
21st January 2006, 13:36
IWell.. stopping the reading of these outputs seems to do the trick.. it's not like you can tell an external process to just go to sleep (it starts with the problem that there's no processpriority.sleep) x264 takes a bit longer to react, but all the others pause instantaneously.
WOW. Very interesting! This means we can't run encoder @ silen mode (without progress output) bcz we can't pause it in this case.
I downloaded your latest Behappy release (December 29th).. there's no nero7aac.exe in it.
;) not just nero7aac.exe BUT BeHappy.Extension.Encoder.Nero7AAC.exe
Another few thoughts: every one of my encoders and muxers performs a check if the required files are there (executable).. before putting a line into the script that requires a plugin, in sticking with the current scheme of encoders, it should check if that plugin does exist (you do have to configure your avisynth plugin path in the settings.. so you know where to look - and in addition I think we could read that path from the registry so it would be pre-configured if the MeGUISettings object holds an empty string for that property)
Yes, It can be done and I will implement it later. In addition i have an idea to implement "check all settings" feature - add one more item to menu. This feature must check every executable/plugin/etc and produce a report about possible troubles.
void Init(string outputFileName, int samplerate, int channels, int bitsPerSample);
void Done();
void Abort();
Do you know all those properties? I certainly don't know them for a besweet encoder.
You forgot again. BeSweet is not an encoder, its whole AudioJobProcessor (in my proposd terminology). AudioEncoder works after decoder/DSP so you know this parameters
And what does Done() do? What about pause/resume?
Sorry, my proposed interface was not complete yet
public interface IAudioEncoder
{
void Init(string outputFileName, int samplerate, int channels, int bitsPerSample);
void EncodeBlock(byte[] rawPcmData);
void Done();
void Abort();
// stop/pause/etc - TODO
}
Done means no nore aduo avaluable let's finalize.
Well.. you can add the all files for completeness sake, but it should never be the default.
Agreed by 100%. Yes, off couse! Current *.* filter is just for testing :)
Why would you need to refactor it? I think it'll probably be enough to just add a few properties that work for audio since currently there's only video related stuff.
I does not want to touch this code at all bcz I plan to replace it ASAP.
And with all your critizizing of my code, I'm a bit surprised to see that the new audio encoder is at least as bad architecture wise.. I hope you'll understand where I might feel a bit miffed by that.. you don't go around critizizing and trying to make everybody change if you then don't live up to the standard yourself.
Hey, I say "this code is crap && reques refactoring" isn't it? I just perform initially copy/paste of BeHappy.Encoder into MeGUI and perform a little tweaks to fit it to IEncoder interface - no more. I do not like this code myself and I plan to refactor it right after my managed Avisynth wrapper will be done. So do not bla me for it ;) And another reason which slowdown code refactoring still conditional compilation - it breaks VS2005 build-in code analyst features as well as it breaks my favorite ReSharper. Of couse this is not MeGUI problem but VS2005/ReSharper but i can't work productively without it. Just imaginate You switch form VS2005 to Notepad - for me this is the same when i switch from ReSharper to pure VS2005.
Doom9
21st January 2006, 14:11
WOW. Very interesting! This means we can't run encoder @ silen mode (without progress output) bcz we can't pause it in this case.No.. you can still read it.. but not process anything and thus no status updates.
not just nero7aac.exe BUT BeHappy.Extension.Encoder.Nero7AAC.exeThere's only one exe in the zip ;)
for me this is the same when i switch from ReSharper to pure VS2005.Visual Studio 2005 has a bunch of refactoring features built-in, and then you have those code templates (that I've never used). And they have no problem with conditional compilation. I can't imagine how ReSharper would help integrating all your duplicate VfW code and put it into the AviReader class.
dimzon
21st January 2006, 15:33
There's only one exe in the zip ;)
are you joking ???
sources
behappy.exe
behappy.exe.config
behappy.extensibility.dll
behappy.extension.encoder.nero7aac.exe
behappy.oggvorbis.encoder.extension
behappy.oggvorbis.encoder.extension.dll
downmix.extension
enc_aacplus.extension
ffmpeg-ac3.extension
flac.extension
lame.extension
nero7.txt
nero7aac.extension
nicaudio.extension
upmix.extension
wavpack.extension
http://img41.imageshack.us/img41/782/untitled5xh1.png
I can't imagine how ReSharper would help integrating all your duplicate VfW code and put it into the AviReader class.
Uhhh. I just tell You in prevoius post:
I does not want to touch this code at all bcz I plan to replace it ASAP.
ASAP == during 2-5 days (mostly AvisynthWrapper is alredy done, keep testing)
Richard Berg
21st January 2006, 16:51
@dimzon
I'm strongly prefer using Guid's to avoid ANY conflicts.
I think it's better to use DateTime.Now.Ticks for unique tempfiles/logs/etc
- much shorter/cleaner-looking that GUIDs
- filenames will always be in date order, makes finding the right one easy
Doom9
21st January 2006, 16:55
well.. in order to be consistent with the naming, the one click encoder uses the input file for avs scripts.. I think the most coherent thing would be that the name of a temporary avs file is the source name plus .avs appended. And there's one problem with moving things to the temp directory.. if something goes wrong, or the user doesn't have the cleanup option enabled.. you'll never find your temporary files as only those who've seen the code know where things go. I'm not happy at all to have applications that fill up my temp directory and force me to clean it on my own.. even if files are not being deleted, at least if I have them all together I'll realize quickly enough what I can get rid of. But perhaps I know too much so that I'm able to identify which files I no longer need?
Richard Berg
21st January 2006, 17:22
Just make it TempDir\MeGUI\<videofilename> + DateTime.Now.Ticks + ".avs"
That gives you everything you want: which input file it affects, proper sorting, and easy for a human to group by job or to blow away the whole directory.
dimzon
21st January 2006, 20:24
2 all developers
AviSynthWrapper is done. take look http://www.mytempdir.com/399806
berrinam
21st January 2006, 22:59
Small CVS update:
(In compile.bat) If there are no commandline arguments, do the same as compile all.
I haven't updated the version number, etc, because it doesn't affect anything else. I made this change so that compile.bat can be run without the commandline.
berrinam
21st January 2006, 23:03
@dimzon: This isn't compatible with current avs opening (ie for previewing), is it? As it is, if you want to preview a file, you need to open it with your wrapper, to check if there is an error, and then you open it with the current code if there isn't. Seems a bit wasteful to me.
dimzon
22nd January 2006, 10:51
@dimzon: This isn't compatible with current avs opening (ie for previewing), is it? As it is, if you want to preview a file, you need to open it with your wrapper, to check if there is an error, and then you open it with the current code if there isn't. Seems a bit wasteful to me.
I'm planning to add video support and create my own VideoReader later. Current implementation is for Audio...
dimzon
22nd January 2006, 12:02
@Doom9
Hi! How does You think, can I add this methods/properties to AudioCodecSettings:
/// <summary>
/// Must return command line arguments string for command-line audio encoder
/// {0} means output file name
/// {1} means samplerate in Hz
/// {2} means bits per sample
/// {3} means channel count
/// {4} means samplecount
/// {5} means size in bytes
/// </summary>
/// <returns>command line arguments</returns>
public abstract string GetCommandLineArguments();
/// <summary>
/// Must return logical flag
/// </summary>
public abstract bool IsRawPcmSupportedByEncoder
{
get;
}
/// <summary>
/// Must read executable path from settings
/// </summary>
/// <param name="from">settings to read path from</param>
/// <returns>path to encoder executable</returns>
public abstract string GetExecutablePath(MeGUISettings from);
/// <summary>
/// Return some additional code to be applied to the end of DSP
/// Example - 6==Audiochannels(last)?GetChannel(last,2,3,1,6,4,5):last{0}
/// </summary>
public abstract string AdjasmentAvisynthScript
{
get;
}
Doom9
22nd January 2006, 13:25
Hi! How does You think, can I add this methods/properties to AudioCodecSettings:If you need them, of course. Althought I'd name the last one AdjustAvisynthScript so that it's proper English ;)
umm wait.. why should the codec settings extract something from the settings? that should be the job of the encoder itself, shouldn't it? The settings should contains a little information about the actual encoding process as possible.. just enough so that the encoder can begin its work.. the encoder should have to intelligence to do whatever's needed to get the encoding done. It's also a question whether source properties really belong to the settings.. I'm afraid I didn't quick stick to that with the videosettings as well. If we have the means to figure out the source properties just before encoding, so that the encoder keeps whatever it needs for status updates, I think that would be the optimal approach.
dimzon
22nd January 2006, 13:40
@Doom9
OK, if you don't like it i will do not do it ;)
New audiosettings look (beSweet - related code is back)
http://img17.imageshack.us/img17/226/untitled9tg.png
Doom9
22nd January 2006, 13:46
umm.. the 24bit thing.. I haven't read the whole thread in the audio forum but I think I read something about avisynth automatically using the proper sample length so there won't be any overflows/cutoffs?
dimzon
22nd January 2006, 14:06
umm.. the 24bit thing.. I haven't read the whole thread in the audio forum but I think I read something about avisynth automatically using the proper sample length so there won't be any overflows/cutoffs?
If You will use 24bit or floating computations you will reduce ROUNDING ERRORS in CHAIN (where multiplication/division is used)
ConvertAudioTo32Bit
SomeOp
SomeOp
SomeOp
ConvertAudioTo16Bit
dimzon
22nd January 2006, 15:14
Doom9
please take look http://www.mytempdir.com/401361
PS. DimzonEncoder is better but still need refactoring
PS2. Maybe it's time to commit this code to CVS?
Doom9
22nd January 2006, 15:21
well.. did you take care of all the issues I've mentioned? checking for plugin existence, checking for encoder existence? move the encoder out of the audioencoder class? I'm also not quite happy about having to select which encoder is going to be used at configuration time.. I think it should be done at encoding time (I know, videoencoder needs an adjustment there as well).
dimzon
22nd January 2006, 15:36
well.. did you take care of all the issues I've mentioned? checking for plugin existence, checking for encoder existence?
Just partially... I have some idea how to do such check at better way in future:
Does you know how jUnit/csUnit/NUnit works? It's possible to create same infrastructure to provide API for checking installation/settings integrity...
move the encoder out of the audioencoder class?
It still in same file Yet. Now it is AudioEncoder descendant.
I'm also not quite happy about having to select which encoder is going to be used at configuration time.. I think it should be done at encoding time (I know, videoencoder needs an adjustment there as well).
I really don't understand what does you men exatly...
Doom9
22nd January 2006, 15:40
I really don't understand what does you men exatly...In the audio options, you have a radiobutton "encode via avisynth" and one "encode via besweet" .. if you go to the x264 or xvid codec setup.. there's no "use x264.exe" and "use mencoder.exe" radiobutton.. that is handled in the settings.
Also, classnames should reflect what a class does.. dimzonencoder does what now? ;)
dimzon
22nd January 2006, 15:44
In the audio options, you have a radiobutton "encode via avisynth" and one "encode via besweet" .. if you go to the x264 or xvid codec setup.. there's no "use x264.exe" and "use mencoder.exe" radiobutton.. that is handled in the settings.
Unfortunally AviSynth has a little different option set (and this option set is easy to increase using additional filters etc). So it's impossible (i think) to switch before them.
Also, classnames should reflect what a class does.. dimzonencoder does what now? ;)
Feel free to rename it as you wish ;)
dimzon
22nd January 2006, 15:57
And yet another programming trick. Does you know WinForms list controls (including ComboBox as well) can host any objects. object.ToString() is used to obtain string to display and you can access selected object via myCombo.SelectedItem property...
So i propose more modular audio settings editing solution. This is my proposal
1) define AudioSettingsProvider interface (or, maybe, class)
public interface IAudioSettingsProvider
{
void LoadDefaults();
bool IsSupportedSettings( AudioCodecSettings settings);
AudioCodecSettings GetCurrentSettings();
void LoadCodecSettings( AudioCodecSettings settings);
bool EditCurrentSettings( IWin32Window parentWindow, profiles, etc )
}
2) implement this interface in
FaacSettingsProvider (override object.ToString to return FAAC)
NaacSettingsProvider (override object.ToString to return NAAC)
LameSettingsProvider (override object.ToString to return Lame MP3)
3) fill AudioCodecComboBox using:
AudioCodecComboBox.Items.AddRange( new object[]{
new FaacSettingsProvider (),
new NaacSettingsProvider(),
new LameSettingsProvider() })
Volia.
To get current settings just call
(AudioCodecComboBox.SelectedItem as IAudioSettingsProvider).GetCurrentSettings()
to load settings from job:
foreach(IAudioSettingsProvider p in AudioCodecComboBox.Items)
{
if(p.IsSupportedSettings(settingsToLoad))
{
p.LoadCodecSettings(settingsToLoad);
AudioCodecComboBox.SelectedItem = p;
break;
}
}
stax76
22nd January 2006, 16:40
And yet another programming trick. Does you know WinForms list controls (including ComboBox as well) can host any objects. object.ToString() is used to obtain string to display and you can access selected object via myCombo.SelectedItem property...
It's important to know this and in most cases more robust, flexible and easier then DataBinding and other things. The only thing I'm disappointed is Microsoft don't have versions of this controls supporting generics, the GUI design time environment is already amazing so supporting this should probably be doable. VB's clunky cast syntax reminds me all the time that it would be a nice feature.
dimzon
22nd January 2006, 17:07
It's important to know this and in most cases more robust, flexible and easier then DataBinding
You can use then both @ same time:
private object[] _besweetDownMix = new object[]{....};
private object[] _avisynthDownMix = new object[]{....};
{
if(isBeSweetMode)
{
dowmixCombo.DataSource = _besweetDownMix;
}
else
{
dowmixCombo.DataSource = _avisynthDownMix;
}
}
Don't forget - you can use DataBinding for any IList (object.ToString() will be used to get representation)
stax76
22nd January 2006, 17:23
If overriding ToString gets you around using DisplayMember then it should be fine as well.
dimzon
22nd January 2006, 17:25
If overriding ToString gets you around using DisplayMember then it should be fine as well.
I prefer to owerrite toString bcz I know how it will be looked @ screen even if I do not touch default ComboBox settings ;)
stax76
22nd January 2006, 17:47
I prefer to owerrite toString bcz I know how it will be looked @ screen even if I do not touch default ComboBox settings
Me too, I don't recall using any DataBinding in StaxRip. Some people will try to solve everything with DataBinding while in many cases it's a poor solution.
berrinam
23rd January 2006, 08:42
0.2.3.2036 23 Jan 2006
Applied Mutant_Fruit's Context Sensitive Help update:
-Just attaching a new version of the contexthelp.xml as written by LiFe.
-I also made a few changes to the contexthelp method as i didn't realise that newlines would be correctly picked up from the xml file.
-Tooltips should no longer stretch across the entire screen. But could possibly do with nicer paragraphing.
Doom9
23rd January 2006, 09:25
@berrinam: did you see richard's patch?
Inc
23rd January 2006, 09:43
2 all developers
AviSynthWrapper is done. take look http://www.mytempdir.com/399806
Could you also offer the sources? :)
My comments:
I had a fast look over your header cs file where the functions of the avsredirect.dll are called.
1. You did declare the samplecount/offset etc. of the arguments in Getaframe() as Long. Did you let pass these valuesas proper Int64 by doing a Cast of the Long values to Int64? as the the orig avs function expects int64 values in here.
2. Seems you still handle the 3 -Y U V- planes separately by calling getvframe() as it was the orig state of avsredirect.dll for supporting FFmpegs native YV12 support. I modded the avsredirect so only the readpointer to the whole bitmap is returned, NO return to a VideoPlanestructure. Keep that in mind :) Thats why I also added the RGB24/32, YUY2 and YV12 output support.
dimzon
23rd January 2006, 09:49
Could you also offer the sources? :)
No problem
http://www.mytempdir.com/402921 - it uses AviSynth so it's LGPL anycase. Just keep in mind it's not finished yet
1. You did declare the samplecount/offset etc. of the arguments in Getaframe() as Long. Did you let pass these valuesas proper Int64 by doing a Cast of the Long values to Int64? as the the orig avs function expects int64 values in here.
long in c# means int64 :cool:
2. Seems you still handle the 3 -Y U V- planes separately by calling getvframe() as it was the orig state of avsredirect.dll for supporting FFmpegs native YV12 support. I modded the avsredirect so only the readpointer to the whole bitmap is returned, NO return to a VideoPlanestructure. Keep that in mind :) Thats why I also added the RGB24/32, YUY2 and YV12 output
support.
I doesn't touch video part yet - i'm planing to get it later
Doom9
23rd January 2006, 09:51
@dimzon: can you handle the cutlist format I proposed? And I really think the encoder should be separate.. so that if you do further work on it, it touches the smallest amount of files. The current AudioEncoder should just serve as an audio job dispatcher.
Inc
23rd January 2006, 10:00
- it uses AviSynth so it's LGPL anycase. Just keep in mind it's not finished yet
btw: Even if AVS is LGPL licensed the root wrapper code by Mobilehackers was released under the GPL thats why I kept it automatically as GPL when I modded the sources. So even the resulted dll is GPL'ed *imho* (not 100% sure)
If you want a preview of the frame or the audio, you can simply use the approaches I discribed in here:
http://forum.doom9.org/showthread.php?p=772595#post772595
There you will obtain a pointer where you can access the Bitmap-startingadress by using for example SetDIBits() of the Win API (or something similair in C#)
dimzon
23rd January 2006, 10:07
btw: Even if AVS is LGPL licensed the root wrapper code by Mobilehackers was released under the GPL thats why I kept it automatically as GPL when I modded the sources. So even the resulted dll is GPL'ed *imho* (not 100% sure)
Sorry, my fault:
Linking Avisynth statically or dynamically with other modules is making a combined work based on Avisynth. Thus, the terms and conditions of the GNU General Public License cover the whole combination.
Doom9
23rd January 2006, 10:27
well.. license wise MeGUI is GPL anyway so whatever parts are integrated fall under this license as well.
dimzon
23rd January 2006, 10:34
@dimzon: can you handle the cutlist format I proposed?
Lets define something like with (for better code maintenance)
public class FrameInterval
{
public long FirstFrame;
public long LastFrame;
}
public class Cutlist
{
// actual fps = FramerateNoninator/FramerateDeNoninator
public long FramerateNoninator;
public long FramerateDeNoninator;
public FrameInterval[] Intervals;
}
And I really think the encoder should be separate.. so that if you do further work on it, it touches the smallest amount of files.
I do not understand exatly what does you mean (my poor english can be a reason). Does you want i move my encoder in separate file? No problem in this case.
The current AudioEncoder should just serve as an audio job dispatcher.
AFAIK it is ;)
public virtual bool setup(Job job, out string error)
{
error = null;
if (((AudioJob)job).Settings.EncodeViaBeSweet)
encoder = new BeSweetEncoder(settings.BesweetPath);
else
encoder = new DimzonEncoder(settings);
return encoder.setup(job, out error);
}
And I want to perform CVS commit before continue. Can I?
By the way - what does you think about my proposal (http://forum.doom9.org/showthread.php?p=773033#post773033)
And I have another proposal about new "prerender" feature. I really have a beteter idea how it must be done!
let's define:
t1 = average time to read 1 avs frame
t2 = average time to encode 1 frame to losless
t3 = average time to decode 1 frame from lossles
t4 = average time to 1-st pass encode for 1 frame
t5 = average time to 2-nd pass encode for 1 frame
Assuming 2-pass encoding we need
t1 + t2 + t3 + t4 + t3 + t5 time to encode 1 frame
We can save marked t3 interval if we write some more intelligent code:
first pass:
1) Read frame from AviSynth
2) Encode it to lossless (it's possible to wrap VfW driver direcly via PInvoke) && save encoded frame @ temporaly stream
3) Encode it via x264 (send frame to it via StdIn like audio encoders do)
second pass:
1) Decode frame from loseless (it's possible to wrap VfW driver direcly via PInvoke)
2) Encode it via x264 (send frame to it via StdIn like audio encoders do)
So were are new unique features:
Since we are 100% controlling process we can use multiple hard drives to store losless temporaly files. Really if we are running out of space @ HDD1 we can start writing rest data to HDD2 etc...
It posiible to perform partially prerender. If we are running out of space @ HDD we can stop caching frames (for first N frames for second pass cached data will be used, for rest fromes - source AviSynth)
Invoking lossless encoder via MeGUI:
there are 2 way to do it:
It's possible to call VfW driver via PInvoke
Since there are open source losless encoders we can ceate our own .NET-friendly DLL ;)
Doom9
23rd January 2006, 10:51
Lets define something like with (for better code maintenance)Agreed.
Does you want i move my encoder in separate file? Yup..
And I want to perform CVS commit before continue. Can I?I still need to do a few testruns myself. Have you tested auto-mode and one click mode?
Now about your prerender suggestion.. wouldn't we incurr a loss of speed if we go from native -> managed -> native again as opposed to having the encoder read frames directly from the avisynth script? PInvoke isn't the most efficient thing after all, is it?
berrinam
23rd January 2006, 11:00
@dimzon: About the prerender scripting: What you suggested about skipping t3 has indeed been suggested before (I linked to zajc's post about it in the first post of the feature request thread). I did plan to implement it that way, using avs2yuv as the way of managing this, as this gives you the option of doing this. I think I even said when I added the support for this that I decided not to in the end, because:
1. avs2yuv wasn't flexible enough for MeGUI.
2. When I tried to make it flexible, my limited C++ skills resulting in the program crashing.
I scrapped that then. However, the t3 time interval is probably the least computer-intensive one. Especially with ffvhuff, which was designed only for speed and lack of colorspace conversions, the decoding speed is very high (I haven't measured it).
As to running it all through MeGUI.... yeesh, I thought the whole point of MeGUI was to get rid of VfW, and now you are suggesting going back to it? Also, using avi's and not splitting them across directories makes it more easy to use this outside of MeGUI (we don't want to create a monopoly on the video we just processed, do we?).
My real objection, of course, is that what you are saying is all too complex for me. I don't think directly controlling VfW is what we want with MeGUI, but a .NET-friendly DLL might not be too bad. Let's see what Doom9 thinks.
@dimzon: I'm planning some refactoring and quite a few changes to the currentNAACSettings, etc, as well as other audio in Form1.cs. Does this clash with the changes you have made?
@Doom9: No, I didn't see Richard's patch. I've found it now.
I objected a while ago to all the currentSomethingSettings in MeGUI, and you asked if I have a better idea. Here we go: update the VidCodecSettings property to have a get and set, and use this throughout MeGUI:
public VideoCodecSettings VidCodecSettings
{
get
{
VideoCodecSettings vSettings = null;
#if FULL
switch (videoCodec.SelectedIndex)
{
case 0:
vSettings = this.currentLavcSettings;
break;
case 1:
vSettings = this.currentX264Settings;
break;
case 2:
vSettings = this.currentSnowSettings;
break;
case 3:
vSettings = this.currentXvidSettings;
break;
}
#elif X264_ONLY
vSettings = this.currentX264Settings;
#elif SNOW_ONLY
vSettings = this.currentSnowSettings;
#endif
return vSettings;
}
set
{
#if FULL
if (value is x264Settings)
{
this.currentX264Settings = (x264Settings)value;
videoCodec.SelectedIndex = (int)VideoJob.CodecType.AVC;
}
if (value is lavcSettings)
{
this.currentLavcSettings = (lavcSettings)value;
videoCodec.SelectedIndex = (int)VideoJob.CodecType.ASP;
}
if (value is snowSettings)
{
this.currentSnowSettings = (snowSettings)value;
videoCodec.SelectedIndex = (int)VideoJob.CodecType.SNOW;
}
if (value is xvidSettings)
{
this.currentXvidSettings = (xvidSettings)value;
videoCodec.SelectedIndex = (int)VideoJob.CodecType.XVID;
}
#elif X264_ONLY
if (value is x264Settings)
this.currentX264Settings = (x264Settings)value;
#elif SNOW_ONLY
if (value is snowSettings)
this.currentSnowSettings = (snowSettings)value;
#endif
}
}Of course, I would do likewise for audio (audio seems even worse.... it has HEAPS of code all over the place, which I don't think has been changed for ages). What do you think?
dimzon
23rd January 2006, 11:07
Agreed.
Yup..
Ok. I will do it after CVS commit. By the way - what name does you propose for DimzonEncoder? Is AvisynthAudioEncoder good for it?
I still need to do a few testruns myself. Have you tested auto-mode and one click mode?
there are some bug, replace audioEncoder.cs http://www.mytempdir.com/403001
wouldn't we incurr a loss of speed if we go from native -> managed -> native again as opposed to having the encoder read frames directly from the avisynth script?
there are some trick to improve PInvoke perfomance. The first off all - avoid Marshaller work for strings, structures and bytearrays. It can be done using unsafe C# code or playing with CGHandle created with Pinned option.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.