mirror of
https://github.com/ioacademy-jikim/multimedia
synced 2026-08-22 13:53:02 +00:00
멀티미디어 예제
This commit is contained in:
Binary file not shown.
@@ -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,21 @@
|
||||
#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<IMemory> memory = interface_cast<IMemory>(binder);
|
||||
ssize_t offset=0;
|
||||
size_t size=0;
|
||||
sp<IMemoryHeap> heap = memory->getMemory(&offset, &size);
|
||||
|
||||
char *p = (char*)heap->getBase();
|
||||
printf("[%s]\n", p+offset );
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <binder/IServiceManager.h>
|
||||
#include <utils/StrongPointer.h>
|
||||
#include <binder/MemoryHeapBase.h>
|
||||
#include <binder/MemoryBase.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") , new MemoryBase(heap, 100, 100) );
|
||||
|
||||
char *p = (char*)heap->getBase();
|
||||
sprintf(p+100, "Hello Client!!\n" );
|
||||
IPCThreadState::self()->joinThreadPool();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user