Ich versuche, einen gstreamer Bash-Skript zu C++ Code, y umcodiert werden, aber ich bin nicht in der Lage de debuggin melden Sie sich in eine Datei speichernGStreamer Debug-Pipeline C++
Dies ist mein Code
int main(int argc, char *argv[])
{
YoctoLinuxSystem* hola;
//hola->YoctoLinuxSystem();
\t CustomData DataTest, DataDvi;
\t GstBus *bus;
\t GstMessage *msg;
\t GstStateChangeReturn ret;
\t GMainLoop *loop; \t
\t
\t //vector<string> lines = YoctoLinuxSystem::getCmdOutputAsLines("./scripts/get_system_temps.sh");
\t
gst_init (&argc, &argv);
\t loop = g_main_loop_new (NULL, FALSE);
\t
\t /******************************/
\t /****AJUSTES GSTREAMER TEST****/
\t /******************************/
\t DataTest.source = gst_element_factory_make ("videotestsrc", "source");
\t DataTest.capsfilter = gst_element_factory_make ("capsfilter","caps");
\t DataTest.sink = gst_element_factory_make ("imxipuvideosink", "sink");
\t
\t DataTest.pipeline = gst_pipeline_new ("test-pipeline");
\t
\t if (!DataTest.pipeline || !DataTest.source || !DataTest.capsfilter || !DataTest.sink) {
\t g_printerr ("Not all elements could be created.\n");
\t return -1;
\t } \t
\t /* Modify the source's properties */
\t g_object_set (DataTest.source, "pattern", 0, NULL);
\t g_object_set(DataTest.capsfilter, "caps", gst_caps_new_simple("video/x-raw", "framerate", GST_TYPE_FRACTION, 25, 1,"width", G_TYPE_INT, 1920, "height", G_TYPE_INT, 1080, "format", G_TYPE_STRING, "RGB", NULL), NULL);
\t
\t /* Build the pipeline */
\t gst_bin_add_many (GST_BIN (DataTest.pipeline), DataTest.source, DataTest.capsfilter, DataTest.sink, NULL);
\t if (gst_element_link (DataTest.source, DataTest.capsfilter) != TRUE) {
\t g_printerr ("Elements source-caps could not be linked.\n");
\t gst_object_unref (DataTest.pipeline);
\t return -1;
\t }
\t if (gst_element_link (DataTest.capsfilter, DataTest.sink) != TRUE) {
\t g_printerr ("Elements caps-sink could not be linked.\n");
\t gst_object_unref (DataTest.pipeline);
\t return -1;
\t }
\t gst_element_link_many (DataTest.source, DataTest.capsfilter, DataTest.sink, NULL);
\t
\t
\t /******************************/
\t /****AJUSTES GSTREAMER DVI****/
\t /******************************/
\t DataDvi.source = gst_element_factory_make ("v4l2src", "source");
\t DataDvi.sink = gst_element_factory_make ("imxipuvideosink", "sink");
\t \t
\t DataDvi.pipeline = gst_pipeline_new ("test-pipeline");
\t \t
\t if (!DataDvi.pipeline || !DataDvi.source || !DataDvi.sink) {
\t \t g_printerr ("Not all elements could be created.\n");
\t \t return -1;
\t } \t
\t \t /* Modify the source's properties */
\t g_object_set (DataDvi.source, "device", "/dev/video0", NULL);
\t \t \t
\t \t /* Build the pipeline */
\t gst_bin_add_many (GST_BIN (DataDvi.pipeline), DataDvi.source, DataDvi.sink, NULL);
\t
\t if (gst_element_link (DataDvi.source, DataDvi.sink) != TRUE) {
\t \t g_printerr ("Elements caps-sink could not be linked.\n");
\t \t gst_object_unref (DataDvi.pipeline);
\t \t return -1;
\t }
\t gst_element_link_many (DataDvi.source, DataDvi.sink, NULL);
\t \t
\t \t
\t GST_DEBUG=2;
\t \t
\t ifstream fileread;
\t // fileread.open("/var/log/data.log");
\t
\t while(1)
\t { \t
\t \t ifstream fileread("/var/log/data.log");
\t \t
\t \t if (!fileread.good())
\t \t {
\t \t /* Start playing */
\t \t //g_print ("Now playing: \n");
\t \t gst_element_set_state (DataDvi.pipeline, GST_STATE_PAUSED);
\t \t ret = gst_element_set_state (DataTest.pipeline, GST_STATE_PLAYING);
\t \t if (ret == GST_STATE_CHANGE_FAILURE) {
\t \t \t g_printerr ("Unable to set the pipeline to the playing state.\n");
\t \t \t gst_object_unref (DataTest.pipeline);
\t \t \t return -1;
\t \t }
\t \t }
\t \t
\t \t else
\t \t {
\t \t \t gst_element_set_state (DataTest.pipeline, GST_STATE_PAUSED);
\t \t \t ret = gst_element_set_state (DataDvi.pipeline, GST_STATE_PLAYING);
/*HERE I NEED TO KNOW THE DEBUG OF THE PIPELINE*/
\t \t \t if (ret == GST_STATE_CHANGE_FAILURE) {
\t \t \t \t g_printerr ("Unable to set the pipeline to the playing state.\n");
\t \t \t \t gst_object_unref (DataDvi.pipeline);
\t \t \t \t return -1;
\t \t \t }
\t \t }
\t }
g_print ("SALE\n");
return 0;
}
Ich benutze gstreamer-1.0-Bibliothek und ich habe gesehen, dass ich GST_DEBUG_FILE verwenden muss, aber ich weiß nicht, wie diese Funktionen von C++ aufrufen.
Danke für die Hilfe!