SegmentInfo Class

Defines the information that must be exposed by any manifest parser. This class corresponds to the Clip element in the composite manifest. You can extend the class with private data if a custom parser needs more information.

Inheritance Hierarchy

System.Object
  Microsoft.Web.Media.SmoothStreaming.SegmentInfo

Namespace:  Microsoft.Web.Media.SmoothStreaming
Assembly:  Microsoft.Web.Media.SmoothStreaming (in Microsoft.Web.Media.SmoothStreaming.dll)

Syntax

'Declaration

Public Class SegmentInfo
'Usage

Dim instance As SegmentInfo
public class SegmentInfo
public ref class SegmentInfo
type SegmentInfo =  class end
public class SegmentInfo

The SegmentInfo type exposes the following members.

Properties

  Name Description
Public propertySupported by Windows Phone AvailableStreams Gets the available StreamInfo objects that is contained by a SegmentInfo object.
Public propertySupported by Windows Phone EndPosition Gets the minimum of the end time for the last audio chunk and last video chunk.
Public propertySupported by Windows Phone SelectedStreams Gets the selected StreamInfo objects.
Public propertySupported by Windows Phone StartPosition Gets the maximum of the start times of the first audio chunk and first video chunk.

Top

Methods

  Name Description
Public methodSupported by Windows Phone Equals (Inherited from Object.)
Protected methodSupported by Windows Phone Finalize (Inherited from Object.)
Public methodSupported by Windows Phone GetHashCode (Inherited from Object.)
Public methodSupported by Windows Phone GetType (Inherited from Object.)
Protected methodSupported by Windows Phone MemberwiseClone (Inherited from Object.)
Public method RestrictStreams Restricts decoder initialization to the specified list of available streams.
Public methodSupported by Windows Phone SelectStreamsAsync(IList<StreamInfo>) Initializes a new instance of the SegmentInfo class.
Public methodSupported by Windows Phone SelectStreamsAsync(IList<StreamInfo>, Object) Initializes a new instance of the SegmentInfo class.
Public methodSupported by Windows Phone ToString (Inherited from Object.)

Top

Remarks

For the client manifest, on demand and live, there is only one SegmentInfo object. You can refer to it as the zeroth segment of Segments. For composite manifests, there can be multiple SegmentInfo objects. (Composite manifests are currently exposed as one segment, but applications should use segment-handling code that can be called on several segments. Do not assume that ManifestInfo.Segments[0] is the current segment.)

SegmentInfo objects contain a list of all available and selected streams and a method for stream selection. The AvailableStreams and SelectedStreams collections represent all the streams in the Smooth Streaming presentation.

For implementation examples, see Timeline Markers and Events and other topics in Microsoft Smooth Streaming Client 2.0.

Examples

The following example shows code that loops through any number of SegmentInfo objects.

    void SmoothPlayer_MediaOpened(object sender, RoutedEventArgs e)
    {
        foreach (SegmentInfo segmentInfo in SmoothPlayer.ManifestInfo.Segments)
        {
            List<StreamInfo> selectStreams = segmentInfo.SelectedStreams.ToList<StreamInfo>();
            foreach (StreamInfo streamInfo in segmentInfo.AvailableStreams)
            {
                if (streamInfo.Type == System.Windows.Media.MediaStreamType.Script)
                {
                    if (streamInfo.Attributes["Name"] == "ClosedCaptions" ||
                                            streamInfo.Attributes["Name"] == "MARKERS")
                    {
                        selectStreams.Add(streamInfo);
                        segmentInfo.SelectStreamsAsync(selectStreams);

                        foreach (TrackInfo trackInfo in streamInfo.SelectedTracks)
                        {
                            foreach (ChunkInfo chunk in streamInfo.ChunkList.ToList<ChunkInfo>())
                            {
                                IAsyncResult ar =
                                    trackInfo.BeginGetChunk(
                                    chunk.TimeStamp, new AsyncCallback(AddMarkers), streamInfo.UniqueId);
                            }
                        }
                    }
                }
            }
        }
    }

Version Information

Silverlight

Supported in: 5

Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Web.Media.SmoothStreaming Namespace