Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
3eb9571d
Commit
3eb9571d
authored
Apr 27, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
May 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Keep a IMFMediaSource pointer in the media stream.
parent
cd120fa8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
19 deletions
+23
-19
media_source.c
dlls/winegstreamer/media_source.c
+23
-19
No files found.
dlls/winegstreamer/media_source.c
View file @
3eb9571d
...
...
@@ -31,7 +31,8 @@ struct media_stream
{
IMFMediaStream
IMFMediaStream_iface
;
LONG
ref
;
struct
media_source
*
parent_source
;
IMFMediaSource
*
media_source
;
IMFMediaEventQueue
*
event_queue
;
IMFStreamDescriptor
*
descriptor
;
...
...
@@ -288,6 +289,7 @@ static BOOL enqueue_token(struct media_stream *stream, IUnknown *token)
static
void
flush_token_queue
(
struct
media_stream
*
stream
,
BOOL
send
)
{
struct
media_source
*
source
=
impl_from_IMFMediaSource
(
stream
->
media_source
);
LONG
i
;
for
(
i
=
0
;
i
<
stream
->
token_queue_count
;
i
++
)
...
...
@@ -301,8 +303,8 @@ static void flush_token_queue(struct media_stream *stream, BOOL send)
command
->
u
.
request_sample
.
stream
=
stream
;
command
->
u
.
request_sample
.
token
=
stream
->
token_queue
[
i
];
hr
=
MFPutWorkItem
(
s
tream
->
parent_source
->
async_commands_queue
,
&
stream
->
parent_source
->
async_commands_callback
,
&
command
->
IUnknown_iface
);
hr
=
MFPutWorkItem
(
s
ource
->
async_commands_queue
,
&
source
->
async_commands_callback
,
&
command
->
IUnknown_iface
);
}
if
(
FAILED
(
hr
))
WARN
(
"Could not enqueue sample request, hr %#lx
\n
"
,
hr
);
...
...
@@ -528,7 +530,7 @@ out:
static
void
wait_on_sample
(
struct
media_stream
*
stream
,
IUnknown
*
token
)
{
struct
media_source
*
source
=
stream
->
parent_source
;
struct
media_source
*
source
=
impl_from_IMFMediaSource
(
stream
->
media_source
)
;
PROPVARIANT
empty_var
=
{.
vt
=
VT_EMPTY
};
struct
wg_parser_buffer
buffer
;
...
...
@@ -542,7 +544,7 @@ static void wait_on_sample(struct media_stream *stream, IUnknown *token)
{
stream
->
eos
=
TRUE
;
IMFMediaEventQueue_QueueEventParamVar
(
stream
->
event_queue
,
MEEndOfStream
,
&
GUID_NULL
,
S_OK
,
&
empty_var
);
dispatch_end_of_presentation
(
s
tream
->
parent_s
ource
);
dispatch_end_of_presentation
(
source
);
}
}
...
...
@@ -741,17 +743,18 @@ static HRESULT WINAPI media_stream_QueueEvent(IMFMediaStream *iface, MediaEventT
return
IMFMediaEventQueue_QueueEventParamVar
(
stream
->
event_queue
,
event_type
,
ext_type
,
hr
,
value
);
}
static
HRESULT
WINAPI
media_stream_GetMediaSource
(
IMFMediaStream
*
iface
,
IMFMediaSource
**
source
)
static
HRESULT
WINAPI
media_stream_GetMediaSource
(
IMFMediaStream
*
iface
,
IMFMediaSource
**
out
)
{
struct
media_stream
*
stream
=
impl_from_IMFMediaStream
(
iface
);
struct
media_source
*
source
=
impl_from_IMFMediaSource
(
stream
->
media_source
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
source
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
out
);
if
(
stream
->
state
==
STREAM_SHUTDOWN
)
return
MF_E_SHUTDOWN
;
IMFMediaSource_AddRef
(
&
s
tream
->
parent_s
ource
->
IMFMediaSource_iface
);
*
source
=
&
stream
->
parent_
source
->
IMFMediaSource_iface
;
IMFMediaSource_AddRef
(
&
source
->
IMFMediaSource_iface
);
*
out
=
&
source
->
IMFMediaSource_iface
;
return
S_OK
;
}
...
...
@@ -774,6 +777,7 @@ static HRESULT WINAPI media_stream_GetStreamDescriptor(IMFMediaStream* iface, IM
static
HRESULT
WINAPI
media_stream_RequestSample
(
IMFMediaStream
*
iface
,
IUnknown
*
token
)
{
struct
media_stream
*
stream
=
impl_from_IMFMediaStream
(
iface
);
struct
media_source
*
source
=
impl_from_IMFMediaSource
(
stream
->
media_source
);
struct
source_async_command
*
command
;
HRESULT
hr
;
...
...
@@ -800,8 +804,7 @@ static HRESULT WINAPI media_stream_RequestSample(IMFMediaStream *iface, IUnknown
IUnknown_AddRef
(
token
);
command
->
u
.
request_sample
.
token
=
token
;
hr
=
MFPutWorkItem
(
stream
->
parent_source
->
async_commands_queue
,
&
stream
->
parent_source
->
async_commands_callback
,
&
command
->
IUnknown_iface
);
hr
=
MFPutWorkItem
(
source
->
async_commands_queue
,
&
source
->
async_commands_callback
,
&
command
->
IUnknown_iface
);
}
return
hr
;
...
...
@@ -821,9 +824,10 @@ static const IMFMediaStreamVtbl media_stream_vtbl =
media_stream_RequestSample
};
static
HRESULT
media_stream_create
(
struct
media_s
ource
*
source
,
DWORD
id
,
static
HRESULT
media_stream_create
(
IMFMediaS
ource
*
source
,
DWORD
id
,
struct
media_stream
**
out
)
{
struct
wg_parser
*
wg_parser
=
impl_from_IMFMediaSource
(
source
)
->
wg_parser
;
struct
media_stream
*
object
;
HRESULT
hr
;
...
...
@@ -841,13 +845,13 @@ static HRESULT media_stream_create(struct media_source *source, DWORD id,
return
hr
;
}
IMFMediaSource_AddRef
(
&
source
->
IMFMediaSource_ifa
ce
);
object
->
parent
_source
=
source
;
IMFMediaSource_AddRef
(
sour
ce
);
object
->
media
_source
=
source
;
object
->
stream_id
=
id
;
object
->
state
=
STREAM_INACTIVE
;
object
->
eos
=
FALSE
;
object
->
wg_stream
=
wg_parser_get_stream
(
source
->
wg_parser
,
id
);
object
->
wg_stream
=
wg_parser_get_stream
(
wg_parser
,
id
);
TRACE
(
"Created stream object %p.
\n
"
,
object
);
...
...
@@ -1368,7 +1372,7 @@ static HRESULT WINAPI media_source_Shutdown(IMFMediaSource *iface)
IMFMediaEventQueue_Shutdown
(
stream
->
event_queue
);
IMFStreamDescriptor_Release
(
stream
->
descriptor
);
IMFMediaSource_Release
(
&
stream
->
parent_source
->
IMFMediaSource_ifa
ce
);
IMFMediaSource_Release
(
stream
->
media_sour
ce
);
IMFMediaStream_Release
(
&
stream
->
IMFMediaStream_iface
);
}
...
...
@@ -1475,13 +1479,13 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
for
(
i
=
0
;
i
<
stream_count
;
++
i
)
{
if
(
FAILED
(
hr
=
media_stream_create
(
object
,
i
,
&
object
->
streams
[
i
])))
if
(
FAILED
(
hr
=
media_stream_create
(
&
object
->
IMFMediaSource_iface
,
i
,
&
object
->
streams
[
i
])))
goto
fail
;
if
(
FAILED
(
hr
=
media_stream_init_desc
(
object
->
streams
[
i
])))
{
ERR
(
"Failed to finish initialization of media stream %p, hr %#lx.
\n
"
,
object
->
streams
[
i
],
hr
);
IMFMediaSource_Release
(
&
object
->
streams
[
i
]
->
parent_source
->
IMFMediaSource_ifa
ce
);
IMFMediaSource_Release
(
object
->
streams
[
i
]
->
media_sour
ce
);
IMFMediaEventQueue_Release
(
object
->
streams
[
i
]
->
event_queue
);
free
(
object
->
streams
[
i
]);
goto
fail
;
...
...
@@ -1567,7 +1571,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
IMFMediaEventQueue_Release
(
stream
->
event_queue
);
IMFStreamDescriptor_Release
(
stream
->
descriptor
);
IMFMediaSource_Release
(
&
stream
->
parent_source
->
IMFMediaSource_ifa
ce
);
IMFMediaSource_Release
(
stream
->
media_sour
ce
);
free
(
stream
);
}
...
...
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