#include #include #include #include #include #define ALP_MTL(str, ...) ALP_TM(TL(0, str, ## __VA_ARGS__)) #define CHECK_RETURN(ret) \ if (ret != ALP_STATUS_OK) \ { \ ALP_MTL("**** Error: %s, file %s line %d", alp_err_get_string(ret, TRUE), __FILE__, __LINE__);\ } typedef struct{ int32_t obj_id; AlpMMPropertyType type; int32_t key; AlpMMPropertyCode code; void *value; int32_t *size; gchar *desc; }Property; void play_back(AlpMMSourceType type, const void* src_url); void get_format(AlpMMSourceID hSource, AlpMediaFileFomatType Format); static void mycallback(const AlpMMSessionEvent *event, void *userdata); gboolean has_audio(); gboolean has_video(); void get_property(Property prop); AlpMMSessionID hSession; void alp_main(int argc, char *argv[]){ ALP_MTL("********** Audio Manager Test Begin ***********"); alp_status_t ret; ret = alp_media_session_create(ALP_MM_SESSION_CLASS_PLAYBACK, &hSession); CHECK_RETURN(ret); play_back(ALP_MM_TYPE_FILE, "/var/opt/alp/bundles/com.access.apps.mmtest/rsc/crazyfrog.3gp"); //alp_media_session_destroy(hSession); ALP_MTL("********** Audio Manager Test End ***********"); } void play_back(AlpMMSourceType type, const void* url){ AlpMMSourceID hSource; AlpMMDestID hDest_Audio; AlpMMDestID hDest_Video; alp_status_t ret; ret = alp_media_session_register_callback(hSession, mycallback, NULL); CHECK_RETURN(ret); ret = alp_media_session_add_source(hSession, type, url, &hSource); CHECK_RETURN(ret); ret = alp_media_session_add_dest(hSession, LCDDEV, &hDest_Video); CHECK_RETURN(ret); ret = alp_media_session_finalize(hSession); CHECK_RETURN(ret); ret = alp_media_session_control(hSession, ALP_MM_SESSION_CTL_RUN); CHECK_RETURN(ret); gboolean bHasAudio = 0; gboolean bHasVideo = 0; AlpMediaFileFomatType iFormat = 0; AlpMMRectangle rRect = {0, 0, 0, 0}; int32_t iSize = 0; int64_t iEndTime = 0; Property propTable[] = { {hSession, ALP_MM_PROPERTY_TYPE_DEFAULT, ALP_MM_SOURCE_FILE_HAS_AUDIO, ALP_MM_PROPERTY_CODE_BOOL, (void*)&bHasAudio, &iSize, "has audio?"}, {hSession, ALP_MM_PROPERTY_TYPE_DEFAULT, ALP_MM_SOURCE_FILE_HAS_VIDEO, ALP_MM_PROPERTY_CODE_BOOL, (void*)&bHasVideo, &iSize, "has video?"}, {hSource, ALP_MM_PROPERTY_TYPE_DEFAULT, ALP_MM_SOURCE_FILE_FORMAT, ALP_MM_PROPERTY_CODE_INT32, (void*)&iFormat, &iSize, "file format?"}, //faild!!?? {hDest_Video, ALP_MM_PROPERTY_TYPE_DEFAULT, ALP_MM_SESSION_DEST_RECT, ALP_MM_PROPERTY_CODE_STRING, (void*)&rRect, &iSize, "rect?"}, {hSession, ALP_MM_PROPERTY_TYPE_DEFAULT, ALP_MM_SESSION_END_TIME, ALP_MM_PROPERTY_CODE_INT64, (void*)&iEndTime, &iSize, "endtime?"} //faild!!?? }; unsigned int i = 0; for (i=0; ievent_cause, event->position, event->duration); switch (event->event_code) { case ALP_MM_SESSION_EVENT_STATE_CHANGED:{ ALP_MTL("state changed"); break; } case ALP_MM_SESSION_EVENT_WARNING:{ ALP_MTL("warning"); break; } case ALP_MM_SESSION_EVENT_ERROR:{ ALP_MTL("error"); break; } case ALP_MM_SESSION_EVENT_CURRENT_TIME:{ ALP_MTL("current time"); break; } case ALP_MM_SESSION_EVENT_DELETING:{ ALP_MTL("deleting"); break; } case ALP_MM_SESSION_EVENT_CUSTOM_BASE:{ ALP_MTL("custom base"); break; } } } ======================== OUTPUT =================== ~ # root: ********** Audio Manager Test Begin *********** root: -----------begin init gstreamer library------ root: pSessionID :135534368 root: outSession : 135534368 root: ALP_DEBUG: successed make element type:filesrc, name:file_src root: ALP_DEBUG: successed make element type:fbsink, name:videosink root: MM_INFO:begin autoplug root: ALP_DEBUG: successed make element type:pipeline, name:pipeline root: ALP_DEBUG: successed make element type:typefind, name:typefind root: MM_INFO:Setting pipeline to PAUSED ... root: INFO:try to link element :typefind 's pad root: try to find compatible element for type:application/x-3gp root: find compatible elememt:qtdemux root: INFO:trying to process qtdemux root: ALP_DEBUG: successed make element type:qtdemux, name:qtdemux0 root: INFO:linked element qtdemux0 on pad typefind:src root: INFO:successed add element:qtdemux0 root: MM_INFO:statechange:1 root: MM_INFO:pipeline is PREROLLED... root: INFO:try to link element :qtdemux0 's pad root: try to find compatible element for type:video/x-h263 root: find compatible elememt:oki_h263_dec root: demux video src caps:video/x-h263, width=(int)176, height=(int)144, framerate=(fraction)10/1 root: get rect:width:176, height :144 root: INFO:element qtdemux0 is a demuxr, inserting a queue root: ALP_DEBUG: successed make element type:queue, name:queue0 root: INFO:trying to process oki_h263_dec root: ALP_DEBUG: successed make element type:oki_h263_dec, name:oki_h263_dec0 root: INFO:linked element oki_h263_dec0 on pad queue0:src root: INFO:successed add element:oki_h263_dec0 root: INFO:try to link element :oki_h263_dec0 's pad root: INFO:find a raw src, type:video/x-raw-yuv root: MEDIA_ENGINE:find dest, try to link root: MEDIA_ENGINE:begin link sink root: MEDIA_ENGINE:link pad root: MEDIA_ENGINE:set state root: MEDIA_ENGINE:End link sink root: INFO:try to link element :qtdemux0 's pad root: try to find compatible element for type:audio/AMR root: find compatible elememt:oki_amrnb_dec root: INFO:element qtdemux0 is a demuxr, inserting a queue root: ALP_DEBUG: successed make element type:queue, name:queue1 root: INFO:trying to process oki_amrnb_dec root: ALP_DEBUG: successed make element type:oki_amrnb_dec, name:oki_amrnb_dec0 root: INFO:linked element oki_amrnb_dec0 on pad queue1:src root: INFO:successed add element:oki_amrnb_dec0 root: INFO:try to link element :oki_amrnb_dec0 's pad root: INFO:find a raw src, type:audio/x-raw-int root: caps: video/x-h263, width=(int)176, height=(int)144, framerate=(fraction)10/1 root: oki_amrnb_dec handling tag event root: oki_amrnb_dec handling newsegment event root: (:1667): GStreamer-CRITICAL **: gst_pad_get_parent_element: assertion `GST_IS_PAD (pad)' failed root: (:1667): GStreamer-CRITICAL **: gst_object_unref: assertion `object != NULL' failed root: filesrc-->typefind-->qtdemux-->queue-->oki_amrnb_dec root: |->queue-->oki_h263_dec-->fbsink root: MM_INFO:auto plug successed root: MEDIA_ENGINE:pipeline state is pause, begin playing ... root: getting property: has audio? root: getting property: has video? root: getting property: file format? root: getting property: rect? root: getting property: endtime? root: Has Audio: 1 root: Has Video: 1 root: File Format: 0 root: Rect Height: 144 root: Rect width: 176 root: Rect x: 0 root: Rect y: 0 root: End Time: 0 root: ********** Audio Manager Test End *********** root: fbopen:open error root: Cannot open fb device. root: down root: down root: down root: down root: wy:176, wuv:88, hy:144, huv:72, root: ystride:176, uvstride:88, ysize:25344, uvsize:6336