레이블이 note인 게시물을 표시합니다. 모든 게시물 표시
레이블이 note인 게시물을 표시합니다. 모든 게시물 표시

2011년 12월 21일 수요일

참고 사이트




Audio Record & Play






Linux
임베디드 시스템 엔지니어를 위한 리눅스 커널 분석
http://wiki.kldp.org/KoreanDoc/html/EmbeddedKernel-KLDP/index.html


vim
http://wiki.kldp.org/KoreanDoc/html/Vim_Guide-KLDP/Vim_Guide-KLDP.html


Thread
Linux Threads Programming
http://wiki.kldp.org/wiki.php/LinuxdocSgml/Thread_Programming-TRANS

Multithreaded Programming (POSIX pthreads Tutorial)
http://randu.org/tutorials/threads/

POSIX thread (pthread) libraries
http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html


pthread_cond_wait/pthread_cond_signal
http://www.joinc.co.kr/modules/moniwiki/wiki.php/man/3/pthread_cond_wait


GCC/Make


ffmpeg http://ffmpeg.org/index.html

Using libavformat and libavcodec
http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html

An ffmpeg and SDL Tutorial
http://dranger.com/ffmpeg/ffmpeg.html

千 Line 으로 비디오플레이어 만들기
http://hybridego.net/1138

류종택의 프로그래밍 강의실/프로그래밍/FFmpeg
http://ryulib.tistory.com/category/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D/FFmpeg

http://www.cnblogs.com/scottwong/archive/2011/06/22/2087677.html
http://www.androidside.com/B52/3816

RockPlayer
http://www.anplayer.com/index_en.html

ffmpeg 라이브러리 빌드
http://blog.daum.net/hopefullife/205

FFmpeg을 이용한 Android 동영상 플레이어 개발
http://helloworld.naver.com/helloworld/8794


JNI
Run native app
http://code.google.com/p/run-native-app/


The Java Native Interface Programmer's Guide and Specification



OpenGL
http://blog.naver.com/gidools/20107805862


Java
JAVA.LANG.CLASS의 사용

Android용 실행파일 만들기 (native)


Android용 실행파일 만들기...(c/c++)


준비사항
  1. NDK 개발환경
  2. 프로젝트아래에 jni 폴더를 생성하고, 아래 파일 생성
  3. Eclipse CDT의 builder를 설정하여 ndk-build 가능하도록 함

Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := test
LOCAL_SRC_FILES := \
    main.cpp \
include $(BUILD_EXECUTABLE)

main.cpp

#include <stdio.h>
int main(int argc, char ** argv)
{
    printf("Hello, world!\n");
    return 0;
}

안드로이드 단말기에서 실행

adb 를 이용하여 실행파일을 read/write permission 이 가능한 /data에 올려두고 실행함.

$ adb push test  /data/
$ adb shell
$ cd /data/
$ ./test

JNI C++ 사용예

JNI C++ 사용 예제

Android.mk
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_LDLIBS := -lm -llog
LOCAL_SHARED_LIBRARIES := liblog libcutils

LOCAL_DEFAULT_CPP_EXTENSION := cpp
LOCAL_MODULE := mylib
LOCAL_SRC_FILES := \
    main.cpp \
    http_get.cpp \

include $(BUILD_SHARED_LIBRARY)


Main.cpp
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <jni.h>
#include <assert.h>

#include "http_get.h"


#include <android/log.h>
#define LOG_TAG "MY"
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__)


extern "C" {

JNIEXPORT jstring JNICALL native_hello(JNIEnv *env, jclass clazz)
{
    printf("hello in native code.");

    mmain();
    return env->NewStringUTF("-------------hello world mmain().-------------");
}

#define JNIREG_CLASS "ub/test/hellojni/HelloJniActivity"

static JNINativeMethod gMethods[] = {
        { "native_hello", "()Ljava/lang/String;", (void*)native_hello },
        }; /* * Register several native methods for one class. */

static int registerNativeMethods(JNIEnv* env, const char* className, JNINativeMethod* gMethods, int numMethods)
{
    jclass clazz;
    clazz = env->FindClass(className);
    if (clazz == NULL)
    {
        return JNI_FALSE;
    }
    if (env->RegisterNatives(clazz, gMethods, numMethods) < 0)
    {
        return JNI_FALSE;
    }

    return JNI_TRUE; }

/* * Register native methods for all classes we know about. */
static int registerNatives(JNIEnv* env)
{
    if (!registerNativeMethods(env, JNIREG_CLASS, gMethods, sizeof(gMethods) / sizeof(gMethods[0])))
    {
        return JNI_FALSE;
    }
    return JNI_TRUE;
}

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
{
    JNIEnv* env = NULL;
    jint result = -1;
    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK)
    {
        return -1;
    }
    assert(env != NULL);
    if (!registerNatives(env))
    {
        return -1;
    }
    /* success -- return valid version number */
    result = JNI_VERSION_1_4;
    return result;
}

}

HelloJniActivity.java
package ub.test.hellojni;


public class HelloJniActivity extends Activity {
    /** Called when the activity is first created. */

public native String  native_hello();


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Log.v("MY", "onCreate! " + native_hello());
    }

    static {
        System.loadLibrary("mylib");
      }
}