gstrtsprange

gstrtsprange — dealing with time ranges

Synopsis

#include <gst/rtsp/gstrtsprange.h>

enum                GstRTSPRangeUnit;
struct              GstRTSPTimeRange;
struct              GstRTSPTime;
struct              GstRTSPTime2;
enum                GstRTSPTimeType;
GstRTSPResult       gst_rtsp_range_parse                (const gchar *rangestr,
                                                         GstRTSPTimeRange **range);
gboolean            gst_rtsp_range_get_times            (const GstRTSPTimeRange *range,
                                                         GstClockTime *min,
                                                         GstClockTime *max);
gchar *             gst_rtsp_range_to_string            (const GstRTSPTimeRange *range);
gboolean            gst_rtsp_range_convert_units        (GstRTSPTimeRange *range,
                                                         GstRTSPRangeUnit unit);
void                gst_rtsp_range_free                 (GstRTSPTimeRange *range);

Description

Provides helper functions to deal with time ranges.

Details

enum GstRTSPRangeUnit

typedef enum {
  GST_RTSP_RANGE_SMPTE,
  GST_RTSP_RANGE_SMPTE_30_DROP,
  GST_RTSP_RANGE_SMPTE_25,
  GST_RTSP_RANGE_NPT,
  GST_RTSP_RANGE_CLOCK
} GstRTSPRangeUnit;

Different possible time range units.

GST_RTSP_RANGE_SMPTE

SMPTE timecode

GST_RTSP_RANGE_SMPTE_30_DROP

29.97 frames per second

GST_RTSP_RANGE_SMPTE_25

25 frames per second

GST_RTSP_RANGE_NPT

Normal play time

GST_RTSP_RANGE_CLOCK

Absolute time expressed as ISO 8601 timestamps

struct GstRTSPTimeRange

struct GstRTSPTimeRange {
  GstRTSPRangeUnit unit;

  GstRTSPTime  min;
  GstRTSPTime  max;
  GstRTSPTime2 min2;
  GstRTSPTime2 max2;
};

A time range.

GstRTSPRangeUnit unit;

the time units used

GstRTSPTime min;

the minimum interval

GstRTSPTime max;

the maximum interval

GstRTSPTime2 min2;

extra fields in the minimum interval (Since: 1.2)

GstRTSPTime2 max2;

extra fields in the maximum interval (Since: 1.2)

struct GstRTSPTime

struct GstRTSPTime {
  GstRTSPTimeType type;
  gdouble         seconds;
};

A time indication.

GstRTSPTimeType type;

the time of the time

gdouble seconds;

seconds when type is GST_RTSP_TIME_SECONDS, GST_RTSP_TIME_UTC and GST_RTSP_TIME_FRAMES

struct GstRTSPTime2

struct GstRTSPTime2 {
  gdouble         frames;
  guint           year;
  guint           month;
  guint           day;
};

Extra fields for a time indication.

gdouble frames;

frames and subframes when type in GstRTSPTime is GST_RTSP_TIME_FRAMES

guint year;

year when type is GST_RTSP_TIME_UTC

guint month;

month when type is GST_RTSP_TIME_UTC

guint day;

day when type is GST_RTSP_TIME_UTC

Since 1.2


enum GstRTSPTimeType

typedef enum {
  GST_RTSP_TIME_SECONDS,
  GST_RTSP_TIME_NOW,
  GST_RTSP_TIME_END,
  GST_RTSP_TIME_FRAMES,
  GST_RTSP_TIME_UTC
} GstRTSPTimeType;

Possible time types.

GST_RTSP_TIME_SECONDS

seconds

GST_RTSP_TIME_NOW

now

GST_RTSP_TIME_END

end

GST_RTSP_TIME_FRAMES

frames and subframes

GST_RTSP_TIME_UTC

UTC time

gst_rtsp_range_parse ()

GstRTSPResult       gst_rtsp_range_parse                (const gchar *rangestr,
                                                         GstRTSPTimeRange **range);

Parse rangestr to a GstRTSPTimeRange.

rangestr :

a range string to parse

range :

location to hold the GstRTSPTimeRange result

Returns :

GST_RTSP_OK on success.

gst_rtsp_range_get_times ()

gboolean            gst_rtsp_range_get_times            (const GstRTSPTimeRange *range,
                                                         GstClockTime *min,
                                                         GstClockTime *max);

Retrieve the minimum and maximum values from range converted to GstClockTime in min and max.

A value of GST_CLOCK_TIME_NONE will be used to signal GST_RTSP_TIME_NOW and GST_RTSP_TIME_END for min and max respectively.

UTC times will be converted to nanoseconds since 1900.

range :

a GstRTSPTimeRange

min :

result minimum GstClockTime

max :

result maximum GstClockTime

Returns :

TRUE on success.

Since 1.2


gst_rtsp_range_to_string ()

gchar *             gst_rtsp_range_to_string            (const GstRTSPTimeRange *range);

Convert range into a string representation.

range :

a GstRTSPTimeRange

Returns :

The string representation of range. g_free() after usage.

gst_rtsp_range_convert_units ()

gboolean            gst_rtsp_range_convert_units        (GstRTSPTimeRange *range,
                                                         GstRTSPRangeUnit unit);

Converts the range in-place between different types of units. Ranges containing the special value GST_RTSP_TIME_NOW can not be converted as these are only valid for GST_RTSP_RANGE_NPT.

range :

a GstRTSPTimeRange

unit :

the unit to convert the range into

Returns :

TRUE if the range could be converted

gst_rtsp_range_free ()

void                gst_rtsp_range_free                 (GstRTSPTimeRange *range);

Free the memory allocated by range.

range :

a GstRTSPTimeRange