2001-05-25 21:00:07 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2002-02-16 17:53:58 +00:00
|
|
|
#include <sys/stat.h>
|
2003-08-19 08:11:58 +00:00
|
|
|
#include <locale.h>
|
2001-05-27 17:02:25 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2001-05-27 17:02:25 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
#include <gst/gst.h>
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2001-05-25 21:00:07 +00:00
|
|
|
gchar *name;
|
|
|
|
GSList *srcpads;
|
|
|
|
GSList *sinkpads;
|
|
|
|
GSList *srcpadtemplates;
|
|
|
|
GSList *sinkpadtemplates;
|
|
|
|
GSList *arguments;
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
|
|
|
comp_element;
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-05-25 21:00:07 +00:00
|
|
|
ARG_INT,
|
|
|
|
ARG_FILENAME,
|
|
|
|
ARG_ENUM
|
|
|
|
};
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2001-05-25 21:00:07 +00:00
|
|
|
gchar *name;
|
|
|
|
int type;
|
|
|
|
GSList *enums;
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
|
|
|
comp_argument;
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2001-05-25 21:00:07 +00:00
|
|
|
gint value;
|
|
|
|
gchar *nick;
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
|
|
|
enum_value;
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
|
|
|
print_match_list (gchar * prefix, int len, GSList * wordlist)
|
|
|
|
{
|
2001-05-25 21:00:07 +00:00
|
|
|
GSList *words = wordlist;
|
|
|
|
|
|
|
|
while (words) {
|
2004-03-13 15:27:01 +00:00
|
|
|
if (!len || !strncmp ((gchar *) (words->data), prefix, len))
|
|
|
|
printf ("%s\n", (gchar *) (words->data));
|
2001-05-25 21:00:07 +00:00
|
|
|
words = g_slist_next (words);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
int
|
|
|
|
match_element (comp_element * element, gchar * name)
|
|
|
|
{
|
|
|
|
return strcmp (element->name, name);
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
2001-05-25 21:00:07 +00:00
|
|
|
xmlDocPtr doc;
|
|
|
|
xmlNodePtr rootnode, elementnode, propnode, argnode;
|
|
|
|
GList *element_list = NULL;
|
|
|
|
comp_element *element;
|
|
|
|
GSList *element_names = NULL;
|
|
|
|
comp_argument *argument;
|
|
|
|
enum_value *option;
|
|
|
|
|
2002-09-20 03:27:54 +00:00
|
|
|
gchar *prev_word;
|
|
|
|
gchar *partial_word;
|
2002-02-16 17:53:58 +00:00
|
|
|
int partial_len;
|
2001-05-25 21:00:07 +00:00
|
|
|
GList *elements;
|
|
|
|
GSList *pads;
|
|
|
|
int num_pads;
|
|
|
|
GSList *args;
|
|
|
|
gchar *word;
|
|
|
|
GSList *words = NULL;
|
|
|
|
|
2002-02-16 17:53:58 +00:00
|
|
|
struct stat stat_buf;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-08-19 08:11:58 +00:00
|
|
|
setlocale (LC_ALL, "");
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (argc < 4) {
|
|
|
|
fprintf (stderr, "gst-complete called with invalid arguments\n");
|
|
|
|
exit (1);
|
2002-09-20 03:27:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
prev_word = argv[3];
|
|
|
|
partial_word = argv[2];
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
partial_len = strlen (partial_word);
|
2002-02-16 17:53:58 +00:00
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/***** Loading the completion information from the registry *****/
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (stat (GST_CACHE_DIR "/compreg.xml", &stat_buf) == 0) {
|
|
|
|
doc = xmlParseFile (GST_CACHE_DIR "/compreg.xml");
|
2002-02-16 17:53:58 +00:00
|
|
|
} else {
|
|
|
|
exit (1);
|
|
|
|
}
|
2001-05-25 21:00:07 +00:00
|
|
|
rootnode = doc->xmlRootNode;
|
|
|
|
|
|
|
|
elementnode = rootnode->xmlChildrenNode;
|
|
|
|
while (elementnode) {
|
More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* examples/typefind/typefind.c: (type_found):
* examples/xml/createxml.c: (object_saved):
* examples/xml/runxml.c: (xml_loaded), (main):
* gst/elements/gstaggregator.c: (gst_aggregator_loop),
(gst_aggregator_chain):
* gst/elements/gstmd5sink.c: (gst_md5sink_get_property):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_handle_event):
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/schedulers/gstoptimalscheduler.c:
(group_inc_links_for_element):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
More GCC4 warning fixes. Basically all libxml-guchar* to
sane-gchar* casts (and reverse).
2005-04-22 12:30:01 +00:00
|
|
|
if (!strcmp ((char *) elementnode->name, "element")) {
|
2004-03-13 15:27:01 +00:00
|
|
|
element = g_new0 (comp_element, 1);
|
2001-05-25 21:00:07 +00:00
|
|
|
propnode = elementnode->xmlChildrenNode;
|
|
|
|
while (propnode) {
|
|
|
|
|
More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* examples/typefind/typefind.c: (type_found):
* examples/xml/createxml.c: (object_saved):
* examples/xml/runxml.c: (xml_loaded), (main):
* gst/elements/gstaggregator.c: (gst_aggregator_loop),
(gst_aggregator_chain):
* gst/elements/gstmd5sink.c: (gst_md5sink_get_property):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_handle_event):
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/schedulers/gstoptimalscheduler.c:
(group_inc_links_for_element):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
More GCC4 warning fixes. Basically all libxml-guchar* to
sane-gchar* casts (and reverse).
2005-04-22 12:30:01 +00:00
|
|
|
if (!strcmp ((char *) propnode->name, "name")) {
|
|
|
|
element->name = (char *) xmlNodeGetContent (propnode);
|
2001-12-14 20:56:51 +00:00
|
|
|
/* fprintf(stderr,element->name); */
|
More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* examples/typefind/typefind.c: (type_found):
* examples/xml/createxml.c: (object_saved):
* examples/xml/runxml.c: (xml_loaded), (main):
* gst/elements/gstaggregator.c: (gst_aggregator_loop),
(gst_aggregator_chain):
* gst/elements/gstmd5sink.c: (gst_md5sink_get_property):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_handle_event):
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/schedulers/gstoptimalscheduler.c:
(group_inc_links_for_element):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
More GCC4 warning fixes. Basically all libxml-guchar* to
sane-gchar* casts (and reverse).
2005-04-22 12:30:01 +00:00
|
|
|
} else if (!strcmp ((char *) propnode->name, "srcpad")) {
|
2004-03-15 19:27:17 +00:00
|
|
|
element->srcpads =
|
|
|
|
g_slist_prepend (element->srcpads, xmlNodeGetContent (propnode));
|
2001-12-14 20:56:51 +00:00
|
|
|
/* fprintf(stderr,"."); */
|
More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* examples/typefind/typefind.c: (type_found):
* examples/xml/createxml.c: (object_saved):
* examples/xml/runxml.c: (xml_loaded), (main):
* gst/elements/gstaggregator.c: (gst_aggregator_loop),
(gst_aggregator_chain):
* gst/elements/gstmd5sink.c: (gst_md5sink_get_property):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_handle_event):
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/schedulers/gstoptimalscheduler.c:
(group_inc_links_for_element):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
More GCC4 warning fixes. Basically all libxml-guchar* to
sane-gchar* casts (and reverse).
2005-04-22 12:30:01 +00:00
|
|
|
} else if (!strcmp ((char *) propnode->name, "sinkpad")) {
|
2004-03-15 19:27:17 +00:00
|
|
|
element->sinkpads =
|
|
|
|
g_slist_prepend (element->sinkpads, xmlNodeGetContent (propnode));
|
More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* examples/typefind/typefind.c: (type_found):
* examples/xml/createxml.c: (object_saved):
* examples/xml/runxml.c: (xml_loaded), (main):
* gst/elements/gstaggregator.c: (gst_aggregator_loop),
(gst_aggregator_chain):
* gst/elements/gstmd5sink.c: (gst_md5sink_get_property):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_handle_event):
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/schedulers/gstoptimalscheduler.c:
(group_inc_links_for_element):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
More GCC4 warning fixes. Basically all libxml-guchar* to
sane-gchar* casts (and reverse).
2005-04-22 12:30:01 +00:00
|
|
|
} else if (!strcmp ((char *) propnode->name, "srcpadtemplate")) {
|
2004-03-15 19:27:17 +00:00
|
|
|
element->srcpadtemplates =
|
|
|
|
g_slist_prepend (element->srcpadtemplates,
|
|
|
|
xmlNodeGetContent (propnode));
|
2001-12-14 20:56:51 +00:00
|
|
|
/* fprintf(stderr,"."); */
|
More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* examples/typefind/typefind.c: (type_found):
* examples/xml/createxml.c: (object_saved):
* examples/xml/runxml.c: (xml_loaded), (main):
* gst/elements/gstaggregator.c: (gst_aggregator_loop),
(gst_aggregator_chain):
* gst/elements/gstmd5sink.c: (gst_md5sink_get_property):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_handle_event):
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/schedulers/gstoptimalscheduler.c:
(group_inc_links_for_element):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
More GCC4 warning fixes. Basically all libxml-guchar* to
sane-gchar* casts (and reverse).
2005-04-22 12:30:01 +00:00
|
|
|
} else if (!strcmp ((char *) propnode->name, "sinkpad")) {
|
2004-03-15 19:27:17 +00:00
|
|
|
element->sinkpadtemplates =
|
|
|
|
g_slist_prepend (element->sinkpadtemplates,
|
|
|
|
xmlNodeGetContent (propnode));
|
More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* examples/typefind/typefind.c: (type_found):
* examples/xml/createxml.c: (object_saved):
* examples/xml/runxml.c: (xml_loaded), (main):
* gst/elements/gstaggregator.c: (gst_aggregator_loop),
(gst_aggregator_chain):
* gst/elements/gstmd5sink.c: (gst_md5sink_get_property):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_handle_event):
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/schedulers/gstoptimalscheduler.c:
(group_inc_links_for_element):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
More GCC4 warning fixes. Basically all libxml-guchar* to
sane-gchar* casts (and reverse).
2005-04-22 12:30:01 +00:00
|
|
|
} else if (!strcmp ((char *) propnode->name, "argument")) {
|
2004-03-15 19:27:17 +00:00
|
|
|
argument = g_new0 (comp_argument, 1);
|
More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* examples/typefind/typefind.c: (type_found):
* examples/xml/createxml.c: (object_saved):
* examples/xml/runxml.c: (xml_loaded), (main):
* gst/elements/gstaggregator.c: (gst_aggregator_loop),
(gst_aggregator_chain):
* gst/elements/gstmd5sink.c: (gst_md5sink_get_property):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_handle_event):
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/schedulers/gstoptimalscheduler.c:
(group_inc_links_for_element):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
More GCC4 warning fixes. Basically all libxml-guchar* to
sane-gchar* casts (and reverse).
2005-04-22 12:30:01 +00:00
|
|
|
argument->name = (char *) xmlNodeGetContent (propnode);
|
2004-03-15 19:27:17 +00:00
|
|
|
argument->type = ARG_INT;
|
|
|
|
|
|
|
|
/* walk through the values data */
|
|
|
|
argnode = propnode->xmlChildrenNode;
|
|
|
|
while (argnode) {
|
More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* examples/typefind/typefind.c: (type_found):
* examples/xml/createxml.c: (object_saved):
* examples/xml/runxml.c: (xml_loaded), (main):
* gst/elements/gstaggregator.c: (gst_aggregator_loop),
(gst_aggregator_chain):
* gst/elements/gstmd5sink.c: (gst_md5sink_get_property):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_handle_event):
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/schedulers/gstoptimalscheduler.c:
(group_inc_links_for_element):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
More GCC4 warning fixes. Basically all libxml-guchar* to
sane-gchar* casts (and reverse).
2005-04-22 12:30:01 +00:00
|
|
|
if (!strcmp ((char *) argnode->name, "filename")) {
|
2004-03-15 19:27:17 +00:00
|
|
|
argument->type = ARG_FILENAME;
|
More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* examples/typefind/typefind.c: (type_found):
* examples/xml/createxml.c: (object_saved):
* examples/xml/runxml.c: (xml_loaded), (main):
* gst/elements/gstaggregator.c: (gst_aggregator_loop),
(gst_aggregator_chain):
* gst/elements/gstmd5sink.c: (gst_md5sink_get_property):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_handle_event):
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/schedulers/gstoptimalscheduler.c:
(group_inc_links_for_element):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
More GCC4 warning fixes. Basically all libxml-guchar* to
sane-gchar* casts (and reverse).
2005-04-22 12:30:01 +00:00
|
|
|
} else if (!strcmp ((char *) argnode->name, "option")) {
|
2004-03-15 19:27:17 +00:00
|
|
|
argument->type = ARG_ENUM;
|
|
|
|
option = g_new0 (enum_value, 1);
|
More GCC4 warning fixes. Basically all libxml-guchar* to sane-gchar* casts (and reverse).
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* examples/typefind/typefind.c: (type_found):
* examples/xml/createxml.c: (object_saved):
* examples/xml/runxml.c: (xml_loaded), (main):
* gst/elements/gstaggregator.c: (gst_aggregator_loop),
(gst_aggregator_chain):
* gst/elements/gstmd5sink.c: (gst_md5sink_get_property):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_handle_event):
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/schedulers/gstoptimalscheduler.c:
(group_inc_links_for_element):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
More GCC4 warning fixes. Basically all libxml-guchar* to
sane-gchar* casts (and reverse).
2005-04-22 12:30:01 +00:00
|
|
|
sscanf ((char *) xmlNodeGetContent (argnode), "%d",
|
|
|
|
&option->value);
|
2004-03-15 19:27:17 +00:00
|
|
|
argument->enums = g_slist_prepend (argument->enums, option);
|
|
|
|
}
|
|
|
|
argnode = argnode->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
element->arguments = g_slist_prepend (element->arguments, argument);
|
|
|
|
}
|
|
|
|
|
|
|
|
propnode = propnode->next;
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
element_list = g_list_prepend (element_list, element);
|
|
|
|
element_names = g_slist_prepend (element_names, element->name);
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|
|
|
|
elementnode = elementnode->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***** Completion *****/
|
|
|
|
|
|
|
|
/* The bulk of the work is in deciding exactly which words are an option. */
|
|
|
|
|
2001-12-14 20:56:51 +00:00
|
|
|
/* if we're right at the beginning, with -launch in the first word */
|
2004-03-13 15:27:01 +00:00
|
|
|
if (strstr (prev_word, "-launch")) {
|
2001-12-14 20:56:51 +00:00
|
|
|
/* print out only elements with no sink pad or padtemplate */
|
2001-05-25 21:00:07 +00:00
|
|
|
elements = element_list;
|
|
|
|
while (elements) {
|
2004-03-13 15:27:01 +00:00
|
|
|
element = (comp_element *) (elements->data);
|
2001-05-25 21:00:07 +00:00
|
|
|
if (!element->sinkpads && !element->sinkpadtemplates)
|
2004-03-15 19:27:17 +00:00
|
|
|
words = g_slist_prepend (words, element->name);
|
2004-03-13 15:27:01 +00:00
|
|
|
elements = g_list_next (elements);
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-14 20:56:51 +00:00
|
|
|
/* if the previous word is a connection */
|
2004-03-13 15:27:01 +00:00
|
|
|
if (strchr (prev_word, '!')) {
|
2001-12-14 20:56:51 +00:00
|
|
|
/* print out oly elements with a sink pad or template */
|
2001-05-25 21:00:07 +00:00
|
|
|
elements = element_list;
|
|
|
|
while (elements) {
|
2004-03-13 15:27:01 +00:00
|
|
|
element = (comp_element *) (elements->data);
|
2001-05-25 21:00:07 +00:00
|
|
|
if (element->sinkpads || element->sinkpadtemplates)
|
2004-03-15 19:27:17 +00:00
|
|
|
words = g_slist_prepend (words, element->name);
|
2001-05-25 21:00:07 +00:00
|
|
|
elements = g_list_next (elements);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-14 20:56:51 +00:00
|
|
|
/* if the partial word is an argument, and it's an enum */
|
2004-03-13 15:27:01 +00:00
|
|
|
if (strchr (prev_word, '=')) {
|
|
|
|
fprintf (stderr, "it's an arg, but dunno what element yet\n");
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
/* if the previous word is an element, we need to list both pads and arguments */
|
|
|
|
if ((elements =
|
2004-03-15 19:27:17 +00:00
|
|
|
g_list_find_custom (element_list, prev_word,
|
|
|
|
(GCompareFunc) match_element))) {
|
2001-05-25 21:00:07 +00:00
|
|
|
element = elements->data;
|
2001-12-14 20:56:51 +00:00
|
|
|
/* zero the numpads list so we can count them */
|
2001-05-25 21:00:07 +00:00
|
|
|
num_pads = 0;
|
|
|
|
|
2001-12-14 20:56:51 +00:00
|
|
|
/* pads */
|
2001-05-25 21:00:07 +00:00
|
|
|
pads = element->srcpads;
|
|
|
|
while (pads) {
|
|
|
|
num_pads++;
|
2004-03-13 15:27:01 +00:00
|
|
|
words =
|
2004-03-15 19:27:17 +00:00
|
|
|
g_slist_prepend (words, g_strdup_printf ("%s!",
|
|
|
|
(gchar *) (pads->data)));
|
2001-05-25 21:00:07 +00:00
|
|
|
pads = g_slist_next (pads);
|
|
|
|
}
|
|
|
|
|
2001-12-14 20:56:51 +00:00
|
|
|
/* padtemplates */
|
2001-05-25 21:00:07 +00:00
|
|
|
pads = element->srcpadtemplates;
|
|
|
|
while (pads) {
|
|
|
|
num_pads++;
|
2004-03-13 15:27:01 +00:00
|
|
|
word = g_strdup_printf ("%s!", (gchar *) (pads->data));
|
|
|
|
if (!g_slist_find_custom (words, word, (GCompareFunc) strcmp))
|
2004-03-15 19:27:17 +00:00
|
|
|
words = g_slist_prepend (words, word);
|
2001-05-25 21:00:07 +00:00
|
|
|
pads = g_slist_next (pads);
|
|
|
|
}
|
|
|
|
|
2001-12-14 20:56:51 +00:00
|
|
|
/* if there is only one pad, add '!' to the list of completions */
|
2001-05-25 21:00:07 +00:00
|
|
|
if (num_pads == 1) {
|
|
|
|
words = g_slist_prepend (words, "!");
|
|
|
|
}
|
|
|
|
|
2001-12-14 20:56:51 +00:00
|
|
|
/* arguments */
|
2001-05-25 21:00:07 +00:00
|
|
|
args = element->arguments;
|
|
|
|
while (args) {
|
2004-03-13 15:27:01 +00:00
|
|
|
argument = (comp_argument *) (args->data);
|
|
|
|
word = strstr (argument->name, "::") + 2;
|
|
|
|
words = g_slist_prepend (words, g_strdup_printf ("%s=", word));
|
|
|
|
words = g_slist_prepend (words, g_strdup_printf ("%s=...", word));
|
2001-05-25 21:00:07 +00:00
|
|
|
args = g_slist_next (args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* The easy part is ouptuting the correct list of possibilities. */
|
|
|
|
print_match_list (partial_word, partial_len, words);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|