mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 18:50:48 +00:00
androidmedia: Only allow GL output if the decoder has unknown color formats
If GST_AMC_IGNORE_UNKNOWN_COLOR_FORMATS is set to yes, non-GL output is still allowed. https://bugzilla.gnome.org/show_bug.cgi?id=731204
This commit is contained in:
parent
43b63f304d
commit
7dbb6681a3
3 changed files with 22 additions and 7 deletions
|
@ -1567,6 +1567,7 @@ scan_codecs (GstPlugin * plugin)
|
|||
goto next_codec;
|
||||
}
|
||||
gst_codec_info->is_encoder = is_encoder;
|
||||
gst_codec_info->gl_output_only = FALSE;
|
||||
|
||||
supported_types =
|
||||
(*env)->CallObjectMethod (env, codec_info, get_supported_types_id);
|
||||
|
@ -1710,12 +1711,13 @@ scan_codecs (GstPlugin * plugin)
|
|||
goto next_supported_type;
|
||||
}
|
||||
|
||||
if (!ignore_unknown_color_formats
|
||||
&& !accepted_color_formats (gst_codec_type, is_encoder)) {
|
||||
GST_ERROR ("%s %s has unknown color formats, ignoring",
|
||||
gst_codec_type->mime, is_encoder ? "encoder" : "decoder");
|
||||
valid_codec = FALSE;
|
||||
goto next_supported_type;
|
||||
if (!accepted_color_formats (gst_codec_type, is_encoder)) {
|
||||
if (!ignore_unknown_color_formats) {
|
||||
gst_codec_info->gl_output_only = TRUE;
|
||||
GST_WARNING
|
||||
("%s %s has unknown color formats, only direct rendering will be supported",
|
||||
gst_codec_type->mime, is_encoder ? "encoder" : "decoder");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ struct _GstAmcCodecType {
|
|||
struct _GstAmcCodecInfo {
|
||||
gchar *name;
|
||||
gboolean is_encoder;
|
||||
gboolean gl_output_only;
|
||||
GstAmcCodecType *supported_types;
|
||||
gint n_supported_types;
|
||||
};
|
||||
|
|
|
@ -230,7 +230,11 @@ gst_amc_video_dec_base_init (gpointer g_class)
|
|||
gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
|
||||
(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, "RGBA"));
|
||||
|
||||
gst_caps_append (all_src_caps, src_caps);
|
||||
if (codec_info->gl_output_only) {
|
||||
gst_caps_unref (src_caps);
|
||||
} else {
|
||||
gst_caps_append (all_src_caps, src_caps);
|
||||
}
|
||||
|
||||
/* Add pad templates */
|
||||
templ =
|
||||
|
@ -1224,6 +1228,7 @@ gst_amc_video_dec_set_format (GstVideoDecoder * decoder,
|
|||
GstVideoCodecState * state)
|
||||
{
|
||||
GstAmcVideoDec *self;
|
||||
GstAmcVideoDecClass *klass;
|
||||
GstAmcFormat *format;
|
||||
const gchar *mime;
|
||||
gboolean is_format_change = FALSE;
|
||||
|
@ -1235,6 +1240,7 @@ gst_amc_video_dec_set_format (GstVideoDecoder * decoder,
|
|||
jobject jsurface = NULL;
|
||||
|
||||
self = GST_AMC_VIDEO_DEC (decoder);
|
||||
klass = GST_AMC_VIDEO_DEC_GET_CLASS (self);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Setting new caps %" GST_PTR_FORMAT, state->caps);
|
||||
|
||||
|
@ -1414,6 +1420,12 @@ gst_amc_video_dec_set_format (GstVideoDecoder * decoder,
|
|||
GST_INFO_OBJECT (self, "GL output: %s",
|
||||
self->downstream_supports_gl ? "enabled" : "disabled");
|
||||
|
||||
if (klass->codec_info->gl_output_only && !self->downstream_supports_gl) {
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Codec only supports GL output but downstream does not");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (self->downstream_supports_gl && self->surface) {
|
||||
jsurface = self->surface->jobject;
|
||||
} else if (self->downstream_supports_gl && !self->surface) {
|
||||
|
|
Loading…
Reference in a new issue