jpegenc a theora playbin2 buffer?

Xabier Rodriguez Calvar calvaris at igalia.com
Mon Sep 19 08:07:59 PDT 2011


O Lun, 19-09-2011 ás 09:38 -0400, Erik Blankinship escribiu:
> I am trying to convert a playbin2 ogv theora buffer to a jpeg encoded
> buffer through an appsrc ! ... ! appsink pipeline.

I'd use the convert-frame element action that you can find with
"gst-inspect playbin2":

"convert-frame" :  GstBuffer user_function (GstElement* object,
                                              GstCaps* arg0);

It gives you the current frame with the caps you need. For jpeg it would
be something like:

{
  GstBuffer *buffer = NULL;
  GstCaps *caps;

  caps = gst_caps_new_simple ("image/jpeg",
                              "bpp", G_TYPE_INT, 24, "depth",
G_TYPE_INT, 24,
                              "pixel-aspect-ratio", GST_TYPE_FRACTION,
1, 1,
                              "endianness", G_TYPE_INT, G_BIG_ENDIAN,
                              "red_mask", G_TYPE_INT, 0xff0000,
                              "green_mask", G_TYPE_INT, 0x00ff00,
                              "blue_mask", G_TYPE_INT, 0x0000ff,
                              NULL);

  g_signal_emit_by_name (pipeline, "convert-frame", caps, &buffer);
  
  gst_caps_unref (caps);

  if (buffer) {
    GstStructure *structure;
    gint width, height;

    caps = GST_BUFFER_CAPS (buffer);
    structure = gst_caps_get_structure (caps, 0);

    gst_structure_get_int (structure, "width", &width);
    gst_structure_get_int (structure, "height", &height);

    /* Load the pixbuf */

    gst_buffer_unref(buffer);
  }

Actually, you wouldn't need create it as jpeg. It would be enough if you
get video/x-raw-rgb and load that as pixbuf. This way you save the jpeg
encoding and decoding.

Best regards.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110919/74fa2d3a/attachment.pgp>


More information about the gstreamer-devel mailing list