rendered paste body#include <stdio.h>#include <alp/errormgr_base.h>#include <alp/traces.h>#include <alp/media_session.h>#include <glib.h>#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; i<sizeof(propTable)/sizeof(propTable[0]); i++) { get_property(propTable[i]); ALP_MTL("getting property: %s", propTable[i].desc); //ALP_MTL("iSize = %d", iSize); } ALP_MTL("Has Audio: %d", bHasAudio); ALP_MTL("Has Video: %d", bHasVideo); ALP_MTL("File Format: %d", iFormat); ALP_MTL("Rect Height: %d", rRect.height); ALP_MTL("Rect width: %d", rRect.width); ALP_MTL("Rect x: %d", rRect.x); ALP_MTL("Rect y: %d", rRect.y); ALP_MTL("End Time: %lli", iEndTime);}void get_property(Property prop){ alp_status_t ret; ret = alp_media_property_get(prop.obj_id, prop.type, prop.key, prop.code, prop.value, prop.size ); CHECK_RETURN(ret);}static void mycallback(const AlpMMSessionEvent *event, void *userdata){ ALP_MTL("eventcause:%d, position:%lli, duration:%lli\n", event->event_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 :135534368root: outSession : 135534368root: ALP_DEBUG: successed make element type:filesrc, name:file_srcroot: ALP_DEBUG: successed make element type:fbsink, name:videosinkroot: MM_INFO:begin autoplugroot: ALP_DEBUG: successed make element type:pipeline, name:pipelineroot: ALP_DEBUG: successed make element type:typefind, name:typefindroot: MM_INFO:Setting pipeline to PAUSED ...root: INFO:try to link element :typefind 's padroot: try to find compatible element for type:application/x-3gproot: find compatible elememt:qtdemuxroot: INFO:trying to process qtdemuxroot: ALP_DEBUG: successed make element type:qtdemux, name:qtdemux0root: INFO:linked element qtdemux0 on pad typefind:srcroot: INFO:successed add element:qtdemux0root: MM_INFO:statechange:1root: MM_INFO:pipeline is PREROLLED...root: INFO:try to link element :qtdemux0 's padroot: try to find compatible element for type:video/x-h263root: find compatible elememt:oki_h263_decroot: demux video src caps:video/x-h263, width=(int)176, height=(int)144, framerate=(fraction)10/1root: get rect:width:176, height :144root: INFO:element qtdemux0 is a demuxr, inserting a queueroot: ALP_DEBUG: successed make element type:queue, name:queue0root: INFO:trying to process oki_h263_decroot: ALP_DEBUG: successed make element type:oki_h263_dec, name:oki_h263_dec0root: INFO:linked element oki_h263_dec0 on pad queue0:srcroot: INFO:successed add element:oki_h263_dec0root: INFO:try to link element :oki_h263_dec0 's padroot: INFO:find a raw src, type:video/x-raw-yuvroot: MEDIA_ENGINE:find dest, try to linkroot: MEDIA_ENGINE:begin link sinkroot: MEDIA_ENGINE:link padroot: MEDIA_ENGINE:set stateroot: MEDIA_ENGINE:End link sinkroot: INFO:try to link element :qtdemux0 's padroot: try to find compatible element for type:audio/AMRroot: find compatible elememt:oki_amrnb_decroot: INFO:element qtdemux0 is a demuxr, inserting a queueroot: ALP_DEBUG: successed make element type:queue, name:queue1root: INFO:trying to process oki_amrnb_decroot: ALP_DEBUG: successed make element type:oki_amrnb_dec, name:oki_amrnb_dec0root: INFO:linked element oki_amrnb_dec0 on pad queue1:srcroot: INFO:successed add element:oki_amrnb_dec0root: INFO:try to link element :oki_amrnb_dec0 's padroot: INFO:find a raw src, type:audio/x-raw-introot: caps: video/x-h263, width=(int)176, height=(int)144, framerate=(fraction)10/1root: oki_amrnb_dec handling tag eventroot: oki_amrnb_dec handling newsegment eventroot: (<unknown>:1667): GStreamer-CRITICAL **: gst_pad_get_parent_element: assertion `GST_IS_PAD (pad)' failedroot: (<unknown>:1667): GStreamer-CRITICAL **: gst_object_unref: assertion `object != NULL' failedroot: filesrc-->typefind-->qtdemux-->queue-->oki_amrnb_decroot: |->queue-->oki_h263_dec-->fbsinkroot: MM_INFO:auto plug successedroot: 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: 1root: Has Video: 1root: File Format: 0root: Rect Height: 144root: Rect width: 176root: Rect x: 0root: Rect y: 0root: End Time: 0root: ********** Audio Manager Test End ***********root: fbopen:open errorroot: Cannot open fb device.root: downroot: downroot: downroot: downroot: wy:176, wuv:88, hy:144, huv:72, root: ystride:176, uvstride:88, ysize:25344, uvsize:6336