×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Jun 2008
    Posts
    59

    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,
    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;
    }

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

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

    Could you try to change bus_callback to non-member function?

    Code:
    static gboolean bus_callback (GstBus *bus, GstMessage *message, gpointer data)
    {
    	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;
    }

  3. #3
    Regular Contributor
    Join Date
    Jun 2008
    Posts
    59

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

    Thank you very very much.

    The change to non-member function worked. How come this was the case? Any idea why?

    Thanks,
    Klen

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

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

    Quote Originally Posted by Klen View Post
    Thank you very very much.

    The change to non-member function worked. How come this was the case? Any idea why?

    Thanks,
    Klen
    Member functions in C++ has first implicit parameter - pointer to the instance of object (a.k.a. this). You should take it into account when dealing with C callbacks as they do not expect to get this.

Similar Threads

  1. Replies: 10
    Last Post: 2009-04-17, 16:49
  2. STLPort namespace issue
    By yickhong in forum Open C/C++
    Replies: 0
    Last Post: 2009-04-09, 08:54
  3. SyncML link problem
    By samuel_ in forum Symbian
    Replies: 4
    Last Post: 2009-03-27, 08:02
  4. Problem MMC+USB Connection
    By Fede81 in forum Symbian
    Replies: 1
    Last Post: 2007-06-14, 06:13
  5. Problem MMC+USB Connection
    By Fede81 in forum General Development Questions
    Replies: 3
    Last Post: 2006-07-19, 15:21

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×