chenyunecjtu / coreavc-for-linux

Automatically exported from code.google.com/p/coreavc-for-linux
GNU General Public License v2.0
0 stars 1 forks source link

dshowserver darwin misaligned stack problem #55

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I tried to test dshow server on Mac OS X 10.5.4 Leopard x86 Darwin 9.4.0.

After patching all occurences of #include <malloc.h> to <sys/malloc.h> and
a few minor fixes to wrapper.S (missing comma at end of .section, excluding
.type which seems unsupported by darwin object model) dshowserver compiled
fine, but it either hangs or crashes (in gdb) with a
__dyld_misaligned_stack_error when trying to init an unpacked CoreAVC 1.7.0.

I tried compiling with PIC disabled and also with
-mprefered-stack-boundary=2 but to no avail. I found somewhere on google
that probably the ebx must be pushed in asm functions due to different
calling conventions in darwin.

Here's the complete gdb log:
$ gdb ../dshowserver/dshowserver GNU gdb 6.3.50-20050815 (Apple version
gdb-960) (Sun May 18 18:38:33 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin"...Reading symbols for shared
libraries ... done

(gdb) r -c CoreAVCDecoder.ax -s 1280x720 -g
09571a4b-f1fe-4c60-9760de6d310c7c31 -b 12 -f 0x34363248 -o
0x30323449Starting program:
/Users/felix/develop/coreavc-for-linux/dshowserver/dshowserver -c
CoreAVCDecoder.ax -s 1280x720 -g 09571a4b-f1fe-4c60-9760de6d310c7c31 -b 12
-f 0x34363248 -o 0x30323449
Reading symbols for shared libraries ++. done
No id specified, assuming test mode
Opening device
tid:a00e7fa0 External func VERSION.dll:GetFileVersionInfoSizeA
tid:a00e7fa0 External func VERSION.dll:GetFileVersionInfoA
tid:a00e7fa0 External func VERSION.dll:VerQueryValueA
tid:a00e7fa0 External func ADVAPI32.dll:RegSetValueA
tid:a00e7fa0 External func ADVAPI32.dll:RegDeleteKeyA
tid:a00e7fa0 External func ADVAPI32.dll:RegEnumKeyExA
tid:a00e7fa0 External func ADVAPI32.dll:RegSetValueExA
tid:a00e7fa0 External func ADVAPI32.dll:RegQueryValueExA
tid:a00e7fa0 External func ADVAPI32.dll:RegOpenKeyExA
tid:a00e7fa0 External func ADVAPI32.dll:RegCloseKey
tid:a00e7fa0 External func ADVAPI32.dll:RegCreateKeyA
tid:a00e7fa0 External func COMCTL32.dll:InitCommonControlsEx
tid:a00e7fa0 External func USER32.dll:IsRectEmpty
tid:a00e7fa0 External func USER32.dll:SetDlgItemTextA
tid:a00e7fa0 External func USER32.dll:GetWindowRect
tid:a00e7fa0 External func USER32.dll:GetDesktopWindow
tid:a00e7fa0 External func USER32.dll:LoadStringW
tid:a00e7fa0 External func USER32.dll:LoadStringA
tid:a00e7fa0 External func USER32.dll:DefWindowProcA
tid:a00e7fa0 External func USER32.dll:DestroyWindow
tid:a00e7fa0 External func USER32.dll:ShowWindow
tid:a00e7fa0 External func USER32.dll:MoveWindow
tid:a00e7fa0 External func USER32.dll:GetWindowLongA
tid:a00e7fa0 External func USER32.dll:SetWindowLongA
tid:a00e7fa0 External func USER32.dll:wvsprintfA
tid:a00e7fa0 External func USER32.dll:GetDlgItemTextA
tid:a00e7fa0 External func USER32.dll:EnableWindow
tid:a00e7fa0 External func USER32.dll:LoadImageA
tid:a00e7fa0 External func USER32.dll:GetSystemMetrics
tid:a00e7fa0 External func USER32.dll:GetDlgItem
tid:a00e7fa0 External func USER32.dll:CreateDialogParamA
tid:a00e7fa0 External func USER32.dll:SendDlgItemMessageA
tid:a00e7fa0 External func USER32.dll:wsprintfA
tid:a00e7fa0 External func USER32.dll:GetClientRect
tid:a00e7fa0 External func USER32.dll:MessageBoxA
tid:a00e7fa0 External func USER32.dll:InvalidateRect
tid:a00e7fa0 External func SHELL32.dll:ShellExecuteExA
tid:a00e7fa0 External func SHELL32.dll:SHGetSpecialFolderPathA
tid:a00e7fa0 External func OLEAUT32.dll:19
tid:a00e7fa0 External func OLEAUT32.dll:24
tid:a00e7fa0 External func OLEAUT32.dll:417
tid:a00e7fa0 External func OLEAUT32.dll:4
tid:a00e7fa0 External func OLEAUT32.dll:8
tid:a00e7fa0 External func OLEAUT32.dll:23
tid:a00e7fa0 External func OLEAUT32.dll:9
tid:a00e7fa0 External func OLEAUT32.dll:20
tid:a00e7fa0 External func ole32.dll:CoTaskMemAlloc
tid:a00e7fa0 External func ole32.dll:CoFreeUnusedLibraries
tid:a00e7fa0 External func ole32.dll:CoInitialize
tid:a00e7fa0 External func ole32.dll:StringFromGUID2
tid:a00e7fa0 External func ole32.dll:CLSIDFromString
tid:a00e7fa0 External func ole32.dll:StringFromCLSID
tid:a00e7fa0 External func ole32.dll:MkParseDisplayName
tid:a00e7fa0 External func ole32.dll:CreateBindCtx
tid:a00e7fa0 External func ole32.dll:CoUninitialize
tid:a00e7fa0 External func ole32.dll:CoCreateInstance
tid:a00e7fa0 External func ole32.dll:CoTaskMemFree
tid:a00e7fa0 External func KERNEL32.dll:FlushFileBuffers
tid:a00e7fa0 External func KERNEL32.dll:CreateFileA
tid:a00e7fa0 External func KERNEL32.dll:GetProcessHeap
tid:a00e7fa0 External func KERNEL32.dll:GetCommandLineA
tid:a00e7fa0 External func KERNEL32.dll:HeapReAlloc
tid:a00e7fa0 External func KERNEL32.dll:IsDebuggerPresent
tid:a00e7fa0 External func KERNEL32.dll:SetUnhandledExceptionFilter
tid:a00e7fa0 External func KERNEL32.dll:UnhandledExceptionFilter
tid:a00e7fa0 External func KERNEL32.dll:TerminateProcess
tid:a00e7fa0 External func KERNEL32.dll:HeapAlloc
tid:a00e7fa0 External func KERNEL32.dll:GetStringTypeW
tid:a00e7fa0 External func KERNEL32.dll:GetStringTypeA
tid:a00e7fa0 External func KERNEL32.dll:LCMapStringW
tid:a00e7fa0 External func KERNEL32.dll:LCMapStringA
tid:a00e7fa0 External func KERNEL32.dll:WriteConsoleW
tid:a00e7fa0 External func KERNEL32.dll:GetConsoleOutputCP
tid:a00e7fa0 External func KERNEL32.dll:WriteConsoleA
tid:a00e7fa0 External func KERNEL32.dll:SetStdHandle
tid:a00e7fa0 External func KERNEL32.dll:GetLocaleInfoA
tid:a00e7fa0 External func KERNEL32.dll:IsValidCodePage
tid:a00e7fa0 External func KERNEL32.dll:GetCPInfo
tid:a00e7fa0 External func KERNEL32.dll:GetConsoleMode
tid:a00e7fa0 External func KERNEL32.dll:GetConsoleCP
tid:a00e7fa0 External func KERNEL32.dll:SetFilePointer
tid:a00e7fa0 External func KERNEL32.dll:HeapFree
tid:a00e7fa0 External func KERNEL32.dll:InterlockedIncrement
tid:a00e7fa0 External func KERNEL32.dll:InterlockedDecrement
tid:a00e7fa0 External func KERNEL32.dll:GetCurrentProcess
tid:a00e7fa0 External func KERNEL32.dll:WaitForSingleObject
tid:a00e7fa0 External func KERNEL32.dll:InitializeCriticalSection
tid:a00e7fa0 External func KERNEL32.dll:TerminateThread
tid:a00e7fa0 External func KERNEL32.dll:Sleep
tid:a00e7fa0 External func KERNEL32.dll:LeaveCriticalSection
tid:a00e7fa0 External func KERNEL32.dll:CreateSemaphoreA
tid:a00e7fa0 External func KERNEL32.dll:ReleaseSemaphore
tid:a00e7fa0 External func KERNEL32.dll:GetProcAddress
tid:a00e7fa0 External func KERNEL32.dll:EnterCriticalSection
tid:a00e7fa0 External func KERNEL32.dll:GetModuleHandleA
tid:a00e7fa0 External func KERNEL32.dll:DeleteCriticalSection
tid:a00e7fa0 External func KERNEL32.dll:GetCurrentThreadId
tid:a00e7fa0 External func KERNEL32.dll:CloseHandle
tid:a00e7fa0 External func KERNEL32.dll:CreateThread
tid:a00e7fa0 External func KERNEL32.dll:FormatMessageA
tid:a00e7fa0 External func KERNEL32.dll:WideCharToMultiByte
tid:a00e7fa0 External func KERNEL32.dll:MultiByteToWideChar
tid:a00e7fa0 External func KERNEL32.dll:GetPrivateProfileStringA
tid:a00e7fa0 External func KERNEL32.dll:WritePrivateProfileStringA
tid:a00e7fa0 External func KERNEL32.dll:GetModuleFileNameA
tid:a00e7fa0 External func KERNEL32.dll:GetSystemTimeAsFileTime
tid:a00e7fa0 External func KERNEL32.dll:HeapDestroy
tid:a00e7fa0 External func KERNEL32.dll:GetOEMCP
tid:a00e7fa0 External func KERNEL32.dll:VirtualQuery
tid:a00e7fa0 External func KERNEL32.dll:RtlUnwind
tid:a00e7fa0 External func KERNEL32.dll:GetCurrentProcessId
tid:a00e7fa0 External func KERNEL32.dll:QueryPerformanceCounter
tid:a00e7fa0 External func KERNEL32.dll:GetEnvironmentStringsW
tid:a00e7fa0 External func KERNEL32.dll:FreeEnvironmentStringsW
tid:a00e7fa0 External func KERNEL32.dll:GetEnvironmentStrings
tid:a00e7fa0 External func KERNEL32.dll:FreeEnvironmentStringsA
tid:a00e7fa0 External func KERNEL32.dll:GetStartupInfoA
tid:a00e7fa0 External func KERNEL32.dll:GetFileType
tid:a00e7fa0 External func KERNEL32.dll:SetHandleCount
tid:a00e7fa0 External func KERNEL32.dll:DisableThreadLibraryCalls
tid:a00e7fa0 External func KERNEL32.dll:RaiseException
tid:a00e7fa0 External func KERNEL32.dll:HeapSize
tid:a00e7fa0 External func KERNEL32.dll:SetLastError
tid:a00e7fa0 External func KERNEL32.dll:TlsFree
tid:a00e7fa0 External func KERNEL32.dll:TlsSetValue
tid:a00e7fa0 External func KERNEL32.dll:TlsAlloc
tid:a00e7fa0 External func KERNEL32.dll:TlsGetValue
tid:a00e7fa0 External func KERNEL32.dll:GetStdHandle
tid:a00e7fa0 External func KERNEL32.dll:WriteFile
tid:a00e7fa0 External func KERNEL32.dll:ExitProcess
tid:a00e7fa0 External func KERNEL32.dll:lstrlenA
tid:a00e7fa0 External func KERNEL32.dll:GetLastError
tid:a00e7fa0 External func KERNEL32.dll:FreeLibrary
tid:a00e7fa0 External func KERNEL32.dll:LoadLibraryA
tid:a00e7fa0 External func KERNEL32.dll:GetACP
tid:a00e7fa0 External func KERNEL32.dll:GetTickCount
tid:a00e7fa0 External func KERNEL32.dll:GetVersionExA
tid:a00e7fa0 External func KERNEL32.dll:VirtualAlloc
tid:a00e7fa0 External func KERNEL32.dll:VirtualFree
tid:a00e7fa0 External func KERNEL32.dll:HeapCreate
tid:a00e7fa0 GetSystemTimeAsFileTime(0xbfffe56c)

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x00000000
0x8fe18b42 in __dyld_misaligned_stack_error ()
(gdb) bt
#0  0x8fe18b42 in __dyld_misaligned_stack_error ()
#1  0x8fe31c28 in __dyld_dyldPool ()
#2  0x0000b32d in expGetSystemTimeAsFileTime ()
#3  0x100ad4f3 in ?? ()
#4  0x100a9858 in ?? ()
#5  0x00003fe0 in MODULE_InitDll ()
#6  0x000045bc in LoadLibraryExA ()
#7  0x00004ac1 in LoadLibraryA ()
#8  0x0001242f in DS_FilterCreate ()
#9  0x0001307a in DS_VideoDecoder_Open ()
#10 0x000026be in main ()
(gdb) disass $eip-64 $eip+64
Dump of assembler code from 0x8fe18b02 to 0x8fe18b82:
0x8fe18b02
<__dyld__ZNSt6vectorIN11ImageLoader7DOFInfoESaIS1_EE13_M_insert_auxEN9__gnu_cxx1
7__normal_iteratorIPS1_S3_EERKS1_+466>:
jmp    0x8fe18979
<__dyld__ZNSt6vectorIN11ImageLoader7DOFInfoESaIS1_EE13_M_insert_auxEN9__gnu_cxx1
7__normal_iteratorIPS1_S3_EERKS1_+73>
0x8fe18b07
<__dyld__ZNSt6vectorIN11ImageLoader7DOFInfoESaIS1_EE13_M_insert_auxEN9__gnu_cxx1
7__normal_iteratorIPS1_S3_EERKS1_+471>:
lea    0xf8ab(%ebx),%eax
0x8fe18b0d
<__dyld__ZNSt6vectorIN11ImageLoader7DOFInfoESaIS1_EE13_M_insert_auxEN9__gnu_cxx1
7__normal_iteratorIPS1_S3_EERKS1_+477>:
mov    %eax,(%esp)
0x8fe18b10
<__dyld__ZNSt6vectorIN11ImageLoader7DOFInfoESaIS1_EE13_M_insert_auxEN9__gnu_cxx1
7__normal_iteratorIPS1_S3_EERKS1_+480>:
call   0x8fe18ed0 <__dyld__ZSt20__throw_length_errorPKc>
0x8fe18b15
<__dyld__ZNSt6vectorIN11ImageLoader7DOFInfoESaIS1_EE13_M_insert_auxEN9__gnu_cxx1
7__normal_iteratorIPS1_S3_EERKS1_+485>:
nop    
0x8fe18b16
<__dyld__ZNSt6vectorIN11ImageLoader7DOFInfoESaIS1_EE13_M_insert_auxEN9__gnu_cxx1
7__normal_iteratorIPS1_S3_EERKS1_+486>:
nopw   %cs:0x0(%eax,%eax,1)
0x8fe18b20 <__dyld_fast_stub_binding_helper_interface+0>:   push   $0x0
0x8fe18b22 <__dyld_stub_binding_helper_interface+0>:    sub    $0x64,%esp
0x8fe18b25 <__dyld_stub_binding_helper_interface+3>:    mov    %eax,0x54(%esp)
0x8fe18b29 <__dyld_stub_binding_helper_interface+7>:    mov    0x68(%esp),%eax
0x8fe18b2d <__dyld_stub_binding_helper_interface+11>:   mov    %eax,0x60(%esp)
0x8fe18b31 <__dyld_stub_binding_helper_interface+15>:   mov    %ebp,0x68(%esp)
0x8fe18b35 <__dyld_stub_binding_helper_interface+19>:   mov    %esp,%ebp
0x8fe18b37 <__dyld_stub_binding_helper_interface+21>:   add    $0x68,%ebp
0x8fe18b3a <__dyld_stub_binding_helper_interface+24>:   mov    %ecx,0x58(%esp)
0x8fe18b3e <__dyld_stub_binding_helper_interface+28>:   mov    %edx,0x5c(%esp)
0x8fe18b42 <__dyld_misaligned_stack_error+0>:   movdqa %xmm0,0x10(%esp)
0x8fe18b48 <__dyld_misaligned_stack_error+6>:   movdqa %xmm1,0x20(%esp)
0x8fe18b4e <__dyld_misaligned_stack_error+12>:  movdqa %xmm2,0x30(%esp)
0x8fe18b54 <__dyld_misaligned_stack_error+18>:  movdqa %xmm3,0x40(%esp)
0x8fe18b5a <__dyld_stub_binding_helper_interface2+0>:   mov    0x64(%esp),%eax
0x8fe18b5e <__dyld_stub_binding_helper_interface2+4>:   mov    %eax,0x0(%esp)
0x8fe18b62 <__dyld_stub_binding_helper_interface2+8>:   mov    0x60(%esp),%eax
0x8fe18b66 <__dyld_stub_binding_helper_interface2+12>:  mov    %eax,0x4(%esp)
0x8fe18b6a <__dyld_stub_binding_helper_interface2+16>:  call   0x8fe06e40
<__dyld__ZN4dyld14bindLazySymbolEPK11mach_headerPm>
0x8fe18b6f <__dyld_stub_binding_helper_interface2+21>:  movdqa 0x10(%esp),%xmm0
0x8fe18b75 <__dyld_stub_binding_helper_interface2+27>:  movdqa 0x20(%esp),%xmm1
0x8fe18b7b <__dyld_stub_binding_helper_interface2+33>:  movdqa 0x30(%esp),%xmm2
0x8fe18b81 <__dyld_stub_binding_helper_interface2+39>:  movdqa 0x40(%esp),%xmm3
End of assembler dump.
(gdb) info all-registers
eax            0x2615b  155995
ecx            0x31 49
edx            0x0  0
ebx            0xb301   45825
esp            0xbfffe4a4   0xbfffe4a4
ebp            0xbfffe50c   0xbfffe50c
esi            0x100a984c   269129804
edi            0xbb40e64e   -1153374642
eip            0x8fe18b42   0x8fe18b42 <__dyld_misaligned_stack_error>
eflags         0x10286  66182
cs             0x17 23
ss             0x1f 31
ds             0x1f 31
es             0x1f 31
fs             0x3f 63
gs             0x37 55
st0            <invalid float value>    (raw 0xffff0000000000000000)
st1            0    (raw 0x00000000000000000000)
st2            0    (raw 0x00000000000000000000)
st3            0    (raw 0x00000000000000000000)
st4            0    (raw 0x00000000000000000000)
st5            18226960964  (raw 0x402187cd2b4880000000)
st6            298090673995415  (raw 0x402f878e525dff4b8000)
st7            2147476857463130112  (raw 0x403bee6af697a3b24000)
fctrl          0x37f    895
fstat          0x0  0
ftag           0xffff   65535
fiseg          0x0  0
fioff          0x0  0
foseg          0x0  0
fooff          0xb04380a0   -1337753440
fop            0x0  0
xmm0           {
  v4_float = {0, 0, 0, 0}, 
  v2_double = {0, 0}, 
  v16_int8 = '\0' <repeats 15 times>, 
  v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, 
  v4_int32 = {0, 0, 0, 0}, 
  v2_int64 = {0, 0}, 
  uint128 = 0
}   (raw 0x00000000000000000000000000000000)
xmm1           {
  v4_float = {1.84921609e+31, 2.53857169e+11, 1.01397074e-38, 247907392}, 
  v2_double = {8.8810981341873615e+247, 1.3533629462147373e-306}, 
  v16_int8 = "sigeRllD\000niaMllD", 
  v8_int16 = {29545, 26469, 21100, 27716, 110, 26977, 19820, 27716}, 
  v4_int32 = {1936287589, 1382837316, 7235937, 1298951236}, 
  v2_int64 = {8316291871788526660, 31078114069867588}, 
  uint128 = 0x73696765526c6c44006e69614d6c6c44
}   (raw 0x446c6c4d61696e00446c6c5265676973)
xmm2           {
  v4_float = {0, 0, -nan(0x7fffff), -nan(0x7fffff)}, 
  v2_double = {0, -nan(0xfffffffffffff)}, 
  v16_int8 = "\000\000\000\000\000\000\000\000????????", 
  v8_int16 = {0, 0, 0, 0, -1, -1, -1, -1}, 
  v4_int32 = {0, 0, -1, -1}, 
  v2_int64 = {0, -1}, 
  uint128 = 18446744073709551615
}   (raw 0xffffffffffffffff0000000000000000)
xmm3           {
  v4_float = {2.85255462e-39, -900099.062, 8.52247494e-17, -nan(0x5eadfb)}, 
  v2_double = {4.3196445229433107e-308, 1.4451118876071399e-131}, 
  v16_int8 = "\000\037\017??[?1$ă??ޭ?", 
  v8_int16 = {31, 4035, -13989, -16335, 9412, -31792, -34, -20997}, 
  v4_int32 = {2035651, -916733903, 616858576, -2183685}, 
  v2_int64 = {8743057849303089, 2649387414469914107}, 
  uint128 = 0x001f0fc3c95bc03124c483d0ffdeadfb
}   (raw 0xfbaddeffd083c42431c05bc9c30f1f00)
xmm4           {
  v4_float = {0, 0, 7.92399693, -4.13563044e+10}, 
  v2_double = {0, 121110.17605024742}, 
  v16_int8 = "\000\000\000\000\000\000\000\000@??b?\032\020r", 
  v8_int16 = {0, 0, 0, 0, 16637, -28318, -12006, 4210}, 
  v4_int32 = {0, 0, 1090359650, -786821006}, 
  v2_int64 = {0, 4683059041136152690}, 
  uint128 = 8219098806555376960
}   (raw 0x72101ad16291fd400000000000000000)
xmm5           {
  v4_float = {0, 0, 10.7572889, 1.32753439e+10}, 
  v2_double = {0, 921325.65678266936}, 
  v16_int8 = "\000\000\000\000\000\000\000\000A,\035?PE?k", 
  v8_int16 = {0, 0, 0, 0, 16684, 7643, 20549, -11925}, 
  v4_int32 = {0, 0, 1093410267, 1346752875}, 
  v2_int64 = {0, 4696161339222380907}, 
  uint128 = 7769067045766638657
}   (raw 0x6bd14550db1d2c410000000000000000)
xmm6           {
  v4_float = {0, 0, 7.15848351, -9.58236546e-34}, 
  v2_double = {0, 43154.391677481821}, 
  v16_int8 = "\000\000\000\000\000\000\000\000@?\022L??6?", 
  v8_int16 = {0, 0, 0, 0, 16613, 4684, -30561, 14048}, 
  v4_int32 = {0, 0, 1088754252, -2002831648}, 
  v2_int64 = {0, 4676163908013078240}, 
  uint128 = 16156276120978908480
}   (raw 0xe0369f884c12e5400000000000000000)
xmm7           {
  v4_float = {0, 0, 102.728897, -2.26283802e-14}, 
  v2_double = {0, 64778396604322.984}, 
  v16_int8 = "\000\000\000\000\000\000\000\000B?u2???~", 
  v8_int16 = {0, 0, 0, 0, 17101, 30002, -22325, -11906}, 
  v4_int32 = {0, 0, 1120761138, -1463037570}, 
  v2_int64 = {0, 4813632437169672574}, 
  uint128 = 9138309042172972354
}   (raw 0x7ed1cba83275cd420000000000000000)
mxcsr          0x1f80   8064
mm0            {
  uint64 = 0, 
  v2_int32 = {0, 0}, 
  v4_int16 = {0, 0, 0, 0}, 
  v8_int8 = "\000\000\000\000\000\000\000"
}   (raw 0x0000000000000000)
mm1            {
  uint64 = 0, 
  v2_int32 = {0, 0}, 
  v4_int16 = {0, 0, 0, 0}, 
  v8_int8 = "\000\000\000\000\000\000\000"
}   (raw 0x0000000000000000)
mm2            {
  uint64 = 0, 
  v2_int32 = {0, 0}, 
  v4_int16 = {0, 0, 0, 0}, 
  v8_int8 = "\000\000\000\000\000\000\000"
}   (raw 0x0000000000000000)
mm3            {
  uint64 = 0, 
  v2_int32 = {0, 0}, 
  v4_int16 = {0, 0, 0, 0}, 
  v8_int8 = "\000\000\000\000\000\000\000"
}   (raw 0x0000000000000000)
mm4            {
  uint64 = 0, 
  v2_int32 = {0, 0}, 
  v4_int16 = {0, 0, 0, 0}, 
  v8_int8 = "\000\000\000\000\000\000\000"
}   (raw 0x0000000000000000)
mm5            {
  uint64 = -8661218917978472448, 
  v2_int32 = {-2147483648, -2016597176}, 
  v4_int16 = {0, -32768, 11080, -30771}, 
  v8_int8 = "\000\000\000?H+͇"
}   (raw 0x87cd2b4880000000)
mm6            {
  uint64 = -8678908868227792896, 
  v2_int32 = {-11829248, -2020715939}, 
  v4_int16 = {-32768, -181, 21085, -30834}, 
  v8_int8 = "\000?K?]R??"
}   (raw 0x878e525dff4b8000)
mm7            {
  uint64 = -1266929214004510720, 
  v2_int32 = {-1548599296, -294979945}, 
  v4_int16 = {16384, -23630, -2409, -4502}, 
  v8_int8 = "\000@????j?"
}   (raw 0xee6af697a3b24000)
(gdb) 

Original issue reported on code.google.com by Felix.Bu...@gmail.com on 4 Sep 2008 at 1:08

GoogleCodeExporter commented 8 years ago
Not sure if you saw this, but you mentioned problems related to unpacked 
coreavc. 
May not be helpful, but see this:
http://code.google.com/p/coreavc-for-linux/issues/detail?id=5&can=1&q=mac#c23

Original comment by nickbell...@gmail.com on 2 Dec 2008 at 5:12

GoogleCodeExporter commented 8 years ago
@nickbellomy: could you be more specific in how that thread would help me? I 
already wrote that I'm using an 
unpacked version of the ax and also postet in the thread you mentioned that it 
isn't working wit the same crash I 
reported here in detail.

Original comment by Felix.Bu...@gmail.com on 3 Dec 2008 at 12:06

GoogleCodeExporter commented 8 years ago
Felix, 

Have you had any success in getting CoreAVC working under OSX?

I am trying to accomplish the same, but without any luck so far. I have tried 
the route of 
patching mplayer directly (avoiding dshowserver), but I had to massage the 
patch a bit to get 
mplayer to build.

After building and installing, I installed an unpacked coreavc 1.8, added the 
registry info 
with serial number and added a section to codecs.conf. I set the coreavc codec 
to "untested" 
to make mplayer prefer it to the other codecs.

Then I run the following:

DYLD_BIND_AT_LAUNCH=1 mplayer -msglevel win32=9 filename.mkv 
MPlayer dev-SVN-r28180-4.0.1 (C) 2000-2008 MPlayer Team
CPU: Intel(R) Atom(TM) CPU N270   @ 1.60GHz (Family: 6, Model: 28, Stepping: 2)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
133 audio & 285 video codecs

Playing filename.mkv.
[mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0
[mkv] Track ID 2: audio (A_AC3), -aid 0, -alang und
[mkv] Will play video track 1.
Matroska file format detected.
VIDEO:  [avc1]  1280x720  24bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening video decoder: [dshow] DirectShow video codecs
tid:a03b1fa0 External func VERSION.dll:GetFileVersionInfoSizeA
tid:a03b1fa0 External func VERSION.dll:GetFileVersionInfoA
tid:a03b1fa0 External func VERSION.dll:VerQueryValueA
tid:a03b1fa0 External func ADVAPI32.dll:RegSetValueA
tid:a03b1fa0 External func ADVAPI32.dll:RegDeleteKeyA
tid:a03b1fa0 External func ADVAPI32.dll:RegEnumKeyExA
tid:a03b1fa0 External func ADVAPI32.dll:RegCreateKeyA
tid:a03b1fa0 External func ADVAPI32.dll:RegSetValueExA
tid:a03b1fa0 External func ADVAPI32.dll:RegQueryValueExA
tid:a03b1fa0 External func ADVAPI32.dll:RegOpenKeyExA
tid:a03b1fa0 External func ADVAPI32.dll:RegCloseKey
tid:a03b1fa0 External func GDI32.dll:GetStockObject
tid:a03b1fa0 External func GDI32.dll:SetBkMode
tid:a03b1fa0 External func COMCTL32.dll:InitCommonControlsEx
tid:a03b1fa0 External func USER32.dll:wvsprintfA
tid:a03b1fa0 External func USER32.dll:MoveWindow
tid:a03b1fa0 External func USER32.dll:DestroyWindow
tid:a03b1fa0 External func USER32.dll:SetTimer
tid:a03b1fa0 External func USER32.dll:CreateDialogParamA
tid:a03b1fa0 External func USER32.dll:SendDlgItemMessageA
tid:a03b1fa0 External func USER32.dll:TrackPopupMenu
tid:a03b1fa0 External func USER32.dll:KillTimer
tid:a03b1fa0 External func USER32.dll:DefWindowProcA
tid:a03b1fa0 External func USER32.dll:SetForegroundWindow
tid:a03b1fa0 External func USER32.dll:LoadMenuA
tid:a03b1fa0 External func USER32.dll:wsprintfA
tid:a03b1fa0 External func USER32.dll:FindWindowExA
tid:a03b1fa0 External func USER32.dll:GetClientRect
tid:a03b1fa0 External func USER32.dll:SendMessageA
tid:a03b1fa0 External func USER32.dll:GetForegroundWindow
tid:a03b1fa0 External func USER32.dll:SetWindowLongA
tid:a03b1fa0 External func USER32.dll:MessageBoxA
tid:a03b1fa0 External func USER32.dll:InvalidateRect
tid:a03b1fa0 External func USER32.dll:GetWindowLongA
tid:a03b1fa0 External func USER32.dll:GetDlgItem
tid:a03b1fa0 External func USER32.dll:EndDialog
tid:a03b1fa0 External func USER32.dll:GetCursorPos
tid:a03b1fa0 External func USER32.dll:ShowWindow
tid:a03b1fa0 External func USER32.dll:GetSystemMetrics
tid:a03b1fa0 External func USER32.dll:LoadImageA
tid:a03b1fa0 External func USER32.dll:MapWindowPoints
tid:a03b1fa0 External func USER32.dll:EnableWindow
tid:a03b1fa0 External func USER32.dll:DestroyMenu
tid:a03b1fa0 External func USER32.dll:GetDlgItemTextA
tid:a03b1fa0 External func USER32.dll:DialogBoxParamA
tid:a03b1fa0 External func USER32.dll:SetDlgItemTextA
tid:a03b1fa0 External func USER32.dll:IsRectEmpty
tid:a03b1fa0 External func USER32.dll:LoadStringA
tid:a03b1fa0 External func USER32.dll:LoadStringW
tid:a03b1fa0 External func USER32.dll:GetDesktopWindow
tid:a03b1fa0 External func USER32.dll:GetWindowRect
tid:a03b1fa0 External func USER32.dll:GetSubMenu
tid:a03b1fa0 External func SHELL32.dll:Shell_NotifyIconA
tid:a03b1fa0 External func SHELL32.dll:SHGetSpecialFolderPathA
tid:a03b1fa0 External func SHELL32.dll:ShellExecuteA
tid:a03b1fa0 External func SHELL32.dll:ShellExecuteExA
tid:a03b1fa0 External func OLEAUT32.dll:8
tid:a03b1fa0 External func OLEAUT32.dll:20
tid:a03b1fa0 External func OLEAUT32.dll:4
tid:a03b1fa0 External func OLEAUT32.dll:24
tid:a03b1fa0 External func OLEAUT32.dll:19
tid:a03b1fa0 External func OLEAUT32.dll:23
tid:a03b1fa0 External func OLEAUT32.dll:9
tid:a03b1fa0 External func ole32.dll:StringFromGUID2
tid:a03b1fa0 External func ole32.dll:CLSIDFromString
tid:a03b1fa0 External func ole32.dll:CoInitialize
tid:a03b1fa0 External func ole32.dll:MkParseDisplayName
tid:a03b1fa0 External func ole32.dll:CreateBindCtx
tid:a03b1fa0 External func ole32.dll:CoUninitialize
tid:a03b1fa0 External func ole32.dll:CoCreateInstance
tid:a03b1fa0 External func ole32.dll:CoTaskMemFree
tid:a03b1fa0 External func ole32.dll:CoFreeUnusedLibraries
tid:a03b1fa0 External func ole32.dll:CoTaskMemAlloc
tid:a03b1fa0 External func ole32.dll:StringFromCLSID
tid:a03b1fa0 External func KERNEL32.dll:WriteConsoleA
tid:a03b1fa0 External func KERNEL32.dll:SetStdHandle
tid:a03b1fa0 External func KERNEL32.dll:GetLocaleInfoA
tid:a03b1fa0 External func KERNEL32.dll:GetStringTypeW
tid:a03b1fa0 External func KERNEL32.dll:GetStringTypeA
tid:a03b1fa0 External func KERNEL32.dll:LCMapStringW
tid:a03b1fa0 External func KERNEL32.dll:LCMapStringA
tid:a03b1fa0 External func KERNEL32.dll:GetConsoleMode
tid:a03b1fa0 External func KERNEL32.dll:GetConsoleCP
tid:a03b1fa0 External func KERNEL32.dll:SetFilePointer
tid:a03b1fa0 External func KERNEL32.dll:RtlUnwind
tid:a03b1fa0 External func KERNEL32.dll:IsValidCodePage
tid:a03b1fa0 External func KERNEL32.dll:GetOEMCP
tid:a03b1fa0 External func KERNEL32.dll:GetCPInfo
tid:a03b1fa0 External func KERNEL32.dll:GetCurrentProcessId
tid:a03b1fa0 External func KERNEL32.dll:QueryPerformanceCounter
tid:a03b1fa0 External func KERNEL32.dll:GetEnvironmentStringsW
tid:a03b1fa0 External func KERNEL32.dll:FreeEnvironmentStringsW
tid:a03b1fa0 External func KERNEL32.dll:GetEnvironmentStrings
tid:a03b1fa0 External func KERNEL32.dll:FreeEnvironmentStringsA
tid:a03b1fa0 External func KERNEL32.dll:GetStartupInfoA
tid:a03b1fa0 External func KERNEL32.dll:GetFileType
tid:a03b1fa0 External func KERNEL32.dll:SetHandleCount
tid:a03b1fa0 External func KERNEL32.dll:RaiseException
tid:a03b1fa0 External func KERNEL32.dll:HeapSize
tid:a03b1fa0 External func KERNEL32.dll:SetLastError
tid:a03b1fa0 External func KERNEL32.dll:TlsFree
tid:a03b1fa0 External func KERNEL32.dll:TlsSetValue
tid:a03b1fa0 External func KERNEL32.dll:TlsAlloc
tid:a03b1fa0 External func KERNEL32.dll:TlsGetValue
tid:a03b1fa0 External func KERNEL32.dll:GetStdHandle
tid:a03b1fa0 External func KERNEL32.dll:WriteFile
tid:a03b1fa0 External func KERNEL32.dll:ExitProcess
tid:a03b1fa0 External func KERNEL32.dll:HeapDestroy
tid:a03b1fa0 External func KERNEL32.dll:GetSystemTimeAsFileTime
tid:a03b1fa0 External func KERNEL32.dll:GetConsoleOutputCP
tid:a03b1fa0 External func KERNEL32.dll:GetCommandLineA
tid:a03b1fa0 External func KERNEL32.dll:HeapReAlloc
tid:a03b1fa0 External func KERNEL32.dll:IsDebuggerPresent
tid:a03b1fa0 External func KERNEL32.dll:SetUnhandledExceptionFilter
tid:a03b1fa0 External func KERNEL32.dll:UnhandledExceptionFilter
tid:a03b1fa0 External func KERNEL32.dll:TerminateProcess
tid:a03b1fa0 External func KERNEL32.dll:HeapAlloc
tid:a03b1fa0 External func KERNEL32.dll:WriteConsoleW
tid:a03b1fa0 External func KERNEL32.dll:InterlockedIncrement
tid:a03b1fa0 External func KERNEL32.dll:InterlockedDecrement
tid:a03b1fa0 External func KERNEL32.dll:GetCurrentProcess
tid:a03b1fa0 External func KERNEL32.dll:WaitForSingleObject
tid:a03b1fa0 External func KERNEL32.dll:InitializeCriticalSection
tid:a03b1fa0 External func KERNEL32.dll:TerminateThread
tid:a03b1fa0 External func KERNEL32.dll:Sleep
tid:a03b1fa0 External func KERNEL32.dll:LeaveCriticalSection
tid:a03b1fa0 External func KERNEL32.dll:CreateSemaphoreA
tid:a03b1fa0 External func KERNEL32.dll:ReleaseSemaphore
tid:a03b1fa0 External func KERNEL32.dll:GetProcAddress
tid:a03b1fa0 External func KERNEL32.dll:EnterCriticalSection
tid:a03b1fa0 External func KERNEL32.dll:GetModuleHandleA
tid:a03b1fa0 External func KERNEL32.dll:DeleteCriticalSection
tid:a03b1fa0 External func KERNEL32.dll:GetCurrentThreadId
tid:a03b1fa0 External func KERNEL32.dll:CloseHandle
tid:a03b1fa0 External func KERNEL32.dll:CreateThread
tid:a03b1fa0 External func KERNEL32.dll:FindResourceA
tid:a03b1fa0 External func KERNEL32.dll:FreeResource
tid:a03b1fa0 External func KERNEL32.dll:FreeLibrary
tid:a03b1fa0 External func KERNEL32.dll:LoadResource
tid:a03b1fa0 External func KERNEL32.dll:GetUserDefaultLCID
tid:a03b1fa0 External func KERNEL32.dll:FormatMessageA
tid:a03b1fa0 External func KERNEL32.dll:WideCharToMultiByte
tid:a03b1fa0 External func KERNEL32.dll:MultiByteToWideChar
tid:a03b1fa0 External func KERNEL32.dll:GetPrivateProfileStringA
tid:a03b1fa0 External func KERNEL32.dll:LoadLibraryA
tid:a03b1fa0 External func KERNEL32.dll:WritePrivateProfileStringA
tid:a03b1fa0 External func KERNEL32.dll:LockResource
tid:a03b1fa0 External func KERNEL32.dll:GetModuleFileNameA
tid:a03b1fa0 External func KERNEL32.dll:GetVersionExA
tid:a03b1fa0 External func KERNEL32.dll:VirtualQuery
tid:a03b1fa0 External func KERNEL32.dll:CreateFileA
tid:a03b1fa0 External func KERNEL32.dll:GetProcessHeap
tid:a03b1fa0 External func KERNEL32.dll:FlushFileBuffers
tid:a03b1fa0 External func KERNEL32.dll:HeapCreate
tid:a03b1fa0 External func KERNEL32.dll:HeapFree
tid:a03b1fa0 External func KERNEL32.dll:DisableThreadLibraryCalls
tid:a03b1fa0 External func KERNEL32.dll:VirtualFree
tid:a03b1fa0 External func KERNEL32.dll:VirtualAlloc
tid:a03b1fa0 External func KERNEL32.dll:GetTickCount
tid:a03b1fa0 External func KERNEL32.dll:GetACP
tid:a03b1fa0 External func KERNEL32.dll:GetLastError
tid:a03b1fa0 External func KERNEL32.dll:lstrlenA

Here, mplayer just freezes.

It might of course be the changes I had to do to the patch to get mplayer to 
build, but I 
would be very interested in knowing if anyone have successfully used coreavc 
under OSX, and 
if so what their method was (including mplayer, coreavc-for-linux, dshowserver 
and coreavc 
revision/version numbers).

Original comment by wiese...@gmail.com on 24 Dec 2008 at 1:00

GoogleCodeExporter commented 8 years ago
Hi,

After some hacking I have CoreAVC working in OS X, using the dshowserver 
method. It still isn't quite fast enough to decode 1080p 
content at full speed (2.33 Ghz Core2 mobile processor), but it's close. There 
are still a few opportunities to improve things at this point:

- Multi-threading in the codec is not working at all, it crashes immediately, 
although the dshowserver test works.
- About 20% of the CPU (of about 140% total) is used for memcpy in mplayer; I 
believe most of this is copying from the shared memory 
buffer to mplayer's internal buffer. I expect that this could be eliminated by 
ensuring the memory copy is using copy-on-write.
- Must compile in debug mode

To solve the stack alignment problem I created a wrapper for each system call 
in the loader that aligns the stack pointer to nearest 16-
bytes before calling the actual function, then undoes its fix after the 
function return. Its only a few assembly instructions before and after 
the system call so the overhead is probably not worth noting.

I have also added cpudetect.c / cpudetect.h from current mplayer svn to take 
care of GetSystemInfo function. This doesn't quite seem to 
work however, probably the flags are wrong when compiling.

To make the solution more manageable, I created a perl script to generate the 
wrappers for each function, and a header that gets included 
in all source files (via -include passed to gcc), rather than have to touch 
each source file.

Versions used:
coreavc-for-linux: 82
CoreAVC: 1.9.5, unpacked
mplayer: 29219

loader/darwincalls.txt
    This is the list of system calls we're wrapping, I simply copied the prototypes right out of the man page(s) for each function.

loader/darwincalls.pl
    This script creates darwinstubs.h, which contains remapping macros and stub prototypes, and darwinstubsgen.h, which contains the C 
function stubs with alignment fix.

loader/darwin.h
   This is the header that gets included in all source files.

loader/darwin.c
   This includes darwinstubsgen.h and includes a few functions that my generator borks on. (The generator doesn't parse function pointer 
types yet).

loader.diff
    Misc patches to existing files (apply in loader/)

loader/compat/cpudetect.c
loader/compat/x86_cpu.h
   CPU detect from latest mplayer

Also attached are the binaries I compiled, they need to be installed the same 
way as the Linux ones (/usr/local/bin should work)

Compiling:
   Drop all files into loader/, except cpudetect.c and x86_cpu.h, those go in compat/
   Apply the patch in loader/ (patch -p0 < loader.diff)
   In dshowserver > make DEBUG=1

Happy Hacking!
-Darrell

Original comment by walis...@mac.com on 22 Apr 2009 at 1:45

GoogleCodeExporter commented 8 years ago
All files in one zip, includes binaries

Original comment by walis...@mac.com on 22 Apr 2009 at 1:47

Attachments:

GoogleCodeExporter commented 8 years ago
Ths stuff should no longer be an issue now that we're using Wine, so hopefully 
it
'just works'  If not let me know.

Original comment by alannis...@gmail.com on 8 Jan 2010 at 8:29