全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:3876
推到 Plurk!
推到 Facebook!

【BCB】請問Java如何呼叫含有dspack的dll

尚未結案
parkghost
一般會員


發表:1
回覆:3
積分:0
註冊:2003-06-08

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-10-28 05:12:10 IP:59.104.xxx.xxx 未訂閱
由於Java沒有支援攝影機的方案,又對DirectX又沒什麼概念,所以採用這種折衷的方案,類似的code在純bcb上是可run的,可是當java執行init()呼叫dll的時候會在SysDev = new TSysDevEnum(CLSID_VideoInputDeviceCategory);當掉。請問這可能會是什麼原因引起的呢,請各位大大請給我一些建議吧 <>環境 >> >> < class="code"> //--------------------------------------------------------------------------- #include #include #include "DirectshowPool.h" #pragma link "DSPack" #include "DSPack.hpp" #pragma hdrstop TSysDevEnum *SysDev; TFilterGraph *FilterGraph[16]; TFilter *Filter[16]; TSampleGrabber *SampleGrabbers[16]; #pragma argsused int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved) { return 1; } //--------------------------------------------------------------------------- void VideoSetup(TFilterGraph *FilterGraph,TFilter *Filter,TSampleGrabber *SampleGrabber,int num){ FilterGraph->ClearGraph(); FilterGraph->Active = false; Filter->BaseFilter->Moniker = SysDev->GetMoniker(num); FilterGraph->Active = true; ICaptureGraphBuilder2 *Graph = NULL; IBaseFilter *SourceFilter = NULL; IBaseFilter *CaptureFilter=NULL; CheckDSError(FilterGraph->QueryInterface(IID_ICaptureGraphBuilder2, &Graph)); CheckDSError(Filter->QueryInterface(IID_IBaseFilter, &SourceFilter)); CheckDSError(SampleGrabber->QueryInterface(IID_IBaseFilter, &CaptureFilter)); Graph->RenderStream(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, SourceFilter, NULL, CaptureFilter); Graph->Release(); SourceFilter->Release(); CaptureFilter->Release(); } //--------------------------------------------------------------------------- JNIEXPORT void JNICALL Java_DirectshowPool_init(JNIEnv *, jobject){ ShowMessage("first line"); SysDev = new TSysDevEnum(CLSID_VideoInputDeviceCategory); ShowMessage("second line"); if (SysDev->CountFilters > 0) { for(int num=0;numCountFilters;num ){ FilterGraph[num] = new TFilterGraph(0); FilterGraph[num]->Mode = gmCapture; Filter[num] = new TFilter(0); SampleGrabbers[num] = new TSampleGrabber(0); Filter[num]->FilterGraph =FilterGraph[num]; SampleGrabbers[num]->FilterGraph =FilterGraph[num]; } } } //--------------------------------------------------------------------------- JNIEXPORT void JNICALL Java_DirectshowPool_bind(JNIEnv *, jobject, jint i){ VideoSetup(FilterGraph[i-1],Filter[i-1],SampleGrabbers[i-1],i-1); } //--------------------------------------------------------------------------- JNIEXPORT void JNICALL Java_DirectshowPool_start(JNIEnv *, jobject, jint i){ FilterGraph[i-1]->Play(); } //--------------------------------------------------------------------------- JNIEXPORT void JNICALL Java_DirectshowPool_stop(JNIEnv *, jobject, jint i ){ FilterGraph[i-1]->Stop(); } //--------------------------------------------------------------------------- JNIEXPORT jbyteArray JNICALL Java_DirectshowPool_grab(JNIEnv *, jobject, jint i ){ Graphics::TBitmap *bmp = new Graphics::TBitmap; SampleGrabbers[i-1]->GetBitmap(bmp); //.... return 0; } //--------------------------------------------------------------------------- Error Message # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0b0b7f2c, pid=3900, tid=916 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_03-b07 mixed mode) # Problematic frame: # C [DSPack_BCB6.bpl 0x7f2c] # --------------- T H R E A D --------------- Current thread (0x0ad3e8b0): JavaThread "AWT-EventQueue-0" [_thread_in_native, id=916] siginfo: ExceptionCode=0xc0000005, reading address 0x00000000 Registers: EAX=0x00000000, EBX=0x00000000, ECX=0x00000000, EDX=0x00000000 ESP=0x0b5df368, EBP=0x0b5df3ec, ESI=0x0b068bdc, EDI=0x0b5df3c4 EIP=0x0b0b7f2c, EFLAGS=0x00010246 Top of Stack: (sp=0x0b5df368) 0x0b5df368: 00000000 0b5df3b4 0b5df3dc 00000000 0x0b5df378: 0b5df3f4 40005f18 0b5df3ec 0b5df41f 0x0b5df388: 0b04524c 06fe1670 00000000 0b0a4263 0x0b5df398: 0b5df3f4 0b0a4290 0b5df3b8 00000000 0x0b5df3a8: 00000000 00000000 00000000 da4e3da0 0x0b5df3b8: 11d0d07d a00050bd 86ce11c9 400056d4 0x0b5df3c8: 06fe1670 40005ac2 00000000 40005b1a 0x0b5df3d8: 00000000 00000000 00000000 0b385514 Instructions: (pc=0x0b0b7f2c) 0x0b0b7f1c: 45 f0 e8 61 21 01 00 50 8d 45 c8 50 8b 45 f4 50 0x0b0b7f2c: 8b 00 ff 50 0c 89 45 e0 83 7d e0 00 0f 85 ea 00 Stack: [0x0b5a0000,0x0b5e0000), sp=0x0b5df368, free space=252k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [DSPack_BCB6.bpl 0x7f2c] C [DSPack_BCB6.bpl 0x8177] C [dp.dll 0x1be2] j DirectshowPool.init()V 0 j test.actionPerformed(Ljava/awt/event/ActionEvent;)V 15 j javax.swing.AbstractButton.fireActionPerformed(Ljava/awt/event/ActionEvent;)V 84 j javax.swing.AbstractButton$Handler.actionPerformed(Ljava/awt/event/ActionEvent;)V 5 j javax.swing.DefaultButtonModel.fireActionPerformed(Ljava/awt/event/ActionEvent;)V 35 j javax.swing.DefaultButtonModel.setPressed(Z)V 117 j javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Ljava/awt/event/MouseEvent;)V 35 j java.awt.Component.processMouseEvent(Ljava/awt/event/MouseEvent;)V 64 j javax.swing.JComponent.processMouseEvent(Ljava/awt/event/MouseEvent;)V 23 j java.awt.Component.processEvent(Ljava/awt/AWTEvent;)V 81 j java.awt.Container.processEvent(Ljava/awt/AWTEvent;)V 18 j java.awt.Component.dispatchEventImpl(Ljava/awt/AWTEvent;)V 477 j java.awt.Container.dispatchEventImpl(Ljava/awt/AWTEvent;)V 42 j java.awt.Component.dispatchEvent(Ljava/awt/AWTEvent;)V 2 j java.awt.LightweightDispatcher.retargetMouseEvent(Ljava/awt/Component;ILjava/awt/event/MouseEvent;)V 304 j java.awt.LightweightDispatcher.processMouseEvent(Ljava/awt/event/MouseEvent;)Z 139 j java.awt.LightweightDispatcher.dispatchEvent(Ljava/awt/AWTEvent;)Z 50 j java.awt.Container.dispatchEventImpl(Ljava/awt/AWTEvent;)V 12 j java.awt.Window.dispatchEventImpl(Ljava/awt/AWTEvent;)V 19 j java.awt.Component.dispatchEvent(Ljava/awt/AWTEvent;)V 2 j java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V 46 j java.awt.EventDispatchThread.pumpOneEventForHierarchy(ILjava/awt/Component;)Z 233 j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V 26 j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V 4 j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V 3 j java.awt.EventDispatchThread.run()V 9 v ~StubRoutines::call_stub V [jvm.dll 0x818b8] V [jvm.dll 0xd431d] V [jvm.dll 0x81789] V [jvm.dll 0x814e6] V [jvm.dll 0x9c06b] V [jvm.dll 0xfe7f5] V [jvm.dll 0xfe7c3] C [MSVCRT.dll 0x2a3b0] C [kernel32.dll 0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j DirectshowPool.init()V 0 j test.actionPerformed(Ljava/awt/event/ActionEvent;)V 15 j javax.swing.AbstractButton.fireActionPerformed(Ljava/awt/event/ActionEvent;)V 84 j javax.swing.AbstractButton$Handler.actionPerformed(Ljava/awt/event/ActionEvent;)V 5 j javax.swing.DefaultButtonModel.fireActionPerformed(Ljava/awt/event/ActionEvent;)V 35 j javax.swing.DefaultButtonModel.setPressed(Z)V 117 j javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Ljava/awt/event/MouseEvent;)V 35 j java.awt.Component.processMouseEvent(Ljava/awt/event/MouseEvent;)V 64 j javax.swing.JComponent.processMouseEvent(Ljava/awt/event/MouseEvent;)V 23 j java.awt.Component.processEvent(Ljava/awt/AWTEvent;)V 81 j java.awt.Container.processEvent(Ljava/awt/AWTEvent;)V 18 j java.awt.Component.dispatchEventImpl(Ljava/awt/AWTEvent;)V 477 j java.awt.Container.dispatchEventImpl(Ljava/awt/AWTEvent;)V 42 j java.awt.Component.dispatchEvent(Ljava/awt/AWTEvent;)V 2 j java.awt.LightweightDispatcher.retargetMouseEvent(Ljava/awt/Component;ILjava/awt/event/MouseEvent;)V 304 j java.awt.LightweightDispatcher.processMouseEvent(Ljava/awt/event/MouseEvent;)Z 139 j java.awt.LightweightDispatcher.dispatchEvent(Ljava/awt/AWTEvent;)Z 50 j java.awt.Container.dispatchEventImpl(Ljava/awt/AWTEvent;)V 12 j java.awt.Window.dispatchEventImpl(Ljava/awt/AWTEvent;)V 19 j java.awt.Component.dispatchEvent(Ljava/awt/AWTEvent;)V 2 j java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V 46 j java.awt.EventDispatchThread.pumpOneEventForHierarchy(ILjava/awt/Component;)Z 233 j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V 26 j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V 4 j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V 3 j java.awt.EventDispatchThread.run()V 9 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) 0x00035bb8 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] =>0x0ad3e8b0 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=916] 0x0acea528 JavaThread "AWT-Shutdown" [_thread_blocked, id=1740] 0x0acea910 JavaThread "AWT-Windows" daemon [_thread_in_native, id=1864] 0x0ace6498 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3336] 0x00ab7238 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=4008] 0x00ab5e08 JavaThread "CompilerThread0" daemon [_thread_blocked, id=2684] 0x00ab5138 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2624] 0x00aa6780 JavaThread "Finalizer" daemon [_thread_blocked, id=2168] 0x00aa52f0 JavaThread "Reference Handler" daemon [_thread_blocked, id=2672] Other Threads: 0x00aa2920 VMThread [id=2696] 0x00ab8418 WatcherThread [id=3384] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 567K [0x02af0000, 0x02b90000, 0x02fd0000) eden space 512K, 98% used [0x02af0000, 0x02b6df38, 0x02b70000) from space 64K, 100% used [0x02b70000, 0x02b80000, 0x02b80000) to space 64K, 0% used [0x02b80000, 0x02b80000, 0x02b90000) tenured generation total 1408K, used 425K [0x02fd0000, 0x03130000, 0x06af0000) the space 1408K, 30% used [0x02fd0000, 0x0303a550, 0x0303a600, 0x03130000) compacting perm gen total 8192K, used 5964K [0x06af0000, 0x072f0000, 0x0aaf0000) the space 8192K, 72% used [0x06af0000, 0x070c33e0, 0x070c3400, 0x072f0000) No shared spaces configured. Dynamic libraries: 0x00400000 - 0x0040c000 C:\Borland\JBuilder2006\jdk1.5\bin\java.exe 0x7c920000 - 0x7c9b5000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c91d000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e47000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d6b0000 - 0x6d836000 C:\Borland\JBuilder2006\jdk1.5\jre\bin\client\jvm.dll 0x77d10000 - 0x77d9e000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76b10000 - 0x76b3a000 C:\WINDOWS\system32\WINMM.dll 0x76300000 - 0x7631d000 C:\WINDOWS\system32\IMM32.DLL 0x621f0000 - 0x621f9000 C:\WINDOWS\system32\LPK.DLL 0x73fa0000 - 0x7400b000 C:\WINDOWS\system32\USP10.dll 0x6d2f0000 - 0x6d2f8000 C:\Borland\JBuilder2006\jdk1.5\jre\bin\hpi.dll 0x76bc0000 - 0x76bcb000 C:\WINDOWS\system32\PSAPI.DLL 0x6d680000 - 0x6d68c000 C:\Borland\JBuilder2006\jdk1.5\jre\bin\verify.dll 0x6d370000 - 0x6d38d000 C:\Borland\JBuilder2006\jdk1.5\jre\bin\java.dll 0x6d6a0000 - 0x6d6af000 C:\Borland\JBuilder2006\jdk1.5\jre\bin\zip.dll 0x6d070000 - 0x6d1d7000 C:\Borland\JBuilder2006\jdk1.5\jre\bin\awt.dll 0x72f70000 - 0x72f96000 C:\WINDOWS\system32\WINSPOOL.DRV 0x76990000 - 0x76acd000 C:\WINDOWS\system32\ole32.dll 0x5a410000 - 0x5a447000 C:\WINDOWS\system32\uxtheme.dll 0x736d0000 - 0x73719000 C:\WINDOWS\system32\ddraw.dll 0x73b30000 - 0x73b36000 C:\WINDOWS\system32\DCIMAN32.dll 0x738b0000 - 0x73980000 C:\WINDOWS\system32\D3DIM700.DLL 0x6d2b0000 - 0x6d2ed000 C:\Borland\JBuilder2006\jdk1.5\jre\bin\fontmanager.dll 0x74680000 - 0x746cb000 C:\WINDOWS\system32\MSCTF.dll 0x73640000 - 0x7366e000 C:\WINDOWS\system32\msctfime.ime 0x7d590000 - 0x7dd83000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77180000 - 0x77282000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x5c820000 - 0x5c8b7000 C:\WINDOWS\system32\comctl32.dll 0x0b040000 - 0x0b04d000 C:\DirectshowCamera\dp.dll 0x400b0000 - 0x401f9000 C:\WINDOWS\system32\vcl60.bpl 0x40000000 - 0x400aa000 C:\WINDOWS\system32\rtl60.bpl 0x770f0000 - 0x7717c000 C:\WINDOWS\system32\oleaut32.dll 0x71a80000 - 0x71a92000 C:\WINDOWS\system32\mpr.dll 0x71a30000 - 0x71a3b000 C:\WINDOWS\system32\wsock32.dll 0x71a10000 - 0x71a27000 C:\WINDOWS\system32\WS2_32.dll 0x71a00000 - 0x71a08000 C:\WINDOWS\system32\WS2HELP.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\version.dll 0x76320000 - 0x76367000 C:\WINDOWS\system32\comdlg32.dll 0x74c90000 - 0x74cb0000 C:\WINDOWS\system32\oledlg.dll 0x0b050000 - 0x0b095000 C:\PROGRA~1\Borland\CBUILD~1\Projects\Bpl\DirectX9_BCB6.bpl 0x0b0a0000 - 0x0b0ab000 C:\PROGRA~1\Borland\CBUILD~1\Bin\BORLNDMM.DLL 0x4b690000 - 0x4b836000 C:\WINDOWS\system32\D3D9.DLL 0x6dca0000 - 0x6dca6000 C:\WINDOWS\system32\d3d8thk.dll 0x32600000 - 0x32776000 C:\PROGRA~1\Borland\CBUILD~1\Bin\CC3260MT.DLL 0x0b0b0000 - 0x0b0e4000 C:\PROGRA~1\Borland\CBUILD~1\Projects\Bpl\DSPack_BCB6.bpl 0x7cf70000 - 0x7d0d7000 C:\WINDOWS\system32\QUARTZ.DLL 0x0b0f0000 - 0x0b334000 C:\WINDOWS\system32\WMVCORE.DLL 0x0b340000 - 0x0b37b000 C:\WINDOWS\system32\WMASF.DLL 0x5e5c0000 - 0x5e5d7000 C:\WINDOWS\system32\OLEPRO32.DLL 0x6d530000 - 0x6d543000 C:\Borland\JBuilder2006\jdk1.5\jre\bin\net.dll 0x6d550000 - 0x6d559000 C:\Borland\JBuilder2006\jdk1.5\jre\bin\nio.dll VM Arguments: java_command: test Environment Variables: PATH=C:\PROGRA~1\Borland\CBUILD~1\Bin;C:\PROGRA~1\Borland\CBUILD~1\Projects\Bpl;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\IDM Computer Solutions\UltraEdit-32;C:\Borland\JBuilder2006\jdk1.5\bin USERNAME=Administrator OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 8 Stepping 10, GenuineIntel --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 family 6, cmov, cx8, fxsr, mmx, sse Memory: 4k page, physical 523760k(215116k free), swap 1280068k(892376k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_03-b07) for windows-x86, built on Apr 13 2005 02:07:01 by "java_re" with MS VC 6.0
系統時間:2024-12-04 1:30:41
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!