Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Building video player using Qt and gstreamer at the backend
Forum Updated to NodeBB v4.3 + New Features

Building video player using Qt and gstreamer at the backend

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 5.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    XMAN
    wrote on last edited by
    #1

    hi! i am unable to display the gstreamer video window at central window of the dock window

    this my code

    videowindow.cpp

    @videoWindow::videoWindow(QWidget *parent) :
    QWidget(parent)
    {
    gst_init(NULL,NULL);

    pipeline=gst_pipeline_new("my_pipeline");
    bin=gst_bin_new("my_bin");
    src=gst_element_factory_make("v4l2src","source");
    sink=gst_element_factory_make("xvimagesink",NULL);
    QLabel *label=new QLabel;
    
    
    
    /*First add the elements to the bin */
      gst_bin_add_many(GST_BIN(bin),src,sink,NULL);
      /* add  bin to the pipeline*/
       gst_bin_add(GST_BIN(pipeline),bin);
        /*link the elemnets */
       gst_element_link(src,sink);
    
       gst_element_set_state(sink,GST_STATE_READY);
       QApplication::syncX();
       //GstXOverlayClass::gst_x_overlay_set_window_handle(GST_X_OVERLAY(sink),window.winId());
       gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(sink),label->winId());
       //run the pipeline
    
       GstStateChangeReturn sret=gst_element_set_state(pipeline,GST_STATE_PLAYING);
       if(sret==GST_STATE_CHANGE_FAILURE)
       {
           gst_element_set_state(pipeline,GST_STATE_NULL);
           gst_object_unref(pipeline);
           //Exit application
         //  QTimer::singleShot(0,QApplication::activeWindow(),SLOT(quit()));
       }
      // label->hide();
    

    }
    videoWindow::~videoWindow()
    {
    gst_element_set_state(pipeline,GST_STATE_NULL);
    gst_object_unref(pipeline);

    }@

    mainwindow.cpp

    @MainWindow::MainWindow()
    {
    //textEdit= new QTextEdit;
    videoWindow *videowindow=new videoWindow;
    setCentralWidget(videowindow);

    createActions();
    createMenus();
    createToolBars();
    createStatusBar();
    createDockWindows();
    
    setWindowTitle(tr("Dock Widgets"));
    

    }

    void MainWindow::newLetter()
    {
    }

    void MainWindow::print()
    {

    }

    void MainWindow::save()
    {

    }

    void MainWindow::undo()
    {

    void MainWindow::about()
    {

    }

    void MainWindow::createActions()
    {

    }

    void MainWindow::createMenus()
    {

    }

    void MainWindow::createToolBars()
    {
    fileToolBar = addToolBar(tr("File"));
    fileToolBar->addAction(newLetterAct);
    fileToolBar->addAction(saveAct);
    fileToolBar->addAction(printAct);

    editToolBar = addToolBar(tr("Edit"));
    editToolBar->addAction(undoAct);
    

    }

    void MainWindow::createStatusBar()
    {
    statusBar()->showMessage(tr("Ready"));
    }

    void MainWindow::createDockWindows()
    {
    QDockWidget *dock = new QDockWidget(tr("Thumbnails"), this);
    QMainWindow::setCorner(Qt::BottomRightCorner,Qt::RightDockWidgetArea);
    dock->setAllowedAreas(Qt::BottomDockWidgetArea);

    QString myDir="/home/sayantan/Qt_project/images";
        QFileSystemModel *model = new QFileSystemModel;
        model->setRootPath(myDir);
        QListView *Thumbnails = new QListView(dock);
        Thumbnails->setMaximumSize(800,200);
        Thumbnails->setModel(model);
        Thumbnails->setRootIndex(model->index(myDir));
    
    dock->setWidget(Thumbnails);
    addDockWidget(Qt::RightDockWidgetArea, dock);
    viewMenu->addAction(dock->toggleViewAction());
    
    dock = new QDockWidget(tr("Paragraphs"), this);
        paragraphsList = new QListWidget(dock);
        paragraphsList->addItems(QStringList()");
        dock->setWidget(paragraphsList);
        addDockWidget(Qt::RightDockWidgetArea, dock);
        viewMenu->addAction(dock->toggleViewAction());
    

    }
    @

    main.cpp

    @int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    MainWindow w;
    w.resize(800,600);
    w.show();

    return app.exec();
    

    }@

    code is compiling and running without any error but it is unable to display any frame..........Please help me

    1 Reply Last reply
    0
    • S Offline
      S Offline
      secretNinja
      wrote on last edited by
      #2

      Would you wrap the code in @ (just before it and right after it), please :)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved