mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
rtsp: avoid ABI break
Move new fields into structures appended at the end of the GstRTSPRange to avoid ABI break.
This commit is contained in:
parent
9042efd458
commit
b785c66098
3 changed files with 43 additions and 28 deletions
|
@ -142,7 +142,8 @@ done:
|
|||
* 19961108T143720.25Z
|
||||
*/
|
||||
static GstRTSPResult
|
||||
parse_utc_time (const gchar * str, GstRTSPTime * time, const gchar * limit)
|
||||
parse_utc_time (const gchar * str, GstRTSPTime * time, GstRTSPTime2 * time2,
|
||||
const gchar * limit)
|
||||
{
|
||||
|
||||
if (str[0] == '\0') {
|
||||
|
@ -168,9 +169,9 @@ parse_utc_time (const gchar * str, GstRTSPTime * time, const gchar * limit)
|
|||
&mins, &secs) != 6)
|
||||
return GST_RTSP_EINVAL;
|
||||
|
||||
time->year = year;
|
||||
time->month = month;
|
||||
time->day = day;
|
||||
time2->year = year;
|
||||
time2->month = month;
|
||||
time2->day = day;
|
||||
time->seconds = ((hours * 60) + mins) * 60 + secs;
|
||||
}
|
||||
return GST_RTSP_OK;
|
||||
|
@ -191,10 +192,10 @@ parse_utc_range (const gchar * str, GstRTSPTimeRange * range)
|
|||
if (p == NULL || p == str)
|
||||
return GST_RTSP_EINVAL;
|
||||
|
||||
if ((res = parse_utc_time (str, &range->min, p)) != GST_RTSP_OK)
|
||||
if ((res = parse_utc_time (str, &range->min, &range->min2, p)) != GST_RTSP_OK)
|
||||
goto done;
|
||||
|
||||
res = parse_utc_time (p + 1, &range->max, NULL);
|
||||
res = parse_utc_time (p + 1, &range->max, &range->max2, NULL);
|
||||
|
||||
done:
|
||||
return res;
|
||||
|
@ -205,7 +206,8 @@ done:
|
|||
* hours:minutes:seconds:frames.subframes
|
||||
*/
|
||||
static GstRTSPResult
|
||||
parse_smpte_time (const gchar * str, GstRTSPTime * time, const gchar * limit)
|
||||
parse_smpte_time (const gchar * str, GstRTSPTime * time, GstRTSPTime2 * time2,
|
||||
const gchar * limit)
|
||||
{
|
||||
gint hours, mins, secs;
|
||||
|
||||
|
@ -222,7 +224,7 @@ parse_smpte_time (const gchar * str, GstRTSPTime * time, const gchar * limit)
|
|||
str = strchr (str + 1, ':');
|
||||
str = strchr (str + 1, ':');
|
||||
if (str && (limit == NULL || str < limit))
|
||||
time->frames = gst_strtod (str + 1);
|
||||
time2->frames = gst_strtod (str + 1);
|
||||
}
|
||||
return GST_RTSP_OK;
|
||||
}
|
||||
|
@ -242,10 +244,11 @@ parse_smpte_range (const gchar * str, GstRTSPTimeRange * range)
|
|||
if (p == NULL || p == str)
|
||||
return GST_RTSP_EINVAL;
|
||||
|
||||
if ((res = parse_smpte_time (str, &range->min, p)) != GST_RTSP_OK)
|
||||
if ((res =
|
||||
parse_smpte_time (str, &range->min, &range->min2, p)) != GST_RTSP_OK)
|
||||
goto done;
|
||||
|
||||
res = parse_smpte_time (p + 1, &range->max, NULL);
|
||||
res = parse_smpte_time (p + 1, &range->max, &range->max2, NULL);
|
||||
|
||||
done:
|
||||
return res;
|
||||
|
|
|
@ -70,6 +70,7 @@ typedef enum
|
|||
|
||||
typedef struct _GstRTSPTimeRange GstRTSPTimeRange;
|
||||
typedef struct _GstRTSPTime GstRTSPTime;
|
||||
typedef struct _GstRTSPTime2 GstRTSPTime2;
|
||||
|
||||
/**
|
||||
* GstRTSPTimeType:
|
||||
|
@ -93,16 +94,25 @@ typedef enum {
|
|||
* @type: the time of the time
|
||||
* @seconds: seconds when @type is GST_RTSP_TIME_SECONDS,
|
||||
* GST_RTSP_TIME_UTC and GST_RTSP_TIME_FRAMES
|
||||
* @frames: frames and subframes when @type is GST_RTSP_TIME_FRAMES
|
||||
* @year: year when @type is GST_RTSP_TIME_UTC
|
||||
* @month: month when @type is GST_RTSP_TIME_UTC
|
||||
* @day: day when @type is GST_RTSP_TIME_UTC
|
||||
*
|
||||
* A time indication.
|
||||
*/
|
||||
struct _GstRTSPTime {
|
||||
GstRTSPTimeType type;
|
||||
gdouble seconds;
|
||||
};
|
||||
|
||||
/**
|
||||
* GstRTSPTime2:
|
||||
* @frames: frames and subframes when type in GstRTSPTime is
|
||||
* GST_RTSP_TIME_FRAMES
|
||||
* @year: year when type is GST_RTSP_TIME_UTC
|
||||
* @month: month when type is GST_RTSP_TIME_UTC
|
||||
* @day: day when type is GST_RTSP_TIME_UTC
|
||||
*
|
||||
* A time indication.
|
||||
*/
|
||||
struct _GstRTSPTime2 {
|
||||
gdouble frames;
|
||||
guint year;
|
||||
guint month;
|
||||
|
@ -120,8 +130,10 @@ struct _GstRTSPTime {
|
|||
struct _GstRTSPTimeRange {
|
||||
GstRTSPRangeUnit unit;
|
||||
|
||||
GstRTSPTime min;
|
||||
GstRTSPTime max;
|
||||
GstRTSPTime min;
|
||||
GstRTSPTime max;
|
||||
GstRTSPTime2 min2;
|
||||
GstRTSPTime2 max2;
|
||||
};
|
||||
|
||||
GstRTSPResult gst_rtsp_range_parse (const gchar *rangestr, GstRTSPTimeRange **range);
|
||||
|
|
|
@ -235,7 +235,7 @@ GST_START_TEST (test_rtsp_range_smpte)
|
|||
fail_unless (range->unit == GST_RTSP_RANGE_SMPTE);
|
||||
fail_unless (range->min.type == GST_RTSP_TIME_FRAMES);
|
||||
fail_unless (range->min.seconds == 0.0);
|
||||
fail_unless (range->min.frames == 0.0);
|
||||
fail_unless (range->min2.frames == 0.0);
|
||||
fail_unless (range->max.type == GST_RTSP_TIME_END);
|
||||
gst_rtsp_range_free (range);
|
||||
|
||||
|
@ -244,10 +244,10 @@ GST_START_TEST (test_rtsp_range_smpte)
|
|||
fail_unless (range->unit == GST_RTSP_RANGE_SMPTE);
|
||||
fail_unless (range->min.type == GST_RTSP_TIME_FRAMES);
|
||||
fail_unless (range->min.seconds == 38063.0);
|
||||
fail_unless (range->min.frames == 0.0);
|
||||
fail_unless (range->min2.frames == 0.0);
|
||||
fail_unless (range->max.type == GST_RTSP_TIME_FRAMES);
|
||||
fail_unless (range->max.seconds == 72729.0);
|
||||
fail_unless (range->max.frames == 20.89);
|
||||
fail_unless (range->max2.frames == 20.89);
|
||||
gst_rtsp_range_free (range);
|
||||
}
|
||||
|
||||
|
@ -268,9 +268,9 @@ GST_START_TEST (test_rtsp_range_clock)
|
|||
&range) == GST_RTSP_OK);
|
||||
fail_unless (range->unit == GST_RTSP_RANGE_CLOCK);
|
||||
fail_unless (range->min.type == GST_RTSP_TIME_UTC);
|
||||
fail_unless (range->min.year == 2000);
|
||||
fail_unless (range->min.month == 10);
|
||||
fail_unless (range->min.day == 10);
|
||||
fail_unless (range->min2.year == 2000);
|
||||
fail_unless (range->min2.month == 10);
|
||||
fail_unless (range->min2.day == 10);
|
||||
fail_unless (range->min.seconds == 44625.0);
|
||||
fail_unless (range->max.type == GST_RTSP_TIME_END);
|
||||
gst_rtsp_range_free (range);
|
||||
|
@ -279,14 +279,14 @@ GST_START_TEST (test_rtsp_range_clock)
|
|||
("clock=19700101T103423Z-30001230T201209.89Z", &range) == GST_RTSP_OK);
|
||||
fail_unless (range->unit == GST_RTSP_RANGE_CLOCK);
|
||||
fail_unless (range->min.type == GST_RTSP_TIME_UTC);
|
||||
fail_unless (range->min.year == 1970);
|
||||
fail_unless (range->min.month == 1);
|
||||
fail_unless (range->min.day == 1);
|
||||
fail_unless (range->min2.year == 1970);
|
||||
fail_unless (range->min2.month == 1);
|
||||
fail_unless (range->min2.day == 1);
|
||||
fail_unless (range->min.seconds == 38063.0);
|
||||
fail_unless (range->max.type == GST_RTSP_TIME_UTC);
|
||||
fail_unless (range->max.year == 3000);
|
||||
fail_unless (range->max.month == 12);
|
||||
fail_unless (range->max.day == 30);
|
||||
fail_unless (range->max2.year == 3000);
|
||||
fail_unless (range->max2.month == 12);
|
||||
fail_unless (range->max2.day == 30);
|
||||
fail_unless (range->max.seconds == 72729.89);
|
||||
gst_rtsp_range_free (range);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue