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

TOPIC:

win_DSPack Question 10 years 8 months ago #4329

  • 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.

Regards,
Glenn

//

procedure TForm1.Button1Click(Sender: TObject); // *** Used during testing to review current profile, modify and configure asfWriter with modified profile
var
ProfileManager: IWMProfileManager;
Profile: IWMProfile;
nLen: LongWord;
// ProfileString: WideString;
NewProfile: IWMProfile;
ConfigAsfWriter: IConfigAsfWriter;
const
old : array[1..21] of string = ('inputname="Audio"','bitrate="64040"','bufferwindow="-1"','lsamplesize="1487"','nSamplesPerSec="44100"','nAvgBytesPerSec="8005"','nBlockAlign="1487"',
'codecdata="008800000F00792E0000"','inputname="Video"','bitrate="386000"','bufferwindow="5000"','decodercomplexity=""','maxkeyframespacing="100000000"',
'quality="75"','dwbitrate="386000"','avgtimeperframe="333333"','right="320"','bottom="240"','biwidth="320"','biheight="240"','bicompression="WMV3"');
const
new : array[1..21] of string = ('inputname="Audio409"','bitrate="128016"','bufferwindow="3000"','lsamplesize="2731"','nSamplesPerSec="48000"','nAvgBytesPerSec="16002"','nBlockAlign="2731"',
'codecdata="008800000F0000000000"','inputname="Video409"','bitrate="4922000"','bufferwindow="3000"','decodercomplexity="AU"','maxkeyframespacing="60000000"',
'quality="90"','dwbitrate="4922000"','avgtimeperframe="666666"','right="1280"','bottom="720"','biwidth="1280"','biheight="720"','bicompression="WMV2"');

begin

// Create instance of Profile Manager
if (Succeeded(WMCreateProfileManager(ProfileManager))) then
begin
// 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
begin
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
end
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
else ShowMessage('ASFWriter1.QueryInterface() Failed!!');
end;
end;
//

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

  • Page:
  • 1