/* utils */
static GstCaps *gst_dshowaudiosrc_getcaps_from_streamcaps (GstDshowAudioSrc *
src, IPin * pin, IAMStreamConfig * streamcaps);
-static gboolean gst_dshowaudiosrc_push_buffer (guint8 * buffer, guint size,
- gpointer src_object, GstClockTime duration);
+static gboolean gst_dshowaudiosrc_push_buffer (byte * buffer, long size,
+ gpointer src_object, UINT64 start, UINT64 stop);
static void
gst_dshowaudiosrc_init_interfaces (GType type)
}
static gboolean
-gst_dshowaudiosrc_push_buffer (guint8 * buffer, guint size, gpointer src_object,
- GstClockTime duration)
+gst_dshowaudiosrc_push_buffer (byte * buffer, long size, gpointer src_object,
+ UINT64 start, UINT64 stop)
{
GstDshowAudioSrc *src = GST_DSHOWAUDIOSRC (src_object);
}
g_mutex_lock (src->gbarray_lock);
- g_byte_array_prepend (src->gbarray, buffer, size);
+ g_byte_array_prepend (src->gbarray, (guint8 *) buffer, size);
g_mutex_unlock (src->gbarray_lock);
return TRUE;
HRESULT CDshowFakeSink::DoRenderSample (IMediaSample * pMediaSample)
{
if (pMediaSample && m_callback) {
- guint8 *pBuffer = NULL;
+ BYTE *
+ pBuffer = NULL;
+ LONGLONG
+ lStart = 0, lStop = 0;
pMediaSample->GetPointer (&pBuffer);
-
- guint size = pMediaSample->GetActualDataLength ();
-
- GstClockTimeDiff lStart = 0;
- GstClockTimeDiff lStop = 0;
+ long
+ size = pMediaSample->GetActualDataLength ();
pMediaSample->GetTime (&lStart, &lStop);
-
- GstClockTime duration = (lStop - lStart) * 100;
- m_callback (pBuffer, size, m_data, duration);
+ lStart *= 100;
+ lStop *= 100;
+ m_callback (pBuffer, size, m_data, lStart, lStop);
}
return S_OK;
0x73}
};
-typedef bool (*push_buffer_func) (guint8 * buffer, guint size, gpointer src_object,
- GstClockTime duration);
+typedef bool (*push_buffer_func) (byte * buffer, long size, gpointer src_object,
+ UINT64 start, UINT64 stop);
class CDshowFakeSink:public CBaseRenderer
{
src, IPin * pin);
static GstCaps *gst_dshowvideosrc_getcaps_from_enum_mediatypes (GstDshowVideoSrc *
src, IPin * pin);
-static gboolean gst_dshowvideosrc_push_buffer (guint8 * buffer, guint size,
- gpointer src_object, GstClockTime duration);
+static gboolean gst_dshowvideosrc_push_buffer (byte * buffer, long size,
+ gpointer src_object, UINT64 start, UINT64 stop);
static void
gst_dshowvideosrc_init_interfaces (GType type)
}
static gboolean
-gst_dshowvideosrc_push_buffer (guint8 * buffer, guint size, gpointer src_object,
- GstClockTime duration)
+gst_dshowvideosrc_push_buffer (byte * buffer, long size, gpointer src_object,
+ UINT64 start, UINT64 stop)
{
GstDshowVideoSrc *src = GST_DSHOWVIDEOSRC (src_object);
- GstBuffer *buf = NULL;
+ GstBuffer *buf;
IPin *pPin = NULL;
HRESULT hres = S_FALSE;
AM_MEDIA_TYPE *pMediaType = NULL;
buf = gst_buffer_new_and_alloc (size);
GST_BUFFER_SIZE (buf) = size;
-
- GstClock *clock = gst_element_get_clock (GST_ELEMENT (src));
- GST_BUFFER_TIMESTAMP (buf) =
- GST_CLOCK_DIFF (gst_element_get_base_time (GST_ELEMENT (src)), gst_clock_get_time (clock));
- gst_object_unref (clock);
-
- GST_BUFFER_DURATION (buf) = duration;
+ GST_BUFFER_TIMESTAMP (buf) = gst_clock_get_time (GST_ELEMENT (src)->clock);
+ GST_BUFFER_TIMESTAMP (buf) -= GST_ELEMENT (src)->base_time;
+ GST_BUFFER_DURATION (buf) = stop - start;
if (src->is_rgb) {
/* FOR RGB directshow decoder will return bottom-up BITMAP
GST_DEBUG ("push_buffer => pts %" GST_TIME_FORMAT "duration %"
GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (duration));
+ GST_TIME_ARGS (stop - start));
/* the negotiate() method already set caps on the source pad */
gst_buffer_set_caps (buf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));