mirror of
https://github.com/ioacademy-jikim/multimedia
synced 2026-08-22 22:02:57 +00:00
멀티미디어 예제
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES:= server.cpp
|
||||
LOCAL_MODULE := my_server
|
||||
LOCAL_SHARED_LIBRARIES:= libcutils libutils libbinder
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES:= client.cpp
|
||||
LOCAL_MODULE := my_client
|
||||
LOCAL_SHARED_LIBRARIES:= libcutils libutils libbinder
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_EXECUTABLE)
|
||||
@@ -0,0 +1,17 @@
|
||||
#include <binder/IServiceManager.h>
|
||||
#include <utils/StrongPointer.h>
|
||||
#include <binder/MemoryHeapBase.h>
|
||||
#include <binder/IPCThreadState.h>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace android;
|
||||
|
||||
int main()
|
||||
{
|
||||
sp<IServiceManager> sm = defaultServiceManager();
|
||||
sp<IBinder> binder = sm->getService( String16("my.ashmem1") );
|
||||
sp<IMemoryHeap> heap = interface_cast<IMemoryHeap>(binder);
|
||||
char *p = (char*)heap->getBase();
|
||||
printf("[%s]\n", p );
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <binder/IServiceManager.h>
|
||||
#include <utils/StrongPointer.h>
|
||||
#include <binder/MemoryHeapBase.h>
|
||||
#include <binder/IPCThreadState.h>
|
||||
|
||||
using namespace android;
|
||||
|
||||
int main()
|
||||
{
|
||||
sp<IServiceManager> sm = defaultServiceManager();
|
||||
sp<MemoryHeapBase> heap = new MemoryHeapBase(4096);
|
||||
sm->addService( String16("my.ashmem1") , heap );
|
||||
|
||||
char *p = (char*)heap->getBase();
|
||||
sprintf(p, "Hello Client!!\n" );
|
||||
IPCThreadState::self()->joinThreadPool();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user