mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
decklink: Our capture time is the end timestamp of the buffer, subtract the duration
This commit is contained in:
parent
4ef676f109
commit
7c0fb92f1b
2 changed files with 24 additions and 5 deletions
|
@ -324,6 +324,7 @@ gst_decklink_audio_src_create (GstPushSrc * bsrc, GstBuffer ** buffer)
|
||||||
gsize data_size;
|
gsize data_size;
|
||||||
CapturePacket *p;
|
CapturePacket *p;
|
||||||
AudioPacket *ap;
|
AudioPacket *ap;
|
||||||
|
GstClockTime timestamp, duration;
|
||||||
|
|
||||||
g_mutex_lock (&self->lock);
|
g_mutex_lock (&self->lock);
|
||||||
while (g_queue_is_empty (&self->current_packets) && !self->flushing) {
|
while (g_queue_is_empty (&self->current_packets) && !self->flushing) {
|
||||||
|
@ -356,9 +357,17 @@ gst_decklink_audio_src_create (GstPushSrc * bsrc, GstBuffer ** buffer)
|
||||||
ap->input->AddRef ();
|
ap->input->AddRef ();
|
||||||
|
|
||||||
// TODO: Jitter/discont handling
|
// TODO: Jitter/discont handling
|
||||||
GST_BUFFER_TIMESTAMP (*buffer) = p->capture_time;
|
duration =
|
||||||
GST_BUFFER_DURATION (*buffer) =
|
|
||||||
gst_util_uint64_scale_int (sample_count, GST_SECOND, self->info.rate);
|
gst_util_uint64_scale_int (sample_count, GST_SECOND, self->info.rate);
|
||||||
|
// Our capture time is the end timestamp, subtract the
|
||||||
|
// duration to get the start timestamp
|
||||||
|
if (p->capture_time >= duration)
|
||||||
|
timestamp = p->capture_time - duration;
|
||||||
|
else
|
||||||
|
timestamp = 0;
|
||||||
|
|
||||||
|
GST_BUFFER_TIMESTAMP (*buffer) = timestamp;
|
||||||
|
GST_BUFFER_DURATION (*buffer) = duration;
|
||||||
|
|
||||||
capture_packet_free (p);
|
capture_packet_free (p);
|
||||||
|
|
||||||
|
|
|
@ -268,6 +268,7 @@ gst_decklink_video_src_create (GstPushSrc * bsrc, GstBuffer ** buffer)
|
||||||
gsize data_size;
|
gsize data_size;
|
||||||
VideoFrame *vf;
|
VideoFrame *vf;
|
||||||
CaptureFrame *f;
|
CaptureFrame *f;
|
||||||
|
GstClockTime timestamp, duration;
|
||||||
|
|
||||||
g_mutex_lock (&self->lock);
|
g_mutex_lock (&self->lock);
|
||||||
while (g_queue_is_empty (&self->current_frames) && !self->flushing) {
|
while (g_queue_is_empty (&self->current_frames) && !self->flushing) {
|
||||||
|
@ -299,9 +300,18 @@ gst_decklink_video_src_create (GstPushSrc * bsrc, GstBuffer ** buffer)
|
||||||
vf->input = self->input->input;
|
vf->input = self->input->input;
|
||||||
vf->input->AddRef ();
|
vf->input->AddRef ();
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (*buffer) = f->capture_time;
|
duration =
|
||||||
GST_BUFFER_DURATION (*buffer) = gst_util_uint64_scale_int (GST_SECOND,
|
gst_util_uint64_scale_int (GST_SECOND, self->info.fps_d,
|
||||||
self->info.fps_d, self->info.fps_n);
|
self->info.fps_n);
|
||||||
|
// Our capture time is the end timestamp, subtract the
|
||||||
|
// duration to get the start timestamp
|
||||||
|
if (f->capture_time >= duration)
|
||||||
|
timestamp = f->capture_time - duration;
|
||||||
|
else
|
||||||
|
timestamp = 0;
|
||||||
|
|
||||||
|
GST_BUFFER_TIMESTAMP (*buffer) = timestamp;
|
||||||
|
GST_BUFFER_DURATION (*buffer) = duration;
|
||||||
|
|
||||||
capture_frame_free (f);
|
capture_frame_free (f);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue