mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
audiodecoder: implement caps and accept-caps queries
Allows decoders to proxy downstream restrictions on caps. Also implements accept-caps query to prevent regressions caused by the new fields on the return of a caps query that would cause the accept-caps to fail as it uses subset caps comparisons
This commit is contained in:
parent
5e3405bd08
commit
160dce872b
1 changed files with 39 additions and 0 deletions
|
@ -149,6 +149,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gstaudiodecoder.h"
|
#include "gstaudiodecoder.h"
|
||||||
|
#include "gstaudioutilsprivate.h"
|
||||||
#include <gst/pbutils/descriptions.h>
|
#include <gst/pbutils/descriptions.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -2460,6 +2461,44 @@ gst_audio_decoder_sink_query (GstPad * pad, GstObject * parent,
|
||||||
res = klass->propose_allocation (dec, query);
|
res = klass->propose_allocation (dec, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_QUERY_CAPS:{
|
||||||
|
GstCaps *filter;
|
||||||
|
GstCaps *result;
|
||||||
|
|
||||||
|
gst_query_parse_caps (query, &filter);
|
||||||
|
result = __gst_audio_element_proxy_getcaps (GST_ELEMENT_CAST (dec),
|
||||||
|
GST_AUDIO_DECODER_SINK_PAD (dec),
|
||||||
|
GST_AUDIO_DECODER_SRC_PAD (dec), NULL, filter);
|
||||||
|
gst_query_set_caps_result (query, result);
|
||||||
|
gst_caps_unref (result);
|
||||||
|
res = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GST_QUERY_ACCEPT_CAPS:{
|
||||||
|
GstCaps *caps;
|
||||||
|
GstCaps *allowed_caps;
|
||||||
|
GstCaps *template_caps;
|
||||||
|
gboolean accept;
|
||||||
|
|
||||||
|
gst_query_parse_accept_caps (query, &caps);
|
||||||
|
|
||||||
|
template_caps = gst_pad_get_pad_template_caps (pad);
|
||||||
|
accept = gst_caps_is_subset (caps, template_caps);
|
||||||
|
gst_caps_unref (template_caps);
|
||||||
|
|
||||||
|
if (accept) {
|
||||||
|
allowed_caps = gst_pad_query_caps (GST_AUDIO_DECODER_SINK_PAD (dec),
|
||||||
|
caps);
|
||||||
|
|
||||||
|
accept = gst_caps_can_intersect (caps, allowed_caps);
|
||||||
|
|
||||||
|
gst_caps_unref (allowed_caps);
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_query_set_accept_caps_result (query, accept);
|
||||||
|
res = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case GST_QUERY_SEEKING:
|
case GST_QUERY_SEEKING:
|
||||||
{
|
{
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
|
|
Loading…
Reference in a new issue