Revert "dshowsrcwrapper: cleanup push buffer callback"

gst-plugins-bad is still frozen for general commits.

This reverts commit 2e4131926f.
This commit is contained in:
Jan Schmidt 2009-10-22 14:00:10 +01:00
parent 2e4131926f
commit 3063de4e87
4 changed files with 25 additions and 29 deletions

View file

@ -94,8 +94,8 @@ static void gst_dshowaudiosrc_reset (GstAudioSrc * asrc);
/* 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)
@ -830,8 +830,8 @@ gst_dshowaudiosrc_getcaps_from_streamcaps (GstDshowAudioSrc * src, IPin * pin,
}
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);
@ -840,7 +840,7 @@ gst_dshowaudiosrc_push_buffer (guint8 * buffer, guint size, gpointer 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;

View file

@ -57,17 +57,17 @@ HRESULT CDshowFakeSink::CheckMediaType (const CMediaType * pmt)
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;

View file

@ -30,8 +30,8 @@ static const GUID CLSID_DshowFakeSink =
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
{

View file

@ -101,8 +101,8 @@ static GstCaps *gst_dshowvideosrc_getcaps_from_streamcaps (GstDshowVideoSrc *
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)
@ -1005,11 +1005,11 @@ gst_dshowvideosrc_getcaps_from_enum_mediatypes (GstDshowVideoSrc * src, IPin * p
}
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;
@ -1022,13 +1022,9 @@ gst_dshowvideosrc_push_buffer (guint8 * buffer, guint size, gpointer src_object,
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
@ -1048,7 +1044,7 @@ gst_dshowvideosrc_push_buffer (guint8 * buffer, guint size, gpointer src_object,
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)));