Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
This helper structure holds the relevant values for tracking the region of interest in a media file, called a segment.
The structure can be used for two purposes: itemizedlist listitemparaperforming seeks (handling seek events)/para/listitem listitemparatracking playback regions (handling newsegment events)/para/listitem /itemizedlist
The segment is usually configured by the application with a seek event which is propagated upstream and eventually handled by an element that performs the seek.
The configured segment is then propagated back downstream with a newsegment event. This information is then used to clip media to the segment boundaries.
A segment structure is initialized with gst_segment_init(), which takes a #GstFormat that will be used as the format of the segment values. The segment will be configured with a start value of 0 and a stop/duration of -1, which is undefined. The default rate and applied_rate is 1.0.
The public duration field contains the duration of the segment. When using the segment for seeking, the start and time members should normally be left to their default 0 value. The stop position is left to -1 unless explicitly configured to a different value after a seek event.
The current position in the segment should be set by changing the position member in the structure.
For elements that perform seeks, the current segment should be updated with the gst_segment_do_seek() and the values from the seek event. This method will update all the segment fields. The position field will contain the new playback position. If the start_type was different from GST_SEEK_TYPE_NONE, playback continues from the position position, possibly with updated flags or rate.
For elements that want to use #GstSegment to track the playback region, update the segment fields with the information from the newsegment event. The gst_segment_clip() method can be used to check and clip the media data to the segment boundaries.
For elements that want to synchronize to the pipeline clock, gst_segment_to_running_time() can be used to convert a timestamp to a value that can be used to synchronize to the clock. This function takes into account the base as well as any rate or applied_rate conversions.
For elements that need to perform operations on media data in stream_time, gst_segment_to_stream_time() can be used to convert a timestamp and the segment info to stream time (which is always between 0 and the duration of the stream).
- newtype Segment = Segment (ForeignPtr Segment)
- newZeroSegment :: MonadIO m => m Segment
- noSegment :: Maybe Segment
- data SegmentClipMethodInfo
- segmentClip :: MonadIO m => Segment -> Format -> Word64 -> Word64 -> m (Bool, Word64, Word64)
- data SegmentCopyMethodInfo
- segmentCopy :: MonadIO m => Segment -> m Segment
- data SegmentCopyIntoMethodInfo
- segmentCopyInto :: MonadIO m => Segment -> Segment -> m ()
- data SegmentDoSeekMethodInfo
- segmentDoSeek :: MonadIO m => Segment -> Double -> Format -> [SeekFlags] -> SeekType -> Word64 -> SeekType -> Word64 -> Bool -> m Bool
- data SegmentFreeMethodInfo
- segmentFree :: MonadIO m => Segment -> m ()
- data SegmentInitMethodInfo
- segmentInit :: MonadIO m => Segment -> Format -> m ()
- data SegmentIsEqualMethodInfo
- segmentIsEqual :: MonadIO m => Segment -> Segment -> m Bool
- segmentNew :: MonadIO m => m Segment
- data SegmentOffsetRunningTimeMethodInfo
- segmentOffsetRunningTime :: MonadIO m => Segment -> Format -> Int64 -> m Bool
- data SegmentSetRunningTimeMethodInfo
- segmentSetRunningTime :: MonadIO m => Segment -> Format -> Word64 -> m Bool
- data SegmentToPositionMethodInfo
- segmentToPosition :: MonadIO m => Segment -> Format -> Word64 -> m Word64
- data SegmentToRunningTimeMethodInfo
- segmentToRunningTime :: MonadIO m => Segment -> Format -> Word64 -> m Word64
- data SegmentToRunningTimeFullMethodInfo
- segmentToRunningTimeFull :: MonadIO m => Segment -> Format -> Word64 -> Word64 -> m Int32
- data SegmentToStreamTimeMethodInfo
- segmentToStreamTime :: MonadIO m => Segment -> Format -> Word64 -> m Word64
- segmentReadAppliedRate :: Segment -> IO Double
- segmentReadBase :: Segment -> IO Word64
- segmentReadDuration :: Segment -> IO Word64
- segmentReadFlags :: Segment -> IO [SegmentFlags]
- segmentReadFormat :: Segment -> IO Format
- segmentReadOffset :: Segment -> IO Word64
- segmentReadPosition :: Segment -> IO Word64
- segmentReadRate :: Segment -> IO Double
- segmentReadStart :: Segment -> IO Word64
- segmentReadStop :: Segment -> IO Word64
- segmentReadTime :: Segment -> IO Word64
Exported types
newZeroSegment :: MonadIO m => m Segment Source
Construct a Segment
struct initialized to zero.
Methods
segmentClip
segmentClip :: MonadIO m => Segment -> Format -> Word64 -> Word64 -> m (Bool, Word64, Word64) Source
segmentCopy
data SegmentCopyMethodInfo Source
((~) (TYPE Lifted) signature (m Segment), MonadIO m) => MethodInfo (TYPE Lifted) SegmentCopyMethodInfo Segment signature Source | |
segmentCopy :: MonadIO m => Segment -> m Segment Source
segmentCopyInto
data SegmentCopyIntoMethodInfo Source
((~) (TYPE Lifted) signature (Segment -> m ()), MonadIO m) => MethodInfo (TYPE Lifted) SegmentCopyIntoMethodInfo Segment signature Source | |
segmentCopyInto :: MonadIO m => Segment -> Segment -> m () Source
segmentDoSeek
segmentDoSeek :: MonadIO m => Segment -> Double -> Format -> [SeekFlags] -> SeekType -> Word64 -> SeekType -> Word64 -> Bool -> m Bool Source
segmentFree
data SegmentFreeMethodInfo Source
((~) (TYPE Lifted) signature (m ()), MonadIO m) => MethodInfo (TYPE Lifted) SegmentFreeMethodInfo Segment signature Source | |
segmentFree :: MonadIO m => Segment -> m () Source
segmentInit
data SegmentInitMethodInfo Source
((~) (TYPE Lifted) signature (Format -> m ()), MonadIO m) => MethodInfo (TYPE Lifted) SegmentInitMethodInfo Segment signature Source | |
segmentInit :: MonadIO m => Segment -> Format -> m () Source
segmentIsEqual
segmentNew
segmentNew :: MonadIO m => m Segment Source
segmentOffsetRunningTime
segmentSetRunningTime
segmentToPosition
segmentToRunningTime
segmentToRunningTimeFull
segmentToStreamTime
Properties
AppliedRate
Base
segmentReadBase :: Segment -> IO Word64 Source
Duration
segmentReadDuration :: Segment -> IO Word64 Source
Flags
segmentReadFlags :: Segment -> IO [SegmentFlags] Source
Format
segmentReadFormat :: Segment -> IO Format Source
Offset
segmentReadOffset :: Segment -> IO Word64 Source
Position
segmentReadPosition :: Segment -> IO Word64 Source
Rate
segmentReadRate :: Segment -> IO Double Source
Start
segmentReadStart :: Segment -> IO Word64 Source
Stop
segmentReadStop :: Segment -> IO Word64 Source
Time
segmentReadTime :: Segment -> IO Word64 Source