Export (0) Print
Expand All

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.

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

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


public class SegmentInfo

The SegmentInfo type exposes the following members.

  NameDescription
Public propertySupported by Windows PhoneAvailableStreamsGets the available StreamInfo objects that is contained by a SegmentInfo object.
Public propertySupported by Windows PhoneEndPositionGets the minimum of the end time for the last audio chunk and last video chunk.
Public propertySupported by Windows PhoneSelectedStreamsGets the selected StreamInfo objects.
Public propertySupported by Windows PhoneStartPositionGets the maximum of the start times of the first audio chunk and first video chunk.
Top

  NameDescription
Public methodSupported by Windows PhoneEquals (Inherited from Object.)
Protected methodSupported by Windows PhoneFinalize (Inherited from Object.)
Public methodSupported by Windows PhoneGetHashCode (Inherited from Object.)
Public methodSupported by Windows PhoneGetType (Inherited from Object.)
Protected methodSupported by Windows PhoneMemberwiseClone (Inherited from Object.)
Public methodRestrictStreamsRestricts decoder initialization to the specified list of available streams.
Public methodSupported by Windows PhoneSelectStreamsAsync(IList<StreamInfo>)Initializes a new instance of the SegmentInfo class.
Public methodSupported by Windows PhoneSelectStreamsAsync(IList<StreamInfo>, Object)Initializes a new instance of the SegmentInfo class.
Public methodSupported by Windows PhoneToString (Inherited from Object.)
Top

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.

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);
                            }
                        }
                    }
                }
            }
        }
    }

Silverlight

Supported in: 5

Windows Phone

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

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