On 4/7/20 4:05 PM, Gabriel Ivăncescu wrote:
-static BOOL is_renderer(IBaseFilter *filter) +static BOOL is_renderer(struct filter *filter) { IAMFilterMiscFlags *flags;
IMediaSeeking *seeking; BOOL ret = FALSE;
if (SUCCEEDED(IBaseFilter_QueryInterface(filter, &IID_IAMFilterMiscFlags, (void **)&flags)))
- if (SUCCEEDED(IBaseFilter_QueryInterface(filter->filter, &IID_IAMFilterMiscFlags, (void **)&flags))) { if (IAMFilterMiscFlags_GetMiscFlags(flags) & AM_FILTER_MISC_FLAGS_IS_RENDERER) ret = TRUE; IAMFilterMiscFlags_Release(flags); }
- else if (SUCCEEDED(IBaseFilter_QueryInterface(filter, &IID_IMediaSeeking, (void **)&seeking)))
- {
IMediaSeeking_Release(seeking);
if (!has_output_pins(filter))
ret = TRUE;
- }
- else if (get_filter_seeking(filter) && !has_output_pins(filter->filter))
}ret = TRUE; return ret;
@@ -675,12 +680,13 @@ static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface, }
IBaseFilter_AddRef(entry->filter = filter);
- entry->seeking = NULL; list_add_head(&graph->filters, &entry->entry); list_add_head(&graph->sorted_filters, &entry->sorted_entry); entry->sorting = FALSE; ++graph->version;
- if (is_renderer(filter))
- if (is_renderer(entry)) ++graph->nRenderers;
Helper name does not imply important state change, will it work if you queried once right after IBaseFilter_AddRef()? This looks like the only place when filter is added to the list. After that you can simply make is_renderer() check for null pointer.