gst_element_query_convert return wrong value
雒宗同
luozongtong123 at 163.com
Fri May 15 10:30:43 UTC 2020
hi,
i am trying use gst_element_query_convert() to convert GST_FORMAT_TIME value to GST_FORMAT_BYTES, but i cant not get right value.
firstly, make a pipeline:
mediaInfoPipeline = gst_pipeline_new("mediaInfoPipeline");
mediaInfoDecodebin = gst_element_factory_make("uridecodebin", NULL);
g_assert(mediaInfoDecodebin);
gst_bin_add(GST_BIN(mediaInfoPipeline), mediaInfoDecodebin);
g_signal_connect(mediaInfoDecodebin,
"pad-added",
G_CALLBACK(on_new_pad),
mediaInfoPipeline);
static void
on_new_pad(GstElement *decodebin, GstPad *srcpad, GstElement *pipeline)
{
Q_UNUSED(decodebin);
GstElement *sink = gst_element_factory_make("fakesink", NULL);
g_assert(sink);
gst_bin_add(GST_BIN(pipeline), sink);
GstPad *sinkpad = gst_element_get_static_pad(sink, "sink");
if (!gst_pad_is_linked(sinkpad))
{
if (gst_pad_link(srcpad, sinkpad) != GST_PAD_LINK_OK)
g_error("Failed to link pads!");
}
// TODO: unref all no need pad
gst_object_unref(sinkpad);
}
then,
g_object_set(mediaInfoDecodebin, "uri", "file:///filetomedia.mp4", NULL);
gst_element_set_state(mediaInfoPipeline, GST_STATE_PAUSED);
after ASYNC_DONE,
if (gst_element_query_convert(mediaInfoPipeline,
GST_FORMAT_TIME,
time,
GST_FORMAT_BYTES,
&bytes))
{
return bytes;
}
else
{
return -1;
}
but i got wrong bytes value, the value enev bigger than the whole file bytes.
what should i do?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200515/bfe21f2b/attachment-0001.htm>
More information about the gstreamer-devel
mailing list