Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
a4e8e4df
Commit
a4e8e4df
authored
Feb 10, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz/videorenderer: Clean up VideoRenderer_GetStaticImage().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9b1ba341
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
41 deletions
+33
-41
videorenderer.c
dlls/quartz/tests/videorenderer.c
+2
-2
videorenderer.c
dlls/quartz/videorenderer.c
+31
-39
No files found.
dlls/quartz/tests/videorenderer.c
View file @
a4e8e4df
...
...
@@ -1117,8 +1117,8 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
size
=
sizeof
(
BITMAPINFOHEADER
)
+
32
*
16
*
2
-
1
;
hr
=
IBasicVideo_GetCurrentImage
(
video
,
&
size
,
buffer
);
todo_wine
ok
(
hr
==
E_OUTOFMEMORY
,
"Got hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
size
==
sizeof
(
BITMAPINFOHEADER
)
+
32
*
16
*
2
-
1
,
"Got size %d.
\n
"
,
size
);
ok
(
hr
==
E_OUTOFMEMORY
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
size
==
sizeof
(
BITMAPINFOHEADER
)
+
32
*
16
*
2
-
1
,
"Got size %d.
\n
"
,
size
);
size
=
sizeof
(
BITMAPINFOHEADER
)
+
32
*
16
*
2
;
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
...
...
dlls/quartz/videorenderer.c
View file @
a4e8e4df
...
...
@@ -350,62 +350,54 @@ static HRESULT WINAPI VideoRenderer_GetSourceRect(BaseControlVideo* iface, RECT
return
S_OK
;
}
static
HRESULT
WINAPI
VideoRenderer_GetStaticImage
(
BaseControlVideo
*
iface
,
LONG
*
pBufferSize
,
LONG
*
pDIBI
mage
)
static
HRESULT
WINAPI
VideoRenderer_GetStaticImage
(
BaseControlVideo
*
iface
,
LONG
*
size
,
LONG
*
i
mage
)
{
VideoRendererImpl
*
This
=
impl_from_BaseControlVideo
(
iface
);
AM_MEDIA_TYPE
*
amt
=
&
This
->
renderer
.
sink
.
pin
.
mt
;
BITMAPINFOHEADER
*
bmiHeader
;
LONG
needed
_size
;
char
*
ptr
;
VideoRendererImpl
*
filter
=
impl_from_BaseControlVideo
(
iface
);
const
AM_MEDIA_TYPE
*
mt
=
&
filter
->
renderer
.
sink
.
pin
.
mt
;
const
BITMAPINFOHEADER
*
bih
;
size_t
image
_size
;
BYTE
*
sample_data
;
FIXME
(
"(%p/%p)->(%p, %p): partial stub
\n
"
,
This
,
iface
,
pBufferSize
,
pDIBI
mage
);
TRACE
(
"filter %p, size %p, image %p.
\n
"
,
filter
,
size
,
i
mage
);
EnterCriticalSection
(
&
This
->
renderer
.
filter
.
csFilter
);
EnterCriticalSection
(
&
filter
->
renderer
.
csRenderLock
);
if
(
!
This
->
renderer
.
pMediaSample
)
{
LeaveCriticalSection
(
&
This
->
renderer
.
filter
.
csFilter
);
return
(
This
->
renderer
.
filter
.
state
==
State_Paused
?
E_UNEXPECTED
:
VFW_E_NOT_PAUSED
)
;
}
if
(
IsEqualGUID
(
&
mt
->
formattype
,
&
FORMAT_VideoInfo
)
)
bih
=
&
((
VIDEOINFOHEADER
*
)
mt
->
pbFormat
)
->
bmiHeader
;
else
/* if (IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo2)) */
bih
=
&
((
VIDEOINFOHEADER2
*
)
mt
->
pbFormat
)
->
bmiHeader
;
image_size
=
bih
->
biWidth
*
bih
->
biHeight
*
bih
->
biBitCount
/
8
;
if
(
IsEqualIID
(
&
amt
->
formattype
,
&
FORMAT_VideoInfo
)
)
if
(
!
image
)
{
bmiHeader
=
&
((
VIDEOINFOHEADER
*
)
amt
->
pbFormat
)
->
bmiHeader
;
}
else
if
(
IsEqualIID
(
&
amt
->
formattype
,
&
FORMAT_VideoInfo2
))
{
bmiHeader
=
&
((
VIDEOINFOHEADER2
*
)
amt
->
pbFormat
)
->
bmiHeader
;
LeaveCriticalSection
(
&
filter
->
renderer
.
csRenderLock
);
*
size
=
sizeof
(
BITMAPINFOHEADER
)
+
image_size
;
return
S_OK
;
}
else
if
(
filter
->
renderer
.
filter
.
state
!=
State_Paused
)
{
FIXME
(
"Unknown type %s
\n
"
,
debugstr_guid
(
&
amt
->
subtype
));
LeaveCriticalSection
(
&
This
->
renderer
.
filter
.
csFilter
);
return
VFW_E_RUNTIME_ERROR
;
LeaveCriticalSection
(
&
filter
->
renderer
.
csRenderLock
);
return
VFW_E_NOT_PAUSED
;
}
needed_size
=
bmiHeader
->
biSize
;
needed_size
+=
IMediaSample_GetActualDataLength
(
This
->
renderer
.
pMediaSample
);
if
(
!
pDIBImage
)
if
(
!
filter
->
renderer
.
pMediaSample
)
{
*
pBufferSize
=
needed_size
;
LeaveCriticalSection
(
&
This
->
renderer
.
filter
.
csFilter
);
return
S_OK
;
LeaveCriticalSection
(
&
filter
->
renderer
.
csRenderLock
);
return
E_UNEXPECTED
;
}
if
(
needed_size
<
*
pBufferS
ize
)
if
(
*
size
<
sizeof
(
BITMAPINFOHEADER
)
+
image_s
ize
)
{
ERR
(
"Buffer too small %u/%u
\n
"
,
needed_size
,
*
pBufferSize
);
LeaveCriticalSection
(
&
This
->
renderer
.
filter
.
csFilter
);
return
E_FAIL
;
LeaveCriticalSection
(
&
filter
->
renderer
.
csRenderLock
);
return
E_OUTOFMEMORY
;
}
*
pBufferSize
=
needed_size
;
memcpy
(
pDIBImage
,
bmiHeader
,
bmiHeader
->
biSize
);
IMediaSample_GetPointer
(
This
->
renderer
.
pMediaSample
,
(
BYTE
**
)
&
ptr
);
memcpy
((
char
*
)
pDIBImage
+
bmiHeader
->
biSize
,
ptr
,
IMediaSample_GetActualDataLength
(
This
->
renderer
.
pMediaSample
)
);
memcpy
(
image
,
bih
,
sizeof
(
BITMAPINFOHEADER
)
);
IMediaSample_GetPointer
(
filter
->
renderer
.
pMediaSample
,
&
sample_data
);
memcpy
((
char
*
)
image
+
sizeof
(
BITMAPINFOHEADER
),
sample_data
,
image_size
);
LeaveCriticalSection
(
&
This
->
renderer
.
filter
.
csFilter
);
LeaveCriticalSection
(
&
filter
->
renderer
.
csRenderLock
);
return
S_OK
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment