summaryrefslogtreecommitdiff
path: root/src/generic/evas
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2019-10-30 17:09:20 +0100
committerCedric BAIL <cedric.bail@free.fr>2019-12-04 12:21:25 -0800
commitb8dc80c144fec54a521987535c57b995748ccece (patch)
tree525452784e313429732ff12f1f556485e159a19e /src/generic/evas
parentf3d9b8ee703621cfbb52a03d346335148318af7a (diff)
emotion & evas: remove gstreamer 0.10 support
We have Gstreamer 1.x support for a long time already. We used to keep this around as fallback. By now Linux distributions start to actually no longer ship the Gstreamer 0.10.x packages and upstream has not seen a release in in 5 years. Time to remove it on our side as well. Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com> Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10779
Diffstat (limited to 'src/generic/evas')
-rw-r--r--src/generic/evas/gst/main_0_10.c281
-rw-r--r--src/generic/evas/gst/meson.build10
2 files changed, 1 insertions, 290 deletions
diff --git a/src/generic/evas/gst/main_0_10.c b/src/generic/evas/gst/main_0_10.c
deleted file mode 100644
index 8a197c4208..0000000000
--- a/src/generic/evas/gst/main_0_10.c
+++ /dev/null
@@ -1,281 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <fcntl.h>
6#include <unistd.h>
7
8#include <gst/gst.h>
9
10#include <Eina.h>
11
12#include "shmfile.h"
13#include "timeout.h"
14
15#define DATA32 unsigned int
16
17//#define GST_DBG
18
19#ifdef GST_DBG
20#define D(fmt, args...) fprintf(stderr, fmt, ## args)
21#else
22#define D(fmt, args...)
23#endif
24
25#define CAPS "video/x-raw-rgb,bpp=(int)32,depth=(int)32,endianness=(int)4321,red_mask=(int)0x0000ff00, green_mask=(int)0x00ff0000, blue_mask=(int)0xff000000"
26
27static GstElement *pipeline = NULL;
28static GstElement *sink = NULL;
29static gint64 duration = -1;
30
31int width = 0;
32int height = 0;
33void *data = NULL;
34
35
36static Eina_Bool
37_gst_init(const char *filename)
38{
39 GstPad *pad;
40 GstCaps *caps;
41 GstStructure *structure;
42 gchar *descr;
43 gchar *uri;
44 GError *error = NULL;
45 GstFormat format;
46 GstStateChangeReturn ret;
47// int vidstr = 0;
48
49 if (!filename || !*filename)
50 return EINA_FALSE;
51
52 if (!gst_init_check(NULL, NULL, &error))
53 return EINA_FALSE;
54
55 if ((*filename == '/') || (*filename == '~'))
56 {
57 uri = g_filename_to_uri(filename, NULL, NULL);
58 if (!uri)
59 {
60 D("could not create new uri from %s", filename);
61 goto unref_pipeline;
62 }
63 }
64 else
65 uri = strdup(filename);
66
67 D("Setting file %s\n", uri);
68
69 descr = g_strdup_printf("uridecodebin uri=%s ! typefind ! ffmpegcolorspace ! "
70 " appsink name=sink caps=\"" CAPS "\"", uri);
71 pipeline = gst_parse_launch(descr, &error);
72 free(uri);
73
74 if (error != NULL)
75 {
76 D("could not construct pipeline: %s\n", error->message);
77 g_error_free (error);
78 goto gst_shutdown;
79 }
80/* needs gst 1.0+
81 * also only works on playbin objects!!! this is a uridecodebin!
82 g_object_get(G_OBJECT(pipeline),
83 "n-video", &vidstr,
84 NULL);
85 if (vidstr <= 0)
86 {
87 D("no video stream\n");
88 goto gst_shutdown;
89 }
90*/
91 sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
92
93 ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
94 switch (ret)
95 {
96 case GST_STATE_CHANGE_FAILURE:
97 D("failed to play the file\n");
98 goto unref_pipeline;
99 case GST_STATE_CHANGE_NO_PREROLL:
100 D("live sources not supported yet\n");
101 goto unref_pipeline;
102 default:
103 break;
104 }
105
106 ret = gst_element_get_state((pipeline), NULL, NULL, GST_CLOCK_TIME_NONE);
107 if (ret == GST_STATE_CHANGE_FAILURE)
108 {
109 D("could not complete pause\n");
110 goto unref_pipeline;
111 }
112
113 format = GST_FORMAT_TIME;
114 gst_element_query_duration (pipeline, &format, &duration);
115 if (duration == -1)
116 {
117 D("could not retrieve the duration, set it to 1s\n");
118 duration = 1 * GST_SECOND;
119 }
120
121 pad = gst_element_get_static_pad(sink, "sink");
122 if (!pad)
123 {
124 D("could not retrieve the sink pad\n");
125 goto unref_pipeline;
126 }
127
128 caps = gst_pad_get_negotiated_caps(pad);
129 if (!caps)
130 goto unref_pad;
131
132 structure = gst_caps_get_structure(caps, 0);
133
134 if (!gst_structure_get_int(structure, "width", &width))
135 goto unref_caps;
136 if (!gst_structure_get_int(structure, "height", &height))
137 goto unref_caps;
138
139 gst_caps_unref(caps);
140 gst_object_unref(pad);
141
142 return EINA_TRUE;
143
144 unref_caps:
145 gst_caps_unref(caps);
146 unref_pad:
147 gst_object_unref(pad);
148 unref_pipeline:
149 gst_element_set_state (pipeline, GST_STATE_NULL);
150 gst_object_unref(pipeline);
151 gst_shutdown:
152 gst_deinit();
153
154 return EINA_FALSE;
155}
156
157static void
158_gst_shutdown()
159{
160 gst_element_set_state (pipeline, GST_STATE_NULL);
161 gst_object_unref(pipeline);
162 gst_deinit();
163}
164
165static void
166_gst_load_image(int size_w EINA_UNUSED, int size_h EINA_UNUSED, double pos)
167{
168 GstBuffer *buffer;
169
170 D("load image\n");
171 if (pos >= 0.0)
172 gst_element_seek_simple(pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
173 pos * 1000000000.0);
174 else
175 gst_element_seek_simple(pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
176 duration / 2);
177 g_signal_emit_by_name(sink, "pull-preroll", &buffer, NULL);
178 D("load image : %p %d\n", GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer));
179
180 shm_alloc(width * height * sizeof(DATA32));
181 if (!shm_addr) return;
182 data = shm_addr;
183
184 memcpy(data, GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer));
185}
186
187int
188main(int argc, char **argv)
189{
190 char *file, *p;
191 int i, numonly;
192 int size_w = 0, size_h = 0;
193 int head_only = 0;
194 long long pos = -1.0;
195
196 if (argc < 2) return -1;
197 // file is ALWAYS first arg, other options come after
198 file = argv[1];
199 for (i = 2; i < argc; i++)
200 {
201 if (!strcmp(argv[i], "-head"))
202 // asked to only load header, not body/data
203 head_only = 1;
204 else if (!strcmp(argv[i], "-key"))
205 {
206 i++;
207 numonly = 1;
208 for (p = argv[i]; *p; p++)
209 {
210 if ((!*p < '0') || (*p > 9))
211 {
212 numonly = 0;
213 break;
214 }
215 }
216 if (numonly) pos = (double)(atoll(argv[i])) / 1000.0;
217 i++;
218 }
219 else if (!strcmp(argv[i], "-opt-scale-down-by"))
220 { // not used by ps loader
221 i++;
222 // int scale_down = atoi(argv[i]);
223 }
224 else if (!strcmp(argv[i], "-opt-dpi"))
225 {
226 i++;
227 }
228 else if (!strcmp(argv[i], "-opt-size"))
229 { // not used by ps loader
230 i++;
231 size_w = atoi(argv[i]);
232 i++;
233 size_h = atoi(argv[i]);
234 }
235 }
236
237 timeout_init(10);
238
239 D("_gst_init_file\n");
240
241 if (!_gst_init(file))
242 return -1;
243 D("_gst_init done\n");
244
245 if (!head_only)
246 {
247 _gst_load_image(size_w, size_h, pos);
248 }
249
250 D("size...: %ix%i\n", width, height);
251 D("alpha..: 0\n");
252
253 printf("size %i %i\n", width, height);
254 printf("alpha 0\n");
255
256 if (!head_only)
257 {
258 if (shm_fd >= 0)
259 {
260 printf("shmfile %s\n", shmfile);
261 }
262 else
263 {
264 // could also to "tmpfile %s\n" like shmfile but just
265 // a mmaped tmp file on the system
266 printf("data\n");
267 if (fwrite(data, width * height * sizeof(DATA32), 1, stdout) != 1)
268 {
269 shm_free();
270 return -1;
271 }
272 }
273 shm_free();
274 }
275 else
276 printf("done\n");
277
278 _gst_shutdown();
279 fflush(stdout);
280 return 0;
281}
diff --git a/src/generic/evas/gst/meson.build b/src/generic/evas/gst/meson.build
index aa10f7e513..c324ef4702 100644
--- a/src/generic/evas/gst/meson.build
+++ b/src/generic/evas/gst/meson.build
@@ -1,11 +1,3 @@
1
2# gstreamer 0.1 support
3#generic_deps = [dependency('gstreamer')]
4#generic_src = files([
5# 'main_0_10.c'
6#])
7
8
9generic_src = files([ 1generic_src = files([
10 'main.c' 2 'main.c'
11]) 3])
@@ -14,4 +6,4 @@ generic_deps = []
14if get_option('gstreamer') == true 6if get_option('gstreamer') == true
15 generic_deps += dependency('gstreamer-1.0') 7 generic_deps += dependency('gstreamer-1.0')
16endif 8endif
17generic_support = ['264','3g2','3gp','3gp2','3gpp','3gpp2','3p2','asf','avi','bdm','bdmv','clpi','cpi','dv','fla','flv','m1v','m2t','m2v','m4v','mkv','mov','mp2','mp2ts','mp4','mpe','mpeg','mpg','mpl','mpls','mts','mxf','nut','nuv','ogg','ogm','ogv','qt','rm','rmj','rmm','rms','rmx','rmvb','rv','swf','ts','webm','weba','wmv'] \ No newline at end of file 9generic_support = ['264','3g2','3gp','3gp2','3gpp','3gpp2','3p2','asf','avi','bdm','bdmv','clpi','cpi','dv','fla','flv','m1v','m2t','m2v','m4v','mkv','mov','mp2','mp2ts','mp4','mpe','mpeg','mpg','mpl','mpls','mts','mxf','nut','nuv','ogg','ogm','ogv','qt','rm','rmj','rmm','rms','rmx','rmvb','rv','swf','ts','webm','weba','wmv']