Welcome, Guest
Username: Password: Remember me
Components and Libraries for Audio and Video Development, discussions, problems and suggestions
  • Page:
  • 1


win_DSPack modified asfWriter profile Question 10 years 11 months ago #4330

  • Glenn Hudson
  • Glenn Hudson's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 7
  • Thank you received: 0
Hello, I am new to Code Typhon(Which I think is incredible!) and Pascal for that matter so please excuse my possibly ignorant question. I came from a 18+ years Borland C++ Builder5 environment and learning Pascal has been a challenge, but fun. Anyway here is my question: I have been struggling with win_DSPack to write a specialized webcam video and audio capture program using the asf/wmv format. Getting that to work, while a bit of a challenge went pretty well. The problems started when I needed to use video formats higher than those available using the preset profiles. I have been trying to load and modify and existing profile using the profileManager interface and almost every works(I think) until I try to load the asfWriter with the modified profile using, ConfigAsfWriter.ConfigureFilterUsingProfile(NewProfile); It ends up thowing an exception. It seems as though it is this function that has a bug because I get an exception thrown even if I try simply configure the asfWriter using the untouched original profile gotten from: ProfileManager.LoadProfileById(CurrentProfile, Profile);
Has anyone been able to successfully use their own profiles using win_DSPack? If so, can you show me how? Here is a code snippet of what I have been trying with no luck. Sorry, I hope it's not too long for the forum and getting the formatting nice in the submission box is difficult. Thanks in advance for any input.

If needed for someone to provide assistance, I can zip up the entire 32bit project and post it.



procedure TForm1.Button1Click(Sender: TObject); // *** Used during testing to review current profile, modify and configure asfWriter with modified profile
ProfileManager: IWMProfileManager;
Profile: IWMProfile;
nLen: LongWord;
// ProfileString: WideString;
NewProfile: IWMProfile;
ConfigAsfWriter: IConfigAsfWriter;
old : array[1..21] of string = ('inputname="Audio"','bitrate="64040"','bufferwindow="-1"','lsamplesize="1487"','nSamplesPerSec="44100"','nAvgBytesPerSec="8005"','nBlockAlign="1487"',
new : array[1..21] of string = ('inputname="Audio409"','bitrate="128016"','bufferwindow="3000"','lsamplesize="2731"','nSamplesPerSec="48000"','nAvgBytesPerSec="16002"','nBlockAlign="2731"',


// Create instance of Profile Manager
if (Succeeded(WMCreateProfileManager(ProfileManager))) then
// Load the WMProfile into the variable 'Profile'
ProfileManager.LoadProfileById(CurrentProfile, Profile);

// Attempt to convert the Profile into a 'nil' String
// This will return with the anticipated length of the String (in nLen)
ProfileManager.SaveProfile(Profile, nil, nLen);

// Use the length value that was returned in nLen to set the required length
// of 'ProfileString' then convert the Profile into a String in ProfileString
SetLength(ProfileString, nLen);
ProfileManager.SaveProfile(Profile, PWideChar(ProfileString), nLen);
NewProfileString := StringsReplace(ProfileString, old, new, [rfReplaceAll, rfIgnoreCase]);
Memo1.Text:= NewProfileString;
ProfileManager.LoadProfileByData(PWideChar(NewProfileString), NewProfile);
ProfileManager:= nil;
FilterGraph1.Active:= true; // needed for QueryInterface to work!
ASFWriter1.FilterGraph:=FilterGraph1; // needed for QueryInterface to work!
if Succeeded(ASFWriter1.QueryInterface(IConfigAsfWriter, ConfigAsfWriter)) then
ShowMessage('QueryInterface Succeeded');
if NewProfile <> nil then begin ConfigAsfWriter.ConfigureFilterUsingProfile(NewProfile); ShowMessage('New Profile Loaded'); end
else begin ShowMessage('ConfigAsfWriter.ConfigureFilterUsingProfile(NewProfile) Failed...Using Old Profile');
ConfigAsfWriter.ConfigureFilterUsingProfileGUID(CurrentProfile); FilterGraph1.Active:=false; ShowMessage('Re-loaded old profile'); end
else ShowMessage('ASFWriter1.QueryInterface() Failed!!');

Please Log in or Create an account to join the conversation.

  • Page:
  • 1