0

我正在将摄像机的 SDK 从 C++ 转换为 VB。

我使用 dll import 从供应商处导入库。

运行第一个函数时,它似乎返回了一个有效的类相机指针(返回的指针不为空):

我这样声明函数:

<DllImport("KMpeg4.dll", SetLastError:=True, CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.Cdecl)> _
    Shared Function KOpenInterface() As System.IntPtr

结束功能

然后在代码中我以这种方式使用它:

    Dim mcc As structural_MEDIA_CONNECTION_CONFIG2
    Dim last_error As UInteger

    mcc = New structural_MEDIA_CONNECTION_CONFIG2()

    mcc.UserID = "root"
    mcc.Password = "123456"
    mcc.UniCastIP = "192.168.10.242 \0"
    mcc.HTTPPort = 80
    mcc.ContactType = CONTACT_TYPE.CONTACT_TYPE_UNICAST_PREVIEW
    mcc.RegisterPort = 6000
    mcc.ControlPort = 6001
    mcc.StreamingPort = 6002
    mcc.ChannelNumber = 0
    mcc.MultiCastIP = "172.16.1.105\0"
    mcc.MultiCastPort = 5000
    mcc.ConnectTimeOut = 3

    Dim myCamera1 As IntPtr = GlobalMembersSDK10000.KOpenInterface()

    If myCamera1 <> IntPtr.Zero Then


        If GlobalMembersSDK10000.KSetMediaConfig2(myCamera1, mcc) Then
            If GlobalMembersSDK10000.KConnect(myCamera1) Then



                If GlobalMembersSDK10000.KStartStreaming(myCamera1) Then


                    GlobalMembersSDK10000.KPlay(myCamera1)
                End If
            End If
        Else
            last_error = GlobalMembersSDK10000.KGetLastError(myCamera1)
            MessageBox.Show("ACTI camera not configured: error ", last_error.ToString)
        End If
    Else
        last_error = GlobalMembersSDK10000.KGetLastError(myCamera1)
        MessageBox.Show("ACTI camera object not created: error ", last_error.ToString)
    End If

但是,当它达到第二个功能时:

如果 GlobalMembersSDK10000.KSetMediaConfig2(myCamera1, mcc) 那么

这返回 0,因此意味着它失败了。

我这样声明:

<DllImport("KMpeg4.dll", SetLastError:=True, CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.Cdecl)> _
Shared Function KSetMediaConfig2(ByVal h As System.IntPtr, ByVal MediaConfig As structural_MEDIA_CONNECTION_CONFIG2) As Boolean

End Function

他们有一个返回错误代码的函数 KGetLastError(myCamera1)

代码运行,但函数返回我从 KGetLastError(myCamera1) 获得的错误代码:代码 11

来自相机文档:

错误 11 是:SDK10000_ERROR_CAN_NOT_LOAD_AVC_ADAPTOR,建议是:

确保使用 KMpeg4.dll 将适配器放置在正确的位置。

我认为 AVC 适配器是子库,例如:

AADP.dll、AFADP.dll、FFMCODEC.dll

所以我的问题是,我如何才能确定哪个库(或他们称之为 AVC)没有链接到 KMpeg4.dll,更重要的是,我如何确保这些子库链接?

我想念使用 DllImport 吗?

根据下面的建议,我使用 Sys Internals Process 监视器来隔离 KMpeg4.dll 的问题,但所有调用接缝都成功:

12:23:07.7439127 AM WifiATR.exe 4004    CreateFile  \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
12:23:07.7445053 AM WifiATR.exe 4004    QueryBasicInformationFile   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS CreationTime: 28/09/2013 12:06:02 AM, LastAccessTime: 28/09/2013 12:06:02 AM, LastWriteTime: 27/09/2013 4:48:14 PM, ChangeTime: 28/09/2013 12:06:02 AM, FileAttributes: N
12:23:07.7445836 AM WifiATR.exe 4004    CloseFile   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS 
12:23:07.7452012 AM WifiATR.exe 4004    CreateFile  \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Desired Access: Read Data/List Directory, Execute/Traverse, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Delete, AllocationSize: n/a, OpenResult: Opened
12:23:07.7698233 AM WifiATR.exe 4004    CreateFileMapping   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS SyncType: SyncTypeCreateSection, PageProtection: 
12:23:07.7698524 AM WifiATR.exe 4004    QueryStandardInformationFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS AllocationSize: 475,136, EndOfFile: 474,624, NumberOfLinks: 1, DeletePending: False, Directory: False
12:23:07.7699283 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 0, Length: 4,096, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.7700397 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 438,784, Length: 16,384, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.7702314 AM WifiATR.exe 4004    CreateFileMapping   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS SyncType: SyncTypeOther
12:23:07.7702835 AM WifiATR.exe 4004    Load Image  \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Image Base: 0x52940000, Image Size: 0x7a000
12:23:07.7703029 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 377,344, Length: 16,384, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.7704030 AM WifiATR.exe 4004    CloseFile   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS 
12:23:07.7704268 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 423,936, Length: 14,848, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.7711082 AM WifiATR.exe 4004    CreateFile  \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Delete, AllocationSize: n/a, OpenResult: Opened
12:23:07.7712269 AM WifiATR.exe 4004    QueryDeviceInformationVolume    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS DeviceType: Disk, Characteristics: Remote
12:23:07.7723003 AM WifiATR.exe 4004    CloseFile   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS 
12:23:07.7723960 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 397,824, Length: 15,872, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.7724840 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 348,672, Length: 16,384, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9494865 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 413,696, Length: 10,240, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9790363 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 254,976, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9791607 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 308,224, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9792672 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 365,056, Length: 12,288, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9794291 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 287,744, Length: 20,480, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9797190 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 222,208, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9799430 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 189,440, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9803362 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 340,992, Length: 7,680, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9805623 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 95,232, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9809615 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 62,464, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9813405 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 156,672, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9822537 AM WifiATR.exe 4004    CreateFile  \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Delete, AllocationSize: n/a, OpenResult: Opened
12:23:07.9823453 AM WifiATR.exe 4004    QueryDeviceInformationVolume    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS DeviceType: Disk, Characteristics: Remote
12:23:07.9832491 AM WifiATR.exe 4004    CloseFile   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS 
12:23:07.9847202 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 9,216, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9848623 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 1,024, Length: 8,192, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9849781 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 128,000, Length: 28,672, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:23:07.9859849 AM WifiATR.exe 4004    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 41,984, Length: 20,480, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:03.8466978 AM WifiATR.exe 4004    QueryNameInformationFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Name: \vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll
12:27:32.1381127 AM WifiATR.exe 2448    CreateFile  \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
12:27:32.1387424 AM WifiATR.exe 2448    QueryBasicInformationFile   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS CreationTime: 28/09/2013 12:23:15 AM, LastAccessTime: 28/09/2013 12:23:15 AM, LastWriteTime: 27/09/2013 4:48:14 PM, ChangeTime: 28/09/2013 12:23:15 AM, FileAttributes: N
12:27:32.1388094 AM WifiATR.exe 2448    CloseFile   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS 
12:27:32.1399486 AM WifiATR.exe 2448    CreateFile  \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Desired Access: Read Data/List Directory, Execute/Traverse, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Delete, AllocationSize: n/a, OpenResult: Opened
12:27:32.1644811 AM WifiATR.exe 2448    CreateFileMapping   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS SyncType: SyncTypeCreateSection, PageProtection: 
12:27:32.1645109 AM WifiATR.exe 2448    QueryStandardInformationFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS AllocationSize: 475,136, EndOfFile: 474,624, NumberOfLinks: 1, DeletePending: False, Directory: False
12:27:32.1646074 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 0, Length: 4,096, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.1647253 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 438,784, Length: 16,384, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.1649146 AM WifiATR.exe 2448    CreateFileMapping   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS SyncType: SyncTypeOther
12:27:32.1649687 AM WifiATR.exe 2448    Load Image  \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Image Base: 0x528d0000, Image Size: 0x7a000
12:27:32.1649885 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 377,344, Length: 16,384, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.1650963 AM WifiATR.exe 2448    CloseFile   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS 
12:27:32.1651205 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 423,936, Length: 14,848, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.1657563 AM WifiATR.exe 2448    CreateFile  \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Delete, AllocationSize: n/a, OpenResult: Opened
12:27:32.1658609 AM WifiATR.exe 2448    QueryDeviceInformationVolume    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS DeviceType: Disk, Characteristics: Remote
12:27:32.1669645 AM WifiATR.exe 2448    CloseFile   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS 
12:27:32.1670638 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 397,824, Length: 15,872, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.1671421 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 348,672, Length: 16,384, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3486441 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 413,696, Length: 10,240, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3655188 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 254,976, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3657121 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 308,224, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3658058 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 365,056, Length: 12,288, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3658999 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 287,744, Length: 20,480, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3660399 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 222,208, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3661344 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 189,440, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3663286 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 340,992, Length: 7,680, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3664307 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 95,232, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3665679 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 62,464, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3666741 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 156,672, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3673361 AM WifiATR.exe 2448    CreateFile  \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Delete, AllocationSize: n/a, OpenResult: Opened
12:27:32.3674520 AM WifiATR.exe 2448    QueryDeviceInformationVolume    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS DeviceType: Disk, Characteristics: Remote
12:27:32.3682142 AM WifiATR.exe 2448    CloseFile   \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS 
12:27:32.3683756 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 9,216, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3707666 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 1,024, Length: 8,192, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3708817 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 128,000, Length: 28,672, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal
12:27:32.3734798 AM WifiATR.exe 2448    ReadFile    \\vboxsrv\ROOT\home\william\Development_new\pipe robot\code\New_GUI_software\src\bin\x86\Debug\KMpeg4.dll   SUCCESS Offset: 41,984, Length: 20,480, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal

在之前的打印输出中,我忘记删除 KMpeg4.dll 过滤器,但即使我没有过滤器,程序正在寻找的功能是在一条或另一条路径中提供资金。

谢谢

威廉

4

1 回答 1

1

好的,我发现了问题。这是与代码相关的。

我需要编组从我作为参数传递的 C++ 转换的结构:

原始 typedef 结构:

typedef struct structural_MEDIA_VIDEO_CONFIG2
{
    short dwEncoder;            // 1:MPEG4 4:MPEG4 5:H264
    short dwTvStander;          // 0:NTSC 1:PAL
    short dwVideoResolution;    // See the definition above
    short dwBitsRate;           // See the definition above
    short dwQuality;            // 0 ~ 100 : Low ~ High
    short dwVideoBrightness;    // 0 ~ 100 : Low ~ High
    short dwVideoContrast;      // 0 ~ 100 : Low ~ High
    short dwVideoSaturation;    // 0 ~ 100 : Low ~ High
    short dwVideoHue;           // 0 ~ 100 : Low ~ High
    short dwFps;                // 0 ~ 30 frame pre second
} MEDIA_VIDEO_CONFIG2;

VB中的转换结构:

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
Public Structure structural_MEDIA_CONNECTION_CONFIG2
    Public ContactType As Integer

    Public ChannelNumber As Byte ' For URL Command CHANNEL tag, when set it to 0, URL command won't bring CHANNEL tag, or the URL command will bring CHANNEL=ChannelNumber tag  )
    Public TCPVideoStreamID As Byte ' 0 based to specify video track, value 0 to 255 for 1 to 256 video track
    Public RTPVideoTrackNumber As Byte ' set it to 0, ARTP will use 1st video track,  1 to 255 is for specify video track
    Public RTPAudioTrackNumber As Byte ' set it to 0, ARTP will use 1st audio track,  1 to 255 is for specify audio track

    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> _
    Public UniCastIP As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> _
    Public MultiCastIP As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> _
    Public PlayFileName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> _
    Public UserID As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> _
    Public Password As String
    Public RegisterPort As UInteger
    Public StreamingPort As UInteger
    Public ControlPort As UInteger
    Public MultiCastPort As UInteger
    Public SearchPortC2S As UInteger
    Public SearchPortS2C As UInteger
    Public HTTPPort As UInteger
    Public RTSPPort As UInteger
    Public Reserved1 As UInteger
    Public Reserved2 As UInteger

    Public ConnectTimeOut As UShort
    Public EncryptionType As UShort
End Structure

对于函数的声明参数,我需要更改为 ByRef 而不是 ByVal:

<DllImport("KMpeg4.dll", SetLastError:=True, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl)> _
Shared Function KSetMediaConfig2(ByVal h As System.IntPtr, ByRef MediaConfig As structural_MEDIA_CONNECTION_CONFIG2) As Boolean
End Function

这让我进入了下一个阶段

威廉

于 2013-09-30T03:31:58.673 回答