INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Encoder GetInfo function  (Read 6468 times)

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Encoder GetInfo function
« on: April 19, 2005, 09:14:12 pm »

John Gateley:

Three things with the Encoder Plugin SDK.

1.  I assume the Options function is only called if the isconfigurable_yes mode is selected and upon clicking the "Advanced" button.  It's not called any other time is it?

2. Assuming the above is true, then I've narrowed my problems down to the GetInfo function.  Can you enumerate what MC might be looking for me to return?  The only item you've provided in the SDK is "Bitrate".  Are there other info items needing to be returned?

3.  It is near impossible to test my plugin since there is no explanation of what steps MC takes to initialize the plugin (in terms of PutSettings, GetInfo, etc).

Current symptoms:  switching from any encoder plugin to mine seems to work, but upon closing the options menu, MC crashes (thread dies, window closes, etc).  If you then restart MC, my plugin is in fact selected.  Switching to another encoder plugin will again cause MC to crash.

I belive the encoding part works (it is essentially unchanged from the previous working version), but testing these setup parts is difficult.
Logged

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #1 on: April 20, 2005, 09:28:37 am »

1.  I assume the Options function is only called if the isconfigurable_yes mode is selected and upon clicking the "Advanced" button.  It's not called any other time is it?

Correct. It takes a single argument, a bstr pointer, to receive the new options string. A typical implementation is:

COptionsDialog OptionsDialog(m_Settings); // m_settings is a member variable containing the current settings
OptionsDialog.DoModal();
m_Settings = OptionsDialog.GetSettings();
*pArgument = m_Settings.AllocSysString(); // pArgument is the pointer to bstr argument

Quote
2. Assuming the above is true, then I've narrowed my problems down to the GetInfo function.  Can you enumerate what MC might be looking for me to return?  The only item you've provided in the SDK is "Bitrate".  Are there other info items needing to be returned?

The only thing GetInfo is currently used for is to get a bitrate estimate. A typical implementation ignores the
"Param" argument, checks the name to see if it is bitrate, and puts in a reasonable value. It sets the param to
null if  the option is not Bitrate.

Quote
Current symptoms:  switching from any encoder plugin to mine seems to work, but upon closing the options menu, MC crashes (thread dies, window closes, etc).  If you then restart MC, my plugin is in fact selected.  Switching to another encoder plugin will again cause MC to crash.

Sounds like Options is not creating the result correctly. It must serialize all options into a single string
(for example, if you had Option1 with Value1, and the same for 2 and 3, it might be: Option1=Value1;Option2=Value2;Option3=Value3)
and copy that string to the argument.

j

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #2 on: April 22, 2005, 08:26:53 pm »

I think you may have misunderstood what I said  :P

I actually have the is_configurable set to NO, so I meant MC's options menu, not mine.

I believe the string is serializing OK because I can test that relatively easily and it seems to pass & forth OK.  This is the put_Settings function.
Logged

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #3 on: April 22, 2005, 11:08:55 pm »

I've managed to test the put_Settings function by throwing in a bunch of message boxes into the dll and using MC to test it.

The function appears to be working fine.  MC will read the registry for the existing setting, the settings are correctly set inside the function, but I think it might be that MC isn't getting it written correctly.

I note that some registry settings are in the key ...Media Center 11... while others are in the key ...MediaJukebox...   Is it possible there is something in MC that would look one place or the other?  (I've been using the key "Media Center 11").
Logged

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #4 on: April 23, 2005, 10:57:39 am »

I also keep getting hits on the GetInfo function looking for "EXE Path".  Since this is an internal plugin (DLL) there is no EXE.  Is that normal?
Logged

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #5 on: April 23, 2005, 11:36:59 am »

John,

Just for kicks, I uninstalled the plugin.  Deleted all applicable MC registry keys from both LOCAL_MACHINE and CURRENT_USER.

Then I reinstalled the plugin, without changing any settings via MC's options menu.  The LOCAL_MACHINE key is created correctly and it installs into MC fine.

Then I go to the MC Options menu, to select the plugin for ripping.  The put_Settings function appears to work fine, as the entry is blank at first, then the default settings are set.  But then MC calls the GetInfo function looking for the EXE Path.

The EXE Path is an External Encoder setting.  The plugin returns a null pointer, and MC continues on.

Since the plugin Options menu is disabled, that's it, so I hit OK on the MC options menu.  MC crashes.  It does not write the settings to the registry (no entries in the CURRENT_USER...Plugins key for the plugin.

Summary:  I don't know why, but MC appears to think my plugin is the External Encoder for some reason.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42384
  • Shoes gone again!
Re: Encoder GetInfo function
« Reply #6 on: April 24, 2005, 09:32:20 pm »

John,

Just for kicks, I uninstalled the plugin.  Deleted all applicable MC registry keys from both LOCAL_MACHINE and CURRENT_USER.

Then I reinstalled the plugin, without changing any settings via MC's options menu.  The LOCAL_MACHINE key is created correctly and it installs into MC fine.

Then I go to the MC Options menu, to select the plugin for ripping.  The put_Settings function appears to work fine, as the entry is blank at first, then the default settings are set.  But then MC calls the GetInfo function looking for the EXE Path.

The EXE Path is an External Encoder setting.  The plugin returns a null pointer, and MC continues on.

Since the plugin Options menu is disabled, that's it, so I hit OK on the MC options menu.  MC crashes.  It does not write the settings to the registry (no entries in the CURRENT_USER...Plugins key for the plugin.

Summary:  I don't know why, but MC appears to think my plugin is the External Encoder for some reason.

Try returning an empty string instead of NULL.  Maybe MC isn't handling that properly.

John will know more.
Logged
Matt Ashland, JRiver Media Center

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #7 on: April 25, 2005, 11:37:01 am »

I did some checking - the EXE Path shouldn't be happening, but it also shouldn't be happening. The GetIfno function returning a NULL pointer should be fine. I fixed the weirdness that was causing this, you shouldn't see it anymore.

The crash. If I read everything correct, it looks like information is not getting written to the CURRENT_USER portion of the tree. If you choose "Encoding for: CD Ripping", this would be the following entries:
HKEY_CURRENT_USER\Software\JRiver\Media Center 11\Ripping\Convert All Formats
HKEY_CURRENT_USER\Software\JRiver\Media Center 11\Ripping\Delete Wav Files
HKEY_CURRENT_USER\Software\JRiver\Media Center 11\Ripping\Encoder Enable Normalization
HKEY_CURRENT_USER\Software\JRiver\Media Center 11\Ripping\Encoder Name
HKEY_CURRENT_USER\Software\JRiver\Media Center 11\Ripping\Encoder Normalization Level
HKEY_CURRENT_USER\Software\JRiver\Media Center 11\Ripping\Rip and Encode Simultaneous
HKEY_CURRENT_USER\Software\JRiver\Media Center 11\Ripping\Skip If Possible
HKEY_CURRENT_USER\Software\JRiver\Media Center 11\Ripping\
I don't know what's going on here, so I've added some logging stuff to the next build (coming out soon). Under Help->Configure Debug Logging..., select  Output to a Logfile, and select Encoders in the list. Then make MC crash, restart MC, and go back to the Dbug Logging and view the log file. Copy and Paste it here.

j

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #8 on: April 25, 2005, 11:23:58 pm »

Thanks for the help...this is all with MC 11 ver 248.  This will be a long post.

I built a version of the plugin with ISCONFIGURABLE_NO set.

I uninstalled the plugin and deleted all "FLAC Encoder" keys in the LOCAL_MACHINE and CURRENT_USER tree.

I installed the plugin.  It creates all of the correct keys in the LOCAL_MACHINE tree and is recognized by MC fine.  No log is created during this process.

I select the menu Tools->Options->Encoders.  Select CD Ripping.  Select the FLAC plugin.  Select OK.  MC does not crash in the current 248 rev.  It previously did.  Here is the log...

8:56:10 PM: Encoders: CPropertiesEncodingDlg::OnOK: Start
8:56:10 PM: Encoders: CPropertiesEncodingDlg::OnOK: Plugins Activated
8:56:10 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set Delete Wave
8:56:10 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set Enable Norm
8:56:10 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set Enable Norm
8:56:10 PM: Encoders: CPropertiesEncodingDlg::OnOK: NormLevel
8:56:10 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set NormLevel
8:56:10 PM: Encoders: CPropertiesEncodingDlg::OnOK: UpdateData
8:56:10 PM: Encoders: CPropertiesEncodingDlg::OnOK: Save Options
8:56:10 PM: Encoders: CPropertiesEncodingDlg::OnOK: Finish (15 ms)
8:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Start
8:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Plugins Activated
8:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set Delete Wave
8:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set Enable Norm
8:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set Enable Norm
8:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: NormLevel
8:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set NormLevel
8:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: UpdateData
8:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Save Options
8:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Finish (16 ms)

OK.  Since my plugin has a bunch of message boxes enabled, I note that the put_Settings and GetInfo functions have not been called at this point.  I check the registry, and the "Ripping", "File Conversion", and "Recording" entries all seem to be fine.

However, I note there is not an entry in the Plugins tree, like there is with the other plugins.  It looks like there ought to be entries for ...\Plugins\Encoders\FLAC Encoder\Ripping and ...\File Conversion and ...\Recording.  Since MC hasn't called the put_Settings function, I can understand why there aren't yet.

So, since it hasn't crashed yet, and hasn't called the put_Settings function yet, I start a rip from a CD.  It pulls the wav off the disc, then calls the put_Settings function with a blank entry, gets the default settings (all normal so far) but then calls the Options function (which seems to work fine since it pulls up the box, gets the quality and returns the right string).  Since ISCONFIGURABLE_NO is set, that's probably wrong behavior.

It pulls the wav from the CD then acts like it converted (it doesn't).  It doesn't crash though, so I check the registry again...no entry in the LOCAL_USER\...\Encoders tree for the FLAC Encoder and it's settings.  Hmmm.  I don't think that's right either.  There's no log from that action either (I only have Encoder selected for logging).  Anyway, it still hasn't crashed.

I'm not sure why the file wasn't converted if the m_Settings string was set correctly (it seemed to be from the message boxes).  The plugin certainly didn't take long enough to convert, it must have bombed somewhere else (will keep checking).

Whew, my fingers are tired.
Logged

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #9 on: April 26, 2005, 12:26:35 pm »

It should have still crashed. I'm suspecting your GetInfo function. Make sure it initializes the result to NULL:

GetInfo(.... BSTR *Result)
{
    *Result = NULL;
    if(... == _T("BitRate))
    { ... }
}

The crash was probably caused by not changing the Result parameter if you didn't recognize the Info name parameter.

j

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #10 on: April 26, 2005, 12:30:47 pm »

Registry settings: The registry settings in LOCAL_MACHINE describe the plugin, and everything is okay there.

The registry settings for the rest of the info are in CURRENT_USER.  They show up in 2 different places:
SOFTWARE\JRiver\Media Center 11\Ripping\<bunch of stuff>
SOFTWARE\JRiver\Media Center 11\Plugins\Encoders\<plugin name>\<usage category>

The "Options" settings are ONLY in the second entry, and will ONLY appear if the plugin has options. Since you have compled with it non-configurable, there are no options and there will be none in the second registry location. This seems to be working fine.

j

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #11 on: April 26, 2005, 12:35:59 pm »

put_Settings is different than what you think. put_Settings takes an options string previously returned from Options, and gives it to the plugin. The plugin should parse the options string and set the state of the plugin to reflect this.

The normal sequence of events is this:
Options gets called (for configurable plugins), the user makes selections, the string is returned and saved in the registry.
Later, the user rips a CD, and when the plugin is "Open"ed, it looks up the settings string from the registry, and tells the plugin to configure itself to this string by calling put_Settings.

Make sense?

j

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #12 on: April 26, 2005, 12:50:53 pm »

Here is the sequence of events when ripping a CD:

(This first part is so that the CD ripper can guess at the time to take)
put_Settings is called.
GetInfo(BitRate...) is called
Stop is called

(This part is the actual encoding)
put_Settings is called again
put_DestinationFile is called
get_DestinationFile is called
put_DestinationFile is called again
InitBufferInput is called
get_DestinationFIle is called again
EncodeBuffer is called until the data is encoded
FinishBufferInput is called
Stop is called

There is no call to Options here. If you are sure Options is getting called, something else is happening.

j

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #13 on: April 26, 2005, 08:02:06 pm »

It should have still crashed. I'm suspecting your GetInfo function. Make sure it initializes the result to NULL:

GetInfo(.... BSTR *Result)
{
    *Result = NULL;
    if(... == _T("BitRate))
    { ... }
}

The crash was probably caused by not changing the Result parameter if you didn't recognize the Info name parameter.

I thought I had copied what I had directly from the SDK.  However, I noticed a small change in the compare method.  I'll switch it around to initialize first.  Easy enough change.  I did some more debugging and did find that it wasn't returning the bitrate correctly.  It was always returning the Null pointer instead, so that's one thing.

The compare operator probably worked as it was ( Name == "Bitrate"), but I switched to using the compare method instead (Name.Compare(_T("Bitrate")) to be safe.

However, the assignment part, which is from the SDK isn't working:

   CString Name(strName, FALSE);
   CString Param(strParam, FALSE);

This compiles fine, but doesn't actually copy the strings as intended.  It should be as follows:

   CString Name, Param;
   Name = strName;
   Param = strParam;

This fixes one thing.  I'll test it out and see what happens.
Logged

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #14 on: April 26, 2005, 09:06:24 pm »

put_Settings is different than what you think. put_Settings takes an options string previously returned from Options, and gives it to the plugin. The plugin should parse the options string and set the state of the plugin to reflect this.

The normal sequence of events is this:
Options gets called (for configurable plugins), the user makes selections, the string is returned and saved in the registry.
Later, the user rips a CD, and when the plugin is "Open"ed, it looks up the settings string from the registry, and tells the plugin to configure itself to this string by calling put_Settings.

So the Options function (regardless of whether the ISCONFIGURABLE bit is set) is what makes the options string.  I do not have to put anything into the registry.  MC takes the m_Settings string and puts it there for me.

I was under the impression that put_Settings did that, and that Options was only for the message box to get the settings.  I keep reading the other message you wrote about the put_Settings function and still don't understand.  Maybe it's the way I have the encoder set up.  I don't need anything from the settings except in the encoder functions, and then I only need access to m_Settings to parse out my stuff. 
Logged

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #15 on: April 26, 2005, 09:38:45 pm »

I tried a few more things.

The funny thing is, I had this down pat when I had to keep track of the settings in the registry.  Now that MC is handling it, there seems to be some miscommunication between the plugin and MC.

OK.  I will eventually need the options dialog box to select the compression level, so I rebuilt using the ISCONFIGURABLE_YES.

When I hit the "advanced" button from MC Tools->Options->Encoders, it calls the put_Settings function with a blank input (since the registry is empty).  Here is my put_Settings function:

put_Settings(BSTR newVal)
{
   m_Settings = newVal;
   if(m_Settings == _T("")) // create default settings
   {
      m_Settings = DEFAULT_SETTINGS;  //_T("Quality=5")
   }
   return S_OK;
}

I know this is working and being called because there are actually a bunch of message boxes thrown in there to follow the flow and show the results.

Anyway, as the function returns, MC crashes.  No log is created.  The registry key is setup, but the key entry "Settings" is blank.  Actually, not blank, but a bunch of what appear to be Nulls or maybe carriage returns.  Here is a paste. 쉞譖菱䡾琀謏䡎Ƌ郿?.  The Options function is not called.

One thing that has me concerned.  I've had some issues when I run my tester program (for debugging) with occasionally I'll call one function and somehow it actually calls a different one.  The problem lies in the order functions are listed in the .h file and the IDL file.  Some sort of compiler mapping error.  However, since the tester program is calling all the right functions, I don't believe that's it in this case.

If I edit the registry entry to read "Quality=5" or similar, and run MC again, it again calls the put_Settings function, this time with the right entry (Quality=5).  The function appears to do what it is supposed to, but MC still crashes.  Again no log is created, and the key entry is back to gibberish again.  The Options function has not been called.
Logged

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #16 on: April 26, 2005, 11:14:14 pm »

The compare operator probably worked as it was ( Name == "Bitrate"), but I switched to using the compare method instead (Name.Compare(_T("Bitrate")) to be safe.

However, the assignment part, which is from the SDK isn't working:

   CString Name(strName, FALSE);
   CString Param(strParam, FALSE);

This compiles fine, but doesn't actually copy the strings as intended.  It should be as follows:

   CString Name, Param;
   Name = strName;
   Param = strParam;

This fixes one thing.  I'll test it out and see what happens.


Don't forget, it should be Name.Compare(_T("BitRate")) == 0
:)

Also, I think the constructors I was using for CString may have been a local version we use to initialize a CString from a BSTR. Make sure you are getting the bstr copied over okay.

j

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #17 on: April 26, 2005, 11:21:07 pm »

So the Options function (regardless of whether the ISCONFIGURABLE bit is set) is what makes the options string.  I do not have to put anything into the registry.  MC takes the m_Settings string and puts it there for me.

I was under the impression that put_Settings did that, and that Options was only for the message box to get the settings.  I keep reading the other message you wrote about the put_Settings function and still don't understand.  Maybe it's the way I have the encoder set up.  I don't need anything from the settings except in the encoder functions, and then I only need access to m_Settings to parse out my stuff. 

Correct - Options creates the string, and passes it back. MC stores it in the registry, and retrieves it later, passing it back in via put_Settings.

Your put_Settings function should also parse the string, and set the state. It should parse the string looking for QUALITY=<number>, figure out the number, and do
m_Quality = <number>
(or you can do this later on in a different function, just make sure it happens before you actually use the quality).

I'll have to look at the put_Settings crash tomorrow - the logging was only for an Options crash.

j

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #18 on: April 27, 2005, 10:47:47 am »

Can you post your Options function? I think the problem may still be there.

j

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #19 on: April 27, 2005, 09:11:11 pm »

Can you post your Options function? I think the problem may still be there.

Here it is.  It works fine from the debugger/tester program I have.  The message boxes are in there so I can see when a function is called and what the results were.  The dialog box is a simple textbox with the numbers 1 through 8 for selection, mapped to the m_QualityValue entry.

STDMETHODIMP CEncoderImpl::Options(BSTR *pVal)
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState())

   #ifdef DEBUG
      MessageBox(NULL, L"Options", NULL, MB_OK);
   #endif

   COptionsDialog dlgOptions;
   dlgOptions.DoModal();
   m_Settings = "";
   m_Settings += "Quality=";
   m_Settings += dlgOptions.m_QualityValue;

   *pVal = m_Settings.AllocSysString();

   #ifdef DEBUG
      MessageBox(NULL, (LPCTSTR)m_Settings, L"m_Settings", MB_OK);
   #endif

   return S_OK;
}
Logged

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #20 on: April 27, 2005, 10:25:43 pm »

Huh. Not what I expected.

Make sure I understand the latest behavior: instead of writing Settings in the registry with value "Quality=something", it's writing Settings in the registry with a garbage value, correct?

That would explain the crashing you saw before that disappeared, it crashed trying to write garbage. The small changes caused by the logging changed the garbage enough it doesn't crash until later now (when referencing the Settings with garbage value).

The next step is more logging, I'll get it in the morning...

j

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #21 on: April 28, 2005, 10:24:03 am »

Okay, more logging in the next build. This is weird.

j

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #22 on: April 30, 2005, 04:01:25 pm »

Huh. Not what I expected.

Make sure I understand the latest behavior: instead of writing Settings in the registry with value "Quality=something", it's writing Settings in the registry with a garbage value, correct?

Yes, that was correct.
Logged

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #23 on: April 30, 2005, 04:24:18 pm »

OK, tried the new version 252.

Similar experience, with one small change.

MC Tools->Options->Encoding->"Advanced" Tab (for FLAC Encoder).

put_Settings function is called first.  It's pulling the right info from the registry, since I am being passed the right string.  Crashes when exiting this function.

Still doesn't make it to the Options function, though, and there is still no log created when it crashes.

The one small change is that instead of the previous garbage that was written, it's different this time.  Now here is the paste "㐜~".

If I edit the registry to be "Quality=5" I still get the right string passed from MC, but it still crashes and writes the garbage.

The way it crashes sounds like a memory error.
Logged

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #24 on: May 02, 2005, 11:11:17 am »

two things:

I need the log again.
and
Check the put_Settings function and DO NOT free(SysFreeString) the BSTR parameter.

j

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #25 on: May 07, 2005, 07:05:37 pm »

It's not generally making a log.

This is under 261.

I uninstalled the plugin and deleted the registry key under CURRENT_USER (that holds the settings).

I restarted MC.  Installed the plugin.  Tools->Options->Encoders.  Select Flac Encoder.  Hit OK.

Here is the log:
4:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Start
4:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Plugins Activated
4:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set Delete Wave
4:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set Enable Norm
4:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set Enable Norm
4:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: NormLevel
4:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Set NormLevel
4:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: UpdateData
4:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Save Options
4:56:18 PM: Encoders: CPropertiesEncodingDlg::OnOK: Finish (32 ms)

So I do Tools->Options->Encoders.  Flac Encoder is selected.  I hit Advanced.  MC calls the put_Settings function.  Not the options function.  The function appears to work.  MC Crashes.  I pulled this from the file log.txt, but if I restart MC it says there is no log file.

5:00:32 PM: Encoders: CEncoderPlugin::Options: Start
5:00:54 PM: Encoders: CEncoderPlugin::Options: Calling Options

The string in the settings registry key is still hosed "恜~".

Here is both my options function and put_Settings function, in all their glory.

STDMETHODIMP CEncoderImpl::Options(BSTR *pVal)
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState())

   #ifdef DEBUG
      MessageBox(NULL, L"Options", NULL, MB_OK);
   #endif

   COptionsDialog dlgOptions;
   dlgOptions.DoModal();
   m_Settings = "";
   m_Settings += "Quality=";
   m_Settings += dlgOptions.m_QualityValue;

   *pVal = m_Settings.AllocSysString();

   #ifdef DEBUG
      MessageBox(NULL, (LPCTSTR)m_Settings, L"m_Settings", MB_OK);
   #endif

   return S_OK;
}

STDMETHODIMP CEncoderImpl::put_Settings(BSTR newVal)
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState())

   #ifdef DEBUG
      MessageBox(NULL, (LPCTSTR)newVal, L"newVal=", MB_OK);
   #endif

   m_Settings = newVal;
   //if(m_Settings == _T("")) // create default settings
   if(m_Settings != _T("Quality=5"))
   {

      #ifdef DEBUG
         MessageBox(NULL, (LPCTSTR)newVal, L"Blank", MB_OK);
      #endif

      m_Settings = DEFAULT_SETTINGS;  //_T("Quality=5")
   }

   #ifdef DEBUG
      MessageBox(NULL, (LPCTSTR)m_Settings, L"m_Settings=", MB_OK);
   #endif

   return S_OK;
}
Logged

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Encoder GetInfo function
« Reply #26 on: May 11, 2005, 08:50:54 am »

So I do Tools->Options->Encoders.  Flac Encoder is selected.  I hit Advanced.  MC calls the put_Settings function.  Not the options function.  The function appears to work.  MC Crashes.  I pulled this from the file log.txt, but if I restart MC it says there is no log file.

5:00:32 PM: Encoders: CEncoderPlugin::Options: Start
5:00:54 PM: Encoders: CEncoderPlugin::Options: Calling Options

The string in the settings registry key is still hosed "恜~".

I think this is a clue - MC thinks it is calling the Options function, but your plugin put_Settings function is being called instead. Something's wrong with the linkage. I'm not sure what, but I'll do some checking.

j

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #27 on: May 11, 2005, 09:31:40 pm »

I think this is a clue - MC thinks it is calling the Options function, but your plugin put_Settings function is being called instead. Something's wrong with the linkage. I'm not sure what, but I'll do some checking.

Well, in one of the above posts, I had mentioned that something similar had happened before, where my debugger program would call one function, but the linkage to the dll would be messed up and it would actually call another function.  This is the same problem, except this time, the debugger program is calling the correct function, but MC isn't.  I would assume that if the debugger program is calling it right, MC would as well.  However...

I rearranged the functions in the IDL, header, and cpp file to all match what you publish in the SDK.  I don't understand why this would make a difference, since mine were all matching with each other.  But, it now seems to be working.  I'll finish up a few things and then make sure.
Logged

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Encoder GetInfo function
« Reply #28 on: May 12, 2005, 12:59:22 am »

Well, mixed success.

After the above, the debugger was completely mixed-up and wouldn't call the right functions anywhere.  I rearranged all of them again (not matching the SDK) and this time they all seem to work, including inside MC.

Except for now MC crashes with a MSVC debug error (Run-Time Check #0) on the value of ESP in the Fire_Finished() function -- on the ret = iencoderimpl->finished() line (next to last line in the function).  When I compile for release, it still just hangs there but doesn't give the error.  It won't let me copy the error text or I'd just paste it in.

But the plugin has in fact made the encoded file correctly, in the correct location, and seems to otherwise interact with MC correctly.
Logged
Pages: [1]   Go Up