Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gstdemux.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index e15072f6aa4..adffee3d24a 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -79,7 +79,7 @@ struct gstdemux_source GstPad *flip_sink, *flip_src; GstPad *their_src; GstPad *my_sink; - AM_MEDIA_TYPE * pmt; + AM_MEDIA_TYPE mt; HANDLE caps_event; GstSegment *segment; SourceSeeking seek; @@ -104,7 +104,7 @@ static const IPinVtbl GST_InputPin_Vtbl; static const IBaseFilterVtbl GST_Vtbl; static const IQualityControlVtbl GSTOutPin_QualityControl_Vtbl;
-static BOOL create_pin(struct gstdemux *filter, const WCHAR *name, const AM_MEDIA_TYPE *mt); +static BOOL create_pin(struct gstdemux *filter, const WCHAR *name); static HRESULT GST_RemoveOutputPins(struct gstdemux *This); static HRESULT WINAPI GST_ChangeCurrent(IMediaSeeking *iface); static HRESULT WINAPI GST_ChangeStop(IMediaSeeking *iface); @@ -285,21 +285,25 @@ static gboolean setcaps_sink(GstPad *pad, GstCaps *caps) { struct gstdemux_source *pin = gst_pad_get_element_private(pad); struct gstdemux *This = impl_from_strmbase_filter(pin->pin.pin.filter); - AM_MEDIA_TYPE amt; GstStructure *arg; const char *typename; gboolean ret;
TRACE("%p %p\n", pad, caps);
+ FreeMediaType(&pin->mt); + arg = gst_caps_get_structure(caps, 0); typename = gst_structure_get_name(arg); if (!strcmp(typename, "audio/x-raw")) { - ret = amt_from_gst_caps_audio(caps, &amt); + ret = amt_from_gst_caps_audio(caps, &pin->mt); } else if (!strcmp(typename, "video/x-raw")) { - ret = amt_from_gst_caps_video(caps, &amt); + ret = amt_from_gst_caps_video(caps, &pin->mt); if (ret) - This->props.cbBuffer = max(This->props.cbBuffer, ((VIDEOINFOHEADER*)amt.pbFormat)->bmiHeader.biSizeImage); + { + VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)pin->mt.pbFormat; + This->props.cbBuffer = max(This->props.cbBuffer, vih->bmiHeader.biSizeImage); + } } else { FIXME("Unhandled type "%s"\n", typename); return FALSE; @@ -307,8 +311,6 @@ static gboolean setcaps_sink(GstPad *pad, GstCaps *caps) TRACE("Linking returned %i for %s\n", ret, typename); if (!ret) return FALSE; - FreeMediaType(pin->pmt); - *pin->pmt = amt; SetEvent(pin->caps_event); return TRUE; } @@ -762,7 +764,6 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, struct gstdemux * { const char *typename; char *name; - AM_MEDIA_TYPE amt = {{0}}; GstCaps *caps; GstStructure *arg; GstPad *mypad; @@ -797,7 +798,7 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, struct gstdemux * return; }
- if (!create_pin(This, nameW, &amt)) + if (!create_pin(This, nameW)) { ERR("Failed to allocate memory.\n"); return; @@ -1666,7 +1667,7 @@ static HRESULT WINAPI GSTOutPin_GetMediaType(BasePin *iface, int iPosition, AM_M if (iPosition > 0) return VFW_S_NO_MORE_ITEMS;
- CopyMediaType(pmt, This->pmt); + CopyMediaType(pmt, &This->mt);
return S_OK; } @@ -1731,7 +1732,7 @@ static void free_source_pin(struct gstdemux_source *pin) } gst_object_unref(pin->my_sink); CloseHandle(pin->caps_event); - DeleteMediaType(pin->pmt); + FreeMediaType(&pin->mt); gst_segment_free(pin->segment);
strmbase_source_cleanup(&pin->pin); @@ -1770,7 +1771,7 @@ static const struct strmbase_source_ops source_ops = GSTOutPin_DecideAllocator, };
-static BOOL create_pin(struct gstdemux *filter, const WCHAR *name, const AM_MEDIA_TYPE *mt) +static BOOL create_pin(struct gstdemux *filter, const WCHAR *name) { struct gstdemux_source *pin, **new_array;
@@ -1783,8 +1784,6 @@ static BOOL create_pin(struct gstdemux *filter, const WCHAR *name, const AM_MEDI
strmbase_source_init(&pin->pin, &GST_OutputPin_Vtbl, &filter->filter, name, &source_ops); - pin->pmt = heap_alloc(sizeof(AM_MEDIA_TYPE)); - CopyMediaType(pin->pmt, mt); pin->caps_event = CreateEventW(NULL, FALSE, FALSE, NULL); pin->segment = gst_segment_new(); pin->IQualityControl_iface.lpVtbl = &GSTOutPin_QualityControl_Vtbl;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gstdemux.c | 59 ++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 26 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index adffee3d24a..e76ceda0fe6 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -254,12 +254,15 @@ static gboolean amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt)
static gboolean accept_caps_sink(GstPad *pad, GstCaps *caps) { + struct gstdemux_source *pin = gst_pad_get_element_private(pad); + gchar *caps_str = gst_caps_to_string(caps); AM_MEDIA_TYPE amt; GstStructure *arg; const char *typename; gboolean ret;
- TRACE("%p %p\n", pad, caps); + TRACE("pin %p, caps %s.\n", pin, debugstr_a(caps_str)); + g_free(caps_str);
arg = gst_caps_get_structure(caps, 0); typename = gst_structure_get_name(arg); @@ -284,12 +287,14 @@ static gboolean accept_caps_sink(GstPad *pad, GstCaps *caps) static gboolean setcaps_sink(GstPad *pad, GstCaps *caps) { struct gstdemux_source *pin = gst_pad_get_element_private(pad); - struct gstdemux *This = impl_from_strmbase_filter(pin->pin.pin.filter); + struct gstdemux *filter = impl_from_strmbase_filter(pin->pin.pin.filter); + gchar *caps_str = gst_caps_to_string(caps); GstStructure *arg; const char *typename; gboolean ret;
- TRACE("%p %p\n", pad, caps); + TRACE("filter %p, caps %s.\n", filter, debugstr_a(caps_str)); + g_free(caps_str);
FreeMediaType(&pin->mt);
@@ -302,7 +307,7 @@ static gboolean setcaps_sink(GstPad *pad, GstCaps *caps) if (ret) { VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)pin->mt.pbFormat; - This->props.cbBuffer = max(This->props.cbBuffer, vih->bmiHeader.biSizeImage); + filter->props.cbBuffer = max(filter->props.cbBuffer, vih->bmiHeader.biSizeImage); } } else { FIXME("Unhandled type "%s"\n", typename); @@ -345,13 +350,12 @@ static gboolean gst_base_src_perform_seek(struct gstdemux *This, GstEvent *event GstEvent *tevent; BOOL thread = !!This->push_thread;
- TRACE("%p %p\n", This, event); - gst_event_parse_seek(event, &rate, &seek_format, &flags, &cur_type, &cur, &stop_type, &stop);
- if (seek_format != GST_FORMAT_BYTES) { - FIXME("Not handling other format %i\n", seek_format); + if (seek_format != GST_FORMAT_BYTES) + { + FIXME("Unhandled format "%s".\n", gst_format_get_name(seek_format)); return FALSE; }
@@ -389,7 +393,7 @@ static gboolean event_src(GstPad *pad, GstObject *parent, GstEvent *event) { struct gstdemux *This = gst_pad_get_element_private(pad);
- TRACE("%p %p\n", pad, event); + TRACE("filter %p, type "%s".\n", This, GST_EVENT_TYPE_NAME(event));
switch (event->type) { case GST_EVENT_SEEK: @@ -407,7 +411,7 @@ static gboolean event_src(GstPad *pad, GstObject *parent, GstEvent *event) LeaveCriticalSection(&This->filter.csFilter); break; default: - FIXME("%p (%u) stub\n", event, event->type); + WARN("Ignoring "%s" event.\n", GST_EVENT_TYPE_NAME(event)); case GST_EVENT_TAG: case GST_EVENT_QOS: case GST_EVENT_RECONFIGURE: @@ -420,7 +424,7 @@ static gboolean event_sink(GstPad *pad, GstObject *parent, GstEvent *event) { struct gstdemux_source *pin = gst_pad_get_element_private(pad);
- TRACE("%p %p\n", pad, event); + TRACE("pin %p, type "%s".\n", pin, GST_EVENT_TYPE_NAME(event));
switch (event->type) { case GST_EVENT_SEGMENT: { @@ -435,8 +439,9 @@ static gboolean event_sink(GstPad *pad, GstObject *parent, GstEvent *event) rate = segment->rate; applied_rate = segment->applied_rate;
- if (segment->format != GST_FORMAT_TIME) { - FIXME("Ignoring new segment because of format %i\n", segment->format); + if (segment->format != GST_FORMAT_TIME) + { + FIXME("Unhandled format "%s".\n", gst_format_get_name(segment->format)); return TRUE; }
@@ -482,7 +487,7 @@ static gboolean event_sink(GstPad *pad, GstObject *parent, GstEvent *event) return setcaps_sink(pad, caps); } default: - TRACE("%p stub %s\n", event, gst_event_type_get_name(event->type)); + WARN("Ignoring "%s" event.\n", GST_EVENT_TYPE_NAME(event)); return gst_pad_event_default(pad, parent, event); } } @@ -940,7 +945,7 @@ static gboolean query_function(GstPad *pad, GstObject *parent, GstQuery *query) int ret; LONGLONG duration;
- TRACE("%p %p %p\n", This, pad, query); + TRACE("filter %p, type %s.\n", This, GST_QUERY_TYPE_NAME(query));
switch (GST_QUERY_TYPE(query)) { case GST_QUERY_DURATION: @@ -954,9 +959,11 @@ static gboolean query_function(GstPad *pad, GstObject *parent, GstQuery *query) return ret; case GST_QUERY_SEEKING: gst_query_parse_seeking (query, &format, NULL, NULL, NULL); - TRACE("Seeking %i %i\n", format, GST_FORMAT_BYTES); if (format != GST_FORMAT_BYTES) + { + WARN("Cannot seek using format "%s".\n", gst_format_get_name(format)); return FALSE; + } gst_query_set_seeking(query, GST_FORMAT_BYTES, 1, 0, This->filesize); return TRUE; case GST_QUERY_SCHEDULING: @@ -965,7 +972,7 @@ static gboolean query_function(GstPad *pad, GstObject *parent, GstQuery *query) gst_query_add_scheduling_mode(query, GST_PAD_MODE_PULL); return TRUE; default: - TRACE("Unhandled query type: %s\n", GST_QUERY_TYPE_NAME(query)); + WARN("Unhandled query type %s.\n", GST_QUERY_TYPE_NAME(query)); return FALSE; } } @@ -974,8 +981,6 @@ static gboolean activate_push(GstPad *pad, gboolean activate) { struct gstdemux *This = gst_pad_get_element_private(pad);
- TRACE("%p %p %u\n", This, pad, activate); - EnterCriticalSection(&This->filter.csFilter); if (!activate) { TRACE("Deactivating\n"); @@ -1003,7 +1008,11 @@ static gboolean activate_push(GstPad *pad, gboolean activate)
static gboolean activate_mode(GstPad *pad, GstObject *parent, GstPadMode mode, gboolean activate) { - TRACE("%p %p 0x%x %u\n", pad, parent, mode, activate); + struct gstdemux *filter = gst_pad_get_element_private(pad); + + TRACE("%s source pad for filter %p in %s mode.\n", + activate ? "Activating" : "Deactivating", filter, gst_pad_mode_get_name(mode)); + switch (mode) { case GST_PAD_MODE_PULL: return TRUE; @@ -1017,9 +1026,9 @@ static gboolean activate_mode(GstPad *pad, GstObject *parent, GstPadMode mode, g
static void no_more_pads(GstElement *decodebin, gpointer user) { - struct gstdemux *This = user; - TRACE("%p %p\n", This, decodebin); - SetEvent(This->no_more_pads_event); + struct gstdemux *filter = user; + TRACE("filter %p.\n", filter); + SetEvent(filter->no_more_pads_event); }
static GstAutoplugSelectResult autoplug_blacklist(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *fact, gpointer user) @@ -1044,7 +1053,7 @@ static GstBusSyncReply watch_bus(GstBus *bus, GstMessage *msg, gpointer data) GError *err = NULL; gchar *dbg_info = NULL;
- TRACE("%p %p %p\n", This, bus, msg); + TRACE("filter %p, message type %s.\n", This, GST_MESSAGE_TYPE_NAME(msg));
if (GST_MESSAGE_TYPE(msg) & GST_MESSAGE_ERROR) { gst_message_parse_error(msg, &err, &dbg_info); @@ -2014,8 +2023,6 @@ void CALLBACK perform_cb(TP_CALLBACK_INSTANCE *instance, void *user) { struct cb_data *cbdata = user;
- TRACE("got cb type: 0x%x\n", cbdata->type); - switch(cbdata->type) { case WATCH_BUS:
The "bits" field does not directly describe the total bit depth.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gstdemux.c | 39 ++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index e76ceda0fe6..c733b6e7e61 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -207,16 +207,35 @@ static gboolean amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt) amt->pUnk = NULL; ZeroMemory(vih, sizeof(*vih)); amt->majortype = MEDIATYPE_Video; - if (GST_VIDEO_INFO_IS_RGB(&vinfo)) { - bih->biBitCount = GST_VIDEO_FORMAT_INFO_BITS(vinfo.finfo); - switch (bih->biBitCount) { - case 16: amt->subtype = MEDIASUBTYPE_RGB555; break; - case 24: amt->subtype = MEDIASUBTYPE_RGB24; break; - case 32: amt->subtype = MEDIASUBTYPE_RGB32; break; - default: - FIXME("Unknown bpp %u\n", bih->biBitCount); - heap_free(vih); - return FALSE; + + if (GST_VIDEO_INFO_IS_RGB(&vinfo)) + { + switch (vinfo.finfo->format) + { + case GST_VIDEO_FORMAT_BGRA: + amt->subtype = MEDIASUBTYPE_ARGB32; + bih->biBitCount = 32; + break; + case GST_VIDEO_FORMAT_BGRx: + amt->subtype = MEDIASUBTYPE_RGB32; + bih->biBitCount = 32; + break; + case GST_VIDEO_FORMAT_BGR: + amt->subtype = MEDIASUBTYPE_RGB24; + bih->biBitCount = 24; + break; + case GST_VIDEO_FORMAT_BGR16: + amt->subtype = MEDIASUBTYPE_RGB565; + bih->biBitCount = 16; + break; + case GST_VIDEO_FORMAT_BGR15: + amt->subtype = MEDIASUBTYPE_RGB555; + bih->biBitCount = 16; + break; + default: + FIXME("Unhandled type %s.\n", vinfo.finfo->name); + heap_free(vih); + return FALSE; } bih->biCompression = BI_RGB; } else {
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gstdemux.c | 69 ++++++++++++++--------------------- 1 file changed, 27 insertions(+), 42 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index c733b6e7e61..397af6ef555 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -121,7 +121,7 @@ BOOL is_wine_thread(void) return pthread_getspecific(wine_gst_key) != NULL; }
-static gboolean amt_from_gst_caps_audio(GstCaps *caps, AM_MEDIA_TYPE *amt) +static gboolean amt_from_gst_caps_audio(const GstCaps *caps, AM_MEDIA_TYPE *amt) { WAVEFORMATEXTENSIBLE *wfe; WAVEFORMATEX *wfx; @@ -182,7 +182,7 @@ static gboolean amt_from_gst_caps_audio(GstCaps *caps, AM_MEDIA_TYPE *amt) return TRUE; }
-static gboolean amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt) +static gboolean amt_from_gst_caps_video(const GstCaps *caps, AM_MEDIA_TYPE *amt) { VIDEOINFOHEADER *vih; BITMAPINFOHEADER *bih; @@ -271,36 +271,34 @@ static gboolean amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt) return TRUE; }
+static gboolean amt_from_gst_caps(const GstCaps *caps, AM_MEDIA_TYPE *mt) +{ + const char *type = gst_structure_get_name(gst_caps_get_structure(caps, 0)); + + if (!strcmp(type, "audio/x-raw")) + return amt_from_gst_caps_audio(caps, mt); + else if (!strcmp(type, "video/x-raw")) + return amt_from_gst_caps_video(caps, mt); + else + { + FIXME("Unhandled type %s.\n", debugstr_a(type)); + return FALSE; + } +} + static gboolean accept_caps_sink(GstPad *pad, GstCaps *caps) { struct gstdemux_source *pin = gst_pad_get_element_private(pad); gchar *caps_str = gst_caps_to_string(caps); - AM_MEDIA_TYPE amt; - GstStructure *arg; - const char *typename; + AM_MEDIA_TYPE mt; gboolean ret;
TRACE("pin %p, caps %s.\n", pin, debugstr_a(caps_str)); g_free(caps_str);
- arg = gst_caps_get_structure(caps, 0); - typename = gst_structure_get_name(arg); - if (!strcmp(typename, "audio/x-raw")) { - ret = amt_from_gst_caps_audio(caps, &amt); - if (ret) - FreeMediaType(&amt); - TRACE("+%i\n", ret); - return ret; - } else if (!strcmp(typename, "video/x-raw")) { - ret = amt_from_gst_caps_video(caps, &amt); - if (ret) - FreeMediaType(&amt); - TRACE("-%i\n", ret); - return ret; - } else { - FIXME("Unhandled type "%s"\n", typename); - return FALSE; - } + if ((ret = amt_from_gst_caps(caps, &mt))) + FreeMediaType(&mt); + return ret; }
static gboolean setcaps_sink(GstPad *pad, GstCaps *caps) @@ -308,33 +306,20 @@ static gboolean setcaps_sink(GstPad *pad, GstCaps *caps) struct gstdemux_source *pin = gst_pad_get_element_private(pad); struct gstdemux *filter = impl_from_strmbase_filter(pin->pin.pin.filter); gchar *caps_str = gst_caps_to_string(caps); - GstStructure *arg; - const char *typename; - gboolean ret;
TRACE("filter %p, caps %s.\n", filter, debugstr_a(caps_str)); g_free(caps_str);
FreeMediaType(&pin->mt);
- arg = gst_caps_get_structure(caps, 0); - typename = gst_structure_get_name(arg); - if (!strcmp(typename, "audio/x-raw")) { - ret = amt_from_gst_caps_audio(caps, &pin->mt); - } else if (!strcmp(typename, "video/x-raw")) { - ret = amt_from_gst_caps_video(caps, &pin->mt); - if (ret) - { - VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)pin->mt.pbFormat; - filter->props.cbBuffer = max(filter->props.cbBuffer, vih->bmiHeader.biSizeImage); - } - } else { - FIXME("Unhandled type "%s"\n", typename); + if (!amt_from_gst_caps(caps, &pin->mt)) return FALSE; + + if (IsEqualGUID(&pin->mt.formattype, &FORMAT_VideoInfo)) + { + VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)pin->mt.pbFormat; + filter->props.cbBuffer = max(filter->props.cbBuffer, vih->bmiHeader.biSizeImage); } - TRACE("Linking returned %i for %s\n", ret, typename); - if (!ret) - return FALSE; SetEvent(pin->caps_event); return TRUE; }