VMINT vm_ivr_call(vm_ivr_call_data* data) { VMINT result = 0; srv_ucm_dial_act_req_struct req; memset(&req, 0, sizeof(req)); if (data->sim_card > vm_sim_max_card_count() || data->sim_card < 1) { result = -2; goto error; } if (srv_ucm_query_call_count(SRV_UCM_CALL_STATE_ALL, SRV_UCM_CALL_TYPE_ALL, NULL) > 0) { result = -3; goto error; } if ((vm_res_save_data(VM_RES_TYPE_IVR, data->user_data, 4, (void*)data->callback, vm_pmng_get_current_handle())) < 0) { result = -4; goto error; } req.call_type = 1<< ((data->sim_card-1)*8); kal_wstrncpy(req.num_uri,data->phone_num,SRV_UCM_MAX_NUM_URI_LEN+1); req.module_id = SRV_UCM_MODULE_ORIGIN_COMMON; req.is_ip_dial = 0; req.phb_data = NULL; srv_ucm_act_request(SRV_UCM_DIAL_ACT,&req,NULL,_vm_ivr_call_callback); error: MMI_PRINT(MOD_MRE,TRACE_GROUP_9,"vm_ivr_call %d,%d",result,data->sim_card); return result; }
/***************************************************************************** * FUNCTION * daf_parse_data_info * DESCRIPTION * * PARAMETERS * info_p [?] * input_stream [?] * id3_tag [?] * RETURNS * void *****************************************************************************/ void daf_parse_data_info(aud_info_struct *info_p, audio_input_stream_struct *input_stream, id3_tag_struct *id3_tag) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ kal_int32 data_size; kal_uint32 offset; kal_bool v2_result = KAL_FALSE; kal_bool v1_result = KAL_FALSE; kal_bool daf_parse_result; daf_data_info_struct daf_data_info; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ /* zero all info_p */ memset(info_p, 0, sizeof(aud_info_struct)); /* init id3 tag data structure */ id3_tag_init(id3_tag); audio_input_stream_seek(input_stream, 0); /* * check id3v2 magic word -- "ID3" * and parse & save data to frames */ v2_result = id3_tag_parse_v2_tag(input_stream, id3_tag); /* * parse daf frame to get duration, bitrate, samplerate, channel_num */ if (v2_result) { /* skip id3v2 tag */ offset = id3_tag->v2_size + 10; if (id3_tag->v2_footer) { offset += 10; } } else { offset = 0; } audio_input_stream_seek(input_stream, offset); daf_parse_result = daf_parse(input_stream, &offset, &daf_data_info); /* * parse id3v1 tag */ if ((data_size = audio_input_stream_get_data_size(input_stream)) >= 128) { /* move to last 128 bytes before file end for checking id3v1 tag */ audio_input_stream_seek(input_stream, data_size - 128); /* * check id3v1 magic word -- "TAG" * and parse & save data to frames */ v1_result = id3_tag_parse_v1_tag(input_stream, id3_tag); } else { v1_result = KAL_FALSE; } /* copy title to info_p */ if (id3_tag->frames[ID3_FRAME_TITLE].text != NULL) { kal_wstrncpy( (kal_wchar*) info_p->title, (const kal_wchar*)id3_tag->frames[ID3_FRAME_TITLE].text, MAX_ID3_TITLE_LEN); } /* copy artist to info_p */ if (id3_tag->frames[ID3_FRAME_ARTIST].text != NULL) { kal_wstrncpy( (kal_wchar*) info_p->artist, (const kal_wchar*)id3_tag->frames[ID3_FRAME_ARTIST].text, MAX_ID3_ARTIST_LEN); } /* copy album to info_p */ if (id3_tag->frames[ID3_FRAME_ALBUM].text != NULL) { kal_wstrncpy( (kal_wchar*) info_p->album, (const kal_wchar*)id3_tag->frames[ID3_FRAME_ALBUM].text, MAX_ID3_ALBUM_LEN); } /* copy genre to info_p */ if (id3_tag->frames[ID3_FRAME_GENRE].text != NULL) { kal_wstrncpy( (kal_wchar*) info_p->genre, (const kal_wchar*)id3_tag->frames[ID3_FRAME_GENRE].text, MAX_ID3_GENRE_LEN); } /* copy year to info_p */ if (id3_tag->frames[ID3_FRAME_YEAR].text != NULL) { kal_wstrncpy( (kal_wchar*) info_p->year, (const kal_wchar*)id3_tag->frames[ID3_FRAME_YEAR].text, MAX_ID3_YEAR_LEN); } if (daf_parse_result) { daf_set_data_info( info_p, daf_data_info.channel_num, daf_data_info.duration, data_size, daf_data_info.bitrate, daf_data_info.samplerate); } }
kal_bool get_aud_meta_data_file(kal_wchar *filename, aud_info_struct *aud_info_p) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ kal_uint32 size; FS_HANDLE file; audio_input_stream_struct *input_stream; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if ((file = DRM_open_file(filename, FS_READ_ONLY | FS_OPEN_NO_DIR, DRM_PERMISSION_PLAY)) < 0) { return KAL_FALSE; } input_stream = audio_file_input_stream_alloc(file); size = audio_input_stream_get_data_size(input_stream); /* get id3 tags info */ memset(aud_info_p, 0, sizeof(aud_info_struct)); daf_set_data_info(aud_info_p, 0, 0, size, 0, 0); if (id3_tag_parse(input_stream, &id3_tag)) { /* copy title to info_p */ if (id3_tag.frames[ID3_FRAME_TITLE].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->title, (const kal_wchar*)id3_tag.frames[ID3_FRAME_TITLE].text, MAX_ID3_TITLE_LEN); } /* copy artist to info_p */ if (id3_tag.frames[ID3_FRAME_ARTIST].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->artist, (const kal_wchar*)id3_tag.frames[ID3_FRAME_ARTIST].text, MAX_ID3_ARTIST_LEN); } /* copy album to info_p */ if (id3_tag.frames[ID3_FRAME_ALBUM].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->album, (const kal_wchar*)id3_tag.frames[ID3_FRAME_ALBUM].text, MAX_ID3_ALBUM_LEN); } /* copy genre to info_p */ if (id3_tag.frames[ID3_FRAME_GENRE].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->genre, (const kal_wchar*)id3_tag.frames[ID3_FRAME_GENRE].text, MAX_ID3_GENRE_LEN); } /* copy year to info_p */ if (id3_tag.frames[ID3_FRAME_YEAR].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->year, (const kal_wchar*)id3_tag.frames[ID3_FRAME_YEAR].text, MAX_ID3_YEAR_LEN); } if (id3_tag.frames[ID3_FRAME_COPYRIGHT].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->copyright, (const kal_wchar*)id3_tag.frames[ID3_FRAME_COPYRIGHT].text, MAX_ID3_COPYRIGHT_LEN); } } DRM_close_file(file); audio_input_stream_free(input_stream); return KAL_TRUE; }
kal_bool get_aud_meta_data_array(kal_char *ptr, kal_uint32 size, aud_info_struct *aud_info_p) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ audio_input_stream_struct *input_stream; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ input_stream = audio_byte_input_stream_alloc( (kal_uint8 *)ptr, size); /* get id3 tags info */ memset(aud_info_p, 0, sizeof(aud_info_struct)); daf_set_data_info(aud_info_p, 0, 0, size, 0, 0); if (id3_tag_parse(input_stream, &id3_tag)) { /* copy title to info_p */ if (id3_tag.frames[ID3_FRAME_TITLE].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->title, (const kal_wchar*)id3_tag.frames[ID3_FRAME_TITLE].text, MAX_ID3_TITLE_LEN); } /* copy artist to info_p */ if (id3_tag.frames[ID3_FRAME_ARTIST].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->artist, (const kal_wchar*)id3_tag.frames[ID3_FRAME_ARTIST].text, MAX_ID3_ARTIST_LEN); } /* copy album to info_p */ if (id3_tag.frames[ID3_FRAME_ALBUM].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->album, (const kal_wchar*)id3_tag.frames[ID3_FRAME_ALBUM].text, MAX_ID3_ALBUM_LEN); } /* copy genre to info_p */ if (id3_tag.frames[ID3_FRAME_GENRE].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->genre, (const kal_wchar*)id3_tag.frames[ID3_FRAME_GENRE].text, MAX_ID3_GENRE_LEN); } /* copy year to info_p */ if (id3_tag.frames[ID3_FRAME_YEAR].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->year, (const kal_wchar*)id3_tag.frames[ID3_FRAME_YEAR].text, MAX_ID3_YEAR_LEN); } if (id3_tag.frames[ID3_FRAME_COPYRIGHT].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->copyright, (const kal_wchar*)id3_tag.frames[ID3_FRAME_COPYRIGHT].text, MAX_ID3_COPYRIGHT_LEN); } } audio_input_stream_free(input_stream); return KAL_TRUE; }
/***************************************************************************** * FUNCTION * get_aud_info * DESCRIPTION * * PARAMETERS * filename [?] * aud_info_p [?] * RETURNS * kal_bool *****************************************************************************/ kal_bool get_aud_info(kal_wchar *filename, aud_info_struct *aud_info_p) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ kal_int16 format; kal_uint32 size; FS_HANDLE file; STFSAL fsal_handle; audInfoStruct *aud_info; kal_uint32 channel_num; audio_input_stream_struct *input_stream; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ Media_Status(*get_aud_info_func) (STFSAL * pstFSAL, audInfoStruct * contentInfo, void *param) = NULL; if ((file = DRM_open_file(filename, FS_READ_ONLY | FS_OPEN_NO_DIR, DRM_PERMISSION_PLAY)) < 0) { return KAL_FALSE; } format = med_get_media_type(filename); input_stream = audio_file_input_stream_alloc(file); size = audio_input_stream_get_data_size(input_stream); /* get id3 tags info */ memset(aud_info_p, 0, sizeof(aud_info_struct)); daf_set_data_info(aud_info_p, 0, 0, size, 0, 0); if (id3_tag_parse(input_stream, &id3_tag)) { /* copy title to info_p */ if (id3_tag.frames[ID3_FRAME_TITLE].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->title, (const kal_wchar*)id3_tag.frames[ID3_FRAME_TITLE].text, MAX_ID3_TITLE_LEN); } /* copy artist to info_p */ if (id3_tag.frames[ID3_FRAME_ARTIST].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->artist, (const kal_wchar*)id3_tag.frames[ID3_FRAME_ARTIST].text, MAX_ID3_ARTIST_LEN); } /* copy album to info_p */ if (id3_tag.frames[ID3_FRAME_ALBUM].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->album, (const kal_wchar*)id3_tag.frames[ID3_FRAME_ALBUM].text, MAX_ID3_ALBUM_LEN); } /* copy genre to info_p */ if (id3_tag.frames[ID3_FRAME_GENRE].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->genre, (const kal_wchar*)id3_tag.frames[ID3_FRAME_GENRE].text, MAX_ID3_GENRE_LEN); } /* copy year to info_p */ if (id3_tag.frames[ID3_FRAME_YEAR].text != NULL) { kal_wstrncpy( (kal_wchar*) aud_info_p->year, (const kal_wchar*)id3_tag.frames[ID3_FRAME_YEAR].text, MAX_ID3_YEAR_LEN); } } DRM_close_file(file); switch (format) { #ifdef AU_DECODE case MED_TYPE_AU: get_aud_info_func = AU_GetContentDescInfo; break; #endif /* AU_DECODE */ #ifdef AIFF_DECODE case MED_TYPE_AIFF: get_aud_info_func = AIFF_GetContentDescInfo; break; #endif /* AIFF_DECODE */ case MED_TYPE_WAV: get_aud_info_func = WAV_GetContentDescInfo; break; #ifdef AMR_DECODE case MED_TYPE_AMR: case MED_TYPE_AMR_WB: get_aud_info_func = AMR_GetContentDescInfo; break; #endif /* AMR_DECODE */ #ifdef AAC_DECODE case MED_TYPE_AAC: get_aud_info_func = AAC_GetContentDescInfo; break; case MED_TYPE_M4A: get_aud_info_func = M4A_GetContentDescInfo; break; #endif /* AAC_DECODE */ #ifdef WMA_DECODE case MED_TYPE_WMA: get_aud_info_func = WMA_GetContentDescInfo; break; #endif /* WMA_DECODE */ #if defined(MED_PURE_AUDIO) case MED_TYPE_MP4: case MED_TYPE_3GP: get_aud_info_func = M4A_GetContentDescInfo; break; #endif /* defined(MED_PURE_AUDIO) */ #ifdef DAF_DECODE case MED_TYPE_DAF: #ifdef MUSICAM_DECODE case MED_TYPE_MUSICAM: #endif get_aud_info_func = DAF_GetContentDescInfo; break; #endif /* DAF_DECODE */ case MED_TYPE_PCM_8K: case MED_TYPE_PCM_16K: get_aud_info_func = PCM_GetContentDescInfo; break; case MED_TYPE_GSM_EFR: get_aud_info_func = VM_GetContentDescInfo; break; } if (get_aud_info_func != NULL) { aud_info = (audInfoStruct*) & id3_tag; /* reuse id3_tag memory for aud_info */ if (FSAL_Open(&fsal_handle, filename, FSAL_READ) == FSAL_OK) { if (get_aud_info_func(&fsal_handle, aud_info, (void*)format) == MEDIA_SUCCESS) { #ifdef WMA_DECODE if (format == MED_TYPE_WMA) { kal_wstrncpy( (kal_wchar*) aud_info_p->title, (const kal_wchar*)aud_info->title, MAX_ID3_TITLE_LEN); kal_wstrncpy( (kal_wchar*) aud_info_p->artist, (const kal_wchar*)aud_info->artist, MAX_ID3_ARTIST_LEN); kal_wstrncpy( (kal_wchar*) aud_info_p->album, (const kal_wchar*)aud_info->album, MAX_ID3_ALBUM_LEN); } #endif /* WMA_DECODE */ channel_num = (aud_info->stereo ? 2 : 1); daf_set_data_info( aud_info_p, channel_num, aud_info->time, size, aud_info->bitRate, aud_info->sampleRate); } FSAL_Close(&fsal_handle); } } audio_input_stream_free(input_stream); return KAL_TRUE; }
/***************************************************************************** * FUNCTION * get_aud_info * DESCRIPTION * * IMPACT * * PARAMETERS * kal_wchar* filename * aud_info_struct* aud_info_p * RETURNS * kal_bool * GLOBALS AFFECTED * *****************************************************************************/ kal_bool get_aud_info( kal_wchar* filename, aud_info_struct* aud_info_p ) { kal_int16 format; kal_uint32 size; FS_HANDLE file; #ifdef __AUD_NEW_INTERFACE__ STFSAL fsal_handle; audInfoStruct* aud_info; #endif // __AUD_NEW_INTERFACE__ audio_input_stream_struct* input_stream; mmi_trace(1,"chenhe,get_aud_info"); if( (file = DRM_open_file( (const UINT8 *)filename, FS_READ_ONLY|FS_OPEN_NO_DIR, 0 )) < 0 ) return KAL_FALSE; format = med_get_media_type( filename ); input_stream = audio_file_input_stream_alloc( file ); size = audio_input_stream_get_data_size( input_stream ); memset(aud_info_p, 0, sizeof(aud_info_struct) ); daf_set_data_info( aud_info_p, 0, 0, size, 0, 0 ); mmi_trace(1,"chenhe,get_aud_info,format is %d,size is %p",format,size); if( format == MED_TYPE_DAF ) daf_parse_data_info( aud_info_p, input_stream, &id3_tag ); else { #ifdef AAC_DECODE if( format == MED_TYPE_AAC ) { if( id3_tag_parse( input_stream, &id3_tag ) ) { // copy title to info_p if( id3_tag.frames[ID3_FRAME_TITLE].text != NULL ) kal_wstrncpy( (kal_wchar*)aud_info_p->title, (const kal_wchar*)id3_tag.frames[ID3_FRAME_TITLE].text, MAX_ID3_TITLE_LEN ); // copy artist to info_p if( id3_tag.frames[ID3_FRAME_ARTIST].text != NULL ) kal_wstrncpy( (kal_wchar*)aud_info_p->artist, (const kal_wchar*)id3_tag.frames[ID3_FRAME_ARTIST].text, MAX_ID3_ARTIST_LEN ); // copy album to info_p if( id3_tag.frames[ID3_FRAME_ALBUM].text != NULL ) kal_wstrncpy( (kal_wchar*)aud_info_p->album, (const kal_wchar*)id3_tag.frames[ID3_FRAME_ALBUM].text, MAX_ID3_ALBUM_LEN ); // copy genre to info_p if( id3_tag.frames[ID3_FRAME_GENRE].text != NULL ) kal_wstrncpy( (kal_wchar*)aud_info_p->genre, (const kal_wchar*)id3_tag.frames[ID3_FRAME_GENRE].text, MAX_ID3_GENRE_LEN ); // copy year to info_p if( id3_tag.frames[ID3_FRAME_YEAR].text != NULL ) kal_wstrncpy( (kal_wchar*)aud_info_p->year, (const kal_wchar*)id3_tag.frames[ID3_FRAME_YEAR].text, MAX_ID3_YEAR_LEN ); } } #endif // AAC_DECODE } DRM_close_file( file ); #ifdef __AUD_NEW_INTERFACE__ if( format == MED_TYPE_AAC || format == MED_TYPE_WMA ) { aud_info = (audInfoStruct*) &id3_tag; // reuse id3_tag memory for aud_info if( FSAL_Open( &fsal_handle, filename, FSAL_READ ) == FSAL_OK ) { media_get_info_func_ptr getInfoFunc; switch( format ) { #ifdef AAC_DECODE case MED_TYPE_AAC: getInfoFunc = AAC_GetContentDescInfo; break; #endif // AAC_DECODE #ifdef WMA_DECODE case MED_TYPE_WMA: getInfoFunc = WMA_GetContentDescInfo; break; #endif // WMA_DECODE default: ASSERT(0); break; } if( getInfoFunc( &fsal_handle, aud_info ) == MEDIA_SUCCESS ) { #ifdef WMA_DECODE if( format == MED_TYPE_WMA ) { kal_wstrncpy( (kal_wchar*)aud_info_p->title, (const kal_wchar*)aud_info->title, MAX_ID3_TITLE_LEN ); kal_wstrncpy( (kal_wchar*)aud_info_p->artist, (const kal_wchar*)aud_info->artist, MAX_ID3_ARTIST_LEN ); kal_wstrncpy( (kal_wchar*)aud_info_p->album, (const kal_wchar*)aud_info->album, MAX_ID3_ALBUM_LEN ); } #endif // WMA_DECODE channel_num = (aud_info->stereo ? 2: 1); daf_set_data_info( aud_info_p, channel_num, aud_info->time, size, aud_info->bitRate, aud_info->sampleRate ); } FSAL_Close( &fsal_handle ); } } #endif // __AUD_NEW_INTERFACE__ audio_input_stream_free( input_stream ); return KAL_TRUE; }
/***************************************************************************** * FUNCTION * daf_parse_data_info * DESCRIPTION * * IMPACT * * PARAMETERS * aud_info_struct *info_p * audio_input_stream_struct* input_stream * id3_tag_struct* id3_tag * RETURNS * void * GLOBALS AFFECTED * *****************************************************************************/ void daf_parse_data_info( aud_info_struct *info_p, audio_input_stream_struct* input_stream, id3_tag_struct* lid3_tag ) { kal_int32 data_size; kal_uint32 offset; kal_bool v2_result = KAL_FALSE; kal_bool v1_result = KAL_FALSE; kal_bool daf_parse_result; daf_data_info_struct daf_data_info; // init id3 tag data structure id3_tag_init( lid3_tag ); audio_input_stream_seek( input_stream, 0 ); /* * check id3v2 magic word -- "ID3" * and parse & save data to frames */ v2_result = id3_tag_parse_v2_tag( input_stream, lid3_tag ); mmi_trace(1,"chenhe,daf_parse_data_info,v2_result is %d",v2_result); /* * parse daf frame to get duration, bitrate, samplerate, channel_num */ if( v2_result ) { // skip id3v2 tag offset = lid3_tag->v2_size + 10; if( lid3_tag->v2_footer ) offset += 10; } else offset = 0; audio_input_stream_seek( input_stream, offset ); daf_parse_result = daf_parse( input_stream, &offset, &daf_data_info ); /* * parse id3v1 tag */ if( (data_size = audio_input_stream_get_data_size( input_stream )) >= 128 ) { // move to last 128 bytes before file end for checking id3v1 tag audio_input_stream_seek( input_stream, data_size - 128 ); /* * check id3v1 magic word -- "TAG" * and parse & save data to frames */ v1_result = id3_tag_parse_v1_tag( input_stream, lid3_tag ); } else v1_result = KAL_FALSE; mmi_trace(1,"chenhe,daf_parse_data_info,v1_result is %d",v1_result); // copy title to info_p if( lid3_tag->frames[ID3_FRAME_TITLE].text != NULL ) kal_wstrncpy( (kal_wchar*)info_p->title, (const kal_wchar*)lid3_tag->frames[ID3_FRAME_TITLE].text, MAX_ID3_TITLE_LEN ); // copy artist to info_p if( lid3_tag->frames[ID3_FRAME_ARTIST].text != NULL ) kal_wstrncpy( (kal_wchar*)info_p->artist, (const kal_wchar*)lid3_tag->frames[ID3_FRAME_ARTIST].text, MAX_ID3_ARTIST_LEN ); // copy album to info_p if( lid3_tag->frames[ID3_FRAME_ALBUM].text != NULL ) kal_wstrncpy( (kal_wchar*)info_p->album, (const kal_wchar*)lid3_tag->frames[ID3_FRAME_ALBUM].text, MAX_ID3_ALBUM_LEN ); // copy genre to info_p if( lid3_tag->frames[ID3_FRAME_GENRE].text != NULL ) kal_wstrncpy( (kal_wchar*)info_p->genre, (const kal_wchar*)lid3_tag->frames[ID3_FRAME_GENRE].text, MAX_ID3_GENRE_LEN ); // copy year to info_p if( lid3_tag->frames[ID3_FRAME_YEAR].text != NULL ) kal_wstrncpy( (kal_wchar*)info_p->year, (const kal_wchar*)lid3_tag->frames[ID3_FRAME_YEAR].text, MAX_ID3_YEAR_LEN ); mmi_trace(1,"chenhe,daf_parse_data_info,daf_parse_result is %d",daf_parse_result); if( daf_parse_result ) daf_set_data_info( info_p, daf_data_info.channel_num, daf_data_info.duration, data_size, daf_data_info.bitrate, daf_data_info.samplerate ); }