Redigera

Dela via


Sending ASF Data to a Publishing Point

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

You can use the Windows Media Format SDK to push ASF data to a publishing point on a Windows Media server. The server then broadcasts the data from that publishing point. This scenario is useful if you are capturing or re-encoding content on one computer, and wish to distribute the content from another computer (or several computers). It is also useful if you need to move content from a computer inside a firewall to a Windows Media server outside the firewall, because push distribution uses the HTTP protocol.

Note

A publishing point acts essentially like a redirector. The client specifies the publishing point in the URL (for example, mms://MyServer/MyPublishingPoint) and the server translates this into a request for content.

 

To push data to the publishing point, attach the push sink object to the writer object. The push sink is used to open the connection to the server and manage the push session. The writer object handles all the other aspects of creating the file.

Perform the following steps:

  1. Create the writer object by calling the WMCreateWriter function, which returns an IWMWriter pointer.
  2. Create the push sink object by calling the WMCreateWriterPushSink function, which returns an IWMWriterPushSink pointer.
  3. Attach the network sink to the writer by calling IWMWriterAdvanced::AddSink on the writer, with a pointer to the network sink's IWMWriterPushSink interface.
  4. Connect to the server by calling IWMWriterPushSink::Connect.
  5. Write the stream. This step involves setting the profile on the writer object, sending samples to the writer, and possibly other tasks. For more information, see Writing ASF Files. Additional tasks might include setting metadata attributes (as described in Working with Metadata) or setting live-DRM on the stream (as described in Enabling DRM Support). These tasks are performed exactly as they are for ASF file writing.
  6. After you are done writing, call IWMWriterAdvanced::RemoveSink on the writer to detach the push sink object.
  7. Call IWMWriterPushSink::EndSession on the push sink to end the session with the server.

These steps are illustrated in the WMVNetWrite sample application.

Note

If you are sending a very-low-bit-rate video-only file, it might not start playing on the publishing point for several seconds. This can happen in various cases, for example when a single packet contains many small video frames and no audio, or when there is a long time gap between the first packet and the second packet in a low-bit-rate video-only file. To avoid this problem, insert a silent audio stream into the file.

 

Authentication

Authentication to the server is automatically handled by the push sink object. However, the application may need to supply credentials. This is done through the IWMCredentialCallback callback interface, as follows:

  1. Implement the IWMStatusCallback and IWMCredentialCallback interface in your application.
  2. Query the push sink object for the IWMRegisterCallback interface.
  3. Call IWMRegisterCallback::Advise with a pointer to your application's IWMStatusCallback interface.
  4. If the push sink needs to get credentials from the application, it queries the IWMStatusCallback pointer for the IWMCredentialCallback interface and calls IWMCredentialCallback::AcquireCredentials. For information about this method, see Authentication.
  5. When you are done, call IWMRegisterCallback::Unadvise to stop getting event notifications from the push sink.

Sending ASF Data Over a Network

Working with Writer Sinks

Writer Push Sink Object