2
* Copyright (C) 2003 Julien Moutte <julien@moutte.net>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Library General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Library General Public License for more details.
14
* You should have received a copy of the GNU Library General Public
15
* License along with this library; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
* Boston, MA 02111-1307, USA.
25
#include "gstswitch.h"
30
/* This element allows runtime switching between many sources. It outputs a
31
* new segment every time it switches. The input sources are expected to be
32
* rate controlled/live or synced to the clock using identity sync=true upstream
33
* of this element. If they are not, your cpu usage will hike up.
36
* videotestsrc pattern=0 ! identity sync=true \
38
* videotestsrc pattern=1 ! identity sync=true /
40
* videotestsrc pattern=0 ! identity sync=true \
42
* identity single-segment=true !
43
* theoraenc ! oggmux ! filesink
44
* videotestsrc pattern=1 ! identity sync=true /
46
* To switch both an audio and a video stream, you need 2 switch elements
47
* one for audio and one for video. To make sure they are in sync, the app
48
* needs to do the following when switching:
50
* i) Block the sink pads of both the switch elements.
51
* ii) Retrieve the last-timestamp property from both the switch elements
52
* iii) Set the stop-value property on both the switch elements to the
54
* iv) Set the active-sinkpad property on the switch elements to the sink
56
* v) Set the queue-buffers property on both the switch elements to True.
57
* vi) Add buffer pad probes on the active sinkpad of each of the switch
59
* vii) Unblock the sink pads of both the swith elements.
60
* viii) In the pad probes, store the buffer timestamp of the buffer that
61
* comes in and remove the pad probe.
62
* ix) Once both pad probes have been fired (one for video, one for audio),
63
* then set the start-value property on both the switch elements to the
64
* lower of the 2 buffer timestamps and set the queue-buffers property
65
* on both the switch elements to False.
79
GST_DEBUG_CATEGORY_STATIC (switch_debug);
80
#define GST_CAT_DEFAULT switch_debug
81
/* ElementFactory information */
82
static const GstElementDetails gst_switch_details =
83
GST_ELEMENT_DETAILS ("Switch",
85
"N-to-1 input switching",
86
"Julien Moutte <julien@moutte.net>\n"
87
"Zaheer Merali <zaheerabbas at merali dot org>");
89
static GstStaticPadTemplate gst_switch_sink_factory =
90
GST_STATIC_PAD_TEMPLATE ("sink%d",
95
static GstStaticPadTemplate gst_switch_src_factory =
96
GST_STATIC_PAD_TEMPLATE ("src",
101
static GstElementClass *parent_class = NULL;
102
static GstCaps *gst_switch_getcaps (GstPad * pad);
103
static GList *gst_switch_get_linked_pads (GstPad * pad);
104
static GstFlowReturn gst_switch_bufferalloc (GstPad * pad, guint64 offset,
105
guint size, GstCaps * caps, GstBuffer ** buf);
106
static GstFlowReturn gst_switch_chain (GstPad * pad, GstBuffer * buf);
107
static gboolean gst_switch_event (GstPad * pad, GstEvent * event);
109
/* ============================================================= */
111
/* Private Methods */
113
/* ============================================================= */
117
gst_switch_release_pad (GstElement * element, GstPad * pad)
119
GstSwitch *gstswitch = NULL;
121
g_return_if_fail (GST_IS_SWITCH (element));
123
gstswitch = GST_SWITCH (element);
125
GST_LOG_OBJECT (gstswitch, "releasing requested pad %p", pad);
127
gst_element_remove_pad (element, pad);
128
GST_OBJECT_LOCK (gstswitch);
129
gstswitch->nb_sinkpads--;
130
if (gstswitch->active_sinkpad == pad) {
131
gst_object_unref (gstswitch->active_sinkpad);
132
gstswitch->active_sinkpad = NULL;
133
if (gstswitch->nb_sinkpads == 0) {
135
gst_element_iterate_sink_pads (GST_ELEMENT (gstswitch));
136
gpointer active_sinkpad_store = (gpointer) gstswitch->active_sinkpad;
138
if (gst_iterator_next (iter, &active_sinkpad_store) == GST_ITERATOR_DONE) {
139
GST_LOG_OBJECT (gstswitch, "active pad now %p",
140
gstswitch->active_sinkpad);
142
GST_LOG_OBJECT (gstswitch, "could not get first sinkpad");
144
gst_iterator_free (iter);
147
GST_OBJECT_UNLOCK (gstswitch);
151
gst_switch_request_new_pad (GstElement * element,
152
GstPadTemplate * templ, const gchar * unused)
155
GstPad *sinkpad = NULL;
156
GstSwitch *gstswitch = NULL;
158
g_return_val_if_fail (GST_IS_SWITCH (element), NULL);
160
gstswitch = GST_SWITCH (element);
162
/* We only provide requested sink pads */
163
if (templ->direction != GST_PAD_SINK) {
164
GST_LOG_OBJECT (gstswitch, "requested a non sink pad");
168
GST_OBJECT_LOCK (gstswitch);
169
name = g_strdup_printf ("sink%d", gstswitch->nb_sinkpads);
171
sinkpad = gst_pad_new_from_template (templ, name);
176
if (gstswitch->active_sinkpad == NULL)
177
gstswitch->active_sinkpad = gst_object_ref (sinkpad);
178
GST_OBJECT_UNLOCK (gstswitch);
180
gst_pad_set_getcaps_function (sinkpad,
181
GST_DEBUG_FUNCPTR (gst_switch_getcaps));
182
gst_pad_set_chain_function (sinkpad, GST_DEBUG_FUNCPTR (gst_switch_chain));
183
gst_pad_set_internal_link_function (sinkpad,
184
GST_DEBUG_FUNCPTR (gst_switch_get_linked_pads));
185
gst_pad_set_bufferalloc_function (sinkpad,
186
GST_DEBUG_FUNCPTR (gst_switch_bufferalloc));
187
gst_pad_set_event_function (sinkpad, GST_DEBUG_FUNCPTR (gst_switch_event));
188
gst_pad_set_active (sinkpad, TRUE);
190
gst_element_add_pad (GST_ELEMENT (gstswitch), sinkpad);
192
gstswitch->nb_sinkpads++;
198
gst_switch_chain (GstPad * pad, GstBuffer * buf)
200
GstSwitch *gstswitch = GST_SWITCH (gst_pad_get_parent (pad));
202
GstPad *active_sinkpad;
204
GST_OBJECT_LOCK (gstswitch);
205
active_sinkpad = gstswitch->active_sinkpad;
206
GST_OBJECT_UNLOCK (gstswitch);
208
/* Ignore buffers from pads except the selected one */
209
if (pad != active_sinkpad) {
210
GST_DEBUG_OBJECT (gstswitch, "Ignoring buffer %p from pad %s:%s",
211
buf, GST_DEBUG_PAD_NAME (pad));
213
gst_object_unref (gstswitch);
214
gst_buffer_unref (buf);
218
/* check if we need to send a new segment event */
219
GST_OBJECT_LOCK (gstswitch);
220
if (gstswitch->need_to_send_newsegment && !gstswitch->queue_buffers) {
221
/* check to see if we need to send a new segment update for stop */
222
if (gstswitch->previous_sinkpad != NULL) {
223
if (gstswitch->stop_value != GST_CLOCK_TIME_NONE) {
224
GstEvent *prev_newsegment =
225
(GstEvent *) g_hash_table_lookup (gstswitch->newsegment_events,
226
gstswitch->previous_sinkpad);
228
if (prev_newsegment) {
229
/* need to send a new segment update changing stop */
231
gdouble rate, applied_rate;
233
gint64 start, stop, position;
235
gst_event_parse_new_segment_full (prev_newsegment, &update, &rate,
236
&applied_rate, &format, &start, &stop, &position);
237
GST_DEBUG_OBJECT (gstswitch,
238
"Sending new segment update with stop of %" G_GUINT64_FORMAT,
239
gstswitch->stop_value);
240
gst_pad_push_event (gstswitch->srcpad,
241
gst_event_new_new_segment_full (TRUE, rate, applied_rate, format,
242
gstswitch->current_start, gstswitch->stop_value, position));
245
gst_object_unref (GST_OBJECT (gstswitch->previous_sinkpad));
246
gstswitch->previous_sinkpad = NULL;
248
/* retrieve event from hash table */
250
(GstEvent *) g_hash_table_lookup (gstswitch->newsegment_events, pad);
252
/* create a copy of this event so we can change start to match
253
* the start time of this buffer */
255
gdouble rate, applied_rate;
257
gint64 start, stop, position;
259
gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
260
&format, &start, &stop, &position);
261
if (gstswitch->start_value != GST_CLOCK_TIME_NONE &&
262
gstswitch->start_value <= GST_BUFFER_TIMESTAMP (buf)) {
263
start = gstswitch->start_value;
265
start = GST_BUFFER_TIMESTAMP (buf);
267
gst_pad_push_event (gstswitch->srcpad,
268
gst_event_new_new_segment_full (FALSE, rate, applied_rate, format,
269
start, stop, position));
270
gstswitch->need_to_send_newsegment = FALSE;
271
gstswitch->current_start = start;
272
GST_DEBUG_OBJECT (gstswitch,
273
"Sending new segment with start of %" G_GUINT64_FORMAT, start);
275
GST_WARNING_OBJECT (pad,
276
"Couldn't find new segment for pad in hashtable");
278
/* reset stop and start value */
279
gstswitch->start_value = GST_CLOCK_TIME_NONE;
280
gstswitch->stop_value = GST_CLOCK_TIME_NONE;
281
/* send all the stored buffers if any */
283
g_hash_table_lookup (gstswitch->stored_buffers, active_sinkpad);
284
while (buffers != NULL) {
285
gst_buffer_ref (GST_BUFFER (buffers->data));
286
gst_pad_push (gstswitch->srcpad, GST_BUFFER (buffers->data));
287
buffers = buffers->next;
289
g_hash_table_remove (gstswitch->stored_buffers, active_sinkpad);
291
gstswitch->last_ts = GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf);
292
if (!gstswitch->queue_buffers) {
293
GST_OBJECT_UNLOCK (gstswitch);
295
GST_DEBUG_OBJECT (gstswitch, "Forwarding buffer %p from pad %s:%s",
296
buf, GST_DEBUG_PAD_NAME (pad));
297
res = gst_pad_push (gstswitch->srcpad, buf);
300
gboolean lookup_res = TRUE;
302
buffers = g_hash_table_lookup (gstswitch->stored_buffers, active_sinkpad);
305
buffers = g_list_append (buffers, buf);
306
/* only need to insert it if it was NULL before because we appended */
308
g_hash_table_insert (gstswitch->stored_buffers, active_sinkpad, buffers);
309
GST_OBJECT_UNLOCK (gstswitch);
313
gst_object_unref (gstswitch);
319
gst_switch_event (GstPad * pad, GstEvent * event)
321
GstSwitch *gstswitch = GST_SWITCH (gst_pad_get_parent (pad));
324
switch (GST_EVENT_TYPE (event)) {
325
case GST_EVENT_NEWSEGMENT:
326
GST_OBJECT_LOCK (gstswitch);
327
/* need to put in or replace what's in hash table */
328
g_hash_table_replace (gstswitch->newsegment_events, pad, event);
329
if (pad == gstswitch->active_sinkpad) {
330
if (!gstswitch->need_to_send_newsegment) {
331
gstswitch->need_to_send_newsegment = TRUE;
334
GST_OBJECT_UNLOCK (gstswitch);
337
ret = gst_pad_event_default (pad, event);
340
gst_object_unref (gstswitch);
344
/* =========================================== */
348
/* =========================================== */
351
gst_switch_set_property (GObject * object, guint prop_id,
352
const GValue * value, GParamSpec * pspec)
354
GstSwitch *gstswitch = NULL;
355
const gchar *pad_name;
357
GstPad **active_pad_p;
359
g_return_if_fail (GST_IS_SWITCH (object));
361
gstswitch = GST_SWITCH (object);
364
case ARG_ACTIVE_SOURCE:
365
pad_name = g_value_get_string (value);
366
if (strcmp (pad_name, "") != 0) {
367
pad = gst_element_get_pad (GST_ELEMENT (object), pad_name);
370
GST_OBJECT_LOCK (object);
371
if (pad == gstswitch->active_sinkpad) {
372
GST_OBJECT_UNLOCK (object);
374
gst_object_unref (pad);
377
active_pad_p = &gstswitch->active_sinkpad;
378
if (gstswitch->previous_sinkpad != NULL) {
379
gst_object_unref (GST_OBJECT (gstswitch->previous_sinkpad));
381
gstswitch->previous_sinkpad = gstswitch->active_sinkpad;
382
gst_object_ref (GST_OBJECT (gstswitch->previous_sinkpad));
383
gst_object_replace ((GstObject **) active_pad_p, GST_OBJECT_CAST (pad));
385
gst_object_unref (pad);
386
GST_DEBUG_OBJECT (gstswitch, "New active pad is %" GST_PTR_FORMAT,
387
gstswitch->active_sinkpad);
388
gstswitch->need_to_send_newsegment = TRUE;
389
GST_OBJECT_UNLOCK (object);
391
case ARG_START_VALUE:
392
GST_OBJECT_LOCK (object);
393
gstswitch->start_value = g_value_get_uint64 (value);
394
GST_OBJECT_UNLOCK (object);
397
GST_OBJECT_LOCK (object);
398
gstswitch->stop_value = g_value_get_uint64 (value);
399
GST_OBJECT_UNLOCK (object);
401
case ARG_QUEUE_BUFFERS:
402
GST_OBJECT_LOCK (object);
403
gstswitch->queue_buffers = g_value_get_boolean (value);
404
GST_OBJECT_UNLOCK (object);
407
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
413
gst_switch_get_property (GObject * object, guint prop_id,
414
GValue * value, GParamSpec * pspec)
416
GstSwitch *gstswitch = NULL;
418
g_return_if_fail (GST_IS_SWITCH (object));
420
gstswitch = GST_SWITCH (object);
423
case ARG_ACTIVE_SOURCE:
424
GST_OBJECT_LOCK (object);
425
if (gstswitch->active_sinkpad != NULL) {
426
g_value_take_string (value,
427
gst_pad_get_name (gstswitch->active_sinkpad));
429
g_value_set_string (value, "");
431
GST_OBJECT_UNLOCK (object);
434
GST_OBJECT_LOCK (object);
435
g_value_set_uint (value, gstswitch->nb_sinkpads);
436
GST_OBJECT_UNLOCK (object);
438
case ARG_START_VALUE:
439
GST_OBJECT_LOCK (object);
440
g_value_set_uint64 (value, gstswitch->start_value);
441
GST_OBJECT_UNLOCK (object);
444
GST_OBJECT_LOCK (object);
445
g_value_set_uint64 (value, gstswitch->stop_value);
446
GST_OBJECT_UNLOCK (object);
449
GST_OBJECT_LOCK (object);
450
g_value_set_uint64 (value, gstswitch->last_ts);
451
GST_OBJECT_UNLOCK (object);
453
case ARG_QUEUE_BUFFERS:
454
GST_OBJECT_LOCK (object);
455
g_value_set_boolean (value, gstswitch->queue_buffers);
456
GST_OBJECT_UNLOCK (object);
459
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
465
gst_switch_get_linked_pad (GstPad * pad, gboolean strict)
467
GstSwitch *gstswitch = GST_SWITCH (gst_pad_get_parent (pad));
468
GstPad *otherpad = NULL;
470
if (pad == gstswitch->srcpad)
471
otherpad = gstswitch->active_sinkpad;
472
else if (pad == gstswitch->active_sinkpad || !strict)
473
otherpad = gstswitch->srcpad;
475
gst_object_unref (gstswitch);
481
gst_switch_getcaps (GstPad * pad)
483
GstPad *otherpad = gst_switch_get_linked_pad (pad, FALSE);
487
parent = gst_object_get_parent (GST_OBJECT (pad));
489
GST_DEBUG_OBJECT (parent,
490
"Pad %s:%s not linked, returning ANY", GST_DEBUG_PAD_NAME (pad));
492
gst_object_unref (parent);
493
return gst_caps_new_any ();
496
GST_DEBUG_OBJECT (parent,
497
"Pad %s:%s is linked (to %s:%s), returning allowed-caps",
498
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (otherpad));
500
gst_object_unref (parent);
502
caps = gst_pad_peer_get_caps (otherpad);
504
caps = gst_caps_new_any ();
510
gst_switch_bufferalloc (GstPad * pad, guint64 offset,
511
guint size, GstCaps * caps, GstBuffer ** buf)
513
GstSwitch *gstswitch = GST_SWITCH (gst_pad_get_parent (pad));
514
GstFlowReturn result;
515
GstPad *active_sinkpad;
517
GST_OBJECT_LOCK (gstswitch);
518
active_sinkpad = gstswitch->active_sinkpad;
519
GST_OBJECT_UNLOCK (gstswitch);
521
/* Fallback allocation for buffers from pads except the selected one */
522
if (pad != active_sinkpad) {
523
GST_DEBUG_OBJECT (gstswitch,
524
"Pad %s:%s is not selected. Performing fallback allocation",
525
GST_DEBUG_PAD_NAME (pad));
528
result = GST_FLOW_OK;
530
result = gst_pad_alloc_buffer (gstswitch->srcpad, offset, size, caps, buf);
532
/* FIXME: HACK. If buffer alloc returns not-linked, perform a fallback
533
* allocation. This should NOT be necessary, because playbin should
534
* properly block the source pad from running until it's finished hooking
535
* everything up, but playbin needs refactoring first. */
536
if (result == GST_FLOW_NOT_LINKED) {
537
GST_DEBUG_OBJECT (gstswitch,
538
"No peer pad yet - performing fallback allocation for pad %s:%s",
539
GST_DEBUG_PAD_NAME (pad));
542
result = GST_FLOW_OK;
546
gst_object_unref (gstswitch);
552
gst_switch_get_linked_pads (GstPad * pad)
554
GstPad *otherpad = gst_switch_get_linked_pad (pad, TRUE);
559
return g_list_append (NULL, otherpad);
563
/* =========================================== */
565
/* Init & Class init */
567
/* =========================================== */
570
gst_switch_dispose (GObject * object)
572
GstSwitch *gstswitch = NULL;
574
gstswitch = GST_SWITCH (object);
576
if (gstswitch->active_sinkpad) {
577
gst_object_unref (gstswitch->active_sinkpad);
578
gstswitch->active_sinkpad = NULL;
580
if (gstswitch->newsegment_events) {
581
g_hash_table_destroy (gstswitch->newsegment_events);
583
if (gstswitch->stored_buffers) {
584
g_hash_table_destroy (gstswitch->stored_buffers);
586
if (gstswitch->previous_sinkpad) {
587
gst_object_unref (GST_OBJECT (gstswitch->previous_sinkpad));
588
gstswitch->previous_sinkpad = NULL;
590
G_OBJECT_CLASS (parent_class)->dispose (object);
594
unref_buffer (GstBuffer * buf, gpointer user_data)
596
gst_buffer_unref (buf);
600
unref_buffers_and_destroy_list (GList * bufferlist)
602
g_list_foreach (bufferlist, (GFunc) unref_buffer, NULL);
603
g_list_free (bufferlist);
607
gst_switch_init (GstSwitch * gstswitch)
609
gstswitch->srcpad = gst_pad_new ("src", GST_PAD_SRC);
610
gst_pad_set_internal_link_function (gstswitch->srcpad,
611
GST_DEBUG_FUNCPTR (gst_switch_get_linked_pads));
612
gst_pad_set_getcaps_function (gstswitch->srcpad,
613
GST_DEBUG_FUNCPTR (gst_switch_getcaps));
614
gst_element_add_pad (GST_ELEMENT (gstswitch), gstswitch->srcpad);
616
gstswitch->active_sinkpad = NULL;
617
gstswitch->previous_sinkpad = NULL;
618
gstswitch->nb_sinkpads = 0;
619
gstswitch->newsegment_events = g_hash_table_new_full (g_direct_hash,
620
g_direct_equal, NULL, (GDestroyNotify) gst_mini_object_unref);
621
gstswitch->stored_buffers = g_hash_table_new_full (g_direct_hash,
622
g_direct_equal, NULL, (GDestroyNotify) unref_buffers_and_destroy_list);
623
gstswitch->need_to_send_newsegment = FALSE;
624
gstswitch->queue_buffers = FALSE;
625
gstswitch->stop_value = GST_CLOCK_TIME_NONE;
626
gstswitch->start_value = GST_CLOCK_TIME_NONE;
627
gstswitch->current_start = 0;
628
gstswitch->last_ts = GST_CLOCK_TIME_NONE;
632
gst_switch_base_init (gpointer g_class)
634
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
636
gst_element_class_set_details (element_class, &gst_switch_details);
638
gst_element_class_add_pad_template (element_class,
639
gst_static_pad_template_get (&gst_switch_sink_factory));
640
gst_element_class_add_pad_template (element_class,
641
gst_static_pad_template_get (&gst_switch_src_factory));
645
gst_switch_class_init (GstSwitchClass * klass)
647
GObjectClass *gobject_class;
648
GstElementClass *gstelement_class;
650
gobject_class = (GObjectClass *) klass;
651
gstelement_class = (GstElementClass *) klass;
653
parent_class = g_type_class_peek_parent (klass);
654
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_switch_set_property);
655
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_switch_get_property);
657
g_object_class_install_property (gobject_class,
659
g_param_spec_uint ("num-sources",
661
"number of sources", 0, G_MAXUINT, 0, G_PARAM_READABLE));
662
g_object_class_install_property (gobject_class,
664
g_param_spec_string ("active-pad",
666
"Name of the currently active sink pad", NULL, G_PARAM_READWRITE));
667
g_object_class_install_property (gobject_class,
669
g_param_spec_uint64 ("start-value",
671
"Timestamp that next segment will start at (-1 to use first buffer)",
672
0, G_MAXUINT64, GST_CLOCK_TIME_NONE, G_PARAM_READWRITE));
673
g_object_class_install_property (gobject_class,
675
g_param_spec_uint64 ("stop-value",
677
"Timestamp that current source will stop at (-1 if unknown or don't care)",
678
0, G_MAXUINT64, GST_CLOCK_TIME_NONE, G_PARAM_READWRITE));
680
g_object_class_install_property (gobject_class,
682
g_param_spec_uint64 ("last-timestamp",
683
"Time at the end of the last buffer",
684
"Time at the end of the last buffer", 0, G_MAXUINT, 0,
687
g_object_class_install_property (gobject_class,
689
g_param_spec_boolean ("queue-buffers",
690
"Queue new segment and buffers instead of sending them",
691
"Queue new segment and buffers instead of sending them",
692
FALSE, G_PARAM_READWRITE));
694
gobject_class->dispose = gst_switch_dispose;
696
gstelement_class->request_new_pad = gst_switch_request_new_pad;
697
gstelement_class->release_pad = gst_switch_release_pad;
700
/* ============================================================= */
704
/* ============================================================= */
707
gst_switch_get_type (void)
709
static GType switch_type = 0;
712
static const GTypeInfo switch_info = {
713
sizeof (GstSwitchClass),
714
gst_switch_base_init,
716
(GClassInitFunc) gst_switch_class_init,
721
(GInstanceInitFunc) gst_switch_init,
724
switch_type = g_type_register_static (GST_TYPE_ELEMENT,
725
"GstSwitch", &switch_info, 0);
727
GST_DEBUG_CATEGORY_INIT (switch_debug, "switch", 0, "the switch element");
734
plugin_init (GstPlugin * plugin)
736
return gst_element_register (plugin, "switch", GST_RANK_NONE,
740
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
743
"N-to-1 input switching",
744
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)