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
af751b59
Commit
af751b59
authored
Sep 24, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Nov 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Split the wm_reader_get_stream_sample helper.
parent
2d442738
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
52 deletions
+58
-52
wm_reader.c
dlls/winegstreamer/wm_reader.c
+58
-52
No files found.
dlls/winegstreamer/wm_reader.c
View file @
af751b59
...
@@ -1596,6 +1596,58 @@ static HRESULT wm_stream_allocate_sample(struct wm_stream *stream, DWORD size, I
...
@@ -1596,6 +1596,58 @@ static HRESULT wm_stream_allocate_sample(struct wm_stream *stream, DWORD size, I
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
wm_reader_read_stream_sample
(
struct
wm_reader
*
reader
,
struct
wm_stream
*
stream
,
struct
wg_parser_buffer
*
buffer
,
INSSBuffer
**
sample
,
QWORD
*
pts
,
QWORD
*
duration
,
DWORD
*
flags
)
{
DWORD
size
,
capacity
;
HRESULT
hr
;
BYTE
*
data
;
TRACE
(
"Got buffer for '%s' stream %p.
\n
"
,
get_major_type_string
(
stream
->
format
.
major_type
),
stream
);
if
(
FAILED
(
hr
=
wm_stream_allocate_sample
(
stream
,
buffer
->
size
,
sample
)))
{
ERR
(
"Failed to allocate sample of %u bytes, hr %#lx.
\n
"
,
buffer
->
size
,
hr
);
wg_parser_stream_release_buffer
(
stream
->
wg_stream
);
return
hr
;
}
if
(
FAILED
(
hr
=
INSSBuffer_GetBufferAndLength
(
*
sample
,
&
data
,
&
size
)))
ERR
(
"Failed to get data pointer, hr %#lx.
\n
"
,
hr
);
if
(
FAILED
(
hr
=
INSSBuffer_GetMaxLength
(
*
sample
,
&
capacity
)))
ERR
(
"Failed to get capacity, hr %#lx.
\n
"
,
hr
);
if
(
buffer
->
size
>
capacity
)
ERR
(
"Returned capacity %lu is less than requested capacity %u.
\n
"
,
capacity
,
buffer
->
size
);
if
(
!
wg_parser_stream_copy_buffer
(
stream
->
wg_stream
,
data
,
0
,
buffer
->
size
))
{
/* The GStreamer pin has been flushed. */
INSSBuffer_Release
(
*
sample
);
*
sample
=
NULL
;
return
S_FALSE
;
}
if
(
FAILED
(
hr
=
INSSBuffer_SetLength
(
*
sample
,
buffer
->
size
)))
ERR
(
"Failed to set size %u, hr %#lx.
\n
"
,
buffer
->
size
,
hr
);
wg_parser_stream_release_buffer
(
stream
->
wg_stream
);
if
(
!
buffer
->
has_pts
)
FIXME
(
"Missing PTS.
\n
"
);
if
(
!
buffer
->
has_duration
)
FIXME
(
"Missing duration.
\n
"
);
*
pts
=
buffer
->
pts
;
*
duration
=
buffer
->
duration
;
*
flags
=
0
;
if
(
buffer
->
discontinuity
)
*
flags
|=
WM_SF_DISCONTINUITY
;
if
(
!
buffer
->
delta
)
*
flags
|=
WM_SF_CLEANPOINT
;
return
S_OK
;
}
/* Find the earliest buffer by PTS.
/* Find the earliest buffer by PTS.
*
*
* Native seems to behave similarly to this with the async reader, although our
* Native seems to behave similarly to this with the async reader, although our
...
@@ -1642,15 +1694,11 @@ static WORD get_earliest_buffer(struct wm_reader *reader, struct wg_parser_buffe
...
@@ -1642,15 +1694,11 @@ static WORD get_earliest_buffer(struct wm_reader *reader, struct wg_parser_buffe
static
HRESULT
wm_reader_get_stream_sample
(
struct
wm_reader
*
reader
,
WORD
stream_number
,
static
HRESULT
wm_reader_get_stream_sample
(
struct
wm_reader
*
reader
,
WORD
stream_number
,
INSSBuffer
**
ret_sample
,
QWORD
*
pts
,
QWORD
*
duration
,
DWORD
*
flags
,
WORD
*
ret_stream_number
)
INSSBuffer
**
ret_sample
,
QWORD
*
pts
,
QWORD
*
duration
,
DWORD
*
flags
,
WORD
*
ret_stream_number
)
{
{
struct
wg_parser_stream
*
wg_stream
;
struct
wg_parser_buffer
wg_buffer
;
struct
wg_parser_buffer
wg_buffer
;
struct
wm_stream
*
stream
;
struct
wm_stream
*
stream
;
DWORD
size
,
capacity
;
INSSBuffer
*
sample
;
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
BYTE
*
data
;
for
(;;)
do
{
{
if
(
!
stream_number
)
if
(
!
stream_number
)
{
{
...
@@ -1661,7 +1709,6 @@ static HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, WORD stream
...
@@ -1661,7 +1709,6 @@ static HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, WORD stream
}
}
stream
=
wm_reader_get_stream_by_stream_number
(
reader
,
stream_number
);
stream
=
wm_reader_get_stream_by_stream_number
(
reader
,
stream_number
);
wg_stream
=
stream
->
wg_stream
;
}
}
else
else
{
{
...
@@ -1670,7 +1717,6 @@ static HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, WORD stream
...
@@ -1670,7 +1717,6 @@ static HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, WORD stream
WARN
(
"Invalid stream number %u; returning E_INVALIDARG.
\n
"
,
stream_number
);
WARN
(
"Invalid stream number %u; returning E_INVALIDARG.
\n
"
,
stream_number
);
return
E_INVALIDARG
;
return
E_INVALIDARG
;
}
}
wg_stream
=
stream
->
wg_stream
;
if
(
stream
->
selection
==
WMT_OFF
)
if
(
stream
->
selection
==
WMT_OFF
)
{
{
...
@@ -1681,7 +1727,7 @@ static HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, WORD stream
...
@@ -1681,7 +1727,7 @@ static HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, WORD stream
if
(
stream
->
eos
)
if
(
stream
->
eos
)
return
NS_E_NO_MORE_SAMPLES
;
return
NS_E_NO_MORE_SAMPLES
;
if
(
!
wg_parser_stream_get_buffer
(
wg_stream
,
&
wg_buffer
))
if
(
!
wg_parser_stream_get_buffer
(
stream
->
wg_stream
,
&
wg_buffer
))
{
{
stream
->
eos
=
true
;
stream
->
eos
=
true
;
TRACE
(
"End of stream.
\n
"
);
TRACE
(
"End of stream.
\n
"
);
...
@@ -1689,51 +1735,11 @@ static HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, WORD stream
...
@@ -1689,51 +1735,11 @@ static HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, WORD stream
}
}
}
}
TRACE
(
"Got buffer for '%s' stream %p.
\n
"
,
get_major_type_string
(
stream
->
format
.
major_type
),
stream
);
if
(
SUCCEEDED
(
hr
=
wm_reader_read_stream_sample
(
reader
,
stream
,
&
wg_buffer
,
ret_sample
,
pts
,
duration
,
flags
)))
*
ret_stream_number
=
stream_number
;
if
(
FAILED
(
hr
=
wm_stream_allocate_sample
(
stream
,
wg_buffer
.
size
,
&
sample
)))
}
while
(
hr
==
S_FALSE
);
{
ERR
(
"Failed to allocate sample of %u bytes, hr %#lx.
\n
"
,
wg_buffer
.
size
,
hr
);
wg_parser_stream_release_buffer
(
wg_stream
);
return
hr
;
}
if
(
FAILED
(
hr
=
INSSBuffer_GetBufferAndLength
(
sample
,
&
data
,
&
size
)))
ERR
(
"Failed to get data pointer, hr %#lx.
\n
"
,
hr
);
if
(
FAILED
(
hr
=
INSSBuffer_GetMaxLength
(
sample
,
&
capacity
)))
ERR
(
"Failed to get capacity, hr %#lx.
\n
"
,
hr
);
if
(
wg_buffer
.
size
>
capacity
)
ERR
(
"Returned capacity %lu is less than requested capacity %u.
\n
"
,
capacity
,
wg_buffer
.
size
);
if
(
!
wg_parser_stream_copy_buffer
(
wg_stream
,
data
,
0
,
wg_buffer
.
size
))
{
/* The GStreamer pin has been flushed. */
INSSBuffer_Release
(
sample
);
continue
;
}
if
(
FAILED
(
hr
=
INSSBuffer_SetLength
(
sample
,
wg_buffer
.
size
)))
ERR
(
"Failed to set size %u, hr %#lx.
\n
"
,
wg_buffer
.
size
,
hr
);
wg_parser_stream_release_buffer
(
wg_stream
);
if
(
!
wg_buffer
.
has_pts
)
FIXME
(
"Missing PTS.
\n
"
);
if
(
!
wg_buffer
.
has_duration
)
FIXME
(
"Missing duration.
\n
"
);
*
pts
=
wg_buffer
.
pts
;
return
hr
;
*
duration
=
wg_buffer
.
duration
;
*
flags
=
0
;
if
(
wg_buffer
.
discontinuity
)
*
flags
|=
WM_SF_DISCONTINUITY
;
if
(
!
wg_buffer
.
delta
)
*
flags
|=
WM_SF_CLEANPOINT
;
*
ret_sample
=
sample
;
*
ret_stream_number
=
stream_number
;
return
S_OK
;
}
}
}
static
struct
wm_reader
*
impl_from_IUnknown
(
IUnknown
*
iface
)
static
struct
wm_reader
*
impl_from_IUnknown
(
IUnknown
*
iface
)
...
...
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