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
911bc74a
Commit
911bc74a
authored
Jan 21, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Jan 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Move pin duration and caps retrieval to GST_Connect().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3c6cf6ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
66 deletions
+33
-66
gstdemux.c
dlls/winegstreamer/gstdemux.c
+33
-66
No files found.
dlls/winegstreamer/gstdemux.c
View file @
911bc74a
...
...
@@ -1452,8 +1452,29 @@ static GstBusSyncReply watch_bus(GstBus *bus, GstMessage *msg, gpointer data)
return
GST_BUS_DROP
;
}
static
LONGLONG
query_duration
(
GstPad
*
pad
)
{
gint64
duration
,
byte_length
;
if
(
gst_pad_query_duration
(
pad
,
GST_FORMAT_TIME
,
&
duration
))
return
duration
/
100
;
WARN
(
"Failed to query time duration; trying to convert from byte length.
\n
"
);
/* To accurately get a duration for the stream, we want to only consider the
* length of that stream. Hence, query for the pad duration, instead of
* using the file duration. */
if
(
gst_pad_query_duration
(
pad
,
GST_FORMAT_BYTES
,
&
byte_length
)
&&
gst_pad_query_convert
(
pad
,
GST_FORMAT_BYTES
,
byte_length
,
GST_FORMAT_TIME
,
&
duration
))
return
duration
/
100
;
ERR
(
"Failed to query duration.
\n
"
);
return
0
;
}
static
HRESULT
GST_Connect
(
struct
parser
*
This
,
IPin
*
pConnectPin
)
{
unsigned
int
i
;
LONGLONG
avail
;
GstStaticPadTemplate
src_template
=
GST_STATIC_PAD_TEMPLATE
(
"quartz_src"
,
...
...
@@ -1483,28 +1504,19 @@ static HRESULT GST_Connect(struct parser *This, IPin *pConnectPin)
if
(
!
This
->
init_gst
(
This
))
return
E_FAIL
;
This
->
nextofs
=
This
->
nextpullofs
=
0
;
return
S_OK
;
}
static
LONGLONG
query_duration
(
GstPad
*
pad
)
{
gint64
duration
,
byte_length
;
if
(
gst_pad_query_duration
(
pad
,
GST_FORMAT_TIME
,
&
duration
))
return
duration
/
100
;
WARN
(
"Failed to query time duration; trying to convert from byte length.
\n
"
);
for
(
i
=
0
;
i
<
This
->
source_count
;
++
i
)
{
struct
parser_source
*
pin
=
This
->
sources
[
i
];
const
HANDLE
events
[
2
]
=
{
pin
->
caps_event
,
This
->
error_event
};
/* To accurately get a duration for the stream, we want to only consider the
* length of that stream. Hence, query for the pad duration, instead of
* using the file duration. */
if
(
gst_pad_query_duration
(
pad
,
GST_FORMAT_BYTES
,
&
byte_length
)
&&
gst_pad_query_convert
(
pad
,
GST_FORMAT_BYTES
,
byte_length
,
GST_FORMAT_TIME
,
&
duration
))
return
duration
/
100
;
pin
->
seek
.
llDuration
=
pin
->
seek
.
llStop
=
query_duration
(
pin
->
their_src
);
pin
->
seek
.
llCurrent
=
0
;
if
(
WaitForMultipleObjects
(
2
,
events
,
FALSE
,
INFINITE
))
return
E_FAIL
;
}
ERR
(
"Failed to query duration.
\n
"
)
;
return
0
;
This
->
nextofs
=
This
->
nextpullofs
=
0
;
return
S_OK
;
}
static
inline
struct
parser_source
*
impl_from_IMediaSeeking
(
IMediaSeeking
*
iface
)
...
...
@@ -1714,7 +1726,6 @@ static const struct strmbase_sink_ops sink_ops =
static
BOOL
decodebin_parser_init_gst
(
struct
parser
*
filter
)
{
GstElement
*
element
=
gst_element_factory_make
(
"decodebin"
,
NULL
);
unsigned
int
i
;
HANDLE
events
[
2
];
int
ret
;
...
...
@@ -1754,18 +1765,6 @@ static BOOL decodebin_parser_init_gst(struct parser *filter)
if
(
WaitForMultipleObjects
(
2
,
events
,
FALSE
,
INFINITE
))
return
FALSE
;
for
(
i
=
0
;
i
<
filter
->
source_count
;
++
i
)
{
struct
parser_source
*
pin
=
filter
->
sources
[
i
];
pin
->
seek
.
llDuration
=
pin
->
seek
.
llStop
=
query_duration
(
pin
->
their_src
);
pin
->
seek
.
llCurrent
=
0
;
events
[
0
]
=
pin
->
caps_event
;
events
[
1
]
=
filter
->
error_event
;
if
(
WaitForMultipleObjects
(
2
,
events
,
FALSE
,
INFINITE
))
return
FALSE
;
}
return
TRUE
;
}
...
...
@@ -2506,7 +2505,6 @@ static BOOL wave_parser_init_gst(struct parser *filter)
static
const
WCHAR
source_name
[]
=
{
'o'
,
'u'
,
't'
,
'p'
,
'u'
,
't'
,
0
};
struct
parser_source
*
pin
;
GstElement
*
element
;
HANDLE
events
[
2
];
int
ret
;
if
(
!
(
element
=
gst_element_factory_make
(
"wavparse"
,
NULL
)))
...
...
@@ -2544,14 +2542,6 @@ static BOOL wave_parser_init_gst(struct parser *filter)
return
FALSE
;
}
pin
->
seek
.
llDuration
=
pin
->
seek
.
llStop
=
query_duration
(
pin
->
their_src
);
pin
->
seek
.
llCurrent
=
0
;
events
[
0
]
=
pin
->
caps_event
;
events
[
1
]
=
filter
->
error_event
;
if
(
WaitForMultipleObjects
(
2
,
events
,
FALSE
,
INFINITE
))
return
FALSE
;
return
TRUE
;
}
...
...
@@ -2621,7 +2611,6 @@ static const struct strmbase_sink_ops avi_splitter_sink_ops =
static
BOOL
avi_splitter_init_gst
(
struct
parser
*
filter
)
{
GstElement
*
element
=
gst_element_factory_make
(
"avidemux"
,
NULL
);
unsigned
int
i
;
HANDLE
events
[
2
];
int
ret
;
...
...
@@ -2660,18 +2649,6 @@ static BOOL avi_splitter_init_gst(struct parser *filter)
if
(
WaitForMultipleObjects
(
2
,
events
,
FALSE
,
INFINITE
))
return
FALSE
;
for
(
i
=
0
;
i
<
filter
->
source_count
;
++
i
)
{
struct
parser_source
*
pin
=
filter
->
sources
[
i
];
pin
->
seek
.
llDuration
=
pin
->
seek
.
llStop
=
query_duration
(
pin
->
their_src
);
pin
->
seek
.
llCurrent
=
0
;
events
[
0
]
=
pin
->
caps_event
;
events
[
1
]
=
filter
->
error_event
;
if
(
WaitForMultipleObjects
(
2
,
events
,
FALSE
,
INFINITE
))
return
FALSE
;
}
return
TRUE
;
}
...
...
@@ -2791,17 +2768,7 @@ static BOOL mpeg_splitter_init_gst(struct parser *filter)
events
[
1
]
=
filter
->
error_event
;
events
[
2
]
=
pin
->
eos_event
;
res
=
WaitForMultipleObjects
(
3
,
events
,
FALSE
,
INFINITE
);
if
(
res
==
1
)
return
FALSE
;
pin
->
seek
.
llDuration
=
pin
->
seek
.
llStop
=
query_duration
(
pin
->
their_src
);
pin
->
seek
.
llCurrent
=
0
;
events
[
0
]
=
pin
->
caps_event
;
if
(
WaitForMultipleObjects
(
2
,
events
,
FALSE
,
INFINITE
))
return
FALSE
;
return
TRUE
;
return
(
res
!=
1
);
}
static
HRESULT
mpeg_splitter_source_query_accept
(
struct
parser_source
*
pin
,
const
AM_MEDIA_TYPE
*
mt
)
...
...
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