winegstreamer: Implement IWMSyncReader::SetStreamsSelected().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c41059bcba
commit
5d0858ee98
|
@ -123,6 +123,7 @@ struct wm_stream
|
|||
WORD index;
|
||||
bool eos;
|
||||
struct wg_format format;
|
||||
WMT_STREAM_SELECTION selection;
|
||||
};
|
||||
|
||||
struct wm_reader
|
||||
|
@ -173,5 +174,7 @@ HRESULT wm_reader_open_stream(struct wm_reader *reader, IStream *stream);
|
|||
void wm_reader_seek(struct wm_reader *reader, QWORD start, LONGLONG duration);
|
||||
HRESULT wm_reader_set_output_props(struct wm_reader *reader, DWORD output,
|
||||
IWMOutputMediaProps *props);
|
||||
HRESULT wm_reader_set_streams_selected(struct wm_reader *reader, WORD count,
|
||||
const WORD *stream_numbers, const WMT_STREAM_SELECTION *selections);
|
||||
|
||||
#endif /* __GST_PRIVATE_INCLUDED__ */
|
||||
|
|
|
@ -1413,6 +1413,7 @@ static HRESULT init_stream(struct wm_reader *reader, QWORD file_size)
|
|||
stream->wg_stream = wg_parser_get_stream(reader->wg_parser, i);
|
||||
stream->reader = reader;
|
||||
stream->index = i;
|
||||
stream->selection = WMT_ON;
|
||||
wg_parser_stream_get_preferred_format(stream->wg_stream, &stream->format);
|
||||
if (stream->format.major_type == WG_MAJOR_TYPE_AUDIO)
|
||||
{
|
||||
|
@ -1739,6 +1740,9 @@ HRESULT wm_reader_get_stream_sample(struct wm_stream *stream,
|
|||
struct wg_parser_event event;
|
||||
struct buffer *object;
|
||||
|
||||
if (stream->selection == WMT_OFF)
|
||||
return NS_E_INVALID_REQUEST;
|
||||
|
||||
if (stream->eos)
|
||||
return NS_E_NO_MORE_SAMPLES;
|
||||
|
||||
|
@ -1824,6 +1828,50 @@ void wm_reader_seek(struct wm_reader *reader, QWORD start, LONGLONG duration)
|
|||
LeaveCriticalSection(&reader->cs);
|
||||
}
|
||||
|
||||
HRESULT wm_reader_set_streams_selected(struct wm_reader *reader, WORD count,
|
||||
const WORD *stream_numbers, const WMT_STREAM_SELECTION *selections)
|
||||
{
|
||||
struct wm_stream *stream;
|
||||
WORD i;
|
||||
|
||||
if (!count)
|
||||
return E_INVALIDARG;
|
||||
|
||||
EnterCriticalSection(&reader->cs);
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
if (!(stream = wm_reader_get_stream_by_stream_number(reader, stream_numbers[i])))
|
||||
{
|
||||
LeaveCriticalSection(&reader->cs);
|
||||
WARN("Invalid stream number %u; returning NS_E_INVALID_REQUEST.\n", stream_numbers[i]);
|
||||
return NS_E_INVALID_REQUEST;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
stream = wm_reader_get_stream_by_stream_number(reader, stream_numbers[i]);
|
||||
stream->selection = selections[i];
|
||||
if (selections[i] == WMT_OFF)
|
||||
{
|
||||
TRACE("Disabling stream %u.\n", stream_numbers[i]);
|
||||
wg_parser_stream_disable(stream->wg_stream);
|
||||
}
|
||||
else if (selections[i] == WMT_ON)
|
||||
{
|
||||
if (selections[i] != WMT_ON)
|
||||
FIXME("Ignoring selection %#x for stream %u; treating as enabled.\n",
|
||||
selections[i], stream_numbers[i]);
|
||||
TRACE("Enabling stream %u.\n", stream_numbers[i]);
|
||||
wg_parser_stream_enable(stream->wg_stream, &stream->format);
|
||||
}
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&reader->cs);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void wm_reader_init(struct wm_reader *reader, const struct wm_reader_ops *ops)
|
||||
{
|
||||
reader->IWMHeaderInfo3_iface.lpVtbl = &header_info_vtbl;
|
||||
|
|
|
@ -83,8 +83,8 @@ static HRESULT WINAPI WMSyncReader_GetNextSample(IWMSyncReader2 *iface,
|
|||
DWORD *flags, DWORD *output_number, WORD *ret_stream_number)
|
||||
{
|
||||
struct sync_reader *reader = impl_from_IWMSyncReader2(iface);
|
||||
HRESULT hr = NS_E_NO_MORE_SAMPLES;
|
||||
struct wm_stream *stream;
|
||||
HRESULT hr;
|
||||
WORD i;
|
||||
|
||||
TRACE("reader %p, stream_number %u, sample %p, pts %p, duration %p,"
|
||||
|
@ -104,8 +104,12 @@ static HRESULT WINAPI WMSyncReader_GetNextSample(IWMSyncReader2 *iface,
|
|||
for (i = 0; i < reader->reader.stream_count; ++i)
|
||||
{
|
||||
WORD index = (i + reader->last_read_stream + 1) % reader->reader.stream_count;
|
||||
struct wm_stream *stream = &reader->reader.streams[index];
|
||||
|
||||
hr = wm_reader_get_stream_sample(&reader->reader.streams[index], sample, pts, duration, flags);
|
||||
if (stream->selection == WMT_OFF)
|
||||
continue;
|
||||
|
||||
hr = wm_reader_get_stream_sample(stream, sample, pts, duration, flags);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
if (output_number)
|
||||
|
@ -296,12 +300,15 @@ static HRESULT WINAPI WMSyncReader_SetReadStreamSamples(IWMSyncReader2 *iface, W
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI WMSyncReader_SetStreamsSelected(IWMSyncReader2 *iface, WORD stream_count,
|
||||
WORD *stream_numbers, WMT_STREAM_SELECTION *selections)
|
||||
static HRESULT WINAPI WMSyncReader_SetStreamsSelected(IWMSyncReader2 *iface,
|
||||
WORD count, WORD *stream_numbers, WMT_STREAM_SELECTION *selections)
|
||||
{
|
||||
struct sync_reader *This = impl_from_IWMSyncReader2(iface);
|
||||
FIXME("(%p)->(%d %p %p): stub!\n", This, stream_count, stream_numbers, selections);
|
||||
return S_OK;
|
||||
struct sync_reader *reader = impl_from_IWMSyncReader2(iface);
|
||||
|
||||
TRACE("reader %p, count %u, stream_numbers %p, selections %p.\n",
|
||||
reader, count, stream_numbers, selections);
|
||||
|
||||
return wm_reader_set_streams_selected(&reader->reader, count, stream_numbers, selections);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI WMSyncReader2_SetRangeByTimecode(IWMSyncReader2 *iface, WORD stream_num,
|
||||
|
|
Loading…
Reference in New Issue