mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
Revert "dshowsrcwrapper: cleanup push buffer callback"
gst-plugins-bad is still frozen for general commits.
This reverts commit 2e4131926f
.
This commit is contained in:
parent
2e4131926f
commit
3063de4e87
4 changed files with 25 additions and 29 deletions
|
@ -94,8 +94,8 @@ static void gst_dshowaudiosrc_reset (GstAudioSrc * asrc);
|
||||||
/* utils */
|
/* utils */
|
||||||
static GstCaps *gst_dshowaudiosrc_getcaps_from_streamcaps (GstDshowAudioSrc *
|
static GstCaps *gst_dshowaudiosrc_getcaps_from_streamcaps (GstDshowAudioSrc *
|
||||||
src, IPin * pin, IAMStreamConfig * streamcaps);
|
src, IPin * pin, IAMStreamConfig * streamcaps);
|
||||||
static gboolean gst_dshowaudiosrc_push_buffer (guint8 * buffer, guint size,
|
static gboolean gst_dshowaudiosrc_push_buffer (byte * buffer, long size,
|
||||||
gpointer src_object, GstClockTime duration);
|
gpointer src_object, UINT64 start, UINT64 stop);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_dshowaudiosrc_init_interfaces (GType type)
|
gst_dshowaudiosrc_init_interfaces (GType type)
|
||||||
|
@ -830,8 +830,8 @@ gst_dshowaudiosrc_getcaps_from_streamcaps (GstDshowAudioSrc * src, IPin * pin,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_dshowaudiosrc_push_buffer (guint8 * buffer, guint size, gpointer src_object,
|
gst_dshowaudiosrc_push_buffer (byte * buffer, long size, gpointer src_object,
|
||||||
GstClockTime duration)
|
UINT64 start, UINT64 stop)
|
||||||
{
|
{
|
||||||
GstDshowAudioSrc *src = GST_DSHOWAUDIOSRC (src_object);
|
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_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);
|
g_mutex_unlock (src->gbarray_lock);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -57,17 +57,17 @@ HRESULT CDshowFakeSink::CheckMediaType (const CMediaType * pmt)
|
||||||
HRESULT CDshowFakeSink::DoRenderSample (IMediaSample * pMediaSample)
|
HRESULT CDshowFakeSink::DoRenderSample (IMediaSample * pMediaSample)
|
||||||
{
|
{
|
||||||
if (pMediaSample && m_callback) {
|
if (pMediaSample && m_callback) {
|
||||||
guint8 *pBuffer = NULL;
|
BYTE *
|
||||||
|
pBuffer = NULL;
|
||||||
|
LONGLONG
|
||||||
|
lStart = 0, lStop = 0;
|
||||||
pMediaSample->GetPointer (&pBuffer);
|
pMediaSample->GetPointer (&pBuffer);
|
||||||
|
long
|
||||||
guint size = pMediaSample->GetActualDataLength ();
|
size = pMediaSample->GetActualDataLength ();
|
||||||
|
|
||||||
GstClockTimeDiff lStart = 0;
|
|
||||||
GstClockTimeDiff lStop = 0;
|
|
||||||
pMediaSample->GetTime (&lStart, &lStop);
|
pMediaSample->GetTime (&lStart, &lStop);
|
||||||
|
lStart *= 100;
|
||||||
GstClockTime duration = (lStop - lStart) * 100;
|
lStop *= 100;
|
||||||
m_callback (pBuffer, size, m_data, duration);
|
m_callback (pBuffer, size, m_data, lStart, lStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -30,8 +30,8 @@ static const GUID CLSID_DshowFakeSink =
|
||||||
0x73}
|
0x73}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef bool (*push_buffer_func) (guint8 * buffer, guint size, gpointer src_object,
|
typedef bool (*push_buffer_func) (byte * buffer, long size, gpointer src_object,
|
||||||
GstClockTime duration);
|
UINT64 start, UINT64 stop);
|
||||||
|
|
||||||
class CDshowFakeSink:public CBaseRenderer
|
class CDshowFakeSink:public CBaseRenderer
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,8 +101,8 @@ static GstCaps *gst_dshowvideosrc_getcaps_from_streamcaps (GstDshowVideoSrc *
|
||||||
src, IPin * pin);
|
src, IPin * pin);
|
||||||
static GstCaps *gst_dshowvideosrc_getcaps_from_enum_mediatypes (GstDshowVideoSrc *
|
static GstCaps *gst_dshowvideosrc_getcaps_from_enum_mediatypes (GstDshowVideoSrc *
|
||||||
src, IPin * pin);
|
src, IPin * pin);
|
||||||
static gboolean gst_dshowvideosrc_push_buffer (guint8 * buffer, guint size,
|
static gboolean gst_dshowvideosrc_push_buffer (byte * buffer, long size,
|
||||||
gpointer src_object, GstClockTime duration);
|
gpointer src_object, UINT64 start, UINT64 stop);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_dshowvideosrc_init_interfaces (GType type)
|
gst_dshowvideosrc_init_interfaces (GType type)
|
||||||
|
@ -1005,11 +1005,11 @@ gst_dshowvideosrc_getcaps_from_enum_mediatypes (GstDshowVideoSrc * src, IPin * p
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_dshowvideosrc_push_buffer (guint8 * buffer, guint size, gpointer src_object,
|
gst_dshowvideosrc_push_buffer (byte * buffer, long size, gpointer src_object,
|
||||||
GstClockTime duration)
|
UINT64 start, UINT64 stop)
|
||||||
{
|
{
|
||||||
GstDshowVideoSrc *src = GST_DSHOWVIDEOSRC (src_object);
|
GstDshowVideoSrc *src = GST_DSHOWVIDEOSRC (src_object);
|
||||||
GstBuffer *buf = NULL;
|
GstBuffer *buf;
|
||||||
IPin *pPin = NULL;
|
IPin *pPin = NULL;
|
||||||
HRESULT hres = S_FALSE;
|
HRESULT hres = S_FALSE;
|
||||||
AM_MEDIA_TYPE *pMediaType = NULL;
|
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);
|
buf = gst_buffer_new_and_alloc (size);
|
||||||
|
|
||||||
GST_BUFFER_SIZE (buf) = size;
|
GST_BUFFER_SIZE (buf) = size;
|
||||||
|
GST_BUFFER_TIMESTAMP (buf) = gst_clock_get_time (GST_ELEMENT (src)->clock);
|
||||||
GstClock *clock = gst_element_get_clock (GST_ELEMENT (src));
|
GST_BUFFER_TIMESTAMP (buf) -= GST_ELEMENT (src)->base_time;
|
||||||
GST_BUFFER_TIMESTAMP (buf) =
|
GST_BUFFER_DURATION (buf) = stop - start;
|
||||||
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;
|
|
||||||
|
|
||||||
if (src->is_rgb) {
|
if (src->is_rgb) {
|
||||||
/* FOR RGB directshow decoder will return bottom-up BITMAP
|
/* 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_DEBUG ("push_buffer => pts %" GST_TIME_FORMAT "duration %"
|
||||||
GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
|
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 */
|
/* the negotiate() method already set caps on the source pad */
|
||||||
gst_buffer_set_caps (buf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
|
gst_buffer_set_caps (buf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
|
||||||
|
|
Loading…
Reference in a new issue