[gst-devel] Error 'not negotiated' from ffmpegcolorspace.

wl2776 wl2776 at gmail.com
Mon Sep 6 16:54:01 CEST 2010


I am writing a small function, making screenshots, I've wrote about it in my
previous message.
Now, instead of setting pad's caps, I'm trying to use capsfilter.

My function gets the last displayed buffer from the videosink, then builds
the pipeline: 
appsrc -> ffmpegcolorspace -> videoscale -> capsfilter -> encoder ->
filesink

However, my problem in another place. 
After adding some debug messages, I've found that ffmpegcolorspace for some
reason cannot negotiate.
Why? 
What does it want?

My code:

/*  get last-buffer from videosink   */
pipeline=(GstPipeline *)gst_pipeline_new("ipipeline");
bus=gst_pipeline_get_bus(pipeline);
		
appsrc=(GstAppSrc *)gst_element_factory_make("appsrc","appsrc0");
colorconv=gst_element_factory_make("ffmpegcolorspace","colorconv");
videoscale=gst_element_factory_make("videoscale","videoscale");
capsflt=gst_element_factory_make("capsfilter","capsfilter");

if(width && height){
  caps=gst_caps_new_simple("video/x-raw-rgb",
                                        "bpp",G_TYPE_INT,24,
                                        "depth",G_TYPE_INT,24,
                                        "width",G_TYPE_INT,width,
                                        "height",G_TYPE_INT,height,
                                        NULL);
}else{
  caps=gst_caps_new_simple("video/x-raw-rgb",
                                        "bpp",G_TYPE_INT,24,
                                        "depth",G_TYPE_INT,24,
                                        NULL);
}

g_object_set(capsflt,"caps",caps,NULL);
gst_object_unref(caps);

switch(format){
case 1: //jpeg
  enc=gst_element_factory_make("jpegenc","jpeg"); 
  break;
case 2: //bmp
  enc=gst_element_factory_make("ffenc_bmp","bmp"); 
  break;
case 3: //png
  enc=gst_element_factory_make("pngenc","png"); 
  break;
case 4: //tiff
  enc=gst_element_factory_make("ffenc_tiff","tiff"); 
  break;
}

filesink=gst_element_factory_make("filesink","fsink");
g_object_set(filesink,"location",filename,NULL);

gst_bin_add_many(GST_BIN(pipeline),GST_ELEMENT(appsrc),colorconv,videoscale,capsflt,enc,filesink,NULL);
rb=gst_element_link_many(GST_ELEMENT(appsrc),colorconv,videoscale,capsflt,enc,filesink,NULL);

gst_app_src_set_stream_type(appsrc,GST_APP_STREAM_TYPE_STREAM);

GstAppSrcCallbacks callbacks;
callbacks.need_data=need_data;  // this callback pushes the buffer to the
ipipeline and also the eos.
callbacks.enough_data=NULL;
callbacks.seek_data=NULL;
gst_app_src_set_callbacks(appsrc,&callbacks,this,NULL);

if(rb){
  gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
  while(1){  //pop messages from the bus and process them without running
the main loop
    msg=gst_bus_pop(bus);
   //process messages.
  }
}

And I can see in the debug output that colorspace always gives the error
'not negotiated'.
If I leave only appsrc, colorspace and filesink in gst_bin_add_many and
gst_bin_link_many, then I get a file on disk and no errors...
-- 
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Error-not-negotiated-from-ffmpegcolorspace-tp2528483p2528483.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list