Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool DtVideoStreamDriver::buildPipeline()
- {
- std::string piplineDescription=myInitializer->findData<std::string>("pipeline");
- GError* error=NULL;
- myPipeline = gst_parse_launch(piplineDescription.c_str(), &error);
- if(error!=NULL)
- {
- DtWarn << "Error: " << error->message << std::endl;
- return false;
- }
- if(myPipeline==NULL)
- {
- DtWarn << "Error creating pipeline" << std::endl;
- return false;
- }
- myAppSrc= gst_bin_get_by_name (GST_BIN(myPipeline), "myAppSrc");
- if(myAppSrc==NULL || !(GST_IS_APP_SRC(myAppSrc)))
- {
- DtWarn << "pipeline description must have an AppSrc element named myAppSrc" << std::endl;
- return false;
- }
- //get the current channels width and height to set the caps on the appsrc
- DtChannel* c=myAgentManager.de().driverManager().inputDriver().currentChannel();
- DtOsgChannel* oc=dynamic_cast<DtOsgChannel*>(c);
- if(!oc)
- {
- DtWarn << "Need an OSG Channel for this to work!" << std::endl;
- return false;
- }
- int x,y;
- oc->getViewport(x,y, myWidth, myHeight);
- GstCaps* caps = gst_caps_new_simple (
- "video/x-raw-rgb",
- "bpp",G_TYPE_INT,24,
- "depth",G_TYPE_INT,24,
- "width", G_TYPE_INT, myWidth,
- "height", G_TYPE_INT, myHeight,
- "red_mask", G_TYPE_INT, 0x000000ff,
- "green_mask", G_TYPE_INT, 0x0000ff00,
- "blue_mask", G_TYPE_INT, 0x00ff0000,
- "framerate", GST_TYPE_FRACTION, 25, 1,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
- NULL);
- gst_app_src_set_caps(GST_APP_SRC(myAppSrc), caps);
- return true;
- }
Add Comment
Please, Sign In to add comment