Composing Caps - Where can I put a code sample?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Composing Caps - Where can I put a code sample?

HaroldJRoth
Any suggestions on where I'd put this code sample?  

For newbies who learn from copy/paste/modify, I think its useful, as it took me a while to figure it out.  (Feel free to correct)

        // Bland caps specification
        //
        LOG_INFO(TAG_GSTREAMER, "Create videoCaps for our input.");
        GstCaps* videoCaps = gst_caps_new_simple("video/x-raw-yuv", "format",
                        GST_TYPE_FOURCC, GST_MAKE_FOURCC('I', '4', '2', '0'), NULL);

        // Idiom for tightening a caps specification.
        //
        LOG_DEBUG(TAG_GSTREAMER, "VideoCaps for our input was: %s \n",
                        gst_caps_to_string(videoCaps));
        GstStructure *cs = gst_caps_get_structure(videoCaps, 0);
        gst_structure_set(cs, "width", G_TYPE_INT, 320, "height", G_TYPE_INT, 240,
                        NULL);
        LOG_DEBUG(TAG_GSTREAMER, "VideoCaps for our input is NOW: %s \n",
                        gst_caps_to_string(videoCaps));


Keywords:

GstCaps
GstStructure
adding properties to existing GstCaps
printing out full caps specification
example