mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 18:20:44 +00:00
parent
9f23b82b2c
commit
d0c3682627
1 changed files with 17 additions and 13 deletions
|
@ -590,6 +590,21 @@ theora_enc_get_ogg_packet_end_time (GstTheoraEnc * enc, ogg_packet * op)
|
||||||
return theora_granule_time (&enc->state, end_granule) * GST_SECOND;
|
return theora_granule_time (&enc->state, end_granule) * GST_SECOND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
theora_enc_force_keyframe (GstTheoraEnc * enc)
|
||||||
|
{
|
||||||
|
GstClockTime next_ts;
|
||||||
|
|
||||||
|
/* make sure timestamps increment after resetting the decoder */
|
||||||
|
next_ts = enc->next_ts + enc->timestamp_offset;
|
||||||
|
|
||||||
|
theora_enc_reset (enc);
|
||||||
|
enc->granulepos_offset =
|
||||||
|
gst_util_uint64_scale (next_ts, enc->fps_n, GST_SECOND * enc->fps_d);
|
||||||
|
enc->timestamp_offset = next_ts;
|
||||||
|
enc->next_ts = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
theora_enc_sink_event (GstPad * pad, GstEvent * event)
|
theora_enc_sink_event (GstPad * pad, GstEvent * event)
|
||||||
{
|
{
|
||||||
|
@ -640,19 +655,8 @@ theora_enc_sink_event (GstPad * pad, GstEvent * event)
|
||||||
|
|
||||||
s = gst_event_get_structure (event);
|
s = gst_event_get_structure (event);
|
||||||
|
|
||||||
if (gst_structure_has_name (s, "GstForceKeyUnit")) {
|
if (gst_structure_has_name (s, "GstForceKeyUnit"))
|
||||||
GstClockTime next_ts;
|
theora_enc_force_keyframe (enc);
|
||||||
|
|
||||||
/* make sure timestamps increment after resetting the decoder */
|
|
||||||
next_ts = enc->next_ts + enc->timestamp_offset;
|
|
||||||
|
|
||||||
theora_enc_reset (enc);
|
|
||||||
enc->granulepos_offset =
|
|
||||||
gst_util_uint64_scale (next_ts, enc->fps_n,
|
|
||||||
GST_SECOND * enc->fps_d);
|
|
||||||
enc->timestamp_offset = next_ts;
|
|
||||||
enc->next_ts = 0;
|
|
||||||
}
|
|
||||||
res = gst_pad_push_event (enc->srcpad, event);
|
res = gst_pad_push_event (enc->srcpad, event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue