Implement element query fix convert bug
Original commit message from CVS: Implement element query fix convert bug
This commit is contained in:
parent
8d31a56e73
commit
efab9f1420
@ -55,7 +55,9 @@ static GstClockTime gst_osssink_get_time (GstClock *clock, gpointer data);
|
|||||||
|
|
||||||
static gboolean gst_osssink_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
|
static gboolean gst_osssink_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
|
||||||
GstFormat *dest_format, gint64 *dest_value);
|
GstFormat *dest_format, gint64 *dest_value);
|
||||||
static gboolean gst_osssink_query (GstPad *pad, GstPadQueryType type,
|
static gboolean gst_osssink_query (GstElement *element, GstPadQueryType type,
|
||||||
|
GstFormat *format, gint64 *value);
|
||||||
|
static gboolean gst_osssink_sink_query (GstPad *pad, GstPadQueryType type,
|
||||||
GstFormat *format, gint64 *value);
|
GstFormat *format, gint64 *value);
|
||||||
|
|
||||||
static GstPadConnectReturn gst_osssink_sinkconnect (GstPad *pad, GstCaps *caps);
|
static GstPadConnectReturn gst_osssink_sinkconnect (GstPad *pad, GstCaps *caps);
|
||||||
@ -225,6 +227,7 @@ gst_osssink_class_init (GstOssSinkClass *klass)
|
|||||||
gobject_class->finalize = gst_osssink_finalize;
|
gobject_class->finalize = gst_osssink_finalize;
|
||||||
|
|
||||||
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_osssink_change_state);
|
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_osssink_change_state);
|
||||||
|
gstelement_class->query = GST_DEBUG_FUNCPTR (gst_osssink_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -236,7 +239,7 @@ gst_osssink_init (GstOssSink *osssink)
|
|||||||
gst_pad_set_connect_function (osssink->sinkpad, gst_osssink_sinkconnect);
|
gst_pad_set_connect_function (osssink->sinkpad, gst_osssink_sinkconnect);
|
||||||
gst_pad_set_bufferpool_function (osssink->sinkpad, gst_osssink_get_bufferpool);
|
gst_pad_set_bufferpool_function (osssink->sinkpad, gst_osssink_get_bufferpool);
|
||||||
gst_pad_set_convert_function (osssink->sinkpad, gst_osssink_convert);
|
gst_pad_set_convert_function (osssink->sinkpad, gst_osssink_convert);
|
||||||
gst_pad_set_query_function (osssink->sinkpad, gst_osssink_query);
|
gst_pad_set_query_function (osssink->sinkpad, gst_osssink_sink_query);
|
||||||
|
|
||||||
gst_pad_set_chain_function (osssink->sinkpad, gst_osssink_chain);
|
gst_pad_set_chain_function (osssink->sinkpad, gst_osssink_chain);
|
||||||
|
|
||||||
@ -610,7 +613,7 @@ gst_osssink_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
|
|||||||
*dest_value = src_value * osssink->bps / GST_SECOND;
|
*dest_value = src_value * osssink->bps / GST_SECOND;
|
||||||
break;
|
break;
|
||||||
case GST_FORMAT_UNITS:
|
case GST_FORMAT_UNITS:
|
||||||
*dest_value = osssink->frequency;
|
*dest_value = src_value * osssink->frequency / GST_SECOND;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
@ -638,7 +641,7 @@ gst_osssink_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_osssink_query (GstPad *pad, GstPadQueryType type, GstFormat *format, gint64 *value)
|
gst_osssink_sink_query (GstPad *pad, GstPadQueryType type, GstFormat *format, gint64 *value)
|
||||||
{
|
{
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
GstOssSink *osssink;
|
GstOssSink *osssink;
|
||||||
@ -654,14 +657,30 @@ gst_osssink_query (GstPad *pad, GstPadQueryType type, GstFormat *format, gint64
|
|||||||
res = FALSE;
|
res = FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GST_PAD_QUERY_POSITION:
|
||||||
|
if (!gst_osssink_convert (pad,
|
||||||
|
GST_FORMAT_TIME, gst_clock_get_time (osssink->provided_clock),
|
||||||
|
format, value))
|
||||||
|
{
|
||||||
|
res = FALSE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
res = FALSE;
|
res = gst_pad_query (gst_pad_get_peer (osssink->sinkpad), type, format, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_osssink_query (GstElement *element, GstPadQueryType type, GstFormat *format, gint64 *value)
|
||||||
|
{
|
||||||
|
GstOssSink *osssink = GST_OSSSINK (element);
|
||||||
|
|
||||||
|
return gst_osssink_sink_query (osssink->sinkpad, type, format, value);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_osssink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
gst_osssink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user