Modifying the Profile

 

Profiles and the AsfWriter

Here, 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 Info

msdn website

A 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;


SetLiveSource

To handle incoming samples correctly, the writer object must be notified whether the source is live.

msdn website

   AsfWriter.WriterAdvanced2.SetLiveSource(True);


Get Connections Count

msdn website

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;

 

previous page

1 | 2 | 3 | 4 | 5 | 6 |


This site and its contents are © Copyright 2005 - All Rights Reserved.