winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
December 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
539 discussions
Start a n
N
ew thread
Brendan Shanks : loader: In macOS preloader, manually set 'environ' to work around a bug in macOS 12 and later.
by Alexandre Julliard
01 Dec '22
01 Dec '22
Module: wine Branch: master Commit: 9ab93415f712c684f1d0cb93945a2518fa060263 URL:
https://gitlab.winehq.org/wine/wine/-/commit/9ab93415f712c684f1d0cb93945a25…
Author: Brendan Shanks <bshanks(a)codeweavers.com> Date: Tue Nov 29 15:13:09 2022 -0800 loader: In macOS preloader, manually set 'environ' to work around a bug in macOS 12 and later. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54009
--- loader/preloader_mac.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/loader/preloader_mac.c b/loader/preloader_mac.c index eb0277469a9..bb9336ead2c 100644 --- a/loader/preloader_mac.c +++ b/loader/preloader_mac.c @@ -704,6 +704,22 @@ void *wld_start( void *stack, int *is_unix_thread ) /* decrement argc and "remove" argv[0] */ fixup_stack(stack); +#if defined(__x86_64__) + /* For LC_UNIXTHREAD binaries on Monterey and later, 'environ' is not set and is NULL. + * Set the correct value here. + */ + if (*is_unix_thread) + { + char **env, ***wine_environ = pdlsym( mod, "environ" ); + + pargc = stack; + argv = (char **)pargc + 1; + env = &argv[*pargc-1] + 2; + + *wine_environ = env; + } +#endif + return entry; }
1
0
0
0
Brendan Shanks : loader: In macOS preloader, fix up argc/argv in C rather than asm.
by Alexandre Julliard
01 Dec '22
01 Dec '22
Module: wine Branch: master Commit: 588e55542525eafafd2c986b79b593f970ccd13d URL:
https://gitlab.winehq.org/wine/wine/-/commit/588e55542525eafafd2c986b79b593…
Author: Brendan Shanks <bshanks(a)codeweavers.com> Date: Tue Nov 29 15:12:13 2022 -0800 loader: In macOS preloader, fix up argc/argv in C rather than asm. --- loader/preloader_mac.c | 116 ++++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/loader/preloader_mac.c b/loader/preloader_mac.c index 7b7e589d684..eb0277469a9 100644 --- a/loader/preloader_mac.c +++ b/loader/preloader_mac.c @@ -188,13 +188,12 @@ __ASM_GLOBAL_FUNC( start, "\tmovl $0,(%eax)\n" "\tcall _wld_start\n" - /* argc/argv need to be fixed to remove argv[0]. - * With LC_MAIN, pointers to argv/env/apple are passed so this is easy. - * With LC_UNIXTHREAD, argv[1] to the end of apple[] need to be moved. - */ - "\tmovl 4(%ebp),%edi\n" - "\tdecl %edi\n" /* %edi = argc (decremented) */ - "\tleal 12(%ebp),%esi\n" /* %esi = &argv[1] */ + /* jmp based on is_unix_thread */ + "\tcmpl $0,8(%esp)\n" + "\tjne 2f\n" + + "\tmovl 4(%ebp),%edi\n" /* %edi = argc */ + "\tleal 8(%ebp),%esi\n" /* %esi = argv */ "\tleal 4(%esi,%edi,4),%edx\n" /* %edx = env */ "\tmovl %edx,%ecx\n" "1:\tmovl (%ecx),%ebx\n" @@ -202,10 +201,6 @@ __ASM_GLOBAL_FUNC( start, "\torl %ebx,%ebx\n" /* look for the NULL ending the env[] array */ "\tjnz 1b\n" /* %ecx = apple data */ - /* jmp based on is_unix_thread */ - "\tcmpl $0,8(%esp)\n" - "\tjne 2f\n" - /* LC_MAIN */ "\tmovl %edi,0(%esp)\n" /* argc */ "\tmovl %esi,4(%esp)\n" /* argv */ @@ -217,22 +212,8 @@ __ASM_GLOBAL_FUNC( start, "\thlt\n" /* LC_UNIXTHREAD */ - "2:\tmovl (%ecx),%ebx\n" - "\tadd $4,%ecx\n" - "\torl %ebx,%ebx\n" /* look for the NULL ending the apple[] array */ - "\tjnz 2b\n" /* %ecx = end of apple[] */ - - "\tsubl %ebp,%ecx\n" - "\tsubl $8,%ecx\n" - "\tleal 4(%ebp),%esp\n" - "\tsubl %ecx,%esp\n" - - "\tmovl %edi,(%esp)\n" /* argc */ - "\tleal 4(%esp),%edi\n" - "\tshrl $2,%ecx\n" - "\tcld\n" - "\trep; movsd\n" /* argv, ... */ - + "\t2:movl %ebp,%esp\n" /* restore the unaligned stack pointer */ + "\taddl $4,%esp\n" /* remove the debugger end frame marker */ "\tmovl $0,%ebp\n" /* restore ebp back to zero */ "\tjmpl *%eax\n" ) /* jump to the entry point */ @@ -279,13 +260,13 @@ __ASM_GLOBAL_FUNC( start, "\tmovq $0,(%rsi)\n" "\tcall _wld_start\n" - /* argc/argv need to be fixed to remove argv[0]. - * With LC_MAIN, pointers to argv/env/apple are passed so this is easy. - * With LC_UNIXTHREAD, argv[1] to the end of apple[] need to be moved. - */ - "\tmovq 8(%rbp),%rdi\n" - "\tdec %rdi\n" /* %rdi = argc (decremented) */ - "\tleaq 24(%rbp),%rsi\n" /* %rsi = &argv[1] */ + /* jmp based on is_unix_thread */ + "\tcmpl $0,0(%rsp)\n" + "\tjne 2f\n" + + /* LC_MAIN */ + "\tmovq 8(%rbp),%rdi\n" /* %rdi = argc */ + "\tleaq 16(%rbp),%rsi\n" /* %rsi = argv */ "\tleaq 8(%rsi,%rdi,8),%rdx\n" /* %rdx = env */ "\tmovq %rdx,%rcx\n" "1:\tmovq (%rcx),%r8\n" @@ -293,11 +274,6 @@ __ASM_GLOBAL_FUNC( start, "\torq %r8,%r8\n" /* look for the NULL ending the env[] array */ "\tjnz 1b\n" /* %rcx = apple data */ - /* jmp based on is_unix_thread */ - "\tcmpl $0,0(%rsp)\n" - "\tjne 2f\n" - - /* LC_MAIN */ "\taddq $16,%rsp\n" /* remove local variables */ "\tcall *%rax\n" /* call main(argc,argv,env,apple) */ "\tmovq %rax,%rdi\n" /* pass result from main() to exit() */ @@ -305,22 +281,8 @@ __ASM_GLOBAL_FUNC( start, "\thlt\n" /* LC_UNIXTHREAD */ - "2:\tmovq (%rcx),%r8\n" - "\taddq $8,%rcx\n" - "\torq %r8,%r8\n" /* look for the NULL ending the apple[] array */ - "\tjnz 2b\n" /* %rcx = end of apple[] */ - - "\tsubq %rbp,%rcx\n" - "\tsubq $16,%rcx\n" - "\tleaq 8(%rbp),%rsp\n" - "\tsubq %rcx,%rsp\n" - - "\tmovq %rdi,(%rsp)\n" /* argc */ - "\tleaq 8(%rsp),%rdi\n" - "\tshrq $3,%rcx\n" - "\tcld\n" - "\trep; movsq\n" /* argv, ... */ - + "\t2:movq %rbp,%rsp\n" /* restore the unaligned stack pointer */ + "\taddq $8,%rsp\n" /* remove the debugger end frame marker */ "\tmovq $0,%rbp\n" /* restore ebp back to zero */ "\tjmpq *%rax\n" ) /* jump to the entry point */ @@ -355,6 +317,23 @@ extern int _dyld_func_lookup( const char *dyld_func_name, void **address ); /* replacement for libc functions */ +void * memmove( void *dst, const void *src, size_t len ) +{ + char *d = dst; + const char *s = src; + if (d < s) + while (len--) + *d++ = *s++; + else + { + const char *lasts = s + (len-1); + char *lastd = d + (len-1); + while (len--) + *lastd-- = *lasts--; + } + return dst; +} + static int wld_strncmp( const char *str1, const char *str2, size_t len ) { if (len <= 0) return 0; @@ -637,6 +616,30 @@ static inline void get_dyld_func( const char *name, void **func ) #define LOAD_POSIX_DYLD_FUNC(f) get_dyld_func( "__dyld_" #f, (void **)&p##f ) #define LOAD_MACHO_DYLD_FUNC(f) get_dyld_func( "_" #f, (void **)&p##f ) +static void fixup_stack( void *stack ) +{ + int *pargc; + char **argv, **env, **apple, **apple_end; + + pargc = stack; + argv = (char **)pargc + 1; + env = &argv[*pargc-1] + 2; + + apple = env; + while (*apple) + apple++; + apple++; + + apple_end = apple; + while (*apple_end) + apple_end++; + apple_end++; + + /* decrement argc, and move all the data between &argv[1] and apple_end down to start at &argv[0] */ + *pargc = *pargc - 1; + memmove(&argv[0], &argv[1], (char *)apple_end - (char *)&argv[1]); +} + void *wld_start( void *stack, int *is_unix_thread ) { struct wine_preload_info builtin_dlls = { (void *)0x7a000000, 0x02000000 }; @@ -698,6 +701,9 @@ void *wld_start( void *stack, int *is_unix_thread ) if (!(entry = get_entry_point( mh, p_dyld_get_image_slide(mh), is_unix_thread ))) fatal_error( "%s: could not find entry point\n", argv[1] ); + /* decrement argc and "remove" argv[0] */ + fixup_stack(stack); + return entry; }
1
0
0
0
Brendan Shanks : loader: Add comments to 'start' in macOS preloader.
by Alexandre Julliard
01 Dec '22
01 Dec '22
Module: wine Branch: master Commit: 4ec770a139774255d199c5844d8630b32455c8d9 URL:
https://gitlab.winehq.org/wine/wine/-/commit/4ec770a139774255d199c5844d8630…
Author: Brendan Shanks <bshanks(a)codeweavers.com> Date: Mon Nov 28 15:50:54 2022 -0800 loader: Add comments to 'start' in macOS preloader. --- loader/preloader_mac.c | 129 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 91 insertions(+), 38 deletions(-) diff --git a/loader/preloader_mac.c b/loader/preloader_mac.c index 01a41f08d8c..7b7e589d684 100644 --- a/loader/preloader_mac.c +++ b/loader/preloader_mac.c @@ -101,6 +101,47 @@ void *__stack_chk_guard = 0; void __stack_chk_fail_local(void) { return; } void __stack_chk_fail(void) { return; } +/* + * When 'start' is called, stack frame looks like: + * + * : + * | STRING AREA | + * +-------------+ + * | 0 | + * +-------------+ + * | exec_path | extra "apple" parameters start after NULL terminating env array + * +-------------+ + * | 0 | + * +-------------+ + * | env[n] | + * +-------------+ + * : + * : + * +-------------+ + * | env[0] | + * +-------------+ + * | 0 | + * +-------------+ + * | arg[argc-1] | + * +-------------+ + * : + * : + * +-------------+ + * | arg[0] | + * +-------------+ + * | argc | argc is always 4 bytes long, even in 64-bit architectures + * +-------------+ <- sp + * + * Where arg[i] and env[i] point into the STRING AREA + * + * See also: + * macOS C runtime 'start': + * <
https://github.com/apple-oss-distributions/Csu/blob/Csu-88/start.s
> + * + * macOS dyld '__dyld_start' (pre-dyld4): + * <
https://github.com/apple-oss-distributions/dyld/blob/dyld-852.2/src/dyldSta…
> + */ + #ifdef __i386__ static const size_t page_size = 0x1000; @@ -132,13 +173,14 @@ static const size_t page_mask = 0xfff; __ASM_GLOBAL_FUNC( start, __ASM_CFI("\t.cfi_undefined %eip\n") /* The first 16 bytes are used as a function signature on i386 */ - "\t.byte 0x6a,0x00\n" /* pushl $0 */ - "\t.byte 0x89,0xe5\n" /* movl %esp,%ebp */ - "\t.byte 0x83,0xe4,0xf0\n" /* andl $-16,%esp */ - "\t.byte 0x83,0xec,0x10\n" /* subl $16,%esp */ - "\t.byte 0x8b,0x5d,0x04\n" /* movl 4(%ebp),%ebx */ - "\t.byte 0x89,0x5c,0x24,0x00\n" /* movl %ebx,0(%esp) */ - + "\t.byte 0x6a,0x00\n" /* pushl $0: push a zero for debugger end of frames marker */ + "\t.byte 0x89,0xe5\n" /* movl %esp,%ebp: pointer to base of kernel frame */ + "\t.byte 0x83,0xe4,0xf0\n" /* andl $-16,%esp: force SSE alignment */ + "\t.byte 0x83,0xec,0x10\n" /* subl $16,%esp: room for new argc, argv, & envp, SSE aligned */ + "\t.byte 0x8b,0x5d,0x04\n" /* movl 4(%ebp),%ebx: pickup argc in %ebx */ + "\t.byte 0x89,0x5c,0x24,0x00\n" /* movl %ebx,0(%esp): argc to reserved stack word */ + + /* call wld_start(stack, &is_unix_thread) */ "\tleal 4(%ebp),%eax\n" "\tmovl %eax,0(%esp)\n" /* stack */ "\tleal 8(%esp),%eax\n" @@ -146,16 +188,21 @@ __ASM_GLOBAL_FUNC( start, "\tmovl $0,(%eax)\n" "\tcall _wld_start\n" + /* argc/argv need to be fixed to remove argv[0]. + * With LC_MAIN, pointers to argv/env/apple are passed so this is easy. + * With LC_UNIXTHREAD, argv[1] to the end of apple[] need to be moved. + */ "\tmovl 4(%ebp),%edi\n" - "\tdecl %edi\n" /* argc */ - "\tleal 12(%ebp),%esi\n" /* argv */ - "\tleal 4(%esi,%edi,4),%edx\n" /* env */ - "\tmovl %edx,%ecx\n" /* apple data */ + "\tdecl %edi\n" /* %edi = argc (decremented) */ + "\tleal 12(%ebp),%esi\n" /* %esi = &argv[1] */ + "\tleal 4(%esi,%edi,4),%edx\n" /* %edx = env */ + "\tmovl %edx,%ecx\n" "1:\tmovl (%ecx),%ebx\n" "\tadd $4,%ecx\n" - "\torl %ebx,%ebx\n" - "\tjnz 1b\n" + "\torl %ebx,%ebx\n" /* look for the NULL ending the env[] array */ + "\tjnz 1b\n" /* %ecx = apple data */ + /* jmp based on is_unix_thread */ "\tcmpl $0,8(%esp)\n" "\tjne 2f\n" @@ -164,16 +211,16 @@ __ASM_GLOBAL_FUNC( start, "\tmovl %esi,4(%esp)\n" /* argv */ "\tmovl %edx,8(%esp)\n" /* env */ "\tmovl %ecx,12(%esp)\n" /* apple data */ - "\tcall *%eax\n" - "\tmovl %eax,(%esp)\n" - "\tcall _wld_exit\n" + "\tcall *%eax\n" /* call main(argc,argv,env,apple) */ + "\tmovl %eax,(%esp)\n" /* pass result from main() to exit() */ + "\tcall _wld_exit\n" /* need to use call to keep stack aligned */ "\thlt\n" /* LC_UNIXTHREAD */ "2:\tmovl (%ecx),%ebx\n" "\tadd $4,%ecx\n" - "\torl %ebx,%ebx\n" - "\tjnz 2b\n" + "\torl %ebx,%ebx\n" /* look for the NULL ending the apple[] array */ + "\tjnz 2b\n" /* %ecx = end of apple[] */ "\tsubl %ebp,%ecx\n" "\tsubl $8,%ecx\n" @@ -186,8 +233,8 @@ __ASM_GLOBAL_FUNC( start, "\tcld\n" "\trep; movsd\n" /* argv, ... */ - "\tmovl $0,%ebp\n" - "\tjmpl *%eax\n" ) + "\tmovl $0,%ebp\n" /* restore ebp back to zero */ + "\tjmpl *%eax\n" ) /* jump to the entry point */ #elif defined(__x86_64__) @@ -221,41 +268,47 @@ static const size_t page_mask = 0xfff; __ASM_GLOBAL_FUNC( start, __ASM_CFI("\t.cfi_undefined %rip\n") - "\tpushq $0\n" - "\tmovq %rsp,%rbp\n" - "\tandq $-16,%rsp\n" - "\tsubq $16,%rsp\n" + "\tpushq $0\n" /* push a zero for debugger end of frames marker */ + "\tmovq %rsp,%rbp\n" /* pointer to base of kernel frame */ + "\tandq $-16,%rsp\n" /* force SSE alignment */ + "\tsubq $16,%rsp\n" /* room for local variables */ + /* call wld_start(stack, &is_unix_thread) */ "\tleaq 8(%rbp),%rdi\n" /* stack */ "\tmovq %rsp,%rsi\n" /* &is_unix_thread */ "\tmovq $0,(%rsi)\n" "\tcall _wld_start\n" + /* argc/argv need to be fixed to remove argv[0]. + * With LC_MAIN, pointers to argv/env/apple are passed so this is easy. + * With LC_UNIXTHREAD, argv[1] to the end of apple[] need to be moved. + */ "\tmovq 8(%rbp),%rdi\n" - "\tdec %rdi\n" /* argc */ - "\tleaq 24(%rbp),%rsi\n" /* argv */ - "\tleaq 8(%rsi,%rdi,8),%rdx\n" /* env */ - "\tmovq %rdx,%rcx\n" /* apple data */ + "\tdec %rdi\n" /* %rdi = argc (decremented) */ + "\tleaq 24(%rbp),%rsi\n" /* %rsi = &argv[1] */ + "\tleaq 8(%rsi,%rdi,8),%rdx\n" /* %rdx = env */ + "\tmovq %rdx,%rcx\n" "1:\tmovq (%rcx),%r8\n" "\taddq $8,%rcx\n" - "\torq %r8,%r8\n" - "\tjnz 1b\n" + "\torq %r8,%r8\n" /* look for the NULL ending the env[] array */ + "\tjnz 1b\n" /* %rcx = apple data */ + /* jmp based on is_unix_thread */ "\tcmpl $0,0(%rsp)\n" "\tjne 2f\n" /* LC_MAIN */ - "\taddq $16,%rsp\n" - "\tcall *%rax\n" - "\tmovq %rax,%rdi\n" - "\tcall _wld_exit\n" + "\taddq $16,%rsp\n" /* remove local variables */ + "\tcall *%rax\n" /* call main(argc,argv,env,apple) */ + "\tmovq %rax,%rdi\n" /* pass result from main() to exit() */ + "\tcall _wld_exit\n" /* need to use call to keep stack aligned */ "\thlt\n" /* LC_UNIXTHREAD */ "2:\tmovq (%rcx),%r8\n" "\taddq $8,%rcx\n" - "\torq %r8,%r8\n" - "\tjnz 2b\n" + "\torq %r8,%r8\n" /* look for the NULL ending the apple[] array */ + "\tjnz 2b\n" /* %rcx = end of apple[] */ "\tsubq %rbp,%rcx\n" "\tsubq $16,%rcx\n" @@ -268,8 +321,8 @@ __ASM_GLOBAL_FUNC( start, "\tcld\n" "\trep; movsq\n" /* argv, ... */ - "\tmovq $0,%rbp\n" - "\tjmpq *%rax\n" ) + "\tmovq $0,%rbp\n" /* restore ebp back to zero */ + "\tjmpq *%rax\n" ) /* jump to the entry point */ #else #error preloader not implemented for this CPU
1
0
0
0
Alex Henrie : include: Annotate WlanAllocateMemory with __WINE_(ALLOC_SIZE|DEALLOC|MALLOC).
by Alexandre Julliard
01 Dec '22
01 Dec '22
Module: wine Branch: master Commit: 57ce3b9190615e5380fc25783a5652650fbd083f URL:
https://gitlab.winehq.org/wine/wine/-/commit/57ce3b9190615e5380fc25783a5652…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Wed Nov 30 19:28:22 2022 -0700 include: Annotate WlanAllocateMemory with __WINE_(ALLOC_SIZE|DEALLOC|MALLOC). --- include/wlanapi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wlanapi.h b/include/wlanapi.h index 13118cbf303..5150ff09f47 100644 --- a/include/wlanapi.h +++ b/include/wlanapi.h @@ -247,8 +247,8 @@ typedef struct _WLAN_HOSTED_NETWORK_STATUS DWORD WINAPI WlanCloseHandle(HANDLE, void *); DWORD WINAPI WlanEnumInterfaces(HANDLE, void *, WLAN_INTERFACE_INFO_LIST **); DWORD WINAPI WlanOpenHandle(DWORD, void *, DWORD *, HANDLE *); -void *WINAPI WlanAllocateMemory(DWORD); void WINAPI WlanFreeMemory(void *); +void *WINAPI WlanAllocateMemory(DWORD) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(WlanFreeMemory) __WINE_MALLOC; DWORD WINAPI WlanScan(HANDLE, const GUID *, const DOT11_SSID *, const WLAN_RAW_DATA *, void *); DWORD WINAPI WlanRegisterNotification(HANDLE, DWORD, BOOL, WLAN_NOTIFICATION_CALLBACK, void *, void *, DWORD *); DWORD WINAPI WlanGetAvailableNetworkList(HANDLE, const GUID *, DWORD, void *, WLAN_AVAILABLE_NETWORK_LIST **);
1
0
0
0
Alex Henrie : services: Use standard C functions for memory allocation.
by Alexandre Julliard
01 Dec '22
01 Dec '22
Module: wine Branch: master Commit: 6136b547570d4edff37d5ce4efc5dd9270b8d231 URL:
https://gitlab.winehq.org/wine/wine/-/commit/6136b547570d4edff37d5ce4efc5dd…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Wed Nov 30 19:21:15 2022 -0700 services: Use standard C functions for memory allocation. --- programs/services/rpc.c | 71 +++++++++++++++--------------- programs/services/services.c | 101 +++++++++++++++++++++---------------------- programs/services/services.h | 1 - programs/services/utils.c | 30 ++++--------- 4 files changed, 93 insertions(+), 110 deletions(-)
1
0
0
0
Anton Baskanov : winegstreamer: Register MPEG layer-3 decoder.
by Alexandre Julliard
01 Dec '22
01 Dec '22
Module: wine Branch: master Commit: 4192ee265715415682a2d050c0215d36db4b7a07 URL:
https://gitlab.winehq.org/wine/wine/-/commit/4192ee265715415682a2d050c0215d…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Wed Oct 5 12:23:24 2022 +0700 winegstreamer: Register MPEG layer-3 decoder. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> --- dlls/winegstreamer/main.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index fc7344df50c..9e54780ac4e 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -34,6 +34,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz); DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); DEFINE_GUID(MEDIASUBTYPE_VC1S,MAKEFOURCC('V','C','1','S'),0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71); +static const GUID MEDIASUBTYPE_MP3 = {0x00000055, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; + bool array_reserve(void **elements, size_t *capacity, size_t count, size_t size) { unsigned int new_capacity, max_capacity; @@ -582,6 +584,37 @@ static const REGFILTER2 reg_mpeg_audio_codec = .u.s2.rgPins2 = reg_mpeg_audio_codec_pins, }; +static const REGPINTYPES reg_mpeg_layer3_decoder_sink_mts[1] = +{ + {&MEDIATYPE_Audio, &MEDIASUBTYPE_MP3}, +}; + +static const REGPINTYPES reg_mpeg_layer3_decoder_source_mts[1] = +{ + {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM}, +}; + +static const REGFILTERPINS2 reg_mpeg_layer3_decoder_pins[2] = +{ + { + .nMediaTypes = 1, + .lpMediaType = reg_mpeg_layer3_decoder_sink_mts, + }, + { + .dwFlags = REG_PINFLAG_B_OUTPUT, + .nMediaTypes = 1, + .lpMediaType = reg_mpeg_layer3_decoder_source_mts, + }, +}; + +static const REGFILTER2 reg_mpeg_layer3_decoder = +{ + .dwVersion = 2, + .dwMerit = 0x00810000, + .u.s2.cPins2 = 2, + .u.s2.rgPins2 = reg_mpeg_layer3_decoder_pins, +}; + static const REGPINTYPES reg_mpeg_splitter_sink_mts[4] = { {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Audio}, @@ -786,6 +819,8 @@ HRESULT WINAPI DllRegisterServer(void) L"GStreamer splitter filter", NULL, NULL, NULL, ®_decodebin_parser); IFilterMapper2_RegisterFilter(mapper, &CLSID_CMpegAudioCodec, L"MPEG Audio Decoder", NULL, NULL, NULL, ®_mpeg_audio_codec); + IFilterMapper2_RegisterFilter(mapper, &CLSID_mpeg_layer3_decoder, + L"MPEG Layer-3 Decoder", NULL, NULL, NULL, ®_mpeg_layer3_decoder); IFilterMapper2_RegisterFilter(mapper, &CLSID_MPEG1Splitter, L"MPEG-I Stream Splitter", NULL, NULL, NULL, ®_mpeg_splitter); IFilterMapper2_RegisterFilter(mapper, &CLSID_WAVEParser, L"Wave Parser", NULL, NULL, NULL, ®_wave_parser); @@ -825,6 +860,7 @@ HRESULT WINAPI DllUnregisterServer(void) IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_AviSplitter); IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_decodebin_parser); IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_CMpegAudioCodec); + IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_mpeg_layer3_decoder); IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_MPEG1Splitter); IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_WAVEParser);
1
0
0
0
Anton Baskanov : quartz/tests: Add tests for MPEG layer-3 decoder quality control.
by Alexandre Julliard
01 Dec '22
01 Dec '22
Module: wine Branch: master Commit: 5d8ef3ffe9e0cbef994ecb5d05b798166624c934 URL:
https://gitlab.winehq.org/wine/wine/-/commit/5d8ef3ffe9e0cbef994ecb5d05b798…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Wed Oct 5 12:21:58 2022 +0700 quartz/tests: Add tests for MPEG layer-3 decoder quality control. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> --- dlls/quartz/tests/mpeglayer3.c | 223 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 223 insertions(+) diff --git a/dlls/quartz/tests/mpeglayer3.c b/dlls/quartz/tests/mpeglayer3.c index 4c8a9659457..7f7b8bf245f 100644 --- a/dlls/quartz/tests/mpeglayer3.c +++ b/dlls/quartz/tests/mpeglayer3.c @@ -775,11 +775,118 @@ static void test_media_types(void) ok(!ref, "Got outstanding refcount %ld.\n", ref); } +struct testqc +{ + IQualityControl IQualityControl_iface; + IUnknown IUnknown_inner; + IUnknown *outer_unk; + LONG refcount; + IBaseFilter *notify_sender; + Quality notify_quality; + HRESULT notify_hr; +}; + +static struct testqc *impl_from_IQualityControl(IQualityControl *iface) +{ + return CONTAINING_RECORD(iface, struct testqc, IQualityControl_iface); +} + +static HRESULT WINAPI testqc_QueryInterface(IQualityControl *iface, REFIID iid, void **out) +{ + struct testqc *qc = impl_from_IQualityControl(iface); + return IUnknown_QueryInterface(qc->outer_unk, iid, out); +} + +static ULONG WINAPI testqc_AddRef(IQualityControl *iface) +{ + struct testqc *qc = impl_from_IQualityControl(iface); + return IUnknown_AddRef(qc->outer_unk); +} + +static ULONG WINAPI testqc_Release(IQualityControl *iface) +{ + struct testqc *qc = impl_from_IQualityControl(iface); + return IUnknown_Release(qc->outer_unk); +} + +static HRESULT WINAPI testqc_Notify(IQualityControl *iface, IBaseFilter *sender, Quality q) +{ + struct testqc *qc = impl_from_IQualityControl(iface); + + qc->notify_sender = sender; + qc->notify_quality = q; + + return qc->notify_hr; +} + +static HRESULT WINAPI testqc_SetSink(IQualityControl *iface, IQualityControl *sink) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static const IQualityControlVtbl testqc_vtbl = +{ + testqc_QueryInterface, + testqc_AddRef, + testqc_Release, + testqc_Notify, + testqc_SetSink, +}; + +static struct testqc *impl_from_qc_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, struct testqc, IUnknown_inner); +} + +static HRESULT WINAPI testqc_inner_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{ + struct testqc *qc = impl_from_qc_IUnknown(iface); + + if (IsEqualIID(iid, &IID_IUnknown)) + *out = iface; + else if (IsEqualIID(iid, &IID_IQualityControl)) + *out = &qc->IQualityControl_iface; + else + return E_NOINTERFACE; + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + +static ULONG WINAPI testqc_inner_AddRef(IUnknown *iface) +{ + struct testqc *qc = impl_from_qc_IUnknown(iface); + return InterlockedIncrement(&qc->refcount); +} + +static ULONG WINAPI testqc_inner_Release(IUnknown *iface) +{ + struct testqc *qc = impl_from_qc_IUnknown(iface); + return InterlockedDecrement(&qc->refcount); +} + +static const IUnknownVtbl testqc_inner_vtbl = +{ + testqc_inner_QueryInterface, + testqc_inner_AddRef, + testqc_inner_Release, +}; + +static void testqc_init(struct testqc *qc, IUnknown *outer) +{ + memset(qc, 0, sizeof(*qc)); + qc->IQualityControl_iface.lpVtbl = &testqc_vtbl; + qc->IUnknown_inner.lpVtbl = &testqc_inner_vtbl; + qc->outer_unk = outer ? outer : &qc->IUnknown_inner; +} + struct testfilter { struct strmbase_filter filter; struct strmbase_source source; struct strmbase_sink sink; + struct testqc *qc; const AM_MEDIA_TYPE *mt; unsigned int got_sample, got_new_segment, got_eos, got_begin_flush, got_end_flush; LONG sample_size; @@ -815,6 +922,19 @@ static const struct strmbase_filter_ops testfilter_ops = .filter_destroy = testfilter_destroy, }; +static HRESULT testsource_query_interface(struct strmbase_pin *iface, REFIID iid, void **out) +{ + struct testfilter *filter = impl_from_strmbase_filter(iface->filter); + + if (IsEqualGUID(iid, &IID_IQualityControl) && filter->qc) + *out = &filter->qc->IQualityControl_iface; + else + return E_NOINTERFACE; + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, IMemInputPin *peer, IMemAllocator **allocator) { @@ -823,6 +943,7 @@ static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, static const struct strmbase_source_ops testsource_ops = { + .base.pin_query_interface = testsource_query_interface, .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection, .pfnDecideAllocator = testsource_DecideAllocator, }; @@ -1066,6 +1187,107 @@ static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control, IFilterGraph2_Disconnect(graph, &testsource->source.pin.IPin_iface); } +static void test_quality_control(IFilterGraph2 *graph, IBaseFilter *filter, + IPin *sink, IPin *source, struct testfilter *testsource, struct testfilter *testsink) +{ + struct testqc testsource_qc; + IQualityControl *source_qc; + IQualityControl *sink_qc; + Quality quality = {0}; + struct testqc qc; + HRESULT hr; + + testqc_init(&testsource_qc, testsource->filter.outer_unk); + testqc_init(&qc, NULL); + + hr = IPin_QueryInterface(sink, &IID_IQualityControl, (void **)&sink_qc); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IPin_QueryInterface(source, &IID_IQualityControl, (void **)&source_qc); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IQualityControl_Notify(sink_qc, &testsink->filter.IBaseFilter_iface, quality); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr); + + hr = IQualityControl_SetSink(sink_qc, &qc.IQualityControl_iface); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + qc.notify_sender = (IBaseFilter *)0xdeadbeef; + memset(&qc.notify_quality, 0xaa, sizeof(qc.notify_quality)); + hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(qc.notify_sender == filter, "Got sender %p.\n", qc.notify_sender); + ok(!memcmp(&qc.notify_quality, &quality, sizeof(quality)), "Quality didn't match.\n"); + hr = IQualityControl_SetSink(sink_qc, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IQualityControl_SetSink(source_qc, &qc.IQualityControl_iface); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + qc.notify_sender = (IBaseFilter *)0xdeadbeef; + hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr); + ok(qc.notify_sender == (IBaseFilter *)0xdeadbeef, "Got sender %p.\n", qc.notify_sender); + hr = IQualityControl_SetSink(source_qc, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IFilterGraph2_ConnectDirect(graph, &testsource->source.pin.IPin_iface, sink, &mp3_mt1); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr); + + testsource->qc = &testsource_qc; + + qc.notify_sender = (IBaseFilter *)0xdeadbeef; + hr = IQualityControl_Notify(sink_qc, &testsink->filter.IBaseFilter_iface, quality); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(qc.notify_sender == (IBaseFilter *)0xdeadbeef, "Got sender %p.\n", qc.notify_sender); + + testsource_qc.notify_sender = (IBaseFilter *)0xdeadbeef; + memset(&testsource_qc.notify_quality, 0xaa, sizeof(testsource_qc.notify_quality)); + hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(testsource_qc.notify_sender == filter, "Got sender %p.\n", testsource_qc.notify_sender); + ok(!memcmp(&testsource_qc.notify_quality, &quality, sizeof(quality)), "Quality didn't match.\n"); + + testsource_qc.notify_hr = E_FAIL; + hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality); + ok(hr == E_FAIL, "Got hr %#lx.\n", hr); + testsource_qc.notify_hr = S_OK; + + hr = IQualityControl_SetSink(sink_qc, &qc.IQualityControl_iface); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + qc.notify_sender = (IBaseFilter *)0xdeadbeef; + memset(&qc.notify_quality, 0xaa, sizeof(qc.notify_quality)); + hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(qc.notify_sender == filter, "Got sender %p.\n", qc.notify_sender); + ok(!memcmp(&qc.notify_quality, &quality, sizeof(quality)), "Quality didn't match.\n"); + hr = IQualityControl_SetSink(sink_qc, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IQualityControl_SetSink(source_qc, &qc.IQualityControl_iface); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + qc.notify_sender = (IBaseFilter *)0xdeadbeef; + hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(qc.notify_sender == (IBaseFilter *)0xdeadbeef, "Got sender %p.\n", qc.notify_sender); + hr = IQualityControl_SetSink(source_qc, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + IFilterGraph2_Disconnect(graph, sink); + IFilterGraph2_Disconnect(graph, &testsource->source.pin.IPin_iface); + + hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr); + + IQualityControl_Release(source_qc); + IQualityControl_Release(sink_qc); + + testsource->qc = NULL; +} + static void test_sample_processing(IMediaControl *control, IMemInputPin *meminput, struct testfilter *testsink) { @@ -1311,6 +1533,7 @@ static void test_connect_pin(void) IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control); test_source_allocator(graph, control, sink, source, &testsource, &testsink); + test_quality_control(graph, filter, sink, source, &testsource, &testsink); /* Test sink connection. */
1
0
0
0
Anton Baskanov : quartz/tests: Add tests for MPEG layer-3 decoder streaming events.
by Alexandre Julliard
01 Dec '22
01 Dec '22
Module: wine Branch: master Commit: ac83c31e96d4a9ee6b13a6a66b756e6452f233e2 URL:
https://gitlab.winehq.org/wine/wine/-/commit/ac83c31e96d4a9ee6b13a6a66b756e…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Wed Oct 5 11:45:36 2022 +0700 quartz/tests: Add tests for MPEG layer-3 decoder streaming events. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> --- dlls/quartz/tests/mpeglayer3.c | 131 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 130 insertions(+), 1 deletion(-) diff --git a/dlls/quartz/tests/mpeglayer3.c b/dlls/quartz/tests/mpeglayer3.c index 1509d628954..4c8a9659457 100644 --- a/dlls/quartz/tests/mpeglayer3.c +++ b/dlls/quartz/tests/mpeglayer3.c @@ -781,7 +781,7 @@ struct testfilter struct strmbase_source source; struct strmbase_sink sink; const AM_MEDIA_TYPE *mt; - unsigned int got_sample; + unsigned int got_sample, got_new_segment, got_eos, got_begin_flush, got_end_flush; LONG sample_size; LONG sample_actual; REFERENCE_TIME sample_start_time; @@ -886,12 +886,48 @@ static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample return S_OK; } +static HRESULT testsink_new_segment(struct strmbase_sink *iface, + REFERENCE_TIME start, REFERENCE_TIME stop, double rate) +{ + struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter); + ++filter->got_new_segment; + ok(start == 10000, "Got start %s.\n", wine_dbgstr_longlong(start)); + ok(stop == 20000, "Got stop %s.\n", wine_dbgstr_longlong(stop)); + ok(rate == 1.0, "Got rate %.16e.\n", rate); + return S_OK; +} + +static HRESULT testsink_eos(struct strmbase_sink *iface) +{ + struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter); + ++filter->got_eos; + return S_OK; +} + +static HRESULT testsink_begin_flush(struct strmbase_sink *iface) +{ + struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter); + ++filter->got_begin_flush; + return S_OK; +} + +static HRESULT testsink_end_flush(struct strmbase_sink *iface) +{ + struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter); + ++filter->got_end_flush; + return S_OK; +} + static const struct strmbase_sink_ops testsink_ops = { .base.pin_query_interface = testsink_query_interface, .base.pin_get_media_type = testsink_get_media_type, .sink_connect = testsink_connect, .pfnReceive = testsink_Receive, + .sink_new_segment = testsink_new_segment, + .sink_eos = testsink_eos, + .sink_begin_flush = testsink_begin_flush, + .sink_end_flush = testsink_end_flush, }; static void testfilter_init(struct testfilter *filter) @@ -1152,6 +1188,98 @@ static void test_sample_processing(IMediaControl *control, IMemAllocator_Release(allocator); } +static void test_streaming_events(IMediaControl *control, IPin *sink, + IMemInputPin *meminput, struct testfilter *testsink) +{ + REFERENCE_TIME start, stop; + IMemAllocator *allocator; + IMediaSample *sample; + HRESULT hr; + BYTE *data; + + hr = IMediaControl_Pause(control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMemInputPin_GetAllocator(meminput, &allocator); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemAllocator_Commit(allocator); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMediaSample_GetPointer(sample, &data); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + memset(data, 0, 144); + data[0] = 0xff; + data[1] = 0xfb; + data[2] = 0x18; + data[3] = 0xc4; + hr = IMediaSample_SetActualDataLength(sample, 144); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + start = 0; + stop = 120000; + hr = IMediaSample_SetTime(sample, &start, &stop); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + ok(!testsink->got_new_segment, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment); + hr = IPin_NewSegment(sink, 10000, 20000, 1.0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(testsink->got_new_segment == 1, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment); + testsink->got_new_segment = 0; + + ok(!testsink->got_eos, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos); + hr = IPin_EndOfStream(sink); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(!testsink->got_sample, "Got %u calls to Receive().\n", testsink->got_sample); + ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos); + testsink->got_eos = 0; + + hr = IPin_EndOfStream(sink); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos); + testsink->got_eos = 0; + + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample); + testsink->got_sample = 0; + + ok(!testsink->got_begin_flush, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush); + hr = IPin_BeginFlush(sink); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(testsink->got_begin_flush == 1, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush); + testsink->got_begin_flush = 1; + + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK || hr == S_FALSE, "Got hr %#lx.\n", hr); + + hr = IPin_EndOfStream(sink); + ok(hr == S_OK || hr == S_FALSE, "Got hr %#lx.\n", hr); + + ok(!testsink->got_end_flush, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush); + hr = IPin_EndFlush(sink); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(testsink->got_end_flush == 1, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush); + testsink->got_end_flush = 0; + + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample); + testsink->got_sample = 0; + + hr = IMediaControl_Stop(control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + IMediaSample_Release(sample); + IMemAllocator_Release(allocator); +} + static void test_connect_pin(void) { IBaseFilter *filter = create_mpeg_layer3_decoder(); @@ -1369,6 +1497,7 @@ static void test_connect_pin(void) ok(hr == S_OK, "Got hr %#lx.\n", hr); test_sample_processing(control, meminput, &testsink); + test_streaming_events(control, sink, meminput, &testsink); hr = IFilterGraph2_Disconnect(graph, source); ok(hr == S_OK, "Got hr %#lx.\n", hr);
1
0
0
0
Anton Baskanov : quartz/tests: Add tests for MPEG layer-3 decoder sample timestamps.
by Alexandre Julliard
01 Dec '22
01 Dec '22
Module: wine Branch: master Commit: dce5f731a270dc4bc6be18d317f3ef6bebf3c06a URL:
https://gitlab.winehq.org/wine/wine/-/commit/dce5f731a270dc4bc6be18d317f3ef…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Tue Oct 4 15:27:32 2022 +0700 quartz/tests: Add tests for MPEG layer-3 decoder sample timestamps. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> --- dlls/quartz/tests/mpeglayer3.c | 75 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/dlls/quartz/tests/mpeglayer3.c b/dlls/quartz/tests/mpeglayer3.c index 85229efc6d9..1509d628954 100644 --- a/dlls/quartz/tests/mpeglayer3.c +++ b/dlls/quartz/tests/mpeglayer3.c @@ -784,6 +784,8 @@ struct testfilter unsigned int got_sample; LONG sample_size; LONG sample_actual; + REFERENCE_TIME sample_start_time; + REFERENCE_TIME sample_stop_time; }; static inline struct testfilter *impl_from_strmbase_filter(struct strmbase_filter *iface) @@ -860,6 +862,8 @@ static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const A static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample *sample) { struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter); + REFERENCE_TIME start, stop; + HRESULT hr; ++filter->got_sample; @@ -869,6 +873,16 @@ static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample filter->sample_actual = IMediaSample_GetActualDataLength(sample); } + start = 0xdeadbeef; + stop = 0xdeadbeef; + hr = IMediaSample_GetTime(sample, &start, &stop); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + if (filter->got_sample == 1) + { + filter->sample_start_time = start; + filter->sample_stop_time = stop; + } + return S_OK; } @@ -1019,6 +1033,7 @@ static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control, static void test_sample_processing(IMediaControl *control, IMemInputPin *meminput, struct testfilter *testsink) { + REFERENCE_TIME start, stop; IMemAllocator *allocator; IMediaSample *sample; HRESULT hr; @@ -1054,6 +1069,62 @@ static void test_sample_processing(IMediaControl *control, hr = IMediaSample_SetActualDataLength(sample, 144); ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMediaSample_SetTime(sample, NULL, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample); + ok(testsink->sample_size == 2304 || testsink->sample_size == 9216, + "Got size %lu.\n", testsink->sample_size); + ok(testsink->sample_actual == 2304 || testsink->sample_actual == 4608, + "Got valid size %lu.\n", testsink->sample_actual); + ok(testsink->sample_start_time == 0, "Got start time %s.\n", + wine_dbgstr_longlong(testsink->sample_start_time)); + ok(testsink->sample_stop_time == (testsink->sample_actual == 2304 ? 360000 : 720000), + "Got stop time %s.\n", wine_dbgstr_longlong(testsink->sample_stop_time)); + testsink->got_sample = 0; + + hr = IMediaControl_Stop(control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMediaControl_Pause(control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + start = 22222; + hr = IMediaSample_SetTime(sample, &start, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample); + ok(testsink->sample_size == 2304 || testsink->sample_size == 9216, + "Got size %lu.\n", testsink->sample_size); + ok(testsink->sample_actual == 2304 || testsink->sample_actual == 4608, + "Got valid size %lu.\n", testsink->sample_actual); + ok(testsink->sample_start_time == 22222, "Got start time %s.\n", + wine_dbgstr_longlong(testsink->sample_start_time)); + ok(testsink->sample_stop_time == (testsink->sample_actual == 2304 ? 382222 : 742222), + "Got stop time %s.\n", wine_dbgstr_longlong(testsink->sample_stop_time)); + testsink->got_sample = 0; + + hr = IMediaControl_Stop(control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMediaControl_Pause(control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + start = 22222; + stop = 33333; + hr = IMediaSample_SetTime(sample, &start, &stop); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemInputPin_Receive(meminput, sample); ok(hr == S_OK, "Got hr %#lx.\n", hr); hr = IMemInputPin_Receive(meminput, sample); @@ -1065,6 +1136,10 @@ static void test_sample_processing(IMediaControl *control, "Got size %lu.\n", testsink->sample_size); ok(testsink->sample_actual == 2304 || testsink->sample_actual == 4608, "Got valid size %lu.\n", testsink->sample_actual); + ok(testsink->sample_start_time == 22222, "Got start time %s.\n", + wine_dbgstr_longlong(testsink->sample_start_time)); + ok(testsink->sample_stop_time == (testsink->sample_actual == 2304 ? 382222 : 742222), + "Got stop time %s.\n", wine_dbgstr_longlong(testsink->sample_stop_time)); testsink->got_sample = 0; hr = IMediaControl_Stop(control);
1
0
0
0
Anton Baskanov : quartz/tests: Add tests for MPEG layer-3 decoder sample processing.
by Alexandre Julliard
01 Dec '22
01 Dec '22
Module: wine Branch: master Commit: 54a59330a6d44b216ed463a507d6792c9c146911 URL:
https://gitlab.winehq.org/wine/wine/-/commit/54a59330a6d44b216ed463a507d679…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Tue Oct 4 12:41:01 2022 +0700 quartz/tests: Add tests for MPEG layer-3 decoder sample processing. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> --- dlls/quartz/tests/mpeglayer3.c | 92 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/dlls/quartz/tests/mpeglayer3.c b/dlls/quartz/tests/mpeglayer3.c index 96307331431..85229efc6d9 100644 --- a/dlls/quartz/tests/mpeglayer3.c +++ b/dlls/quartz/tests/mpeglayer3.c @@ -781,6 +781,9 @@ struct testfilter struct strmbase_source source; struct strmbase_sink sink; const AM_MEDIA_TYPE *mt; + unsigned int got_sample; + LONG sample_size; + LONG sample_actual; }; static inline struct testfilter *impl_from_strmbase_filter(struct strmbase_filter *iface) @@ -854,11 +857,27 @@ static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const A return S_OK; } +static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample *sample) +{ + struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter); + + ++filter->got_sample; + + if (filter->got_sample == 1) + { + filter->sample_size = IMediaSample_GetSize(sample); + filter->sample_actual = IMediaSample_GetActualDataLength(sample); + } + + return S_OK; +} + static const struct strmbase_sink_ops testsink_ops = { .base.pin_query_interface = testsink_query_interface, .base.pin_get_media_type = testsink_get_media_type, .sink_connect = testsink_connect, + .pfnReceive = testsink_Receive, }; static void testfilter_init(struct testfilter *filter) @@ -997,6 +1016,67 @@ static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control, IFilterGraph2_Disconnect(graph, &testsource->source.pin.IPin_iface); } +static void test_sample_processing(IMediaControl *control, + IMemInputPin *meminput, struct testfilter *testsink) +{ + IMemAllocator *allocator; + IMediaSample *sample; + HRESULT hr; + BYTE *data; + LONG size; + + hr = IMemInputPin_ReceiveCanBlock(meminput); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMemInputPin_GetAllocator(meminput, &allocator); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMediaControl_Pause(control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0); + ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr); + + hr = IMemAllocator_Commit(allocator); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMediaSample_GetPointer(sample, &data); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + size = IMediaSample_GetSize(sample); + ok(size == 256, "Got size %ld.\n", size); + memset(data, 0, 144); + data[0] = 0xff; + data[1] = 0xfb; + data[2] = 0x18; + data[3] = 0xc4; + hr = IMediaSample_SetActualDataLength(sample, 144); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample); + ok(testsink->sample_size == 2304 || testsink->sample_size == 9216, + "Got size %lu.\n", testsink->sample_size); + ok(testsink->sample_actual == 2304 || testsink->sample_actual == 4608, + "Got valid size %lu.\n", testsink->sample_actual); + testsink->got_sample = 0; + + hr = IMediaControl_Stop(control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMemInputPin_Receive(meminput, sample); + ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr); + + IMediaSample_Release(sample); + IMemAllocator_Release(allocator); +} + static void test_connect_pin(void) { IBaseFilter *filter = create_mpeg_layer3_decoder(); @@ -1208,6 +1288,18 @@ static void test_connect_pin(void) hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr); + init_pcm_mt(&req_mt, &req_format, 1, 32000, 16); + req_mt.lSampleSize = 2304; + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + test_sample_processing(control, meminput, &testsink); + + hr = IFilterGraph2_Disconnect(graph, source); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + /* Connection with wildcards. */ init_pcm_mt(&source_mt, &source_format, 1, 32000, 16);
1
0
0
0
← Newer
1
...
50
51
52
53
54
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Results per page:
10
25
50
100
200