summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuqing Zhu <carol.zhu@nxp.com>2017-06-23 13:50:32 +0800
committerOtavio Salvador <otavio@ossystems.com.br>2017-06-28 15:21:18 -0300
commitf7c8e6d22837fadbe0e1fc99129f9a17978707e5 (patch)
tree54e54c6b1aa09ab6ffc38c61658b1eddd8247dd2
parentb3658be99a9ae30f61c9ecad2dd037a4b20d118d (diff)
downloadmeta-freescale-f7c8e6d22837fadbe0e1fc99129f9a17978707e5.tar.gz
Revert "gstreamer1.0-plugins-bad: Add some gstplayer API"
The patch has some applying conflicts. It should be applied after some poky patches, but they are still under review, not accepted yet. Will add it back later. This reverts commit faa2234c766558b904447405ee30cd3d183c79e4. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
-rwxr-xr-xrecipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-Specific-patches-for-gstplayer-API.patch292
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend1
2 files changed, 0 insertions, 293 deletions
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-Specific-patches-for-gstplayer-API.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-Specific-patches-for-gstplayer-API.patch
deleted file mode 100755
index 0679e4b6..00000000
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-Specific-patches-for-gstplayer-API.patch
+++ /dev/null
@@ -1,292 +0,0 @@
1From 3d789943c1f0568014ff2399a097b5dfa5d7a92e Mon Sep 17 00:00:00 2001
2From: Lyon Wang <lyon.wang@nxp.com>
3Date: Fri, 30 Dec 2016 15:53:21 +0800
4Subject: [PATCH 3/5] Specific patches for gstplayer API
5
6player: Add get_rotate, set_rotate API
7
8- Add gstplayer get_rotate() and set_rotate() API
9
10player: Add force-aspect-ratio config
11
12- Add get/set force-aspect-ratio config API
13
14player: Add set audio / text sink API
15
16- Add set audio / text sink API
17
18Upstream-Status: Inappropriate [i.MX specific]
19
20Signed-off-by: Lyon Wang <lyon.wang@nxp.com>
21---
22 gst-libs/gst/player/gstplayer.c | 214 ++++++++++++++++++++++++++++++++++++++++
23 gst-libs/gst/player/gstplayer.h | 10 ++
24 2 files changed, 224 insertions(+)
25
26diff --git a/gst-libs/gst/player/gstplayer.c b/gst-libs/gst/player/gstplayer.c
27index d9ff524..960e7a2 100644
28--- a/gst-libs/gst/player/gstplayer.c
29+++ b/gst-libs/gst/player/gstplayer.c
30@@ -86,6 +86,7 @@ typedef enum
31 CONFIG_QUARK_USER_AGENT = 0,
32 CONFIG_QUARK_POSITION_INTERVAL_UPDATE,
33 CONFIG_QUARK_ACCURATE_SEEK,
34+ CONFIG_QUARK_FORCE_ASPECT_RATIO,
35
36 CONFIG_QUARK_MAX
37 } ConfigQuarkId;
38@@ -94,6 +95,7 @@ static const gchar *_config_quark_strings[] = {
39 "user-agent",
40 "position-interval-update",
41 "accurate-seek",
42+ "force-aspect-ratio",
43 };
44
45 GQuark _config_quark_table[CONFIG_QUARK_MAX];
46@@ -269,6 +271,7 @@ gst_player_init (GstPlayer * self)
47 self->config = gst_structure_new_id (QUARK_CONFIG,
48 CONFIG_QUARK (POSITION_INTERVAL_UPDATE), G_TYPE_UINT, DEFAULT_POSITION_UPDATE_INTERVAL_MS,
49 CONFIG_QUARK (ACCURATE_SEEK), G_TYPE_BOOLEAN, FALSE,
50+ CONFIG_QUARK (FORCE_ASPECT_RATIO), G_TYPE_BOOLEAN, TRUE,
51 NULL);
52 /* *INDENT-ON* */
53
54@@ -4259,3 +4262,214 @@ gst_player_config_get_seek_accurate (const GstStructure * config)
55
56 return accurate;
57 }
58+
59+/**
60+ * gst_player_get_video_sink:
61+ * @player: #GstPlayer instance
62+ *
63+ * Returns: actual video sink element
64+ */
65+GstElement *
66+gst_player_get_video_sink (GstPlayer * self)
67+{
68+ GstElement *sink = NULL;
69+ GstElement *actual_sink = NULL;
70+ GstIteratorResult rc;
71+ GstIterator *it;
72+ GValue item = { 0, };
73+ g_return_val_if_fail (GST_IS_PLAYER (self), NULL);
74+
75+ g_object_get (G_OBJECT (self->playbin), "video-sink", &sink, NULL);
76+ if (NULL == sink) {
77+ GST_WARNING_OBJECT (self, "No video-sink found");
78+ return NULL;
79+ }
80+ it = gst_bin_iterate_sinks ((GstBin *) sink);
81+ do {
82+ rc = gst_iterator_next (it, &item);
83+ if (rc == GST_ITERATOR_OK) {
84+ break;
85+ }
86+ } while (rc != GST_ITERATOR_DONE);
87+
88+ g_object_unref (sink);
89+ actual_sink = g_value_get_object (&item);
90+ g_value_unset (&item);
91+ gst_iterator_free (it);
92+
93+ if (NULL == actual_sink) {
94+ GST_WARNING_OBJECT (self, "No video-sink found");
95+ return NULL;
96+ }
97+
98+ return actual_sink;
99+}
100+
101+/**
102+ * gst_palyer_set_rotate:
103+ * @player: #GstPlayer instance
104+ * @rotation: rotation degree value
105+ *
106+ * Returns: %TRUE or %FALSE
107+ *
108+ * Set the rotation vaule
109+ */
110+gboolean
111+gst_player_set_rotate (GstPlayer * self, gint rotation)
112+{
113+ GstElement *video_sink = NULL;
114+ GObjectClass *gobjclass = NULL;
115+ g_return_val_if_fail (GST_IS_PLAYER (self), FALSE);
116+
117+ video_sink = gst_player_get_video_sink (self);
118+ if (NULL == video_sink) {
119+ GST_WARNING_OBJECT (self, " cannot get video sink ");
120+ return FALSE;
121+ }
122+ GST_DEBUG_OBJECT (self, "set rotation degree '%d'", rotation);
123+
124+ gobjclass = G_OBJECT_GET_CLASS (G_OBJECT (video_sink));
125+ if (g_object_class_find_property (gobjclass, "rotate")
126+ && g_object_class_find_property (gobjclass, "reconfig")) {
127+ g_object_set (G_OBJECT (video_sink), "rotate", rotation / 90, NULL);
128+ g_object_set (G_OBJECT (video_sink), "reconfig", 1, NULL);
129+ } else if (g_object_class_find_property (gobjclass, "rotate-method")) {
130+ g_object_set (G_OBJECT (video_sink), "rotate-method", rotation / 90, NULL);
131+ } else {
132+ GST_INFO_OBJECT (self, "can't set rotation for current video sink %s'",
133+ gst_element_get_name (video_sink));
134+ return FALSE;
135+ }
136+
137+ return TRUE;
138+}
139+
140+/**
141+ * gst_player_get_rotate:
142+ * @player: #GstPlayer instance
143+ *
144+ * Returns: the rotation degree value
145+ */
146+gint
147+gst_player_get_rotate (GstPlayer * self)
148+{
149+ GstElement *video_sink = NULL;
150+ GObjectClass *gobjclass = NULL;
151+ gint rotation = 0;
152+ g_return_val_if_fail (GST_IS_PLAYER (self), 0);
153+
154+ video_sink = gst_player_get_video_sink (self);
155+ if (NULL == video_sink) {
156+ GST_WARNING_OBJECT (self, " cannot get video sink ");
157+ return 0;
158+ }
159+
160+ /* check if the element has "rotate" property */
161+ gobjclass = G_OBJECT_GET_CLASS (video_sink);
162+ if (g_object_class_find_property (gobjclass, "rotate")) {
163+ g_object_get (G_OBJECT (video_sink), "rotate", &rotation, NULL);
164+ rotation = rotation * 90;
165+ } else if (g_object_class_find_property (gobjclass, "rotate-method")) {
166+ g_object_get (G_OBJECT (video_sink), "rotate-method", &rotation, NULL);
167+ rotation = rotation * 90;
168+ }
169+
170+ GST_DEBUG_OBJECT (self, "get rotation degree '%d'", rotation);
171+
172+ return rotation;
173+}
174+
175+/**
176+ * gst_player_config_set_force_aspect_ratio:
177+ * @player: #GstPlayer instance
178+ * @force_aspect_ratio: keey original aspect ratio or not
179+ *
180+ * Enable or disable force aspect ratio
181+ * force_aspect_ratio seeking is TRUE by default.
182+ *
183+ * Since: 1.12
184+ */
185+void
186+gst_player_config_set_force_aspect_ratio (GstPlayer * self, gboolean force_aspect_ratio)
187+{
188+ GstStructure *config = self->config;
189+ g_return_if_fail (config != NULL);
190+
191+ gst_structure_id_set (config,
192+ CONFIG_QUARK (FORCE_ASPECT_RATIO), G_TYPE_BOOLEAN, force_aspect_ratio, NULL);
193+
194+ g_object_set(self->playbin, "force-aspect-ratio", force_aspect_ratio, NULL);
195+}
196+
197+/**
198+ * gst_player_config_get_force_aspect_ratio:
199+ * @config: a #GstPlayer configuration
200+ *
201+ * Returns: %TRUE if force-aspect-ratio is enabled
202+ *
203+ * Since 1.12
204+ */
205+gboolean
206+gst_player_config_get_force_aspect_ratio (const GstStructure * config)
207+{
208+ gboolean force_aspect_ratio = TRUE;
209+
210+ g_return_val_if_fail (config != NULL, FALSE);
211+
212+ gst_structure_id_get (config,
213+ CONFIG_QUARK (FORCE_ASPECT_RATIO), G_TYPE_BOOLEAN, &force_aspect_ratio, NULL);
214+
215+ return force_aspect_ratio;
216+}
217+
218+/**
219+ * gst_player_set_audio_sink:
220+ * @player: #GstPlayer instance
221+ * @sink_name: the sink name to set
222+ *
223+ * Returns: %TRUE or %FALSE
224+ *
225+ * Set the customize audio sink
226+ */
227+gboolean
228+gst_player_set_audio_sink (GstPlayer * self, const gchar * sink_name)
229+{
230+ GstElement *audio_sink = NULL;
231+ g_return_val_if_fail (GST_IS_PLAYER (self), FALSE);
232+
233+ audio_sink = gst_parse_bin_from_description (sink_name, TRUE, NULL);
234+ if (!audio_sink) {
235+ GST_ERROR_OBJECT (self, "invalid audio sink %s", sink_name);
236+ return FALSE;
237+ }
238+
239+ g_object_set (G_OBJECT (self->playbin), "audio-sink", audio_sink, NULL);
240+ GST_DEBUG_OBJECT (self, "set audio sink '%s'", sink_name);
241+ return TRUE;
242+}
243+
244+/**
245+ * gst_player_set_text_sink:
246+ * @player: #GstPlayer instance
247+ * @sink_name: the sink name to set
248+ *
249+ * Returns: %TRUE or %FALSE
250+ *
251+ * Set the customize video sink
252+ */
253+gboolean
254+gst_player_set_text_sink (GstPlayer * self, const gchar * sink_name)
255+{
256+ GstElement *text_sink = NULL;
257+ g_return_val_if_fail (GST_IS_PLAYER (self), FALSE);
258+
259+ text_sink = gst_parse_bin_from_description (sink_name, TRUE, NULL);
260+ if (!text_sink) {
261+ GST_ERROR_OBJECT (self, "invalid text sink %s", sink_name);
262+ return FALSE;
263+ }
264+
265+ g_object_set (G_OBJECT (self->playbin), "text-sink", text_sink, NULL);
266+ GST_DEBUG_OBJECT (self, "set text sink '%s'", sink_name);
267+ return TRUE;
268+}
269diff --git a/gst-libs/gst/player/gstplayer.h b/gst-libs/gst/player/gstplayer.h
270index 8426be5..bfc12b2 100644
271--- a/gst-libs/gst/player/gstplayer.h
272+++ b/gst-libs/gst/player/gstplayer.h
273@@ -205,6 +205,16 @@ guint gst_player_config_get_position_update_interval (const GstStructu
274 void gst_player_config_set_seek_accurate (GstPlayer * player, gboolean accurate);
275 gboolean gst_player_config_get_seek_accurate (const GstStructure * config);
276
277+/* Custom gstplayer API */
278+gboolean gst_player_set_rotate (GstPlayer * player, gint rotation);
279+gint gst_player_get_rotate (GstPlayer * player);
280+
281+void gst_player_config_set_force_aspect_ratio (GstPlayer * self, gboolean force_aspect_ratio);
282+gboolean gst_player_config_get_force_aspect_ratio (const GstStructure * config);
283+
284+gboolean gst_player_set_audio_sink (GstPlayer * player, const gchar * sink_name);
285+gboolean gst_player_set_text_sink (GstPlayer * player, const gchar * sink_name);
286+
287 G_END_DECLS
288
289 #endif /* __GST_PLAYER_H__ */
290--
2911.9.1
292
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
index 12b70226..7d852d84 100644
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
+++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
@@ -15,7 +15,6 @@ SRC_URI_append_imxgpu2d = " \
15 file://0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch \ 15 file://0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch \
16 file://0006-glwindow-work-around-for-no-frame-when-imxplayer-use.patch \ 16 file://0006-glwindow-work-around-for-no-frame-when-imxplayer-use.patch \
17 file://0007-glcolorconvert-fix-MRT-cannot-work-in-GLES3.0.patch \ 17 file://0007-glcolorconvert-fix-MRT-cannot-work-in-GLES3.0.patch \
18 file://0008-Specific-patches-for-gstplayer-API.patch \
19" 18"
20 19
21 20