Changeset 1193:58278fd087fd in mediastreamer2
- Timestamp:
- Nov 12, 2010 2:12:28 PM (3 years ago)
- Branch:
- default
- Files:
-
- 3 edited
-
build/android/Android.mk (modified) (2 diffs)
-
src/android-display.c (modified) (5 diffs)
-
src/mscommon.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
build/android/Android.mk
r1190 r1193 109 109 rfc3984.c \ 110 110 mire.c \ 111 videostream.c 111 videostream.c \ 112 layouts.c \ 113 android-display.c 112 114 113 115 endif … … 152 154 153 155 154 155 156 include $(BUILD_STATIC_LIBRARY) 156 157 include $(CLEAR_VARS)158 159 LOCAL_MODULE := msandroiddisplay160 161 LOCAL_SRC_FILES := android-display.c162 163 LOCAL_C_INCLUDES += \164 $(MEDIASTREAMER2_INCLUDES)165 166 LOCAL_CFLAGS += \167 -UHAVE_CONFIG_H \168 -include $(LOCAL_PATH)/../build/android/libmediastreamer2_AndroidConfig.h \169 -D_POSIX_SOURCE170 171 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true172 173 include $(BUILD_SHARED_LIBRARY)174 157 175 158 176 159 160 -
src/android-display.c
r1192 r1193 25 25 #include <android/bitmap.h> 26 26 #include <jni.h> 27 #include <dlfcn.h> 27 28 28 29 /*defined in msandroid.cpp*/ … … 41 42 }AndroidDisplay; 42 43 44 45 static int (*sym_AndroidBitmap_getInfo)(JNIEnv *env,jobject bitmap, AndroidBitmapInfo *bmpinfo)=NULL; 46 static int (*sym_AndroidBitmap_lockPixels)(JNIEnv *env, jobject bitmap, void **pixels)=NULL; 47 static int (*sym_AndroidBitmap_unlockPixels)(JNIEnv *env, jobject bitmap)=NULL; 48 43 49 static void android_display_init(MSFilter *f){ 44 50 AndroidDisplay *ad=(AndroidDisplay*)ms_new0(AndroidDisplay,1); … … 116 122 } 117 123 } 118 if ( AndroidBitmap_lockPixels(ad->jenv,ad->jbitmap,&pixels)==0){124 if (sym_AndroidBitmap_lockPixels(ad->jenv,ad->jbitmap,&pixels)==0){ 119 125 dest.planes[0]=(uint8_t*)pixels+(vrect.y*ad->bmpinfo.stride)+(vrect.x*2); 120 126 dest.strides[0]=ad->bmpinfo.stride; 121 127 ms_sws_scale (ad->sws,pic.planes,pic.strides,0,pic.h,dest.planes,dest.strides); 122 AndroidBitmap_unlockPixels(ad->jenv,ad->jbitmap);128 sym_AndroidBitmap_unlockPixels(ad->jenv,ad->jbitmap); 123 129 }else{ 124 130 ms_error("AndroidBitmap_lockPixels() failed !"); … … 151 157 ad->jbitmap=(*jenv)->CallObjectMethod(jenv,window,ad->get_bitmap_id); 152 158 ad->android_video_window=window; 153 err= AndroidBitmap_getInfo(jenv,ad->jbitmap,&ad->bmpinfo);159 err=sym_AndroidBitmap_getInfo(jenv,ad->jbitmap,&ad->bmpinfo); 154 160 if (err!=0){ 155 161 ms_error("AndroidBitmap_getInfo() failed."); … … 182 188 183 189 void libmsandroiddisplay_init(void){ 184 ms_filter_register(&ms_android_display_desc); 185 } 186 187 190 /*See if we can use AndroidBitmap_* symbols (only since android 2.2 normally)*/ 191 void *handle=dlopen("libjnigraphics.so",RTLD_LAZY); 192 if (handle!=NULL){ 193 sym_AndroidBitmap_getInfo=dlsym(handle,"AndroidBitmap_getInfo"); 194 sym_AndroidBitmap_lockPixels=dlsym(handle,"AndroidBitmap_lockPixels"); 195 sym_AndroidBitmap_unlockPixels=dlsym(handle,"AndroidBitmap_unlockPixels"); 196 197 if (sym_AndroidBitmap_getInfo==NULL || sym_AndroidBitmap_lockPixels==NULL 198 || sym_AndroidBitmap_unlockPixels==NULL){ 199 ms_warning("AndroidBitmap not available."); 200 }else{ 201 ms_filter_register(&ms_android_display_desc); 202 ms_message("MSAndroidDisplay registered."); 203 } 204 }else ms_warning("libjnigraphics.so cannot be loaded."); 205 } 206 207 -
src/mscommon.c
r1166 r1193 23 23 24 24 extern void __register_ffmpeg_encoders_if_possible(void); 25 extern void libmsandroiddisplay_init(void); 25 26 26 27 #include "mediastreamer2/mscommon.h" … … 596 597 ms_load_plugins(PACKAGE_PLUGINS_DIR); 597 598 #endif 599 600 #if defined(ANDROID) && defined (VIDEO_ENABLED) 601 libmsandroiddisplay_init(); 602 #endif 598 603 ms_message("ms_init() done"); 599 604 }
Note: See TracChangeset
for help on using the changeset viewer.
