klv: allow building with older versions of GStreamer
GstReferenceTimestampMeta appeared in version 1.14
This commit is contained in:
parent
663269e9a6
commit
5c811d9b79
@ -112,16 +112,20 @@ gst_klvinject_add_test_meta (GstKlvInject * filt, GstBuffer * buf)
|
|||||||
0x01, 0x0e, 0x01, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00
|
0x01, 0x0e, 0x01, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
GstByteWriter bw;
|
GstByteWriter bw;
|
||||||
GstReferenceTimestampMeta *time_meta;
|
|
||||||
gint64 utc_us;
|
|
||||||
|
|
||||||
/* NOTE: MISB defines MISP time, which is NOT UTC, but use UTC for now */
|
/* NOTE: MISB defines MISP time, which is NOT UTC, but use UTC for now */
|
||||||
|
gint64 utc_us = -1;
|
||||||
|
|
||||||
|
#if GST_CHECK_VERSION(1,14,0)
|
||||||
|
GstReferenceTimestampMeta *time_meta;
|
||||||
time_meta =
|
time_meta =
|
||||||
gst_buffer_get_reference_timestamp_meta (buf,
|
gst_buffer_get_reference_timestamp_meta (buf,
|
||||||
gst_static_caps_get (&unix_reference));
|
gst_static_caps_get (&unix_reference));
|
||||||
if (time_meta) {
|
if (time_meta) {
|
||||||
utc_us = time_meta->timestamp / 1000;
|
utc_us = time_meta->timestamp / 1000;
|
||||||
} else {
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (utc_us == -1) {
|
||||||
GDateTime *dt = g_date_time_new_now_utc ();
|
GDateTime *dt = g_date_time_new_now_utc ();
|
||||||
utc_us = g_date_time_to_unix (dt) * 1000000; /* microseconds */
|
utc_us = g_date_time_to_unix (dt) * 1000000; /* microseconds */
|
||||||
utc_us += g_date_time_get_microsecond (dt);
|
utc_us += g_date_time_get_microsecond (dt);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user