@@ -197,6 +197,19 @@ gboolean mfx_gst_plugin_vdec_input_event(mfx_GstPad *mfxpad, mfx_GstPlugin *plug
197
197
// forwarding EOS right away in case we failed to post a task
198
198
return gst_pad_event_default (mfxpad->pad , (GstObject*)plugin, event);
199
199
}
200
+ else if (GST_EVENT_SEGMENT == event->type ) {
201
+ gint64 start = 0 ;
202
+ GstSegment segment;
203
+ gst_event_copy_segment (event, &segment);
204
+
205
+ if (segment.format != GST_FORMAT_TIME) {
206
+ gst_pad_query_convert (mfxpad->pad , segment.format ,
207
+ segment.start , GST_FORMAT_TIME, &start);
208
+ segment.format = GST_FORMAT_TIME;
209
+ gst_event_unref (event);
210
+ event = gst_event_new_segment (&segment);
211
+ }
212
+ }
200
213
return gst_pad_event_default (mfxpad->pad , (GstObject*)plugin, event);
201
214
}
202
215
@@ -219,6 +232,23 @@ GstFlowReturn mfx_gst_vdec_chain(mfx_GstPad *mfxpad, mfx_GstPlugin *plugin, GstB
219
232
return GST_FLOW_ERROR;
220
233
}
221
234
235
+ if (GST_BUFFER_DTS (buffer) == GST_CLOCK_TIME_NONE &&
236
+ GST_BUFFER_PTS (buffer) == GST_CLOCK_TIME_NONE) {
237
+ GstClock *clock = gst_element_get_clock (&plugin->element );
238
+ if (clock ) {
239
+ GstClockTime base_time =
240
+ gst_element_get_base_time (&plugin->element );
241
+ GstClockTime now = gst_clock_get_time (clock );
242
+ if (now > base_time)
243
+ now -= base_time;
244
+ else
245
+ now = 0 ;
246
+ gst_object_unref (clock );
247
+
248
+ GST_BUFFER_PTS (buffer) = now;
249
+ GST_BUFFER_DTS (buffer) = now;
250
+ }
251
+ }
222
252
mfxGstPluginVdecData* vdec = (mfxGstPluginVdecData*)plugin->data ;
223
253
224
254
std::shared_ptr<mfxGstPluginVdecData::InputData> input_data (new mfxGstPluginVdecData::InputData);
0 commit comments