player: Rewrite as GstPlay wrapper

For the time being the GstPlayer library remains as a wrapper for GstPlay, in
order to keep existing applications working and give them time to port to
GstPlay. GstPlayer will remain in -bad for a couple cycles and the plan for
GstPlay is to move it to -base before 1.20.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2061>
This commit is contained in:
Philippe Normand 2020-12-07 10:47:30 +00:00
parent f009802771
commit 12a7bf9f7c
7 changed files with 548 additions and 3480 deletions

View file

@ -439,12 +439,12 @@ gst_play_signal_adapter_class_init (GstPlaySignalAdapterClass * klass)
signals[SIGNAL_VOLUME_CHANGED] =
g_signal_new ("volume-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL,
NULL, NULL, G_TYPE_NONE, 0, G_TYPE_INVALID);
NULL, NULL, G_TYPE_NONE, 1, G_TYPE_DOUBLE);
signals[SIGNAL_MUTE_CHANGED] =
g_signal_new ("mute-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL,
NULL, NULL, G_TYPE_NONE, 0, G_TYPE_INVALID);
NULL, NULL, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals[SIGNAL_WARNING] =
g_signal_new ("warning", G_TYPE_FROM_CLASS (klass),

View file

@ -23,16 +23,14 @@
#ifndef __GST_PLAYER_MEDIA_INFO_PRIVATE_H__
#define __GST_PLAYER_MEDIA_INFO_PRIVATE_H__
#include <gst/play/gstplay-media-info.h>
struct _GstPlayerStreamInfo
{
GObject parent;
gchar *codec;
GstCaps *caps;
gint stream_index;
GstTagList *tags;
gchar *stream_id;
GstPlayStreamInfo *info;
};
struct _GstPlayerStreamInfoClass
@ -42,9 +40,9 @@ struct _GstPlayerStreamInfoClass
struct _GstPlayerSubtitleInfo
{
GstPlayerStreamInfo parent;
GstPlayerStreamInfo parent;
gchar *language;
GstPlaySubtitleInfo *info;
};
struct _GstPlayerSubtitleInfoClass
@ -54,15 +52,9 @@ struct _GstPlayerSubtitleInfoClass
struct _GstPlayerAudioInfo
{
GstPlayerStreamInfo parent;
GstPlayerStreamInfo parent;
gint channels;
gint sample_rate;
guint bitrate;
guint max_bitrate;
gchar *language;
GstPlayAudioInfo *info;
};
struct _GstPlayerAudioInfoClass
@ -72,17 +64,9 @@ struct _GstPlayerAudioInfoClass
struct _GstPlayerVideoInfo
{
GstPlayerStreamInfo parent;
GstPlayerStreamInfo parent;
gint width;
gint height;
gint framerate_num;
gint framerate_denom;
gint par_num;
gint par_denom;
guint bitrate;
guint max_bitrate;
GstPlayVideoInfo *info;
};
struct _GstPlayerVideoInfoClass
@ -94,19 +78,11 @@ struct _GstPlayerMediaInfo
{
GObject parent;
gchar *uri;
gchar *title;
gchar *container;
gboolean seekable, is_live;
GstTagList *tags;
GstSample *image_sample;
GList *stream_list;
GList *audio_stream_list;
GList *video_stream_list;
GList *subtitle_stream_list;
GstClockTime duration;
GstPlayMediaInfo *info;
};
struct _GstPlayerMediaInfoClass
@ -115,12 +91,23 @@ struct _GstPlayerMediaInfoClass
};
G_GNUC_INTERNAL GstPlayerMediaInfo* gst_player_media_info_new
(const gchar *uri);
(void);
G_GNUC_INTERNAL GstPlayerMediaInfo* gst_player_media_info_copy
(GstPlayerMediaInfo *ref);
G_GNUC_INTERNAL GstPlayerStreamInfo* gst_player_stream_info_new
(gint stream_index, GType type);
G_GNUC_INTERNAL GstPlayerStreamInfo* gst_player_stream_info_wrapped
(GstPlayStreamInfo * info);
G_GNUC_INTERNAL GstPlayerStreamInfo* gst_player_stream_info_copy
(GstPlayerStreamInfo *ref);
G_GNUC_INTERNAL GstPlayerMediaInfo* gst_player_media_info_wrapped
(GstPlayMediaInfo *info);
G_GNUC_INTERNAL GstPlayerAudioInfo* gst_player_audio_info_wrapped
(GstPlayAudioInfo *info);
G_GNUC_INTERNAL GstPlayerVideoInfo* gst_player_video_info_wrapped
(GstPlayVideoInfo *info);
G_GNUC_INTERNAL GstPlayerSubtitleInfo* gst_player_subtitle_info_wrapped
(GstPlaySubtitleInfo *info);
#endif /* __GST_PLAYER_MEDIA_INFO_PRIVATE_H__ */

View file

@ -47,14 +47,7 @@ gst_player_stream_info_finalize (GObject * object)
{
GstPlayerStreamInfo *sinfo = GST_PLAYER_STREAM_INFO (object);
g_free (sinfo->codec);
g_free (sinfo->stream_id);
if (sinfo->caps)
gst_caps_unref (sinfo->caps);
if (sinfo->tags)
gst_tag_list_unref (sinfo->tags);
g_clear_object (&sinfo->info);
G_OBJECT_CLASS (gst_player_stream_info_parent_class)->finalize (object);
}
@ -97,12 +90,7 @@ gst_player_stream_info_get_stream_type (const GstPlayerStreamInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_STREAM_INFO (info), NULL);
if (GST_IS_PLAYER_VIDEO_INFO (info))
return "video";
else if (GST_IS_PLAYER_AUDIO_INFO (info))
return "audio";
else
return "subtitle";
return gst_play_stream_info_get_stream_type (info->info);
}
/**
@ -116,7 +104,7 @@ gst_player_stream_info_get_tags (const GstPlayerStreamInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_STREAM_INFO (info), NULL);
return info->tags;
return gst_play_stream_info_get_tags (info->info);
}
/**
@ -132,7 +120,7 @@ gst_player_stream_info_get_codec (const GstPlayerStreamInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_STREAM_INFO (info), NULL);
return info->codec;
return gst_play_stream_info_get_codec (info->info);
}
/**
@ -146,7 +134,7 @@ gst_player_stream_info_get_caps (const GstPlayerStreamInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_STREAM_INFO (info), NULL);
return info->caps;
return gst_play_stream_info_get_caps (info->info);
}
/* Video information */
@ -154,14 +142,9 @@ G_DEFINE_TYPE (GstPlayerVideoInfo, gst_player_video_info,
GST_TYPE_PLAYER_STREAM_INFO);
static void
gst_player_video_info_init (GstPlayerVideoInfo * info)
gst_player_video_info_init (G_GNUC_UNUSED GstPlayerVideoInfo * info)
{
info->width = -1;
info->height = -1;
info->framerate_num = 0;
info->framerate_denom = 1;
info->par_num = 1;
info->par_denom = 1;
}
static void
@ -181,7 +164,7 @@ gst_player_video_info_get_width (const GstPlayerVideoInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_VIDEO_INFO (info), -1);
return info->width;
return gst_play_video_info_get_width (info->info);
}
/**
@ -195,7 +178,7 @@ gst_player_video_info_get_height (const GstPlayerVideoInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_VIDEO_INFO (info), -1);
return info->height;
return gst_play_video_info_get_height (info->info);
}
/**
@ -211,8 +194,7 @@ gst_player_video_info_get_framerate (const GstPlayerVideoInfo * info,
{
g_return_if_fail (GST_IS_PLAYER_VIDEO_INFO (info));
*fps_n = info->framerate_num;
*fps_d = info->framerate_denom;
gst_play_video_info_get_framerate (info->info, fps_n, fps_d);
}
/**
@ -230,8 +212,7 @@ gst_player_video_info_get_pixel_aspect_ratio (const GstPlayerVideoInfo * info,
{
g_return_if_fail (GST_IS_PLAYER_VIDEO_INFO (info));
*par_n = info->par_num;
*par_d = info->par_denom;
gst_play_video_info_get_pixel_aspect_ratio (info->info, par_n, par_d);
}
/**
@ -245,7 +226,7 @@ gst_player_video_info_get_bitrate (const GstPlayerVideoInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_VIDEO_INFO (info), -1);
return info->bitrate;
return gst_play_video_info_get_bitrate (info->info);
}
/**
@ -259,7 +240,7 @@ gst_player_video_info_get_max_bitrate (const GstPlayerVideoInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_VIDEO_INFO (info), -1);
return info->max_bitrate;
return gst_play_video_info_get_max_bitrate (info->info);
}
/* Audio information */
@ -267,12 +248,9 @@ G_DEFINE_TYPE (GstPlayerAudioInfo, gst_player_audio_info,
GST_TYPE_PLAYER_STREAM_INFO);
static void
gst_player_audio_info_init (GstPlayerAudioInfo * info)
gst_player_audio_info_init (G_GNUC_UNUSED GstPlayerAudioInfo * info)
{
info->channels = 0;
info->sample_rate = 0;
info->bitrate = -1;
info->max_bitrate = -1;
}
static void
@ -280,7 +258,7 @@ gst_player_audio_info_finalize (GObject * object)
{
GstPlayerAudioInfo *info = GST_PLAYER_AUDIO_INFO (object);
g_free (info->language);
g_clear_object (&info->info);
G_OBJECT_CLASS (gst_player_audio_info_parent_class)->finalize (object);
}
@ -304,7 +282,7 @@ gst_player_audio_info_get_language (const GstPlayerAudioInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_AUDIO_INFO (info), NULL);
return info->language;
return gst_play_audio_info_get_language (info->info);
}
/**
@ -318,7 +296,7 @@ gst_player_audio_info_get_channels (const GstPlayerAudioInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_AUDIO_INFO (info), 0);
return info->channels;
return gst_play_audio_info_get_channels (info->info);
}
/**
@ -332,7 +310,7 @@ gst_player_audio_info_get_sample_rate (const GstPlayerAudioInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_AUDIO_INFO (info), 0);
return info->sample_rate;
return gst_play_audio_info_get_sample_rate (info->info);
}
/**
@ -346,7 +324,7 @@ gst_player_audio_info_get_bitrate (const GstPlayerAudioInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_AUDIO_INFO (info), -1);
return info->bitrate;
return gst_play_audio_info_get_bitrate (info->info);
}
/**
@ -360,7 +338,7 @@ gst_player_audio_info_get_max_bitrate (const GstPlayerAudioInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_AUDIO_INFO (info), -1);
return info->max_bitrate;
return gst_play_audio_info_get_max_bitrate (info->info);
}
/* Subtitle information */
@ -378,7 +356,7 @@ gst_player_subtitle_info_finalize (GObject * object)
{
GstPlayerSubtitleInfo *info = GST_PLAYER_SUBTITLE_INFO (object);
g_free (info->language);
g_clear_object (&info->info);
G_OBJECT_CLASS (gst_player_subtitle_info_parent_class)->finalize (object);
}
@ -402,18 +380,16 @@ gst_player_subtitle_info_get_language (const GstPlayerSubtitleInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_SUBTITLE_INFO (info), NULL);
return info->language;
return gst_play_subtitle_info_get_language (info->info);
}
/* Global media information */
G_DEFINE_TYPE (GstPlayerMediaInfo, gst_player_media_info, G_TYPE_OBJECT);
static void
gst_player_media_info_init (GstPlayerMediaInfo * info)
gst_player_media_info_init (G_GNUC_UNUSED GstPlayerMediaInfo * info)
{
info->duration = -1;
info->is_live = FALSE;
info->seekable = FALSE;
}
static void
@ -421,18 +397,6 @@ gst_player_media_info_finalize (GObject * object)
{
GstPlayerMediaInfo *info = GST_PLAYER_MEDIA_INFO (object);
g_free (info->uri);
if (info->tags)
gst_tag_list_unref (info->tags);
g_free (info->title);
g_free (info->container);
if (info->image_sample)
gst_sample_unref (info->image_sample);
if (info->audio_stream_list)
g_list_free (info->audio_stream_list);
@ -444,6 +408,7 @@ gst_player_media_info_finalize (GObject * object)
if (info->stream_list)
g_list_free_full (info->stream_list, g_object_unref);
g_clear_object (&info->info);
G_OBJECT_CLASS (gst_player_media_info_parent_class)->finalize (object);
}
@ -480,15 +445,7 @@ gst_player_video_info_copy (GstPlayerVideoInfo * ref)
GstPlayerVideoInfo *ret;
ret = gst_player_video_info_new ();
ret->width = ref->width;
ret->height = ref->height;
ret->framerate_num = ref->framerate_num;
ret->framerate_denom = ref->framerate_denom;
ret->par_num = ref->par_num;
ret->par_denom = ref->par_denom;
ret->bitrate = ref->bitrate;
ret->max_bitrate = ref->max_bitrate;
ret->info = g_object_ref (ref->info);
return (GstPlayerStreamInfo *) ret;
}
@ -499,14 +456,7 @@ gst_player_audio_info_copy (GstPlayerAudioInfo * ref)
GstPlayerAudioInfo *ret;
ret = gst_player_audio_info_new ();
ret->sample_rate = ref->sample_rate;
ret->channels = ref->channels;
ret->bitrate = ref->bitrate;
ret->max_bitrate = ref->max_bitrate;
if (ref->language)
ret->language = g_strdup (ref->language);
ret->info = g_object_ref (ref->info);
return (GstPlayerStreamInfo *) ret;
}
@ -517,8 +467,7 @@ gst_player_subtitle_info_copy (GstPlayerSubtitleInfo * ref)
GstPlayerSubtitleInfo *ret;
ret = gst_player_subtitle_info_new ();
if (ref->language)
ret->language = g_strdup (ref->language);
ret->info = g_object_ref (ref->info);
return (GstPlayerStreamInfo *) ret;
}
@ -539,14 +488,6 @@ gst_player_stream_info_copy (GstPlayerStreamInfo * ref)
info = gst_player_subtitle_info_copy ((GstPlayerSubtitleInfo *) ref);
info->stream_index = ref->stream_index;
if (ref->tags)
info->tags = gst_tag_list_ref (ref->tags);
if (ref->caps)
info->caps = gst_caps_copy (ref->caps);
if (ref->codec)
info->codec = g_strdup (ref->codec);
if (ref->stream_id)
info->stream_id = g_strdup (ref->stream_id);
return info;
}
@ -560,20 +501,9 @@ gst_player_media_info_copy (GstPlayerMediaInfo * ref)
if (!ref)
return NULL;
info = gst_player_media_info_new (ref->uri);
info->duration = ref->duration;
info->seekable = ref->seekable;
info->is_live = ref->is_live;
if (ref->tags)
info->tags = gst_tag_list_ref (ref->tags);
if (ref->title)
info->title = g_strdup (ref->title);
if (ref->container)
info->container = g_strdup (ref->container);
if (ref->image_sample)
info->image_sample = gst_sample_ref (ref->image_sample);
info = gst_player_media_info_new ();
for (l = ref->stream_list; l != NULL; l = l->next) {
for (l = gst_player_media_info_get_stream_list (ref); l != NULL; l = l->next) {
GstPlayerStreamInfo *s;
s = gst_player_stream_info_copy ((GstPlayerStreamInfo *) l->data);
@ -588,6 +518,8 @@ gst_player_media_info_copy (GstPlayerMediaInfo * ref)
g_list_append (info->subtitle_stream_list, s);
}
info->info = g_object_ref (ref->info);
return info;
}
@ -608,17 +540,99 @@ gst_player_stream_info_new (gint stream_index, GType type)
return info;
}
GstPlayerMediaInfo *
gst_player_media_info_new (const gchar * uri)
GstPlayerStreamInfo *
gst_player_stream_info_wrapped (GstPlayStreamInfo * info)
{
GstPlayerMediaInfo *info;
GstPlayerStreamInfo *ret;
GType type;
g_return_val_if_fail (uri != NULL, NULL);
if (GST_IS_PLAY_AUDIO_INFO (info)) {
type = GST_TYPE_PLAYER_AUDIO_INFO;
} else if (GST_IS_PLAY_VIDEO_INFO (info)) {
type = GST_TYPE_PLAYER_VIDEO_INFO;
} else {
type = GST_TYPE_PLAYER_SUBTITLE_INFO;
}
info = g_object_new (GST_TYPE_PLAYER_MEDIA_INFO, NULL);
info->uri = g_strdup (uri);
ret =
gst_player_stream_info_new (gst_play_stream_info_get_index (info), type);
ret->info = g_object_ref (info);
return ret;
}
return info;
GstPlayerMediaInfo *
gst_player_media_info_new (void)
{
return g_object_new (GST_TYPE_PLAYER_MEDIA_INFO, NULL);
}
GstPlayerMediaInfo *
gst_player_media_info_wrapped (GstPlayMediaInfo * info)
{
GstPlayerMediaInfo *ret;
GList *l;
ret = gst_player_media_info_new ();
ret->info = g_object_ref (info);
for (l = gst_play_media_info_get_stream_list (info); l != NULL; l = l->next) {
GstPlayerStreamInfo *s;
s = gst_player_stream_info_wrapped ((GstPlayStreamInfo *) l->data);
ret->stream_list = g_list_append (ret->stream_list, s);
if (GST_IS_PLAYER_AUDIO_INFO (s)) {
GstPlayerAudioInfo *i = GST_PLAYER_AUDIO_INFO (s);
i->info = g_object_ref (GST_PLAY_AUDIO_INFO (l->data));
ret->audio_stream_list = g_list_append (ret->audio_stream_list, i);
} else if (GST_IS_PLAYER_VIDEO_INFO (s)) {
GstPlayerVideoInfo *i = GST_PLAYER_VIDEO_INFO (s);
i->info = g_object_ref (GST_PLAY_VIDEO_INFO (l->data));
ret->video_stream_list = g_list_append (ret->video_stream_list, i);
} else {
GstPlayerSubtitleInfo *i = GST_PLAYER_SUBTITLE_INFO (s);
i->info = g_object_ref (GST_PLAY_SUBTITLE_INFO (l->data));
ret->subtitle_stream_list = g_list_append (ret->subtitle_stream_list, i);
}
}
return ret;
}
GstPlayerAudioInfo *
gst_player_audio_info_wrapped (GstPlayAudioInfo * info)
{
GstPlayerStreamInfo *s;
GstPlayerAudioInfo *i;
s = gst_player_stream_info_wrapped ((GstPlayStreamInfo *) info);
i = GST_PLAYER_AUDIO_INFO (s);
i->info = g_object_ref (info);
return i;
}
GstPlayerVideoInfo *
gst_player_video_info_wrapped (GstPlayVideoInfo * info)
{
GstPlayerStreamInfo *s;
GstPlayerVideoInfo *i;
s = gst_player_stream_info_wrapped ((GstPlayStreamInfo *) info);
i = GST_PLAYER_VIDEO_INFO (s);
i->info = g_object_ref (info);
return i;
}
GstPlayerSubtitleInfo *
gst_player_subtitle_info_wrapped (GstPlaySubtitleInfo * info)
{
GstPlayerStreamInfo *s;
GstPlayerSubtitleInfo *i;
s = gst_player_stream_info_wrapped ((GstPlayStreamInfo *) info);
i = GST_PLAYER_SUBTITLE_INFO (s);
i->info = g_object_ref (info);
return i;
}
/**
@ -632,7 +646,7 @@ gst_player_media_info_get_uri (const GstPlayerMediaInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);
return info->uri;
return gst_play_media_info_get_uri (info->info);
}
/**
@ -646,7 +660,7 @@ gst_player_media_info_is_seekable (const GstPlayerMediaInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), FALSE);
return info->seekable;
return gst_play_media_info_is_seekable (info->info);
}
/**
@ -660,7 +674,7 @@ gst_player_media_info_is_live (const GstPlayerMediaInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), FALSE);
return info->is_live;
return gst_play_media_info_is_live (info->info);
}
/**
@ -734,7 +748,7 @@ gst_player_media_info_get_duration (const GstPlayerMediaInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), -1);
return info->duration;
return gst_play_media_info_get_duration (info->info);
}
/**
@ -748,7 +762,7 @@ gst_player_media_info_get_tags (const GstPlayerMediaInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);
return info->tags;
return gst_play_media_info_get_tags (info->info);
}
/**
@ -762,7 +776,7 @@ gst_player_media_info_get_title (const GstPlayerMediaInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);
return info->title;
return gst_play_media_info_get_title (info->info);
}
/**
@ -776,7 +790,7 @@ gst_player_media_info_get_container_format (const GstPlayerMediaInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);
return info->container;
return gst_play_media_info_get_container_format (info->info);
}
/**
@ -793,7 +807,7 @@ gst_player_media_info_get_image_sample (const GstPlayerMediaInfo * info)
{
g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);
return info->image_sample;
return gst_play_media_info_get_image_sample (info->info);
}
/**

View file

@ -0,0 +1,49 @@
/* GStreamer
*
* Copyright (C) 2020 Philippe Normand <philn@igalia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_PLAYER_WRAPPED_VIDEO_RENDERER_H__
#define __GST_PLAYER_WRAPPED_VIDEO_RENDERER_H__
#include <gst/player/gstplayer-types.h>
#include <gst/player/gstplayer-video-renderer.h>
G_BEGIN_DECLS
typedef struct _GstPlayerWrappedVideoRenderer
GstPlayerWrappedVideoRenderer;
typedef struct _GstPlayerWrappedVideoRendererClass
GstPlayerWrappedVideoRendererClass;
#define GST_TYPE_PLAYER_WRAPPED_VIDEO_RENDERER (gst_player_wrapped_video_renderer_get_type ())
#define GST_IS_PLAYER_WRAPPED_VIDEO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAYER_WRAPPED_VIDEO_RENDERER))
#define GST_IS_PLAYER_WRAPPED_VIDEO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAYER_WRAPPED_VIDEO_RENDERER))
#define GST_PLAYER_WRAPPED_VIDEO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAYER_WRAPPED_VIDEO_RENDERER, GstPlayerWrappedVideoRendererClass))
#define GST_PLAYER_WRAPPED_VIDEO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAYER_WRAPPED_VIDEO_RENDERER, GstPlayerWrappedVideoRenderer))
#define GST_PLAYER_WRAPPED_VIDEO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAYER_WRAPPED_VIDEO_RENDERER, GstPlayerWrappedVideoRendererClass))
#define GST_PLAYER_WRAPPED_VIDEO_RENDERER_CAST(obj) ((GstPlayerWrappedVideoRenderer*)(obj))
GType gst_player_wrapped_video_renderer_get_type (void);
GstPlayerVideoRenderer * gst_player_wrapped_video_renderer_new (GstPlayerVideoRenderer * renderer, GstPlayer * player);
G_END_DECLS
#endif /* __GST_PLAYER_WRAPPED_VIDEO_RENDERER_H__ */

View file

@ -0,0 +1,114 @@
/* GStreamer
*
* Copyright (C) 2020 Philippe Normand <philn@igalia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/play/gstplay-video-renderer.h>
#include "gstplayer-wrapped-video-renderer-private.h"
#include "gstplayer.h"
#include "gstplayer-video-renderer-private.h"
/*
* This object is an internal wrapper created by the GstPlayer, implementing the
* new GstPlayVideoRenderer interface and acting as a bridge from the legacy
* GstPlayerVideoRenderer interface.
*/
struct _GstPlayerWrappedVideoRenderer
{
GObject parent;
GstPlayerVideoRenderer *renderer;
GstPlayer *player;
};
struct _GstPlayerWrappedVideoRendererClass
{
GObjectClass parent_class;
};
static void
gst_player_wrapped_video_renderer_interface_init
(GstPlayVideoRendererInterface * iface);
G_DEFINE_TYPE_WITH_CODE (GstPlayerWrappedVideoRenderer,
gst_player_wrapped_video_renderer, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GST_TYPE_PLAY_VIDEO_RENDERER,
gst_player_wrapped_video_renderer_interface_init));
static void
gst_player_wrapped_video_renderer_finalize (GObject * object)
{
GstPlayerWrappedVideoRenderer *self =
GST_PLAYER_WRAPPED_VIDEO_RENDERER (object);
g_clear_object (&self->renderer);
G_OBJECT_CLASS
(gst_player_wrapped_video_renderer_parent_class)->finalize (object);
}
static void
gst_player_wrapped_video_renderer_class_init (GstPlayerWrappedVideoRendererClass
* klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = gst_player_wrapped_video_renderer_finalize;
}
static void
gst_player_wrapped_video_renderer_init (GstPlayerWrappedVideoRenderer * self)
{
}
static GstElement *
gst_player_wrapped_video_renderer_create_video_sink (GstPlayVideoRenderer *
iface, GstPlay * player)
{
GstPlayerWrappedVideoRenderer *self =
GST_PLAYER_WRAPPED_VIDEO_RENDERER (iface);
return gst_player_video_renderer_create_video_sink (self->renderer,
self->player);
}
static void
gst_player_wrapped_video_renderer_interface_init (GstPlayVideoRendererInterface
* iface)
{
iface->create_video_sink =
gst_player_wrapped_video_renderer_create_video_sink;
}
GstPlayerVideoRenderer *
gst_player_wrapped_video_renderer_new (GstPlayerVideoRenderer * renderer,
GstPlayer * player)
{
GstPlayerWrappedVideoRenderer *self =
g_object_new (GST_TYPE_PLAYER_WRAPPED_VIDEO_RENDERER,
NULL);
self->renderer = g_object_ref (renderer);
self->player = player;
return (GstPlayerVideoRenderer *) self;
}

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,7 @@ gstplayer_sources = [
'gstplayer-media-info.c',
'gstplayer-g-main-context-signal-dispatcher.c',
'gstplayer-video-overlay-video-renderer.c',
'gstplayer-wrapped-video-renderer.c',
'gstplayer-visualization.c',
]
@ -31,7 +32,7 @@ gstplayer = library('gstplayer-' + api_version,
soversion : soversion,
darwin_versions : osxversion,
install : true,
dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep,
dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep, gstplay_dep,
gsttag_dep, gstpbutils_dep],
)
@ -56,7 +57,7 @@ if build_gir
'GstAudio-1.0', 'GstTag-1.0'],
install : true,
extra_args : gir_init_section + ['-DGST_USE_UNSTABLE_API'] + ['--c-include=gst/player/player.h'],
dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep,
dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep, gstplay_dep,
gsttag_dep, gstpbutils_dep]
)
gen_sources += player_gir
@ -65,7 +66,7 @@ endif
gstplayer_dep = declare_dependency(link_with : gstplayer,
include_directories : [libsinc],
sources: gen_sources,
dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep,
dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep, gstplay_dep,
gsttag_dep, gstpbutils_dep])
meson.override_dependency('gstreamer-player-1.0', gstplayer_dep)