diff --git a/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-info.c b/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-info.c index 2fcc6711fb..f55246d901 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-info.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-info.c @@ -320,6 +320,28 @@ invalid_channel_mask: } } +/** + * gst_audio_info_new_from_caps: + * @caps: a #GstCaps + * + * Parse @caps to generate a #GstAudioInfo. + * + * Returns: A #GstAudioInfo, or %NULL if @caps couldn't be parsed + * Since: 1.20 + */ +GstAudioInfo * +gst_audio_info_new_from_caps (const GstCaps * caps) +{ + GstAudioInfo *ret = gst_audio_info_new (); + + if (gst_audio_info_from_caps (ret, caps)) { + return ret; + } else { + gst_audio_info_free (ret); + return NULL; + } +} + /** * gst_audio_info_to_caps: * @info: a #GstAudioInfo diff --git a/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-info.h b/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-info.h index 8cc6d36f16..51264b9304 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-info.h +++ b/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-info.h @@ -104,6 +104,9 @@ GType gst_audio_info_get_type (void); GST_AUDIO_API GstAudioInfo * gst_audio_info_new (void); +GST_AUDIO_API +GstAudioInfo * gst_audio_info_new_from_caps (const GstCaps * caps); + GST_AUDIO_API void gst_audio_info_init (GstAudioInfo *info); diff --git a/subprojects/gst-plugins-base/gst-libs/gst/video/video-info.c b/subprojects/gst-plugins-base/gst-libs/gst/video/video-info.c index 0269b970fd..9cf7821f9f 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/video/video-info.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/video/video-info.c @@ -568,6 +568,28 @@ alternate_no_feature: } } +/** + * gst_video_info_new_from_caps: + * @caps: a #GstCaps + * + * Parse @caps to generate a #GstVideoInfo. + * + * Returns: A #GstVideoInfo, or %NULL if @caps couldn't be parsed + * Since: 1.20 + */ +GstVideoInfo * +gst_video_info_new_from_caps (const GstCaps * caps) +{ + GstVideoInfo *ret = gst_video_info_new (); + + if (gst_video_info_from_caps (ret, caps)) { + return ret; + } else { + gst_video_info_free (ret); + return NULL; + } +} + /** * gst_video_info_is_equal: * @info: a #GstVideoInfo diff --git a/subprojects/gst-plugins-base/gst-libs/gst/video/video-info.h b/subprojects/gst-plugins-base/gst-libs/gst/video/video-info.h index d3ff1ba965..3de617d954 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/video/video-info.h +++ b/subprojects/gst-plugins-base/gst-libs/gst/video/video-info.h @@ -436,6 +436,9 @@ GstVideoInfo * gst_video_info_copy (const GstVideoInfo *info); GST_VIDEO_API void gst_video_info_free (GstVideoInfo *info); +GST_VIDEO_API +GstVideoInfo * gst_video_info_new_from_caps (const GstCaps * caps); + GST_VIDEO_API gboolean gst_video_info_set_format (GstVideoInfo *info, GstVideoFormat format, guint width, guint height); diff --git a/subprojects/gst-python/gi/overrides/GstAudio.py b/subprojects/gst-python/gi/overrides/GstAudio.py new file mode 100644 index 0000000000..c186371d11 --- /dev/null +++ b/subprojects/gst-python/gi/overrides/GstAudio.py @@ -0,0 +1,16 @@ +from ..module import get_introspection_module + +import gi +gi.require_version('Gst', '1.0') + +from gi.repository import Gst # noqa + +GstAudio = get_introspection_module('GstAudio') +__all__ = [] + + +def __audio_info_from_caps(*args): + raise NotImplementedError('AudioInfo.from_caps was removed, use AudioInfo.new_from_caps instead') + + +GstAudio.AudioInfo.from_caps = __audio_info_from_caps diff --git a/subprojects/gst-python/gi/overrides/GstVideo.py b/subprojects/gst-python/gi/overrides/GstVideo.py new file mode 100644 index 0000000000..2650c113ca --- /dev/null +++ b/subprojects/gst-python/gi/overrides/GstVideo.py @@ -0,0 +1,16 @@ +from ..module import get_introspection_module + +import gi +gi.require_version('Gst', '1.0') + +from gi.repository import Gst # noqa + +GstVideo = get_introspection_module('GstVideo') +__all__ = [] + + +def __video_info_from_caps(*args): + raise NotImplementedError('VideoInfo.from_caps was removed, use VideoInfo.new_from_caps instead') + + +GstVideo.VideoInfo.from_caps = __video_info_from_caps diff --git a/subprojects/gst-python/gi/overrides/meson.build b/subprojects/gst-python/gi/overrides/meson.build index b2aa334dec..5b87a72a90 100644 --- a/subprojects/gst-python/gi/overrides/meson.build +++ b/subprojects/gst-python/gi/overrides/meson.build @@ -1,4 +1,4 @@ -pysources = ['Gst.py', 'GstPbutils.py'] +pysources = ['Gst.py', 'GstPbutils.py', 'GstVideo.py', 'GstAudio.py'] install_data(pysources, install_dir: pygi_override_dir)