Dynamic Digital Zoom - videocrop - videoscale

tnewman newmantye at gmail.com
Tue Mar 10 14:26:08 PDT 2015


Hi Arjen,

So I am a firm believer in baby steps so I have modified the code to the
following:

void cb_blocked (GstPad *pad, gboolean blocked, gpointer user_data)
{
    if (blocked)
    {
        //GstPad     *peer = gst_pad_get_peer (pad);
        //gst_pad_unlink (pad, peer);
        //event = gst_event_new_eos();
        //gst_pad_send_event (peer, event);

        g_print("[VideoCrop]\n");
        g_print("\tTop:%d\n",    g_gst_VideoCropDims.topOffset);
        g_print("\tLeft:%d\n",   g_gst_VideoCropDims.leftOffset);
        g_print("\tBottom:%d\n", g_gst_VideoCropDims.bottomOffset);
        g_print("\tRight:%d\n",  g_gst_VideoCropDims.rightOffset);

        g_object_set (G_OBJECT (g_gst_Pipeline.videocrop), "top",   
g_gst_VideoCropDims.topOffset,
                                                           "left",  
g_gst_VideoCropDims.bottomOffset,
                                                           "bottom",
g_gst_VideoCropDims.leftOffset,
                                                           "right", 
g_gst_VideoCropDims.rightOffset,
                                                           NULL);

        gst_pad_set_blocked_async (pad, FALSE, G_CALLBACK(cb_blocked),
NULL);

        //gst_object_unref (peer);
    }
    else /* Unblock is finished */
    {
        asm("nop;");  // just for a break point opportunity
    }
}

void gst_SetZoomLevel(gchar zoomStep)
{
    gfloat zoomFactor = (float)((float)1-(0.0555*(float)zoomStep));

    gshort newWidth  = (gshort)(INCOMING_VIDEO_WIDTH) * zoomFactor;
    gshort newHeight = (gshort)(INCOMING_VIDEO_HEIGHT) * zoomFactor;

    g_gst_VideoCropDims.topOffset = g_gst_VideoCropDims.bottomOffset =
(INCOMING_VIDEO_WIDTH - newWidth)/2;
    g_gst_VideoCropDims.leftOffset = g_gst_VideoCropDims.rightOffset =
(INCOMING_VIDEO_HEIGHT - newHeight)/2;

    //ZoomChangeRequested = true;
    //gst_element_set_state (g_gst_Pipeline.pipeline, GST_STATE_PAUSED);

    g_gst_Pipeline.blockingPad = gst_element_get_static_pad
(g_gst_Pipeline.source, "src");
    gst_pad_set_blocked_async(g_gst_Pipeline.blockingPad, TRUE,
G_CALLBACK(cb_blocked), g_gst_Pipeline.pipeline);

}

The grand assumption is that I did things right.  Presumably not.

The callback function is called, twice in fact; once for the blocked
condition and once for the released condition.

The issue is that I am still getting the error whereby the source states if
is having a internal data flow error.

So, I know that I have not done exactly as you have stated but I wanted to
ensure that I am implementing the blocking routines as you would have
excepted.

I must warn you that I am a newcomer to gstreamer so some of these concepts
are still new.  Can you please tell me if I have implemented your thoughts
correctly and perhaps provide some sample source for the remainder of the
implementation as you have described.

Thanks again for the quick response!



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Dynamic-Digital-Zoom-videocrop-videoscale-tp4671073p4671079.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list