maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Gstreamer "autofocus-done" Problem (photography.h, GstFocusState) (https://talk.maemo.org/showthread.php?t=49258)

klen 2010-04-05 14:47

(SOLVED) Gstreamer "autofocus-done" Problem (photography.h, GstFocusState)
 
Hello,

I am trying to use autofocus functionality of gst/interfaces/photography.h. I manage to activate the autofocus by calling gst_photography_set_autofocus() on my camer source, however, I also want to trace the progress of autofocusing state(i.e running, success, fail, done). I created a GstBus element, added a watch to camera source and expected GstMessage "autofocus-done" in my bus_callback function. On capture of this message, I planned to check if the focusing was successfull or not, by fetching GstFocusState variable, with calling gst_focus_status_get_type().

The problem is that the "autofocus-done" message was never received. The gst_message_type_get_name function always returned string "unknown". I guess I am making a fundamental mistake somewhere as I found clear evidence of support for this feature in "photography.h" file. I was also not successful in calling gst_focus_status_get_type() function to get the focus state.

Any suggestions,

PS: I opened the same thread on Forum Nokia.
Thanks,
Klen

photogrpahy.h
Code:

...
Custom GstMessage name that will be sent to GstBus when autofocusing  is complete */
#define GST_PHOTOGRAPHY_AUTOFOCUS_DONE "autofocus-done"
...


My Code
Code:

gboolean CameraN900::initialize_pipeline(int *argc, char ***argv)
{
        ...
        pipeline = gst_pipeline_new("test-camera");
        bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
        gst_bus_add_watch(bus, (GstBusFunc)bus_callback, camera_src);
        ...
}

gboolean CameraN900::bus_callback (GstMessage * message)
{
        const gchar *message_str;       
       
        message_str = gst_message_type_get_name(GST_MESSAGE_TYPE (message));
        printf("Message: %s\n",message_str);

        GType focusStatus= gst_focus_status_get_type();
        switch(GstFocusStatus (focusStatus)){
                case GST_PHOTOGRAPHY_FOCUS_STATUS_NONE:
                        printf("NONE\n");
                case GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING:
                                printf("RUNNINF\n");
                case GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL:
                                printf("FAILE\n");
                case GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS:
                                printf("SUCCESS\n");
                        break;
                }
        return TRUE;
}


LuisN900 2010-04-08 15:42

Re: Gstreamer "autofocus-done" Problem (photography.h, GstFocusState)
 
żDo you know how to obtain the focal distance to the objetive? or in other case, how can be changed the zone wheres is the autofocus applied? For example, If I want to focus one object in the corner that isn't in the center or isn't the nearest object, how can we do that?

Thanks in advance!

klen 2010-04-12 17:32

Re: Gstreamer "autofocus-done" Problem (photography.h, GstFocusState)
 
Problem solved.

The solution can be found on this Forum Nokia post.

Thx

klen 2010-04-12 17:36

Re: Gstreamer "autofocus-done" Problem (photography.h, GstFocusState)
 
Quote:

Originally Posted by LuisN900 (Post 601124)
żDo you know how to obtain the focal distance to the objetive? or in other case, how can be changed the zone wheres is the autofocus applied? For example, If I want to focus one object in the corner that isn't in the center or isn't the nearest object, how can we do that?

Thanks in advance!

I already commented on that here.

The only way I would know to do it is to implement a manual focus.

Sorry can't offer more help then that at the moment.

Klen


All times are GMT. The time now is 09:28.

vBulletin® Version 3.8.8