diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2020-02-27 17:16:45 +0530 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-02-28 16:57:30 +0000 |
commit | de4ea9476694c82ba4a3a47a9d552b5b93672241 (patch) | |
tree | f4aceab8e7e5643676b36fd0b3ed539586386645 /gst/transcode | |
parent | 4b6164339f43a4b37e5d358338c99383e53eabaa (diff) | |
download | gstreamer-plugins-bad-de4ea9476694c82ba4a3a47a9d552b5b93672241.tar.gz |
transcodebin: force decoding if a filter is defined
Filter operates on raw data so don't allow decodebin to produce
encoded data if one is defined.
My use case here is keeping the video stream untouched but apply a filter
on the audio one, while keeping the same audio format.
Diffstat (limited to 'gst/transcode')
-rw-r--r-- | gst/transcode/gsttranscodebin.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/gst/transcode/gsttranscodebin.c b/gst/transcode/gsttranscodebin.c index 1d8b50745..f1362f133 100644 --- a/gst/transcode/gsttranscodebin.c +++ b/gst/transcode/gsttranscodebin.c @@ -306,13 +306,29 @@ make_decodebin (GstTranscodeBin * self) gst_encoding_container_profile_get_profiles (GST_ENCODING_CONTAINER_PROFILE (self->profile)); tmp; tmp = tmp->next) { - GstCaps *restrictions = - gst_encoding_profile_get_restriction (tmp->data); + GstEncodingProfile *profile = tmp->data; + GstCaps *restrictions; - if (!restrictions || gst_caps_is_any (restrictions)) { - GstCaps *encodecaps = gst_encoding_profile_get_format (tmp->data); + restrictions = gst_encoding_profile_get_restriction (profile); - gst_caps_append (decodecaps, encodecaps); + if (!restrictions || gst_caps_is_any (restrictions)) { + GstCaps *encodecaps = gst_encoding_profile_get_format (profile); + GstElement *filter = NULL; + + /* Filter operates on raw data so don't allow decodebin to produce + * encoded data if one is defined. */ + if (GST_IS_ENCODING_VIDEO_PROFILE (profile) && self->video_filter) + filter = self->video_filter; + else if (GST_IS_ENCODING_AUDIO_PROFILE (profile) + && self->audio_filter) + filter = self->audio_filter; + + if (!filter) { + GST_DEBUG_OBJECT (self, + "adding %" GST_PTR_FORMAT " as output caps to decodebin", + encodecaps); + gst_caps_append (decodecaps, encodecaps); + } } else { gst_caps_unref (restrictions); } |