winegstreamer: Move wg_parser flushing to the Unix library.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
aa695e2125
commit
7a5224beb6
|
@ -215,6 +215,9 @@ struct unix_funcs
|
||||||
HRESULT (CDECL *wg_parser_connect)(struct wg_parser *parser, uint64_t file_size);
|
HRESULT (CDECL *wg_parser_connect)(struct wg_parser *parser, uint64_t file_size);
|
||||||
void (CDECL *wg_parser_disconnect)(struct wg_parser *parser);
|
void (CDECL *wg_parser_disconnect)(struct wg_parser *parser);
|
||||||
|
|
||||||
|
void (CDECL *wg_parser_begin_flush)(struct wg_parser *parser);
|
||||||
|
void (CDECL *wg_parser_end_flush)(struct wg_parser *parser);
|
||||||
|
|
||||||
uint32_t (CDECL *wg_parser_get_stream_count)(struct wg_parser *parser);
|
uint32_t (CDECL *wg_parser_get_stream_count)(struct wg_parser *parser);
|
||||||
struct wg_parser_stream *(CDECL *wg_parser_get_stream)(struct wg_parser *parser, uint32_t index);
|
struct wg_parser_stream *(CDECL *wg_parser_get_stream)(struct wg_parser *parser, uint32_t index);
|
||||||
|
|
||||||
|
|
|
@ -856,9 +856,7 @@ static HRESULT parser_init_stream(struct strmbase_filter *iface)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
filter->streaming = true;
|
filter->streaming = true;
|
||||||
pthread_mutex_lock(&parser->mutex);
|
unix_funcs->wg_parser_end_flush(filter->wg_parser);
|
||||||
parser->flushing = false;
|
|
||||||
pthread_mutex_unlock(&parser->mutex);
|
|
||||||
|
|
||||||
/* DirectShow retains the old seek positions, but resets to them every time
|
/* DirectShow retains the old seek positions, but resets to them every time
|
||||||
* it transitions from stopped -> paused. */
|
* it transitions from stopped -> paused. */
|
||||||
|
@ -899,17 +897,7 @@ static HRESULT parser_cleanup_stream(struct strmbase_filter *iface)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
filter->streaming = false;
|
filter->streaming = false;
|
||||||
pthread_mutex_lock(&parser->mutex);
|
unix_funcs->wg_parser_begin_flush(filter->wg_parser);
|
||||||
parser->flushing = true;
|
|
||||||
pthread_mutex_unlock(&parser->mutex);
|
|
||||||
|
|
||||||
for (i = 0; i < parser->stream_count; ++i)
|
|
||||||
{
|
|
||||||
struct wg_parser_stream *stream = parser->streams[i];
|
|
||||||
|
|
||||||
if (stream->enabled)
|
|
||||||
pthread_cond_signal(&stream->event_cond);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < filter->source_count; ++i)
|
for (i = 0; i < filter->source_count; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1228,7 +1216,6 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface,
|
||||||
struct parser_source *pin = impl_from_IMediaSeeking(iface);
|
struct parser_source *pin = impl_from_IMediaSeeking(iface);
|
||||||
struct wg_parser_stream *stream = pin->wg_stream;
|
struct wg_parser_stream *stream = pin->wg_stream;
|
||||||
struct parser *filter = impl_from_strmbase_filter(pin->pin.pin.filter);
|
struct parser *filter = impl_from_strmbase_filter(pin->pin.pin.filter);
|
||||||
struct wg_parser *parser = filter->wg_parser;
|
|
||||||
GstSeekFlags flags = 0;
|
GstSeekFlags flags = 0;
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1247,17 +1234,12 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface,
|
||||||
|
|
||||||
if (!(current_flags & AM_SEEKING_NoFlush))
|
if (!(current_flags & AM_SEEKING_NoFlush))
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&parser->mutex);
|
unix_funcs->wg_parser_begin_flush(filter->wg_parser);
|
||||||
parser->flushing = true;
|
|
||||||
pthread_mutex_unlock(&parser->mutex);
|
|
||||||
|
|
||||||
for (i = 0; i < filter->source_count; ++i)
|
for (i = 0; i < filter->source_count; ++i)
|
||||||
{
|
{
|
||||||
if (filter->sources[i]->pin.pin.peer)
|
if (filter->sources[i]->pin.pin.peer)
|
||||||
{
|
|
||||||
pthread_cond_signal(&stream->event_cond);
|
|
||||||
IPin_BeginFlush(filter->sources[i]->pin.pin.peer);
|
IPin_BeginFlush(filter->sources[i]->pin.pin.peer);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter->reader)
|
if (filter->reader)
|
||||||
|
@ -1296,9 +1278,7 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface,
|
||||||
|
|
||||||
if (!(current_flags & AM_SEEKING_NoFlush))
|
if (!(current_flags & AM_SEEKING_NoFlush))
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&parser->mutex);
|
unix_funcs->wg_parser_end_flush(filter->wg_parser);
|
||||||
parser->flushing = false;
|
|
||||||
pthread_mutex_unlock(&parser->mutex);
|
|
||||||
|
|
||||||
for (i = 0; i < filter->source_count; ++i)
|
for (i = 0; i < filter->source_count; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -327,6 +327,28 @@ static struct wg_parser_stream * CDECL wg_parser_get_stream(struct wg_parser *pa
|
||||||
return parser->streams[index];
|
return parser->streams[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CDECL wg_parser_begin_flush(struct wg_parser *parser)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
pthread_mutex_lock(&parser->mutex);
|
||||||
|
parser->flushing = true;
|
||||||
|
pthread_mutex_unlock(&parser->mutex);
|
||||||
|
|
||||||
|
for (i = 0; i < parser->stream_count; ++i)
|
||||||
|
{
|
||||||
|
if (parser->streams[i]->enabled)
|
||||||
|
pthread_cond_signal(&parser->streams[i]->event_cond);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CDECL wg_parser_end_flush(struct wg_parser *parser)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&parser->mutex);
|
||||||
|
parser->flushing = false;
|
||||||
|
pthread_mutex_unlock(&parser->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
static void CDECL wg_parser_stream_get_preferred_format(struct wg_parser_stream *stream, struct wg_format *format)
|
static void CDECL wg_parser_stream_get_preferred_format(struct wg_parser_stream *stream, struct wg_format *format)
|
||||||
{
|
{
|
||||||
*format = stream->preferred_format;
|
*format = stream->preferred_format;
|
||||||
|
@ -1520,6 +1542,9 @@ static const struct unix_funcs funcs =
|
||||||
wg_parser_connect,
|
wg_parser_connect,
|
||||||
wg_parser_disconnect,
|
wg_parser_disconnect,
|
||||||
|
|
||||||
|
wg_parser_begin_flush,
|
||||||
|
wg_parser_end_flush,
|
||||||
|
|
||||||
wg_parser_get_stream_count,
|
wg_parser_get_stream_count,
|
||||||
wg_parser_get_stream,
|
wg_parser_get_stream,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue