Hello all
a question about gstreamermm: I am trying to convert an old project of
mine to the current version of gtkmm and gstreamermm. And there is one
particular problem that I can not solve. 
I have a piece of code that extracts a thumbnail picture from a video,
in order to give an idea of what the video is about. What I used to do
in the old code was:
Save_Frame_To_Jpeg(){Glib::RefPtr<Gst::Caps>             image_caps;Gli
b::RefPtr<Gst::Buffer>  image_buf;Glib::RefPtr<Gdk::Pixbuf>     
pix_buf;  /////////////////////////////////////////////////
image_caps = Gst::Caps::create_simple("video/x-raw-rgb");
image_caps->set_simple("endianness", G_BIG_ENDIAN);image_caps-
>set_simple("bpp", 24);image_caps->set_simple("depth", 24);image_caps-
>set_simple("red_mask", 0xff0000);image_caps->set_simple("green_mask",
0x00ff00);image_caps->set_simple("blue_mask", 0x0000ff);
//  get the Gst::Buffer of the current frame of the video image_buf =
m_play_bin->convert_frame (image_caps);
image_buf->get_caps()->get_structure(0).get_field("width", w)
;image_buf->get_caps()->get_structure(0).get_field("height", h) ;
//  convert the Gst::Buffer current frame of the video to a
Gdk::PixBuf  pix_buf       =            Gdk::Pixbuf::create_from_da
ta(                        (const       guint8*) image_buf-
>get_data(),                            Gdk::COLORSPACE_RGB, /*
RGB-colorspace */                               false, /* No alpha-
channel */                              8, /* Bits per RGB-
component */                            w, h, /* Dimensions */  
                    (((3 * w)+3)&~3) /* Number of bytes between lines
(ie stride) */                  //,Gdk::Pixbuf::SlotDestroyData(&
UnRef_Pixbuf)                           );
…}
how can I do this today, with the current gstreamermm?  I have tried
things like
Save_Frame_To_Jpeg(){Glib::RefPtr<Gst::Caps>             image_caps;Gli
b::RefPtr<Gst::Sample>    image_buf;Glib::RefPtr<Gdk::Pixbuf>     
pix_buf;/////////////////////////////////////////////////
...image_buf = m_play_bin->convert_sample (image_caps);
m_play_bin→get_video_pad(0)→get_current_caps()-
>get_structure(0).get_field("width", w) ;m_play_bin->get_video_pad(0)-
>get_current_caps()->get_structure(0).get_field("height", h) ;
pix_buf =               Gdk::Pixbuf::create_from_data(          
(const guint8*) image_buf->get_buffer()->get_all_memory(),              
                Gdk::COLORSPACE_RGB, /* RGB-colorspace */
                false, /* No alpha-channel */                           
8, /* Bits per RGB-component */                         w, h, /*
Dimensions */
                                (((3 * w)+3)&~3) /* Number of bytes
between lines (ie stride) */
                                   ,Gdk::Pixbuf::SlotDestroyData(&UnRef
_Pixbuf)                );
but that does not even compile…
so… can someone tell me what the correct way is of converting one
particular frame of a video to a jpeg?
Regards,Danny.









_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to