Modifying the Profile | |
Profiles and the AsfWriterHere, we'll briefly look at ways to manipulate the Profile after it has been assigned to the AsfWriter. This is usually accomplished through the AsfWriter's WriterAdvanced2 interface.
Adding Header Infomsdn websiteA short text message can be displayed in Windows Media Player's status panel.
var hr: HRESULT; HeaderInfo: IWMHeaderInfo3; Title: PWideChar; Idx: word; Temp: String; cValue: PWideChar; begin hr:= AsfWriter.WriterAdvanced2.QueryInterface(IWMHeaderInfo3, HeaderInfo); if Failed(hr) then ShowMessage('Failed to get IWMHeaderInfo3 interface'); Title:= 'Title'; //Test Message Temp:= 'Short Test Message'; GetMem(cValue, sizeof(WideChar) * Succ(Length(Temp))); StringToWideChar(Temp, cValue, Length(Temp) + 1); hr:= HeaderInfo.AddAttribute(0, PWideChar(Title), Idx, WMT_TYPE_STRING, 0, PByte(cValue), Length(Temp) * 2); FreeMem(cValue); if Failed(hr) then ShowMessage('Failed to add attribute.'); end;
SetLiveSourceTo handle incoming samples correctly, the writer object must be notified whether the source is live.
AsfWriter.WriterAdvanced2.SetLiveSource(True);
Get Connections Count
var ClientConnections: IWMClientConnections; hr: HRESULT; nClients: Cardinal; ClientProperties: WM_CLIENT_PROPERTIES; begin if (not FilterGraph1.Active) then Exit; hr:= AsfWriter.WriterNetworkSink.QueryInterface(IWMClientConnections, ClientConnections); if Failed(hr) then Showmessage('Error - failed to get IWMClientConnections interface'); ClientConnections.GetClientCount(nClients); Label1.Text:= 'Connections: ' + IntToStr(nClients); end;
|