winegstreamer: Forward media time on transform filter.

This commit is contained in:
Maarten Lankhorst 2010-11-07 15:02:50 +01:00 committed by Alexandre Julliard
parent 8c42595c34
commit 1577c5a8c3
1 changed files with 12 additions and 0 deletions

View File

@ -166,6 +166,14 @@ static GstFlowReturn got_data(GstPad *pad, GstBuffer *buf) {
} }
else else
IMediaSample_SetTime(sample, NULL, NULL); IMediaSample_SetTime(sample, NULL, NULL);
if (GST_BUFFER_OFFSET_IS_VALID(buf) &&
GST_BUFFER_OFFSET_END_IS_VALID(buf)) {
tStart = buf->offset / 100;
tStop = buf->offset_end / 100;
IMediaSample_SetMediaTime(sample, &tStart, &tStop);
}
else
IMediaSample_SetMediaTime(sample, NULL, NULL);
IMediaSample_SetDiscontinuity(sample, GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_DISCONT)); IMediaSample_SetDiscontinuity(sample, GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_DISCONT));
IMediaSample_SetPreroll(sample, GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_PREROLL)); IMediaSample_SetPreroll(sample, GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_PREROLL));
@ -232,6 +240,10 @@ static HRESULT WINAPI Gstreamer_transform_ProcessData(TransformFilter *iface, IM
if (hr == S_OK) if (hr == S_OK)
buf->duration = (tStop - tStart)*100; buf->duration = (tStop - tStart)*100;
} }
if (IMediaSample_GetMediaTime(sample, &tStart, &tStop) == S_OK) {
buf->offset = tStart * 100;
buf->offset_end = tStop * 100;
}
if (IMediaSample_IsDiscontinuity(sample) == S_OK) if (IMediaSample_IsDiscontinuity(sample) == S_OK)
GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_DISCONT); GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_DISCONT);
if (IMediaSample_IsPreroll(sample) == S_OK) if (IMediaSample_IsPreroll(sample) == S_OK)