语言

Menu
Sites
Language
Audio Player issue: player_create cause APP crash

Hi,

When I use player_create function to create a audio object, my app was crashed and exit, is there anybody face this issue? how to resolve it?

below is code snipet:

 

typedef struct appdata {
 Evas_Object *win;
 Evas_Object *conform;
 Evas_Object *label;
 player_h player;
 Evas_Object *btn_audio;
 Evas_Object *btn_video;
} appdata_s;

......

static void init_base_player(appdata_s *ad)
{
   
 dlog_print(DLOG_ERROR, LOG_TAG, "init_base_player ");
 int error_code = 0;
 error_code = player_create(&ad->player);
 dlog_print(DLOG_ERROR, LOG_TAG, "player_create");

.....

in log can see the init_base_player, but no player_create found and APP exit here

thanks

响应

4 回复
Alex Ashirov

Hi,

You can take a look at Media app sample delivered with the SDK in order to understand how to use the API. I tried this sample and player_create() works fine on the both device and Emulator. I don’t know reason of your error, but please note that you should call this API when main loop has been already started.

Alex Dem

Hi,
Try to look (and launch) at Tizen Native project->Sample-> Media Sample application.
But at first sight your code looks ok (if incoming structure appdata_s is valid and contains player_h player member).
Alexey.

Trcy

Thanks for all of you, I have resolved this issue, because I have test this in a button call back function, the object info)( data ) parameter didn't pass correctly.

evas_object_smart_callback_add(ad->btn_audio, "clicked", init_base_player,ad->player);  the ad->player should be ad.

the function data parameter should be passed whole struct data ad as parameter, pass only ad->player is wrong, most likely ad->player is can't use as const void* type here, and in function init_base_player, the parameter is appdata_s *ad.

void evas_object_smart_callback_add( Evas_Object * obj, const char * event, Evas_Smart_Cb func, const void * data )

Alex Ashirov

Hi,

If you don’t want to pass whole appdata_s structure to init_base_player() function and pass ad->player instead then, as far as I understand, you just need the following:

evas_object_smart_callback_add(ad->btn_audio, "clicked", init_base_player,  &(ad->player));

and:

static void init_base_player(player_h *player)
{
 int error_code = 0;
 error_code = player_create(player);

instead of

error_code = player_create(&ad->player);