我目前正在尝试与GSteamer循环播放视频。我目前有这样实现:
void VPlayer::playFile(QString video_filename, bool loop)
{
m_isLooping = loop;
QString cmdstr = "gst-launch-1.0 -v filesrc location=" + video_filename + " ! qtdemux ! queue max-size-buffers=0 max-size-time=0 ! vpudec frame-drop=0 ! queue ! imxv4l2sink device=/dev/video16";
GError **l_error = NULL;;
m_gst_pipeline = gst_parse_launch (cmdstr.toUtf8().data(), l_error);
m_gst_bus = gst_pipeline_get_bus (GST_PIPELINE(m_gst_pipeline));
gst_bus_set_sync_handler (m_gst_bus, GStreamerBusCallback, this, nullptr);
gst_object_ref (m_gst_bus);
gst_object_ref(m_gst_pipeline);
gst_element_set_state (m_gst_pipeline, GST_STATE_NULL);
gst_element_seek_simple (m_gst_pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, 0);
gst_element_set_state (m_gst_pipeline, GST_STATE_PLAYING);
}
GstBusSyncReply VPlayer::GStreamerBusCallback(GstBus *bus, GstMessage *msg, gpointer data)
{
VPlayer* player = (VPlayer*) data;
GstElement *pipeline = player->getPipeline();
switch (GST_MESSAGE_TYPE(msg))
{
case GST_MESSAGE_EOS:
/* restart playback if at end */
qDebug() << "PLAYBACK FINISHED";
if(player->isLooping())
{
qDebug() << "LOOPING";
gst_element_seek_simple (pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, 0);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
}
break;
default:
break;
}
return GST_BUS_PASS;
}
当我运行此示例时,我得到了预期的EOS,调试输出也可以,但是没有寻找图像冻结的情况,没有任何反应。而且循环似乎没有继续。
我在这里想念什么?
答案 0 :(得分:0)
至少需要解决此问题:
$sql = "INSERT INTO visitors (visitor_id,visitor_name,gender,address,phone,date,contact_person,reason,photo,time_in)
VALUES (".$visitor_id.",'".$visitor_name."','".$gender."','".$address."',".$phone.",'".$date."','".$contact_person."','".$reason."','".$fileName."','".$time_in."')";
if ($conn->query($sql) === TRUE) {
//echo "New record created successfully";
echo "<script>alert('Record inserted')</script>;";
include('visitor.php');
} else {
echo "<script>alert('Record cannot be inserted')</script>;";
include('visitor.php');
}
我假设您在某处致电GError *l_error = NULL;
m_gst_pipeline = gst_parse_launch (cmdstr.toUtf8().data(), &l_error);
。