mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
ok, death to all // GCC only comments, we are going portable
Original commit message from CVS: ok, death to all // GCC only comments, we are going portable
This commit is contained in:
parent
91881fb4ed
commit
08e95cee03
6 changed files with 56 additions and 54 deletions
|
@ -80,15 +80,15 @@ int main(int argc,char *argv[]) {
|
||||||
|
|
||||||
if (!strcmp(propnode->name, "name")) {
|
if (!strcmp(propnode->name, "name")) {
|
||||||
element->name = xmlNodeGetContent(propnode);
|
element->name = xmlNodeGetContent(propnode);
|
||||||
//fprintf(stderr,element->name);
|
/* fprintf(stderr,element->name); */
|
||||||
} else if (!strcmp(propnode->name, "srcpad")) {
|
} else if (!strcmp(propnode->name, "srcpad")) {
|
||||||
element->srcpads = g_slist_prepend(element->srcpads, xmlNodeGetContent(propnode));
|
element->srcpads = g_slist_prepend(element->srcpads, xmlNodeGetContent(propnode));
|
||||||
//fprintf(stderr,".");
|
/* fprintf(stderr,"."); */
|
||||||
} else if (!strcmp(propnode->name, "sinkpad")) {
|
} else if (!strcmp(propnode->name, "sinkpad")) {
|
||||||
element->sinkpads = g_slist_prepend(element->sinkpads, xmlNodeGetContent(propnode));
|
element->sinkpads = g_slist_prepend(element->sinkpads, xmlNodeGetContent(propnode));
|
||||||
} else if (!strcmp(propnode->name, "srcpadtemplate")) {
|
} else if (!strcmp(propnode->name, "srcpadtemplate")) {
|
||||||
element->srcpadtemplates = g_slist_prepend(element->srcpadtemplates, xmlNodeGetContent(propnode));
|
element->srcpadtemplates = g_slist_prepend(element->srcpadtemplates, xmlNodeGetContent(propnode));
|
||||||
//fprintf(stderr,".");
|
/* fprintf(stderr,"."); */
|
||||||
} else if (!strcmp(propnode->name, "sinkpad")) {
|
} else if (!strcmp(propnode->name, "sinkpad")) {
|
||||||
element->sinkpadtemplates = g_slist_prepend(element->sinkpadtemplates, xmlNodeGetContent(propnode));
|
element->sinkpadtemplates = g_slist_prepend(element->sinkpadtemplates, xmlNodeGetContent(propnode));
|
||||||
} else if (!strcmp(propnode->name, "argument")) {
|
} else if (!strcmp(propnode->name, "argument")) {
|
||||||
|
@ -96,7 +96,7 @@ int main(int argc,char *argv[]) {
|
||||||
argument->name = xmlNodeGetContent(propnode);
|
argument->name = xmlNodeGetContent(propnode);
|
||||||
argument->type = ARG_INT;
|
argument->type = ARG_INT;
|
||||||
|
|
||||||
// walk through the values data
|
/* walk through the values data */
|
||||||
argnode = propnode->xmlChildrenNode;
|
argnode = propnode->xmlChildrenNode;
|
||||||
while (argnode) {
|
while (argnode) {
|
||||||
if (!strcmp(argnode->name, "filename")) {
|
if (!strcmp(argnode->name, "filename")) {
|
||||||
|
@ -127,9 +127,9 @@ int main(int argc,char *argv[]) {
|
||||||
|
|
||||||
/* The bulk of the work is in deciding exactly which words are an option. */
|
/* The bulk of the work is in deciding exactly which words are an option. */
|
||||||
|
|
||||||
// if we're right at the beginning, with -launch in the first word
|
/* if we're right at the beginning, with -launch in the first word */
|
||||||
if (strstr(prev_word,"-launch")) {
|
if (strstr(prev_word,"-launch")) {
|
||||||
// print out only elements with no sink pad or padtemplate
|
/* print out only elements with no sink pad or padtemplate */
|
||||||
elements = element_list;
|
elements = element_list;
|
||||||
while (elements) {
|
while (elements) {
|
||||||
element = (comp_element *)(elements->data);
|
element = (comp_element *)(elements->data);
|
||||||
|
@ -139,9 +139,9 @@ int main(int argc,char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the previous word is a connection
|
/* if the previous word is a connection */
|
||||||
if (strchr(prev_word, '!')) {
|
if (strchr(prev_word, '!')) {
|
||||||
// print out oly elements with a sink pad or template
|
/* print out oly elements with a sink pad or template */
|
||||||
elements = element_list;
|
elements = element_list;
|
||||||
while (elements) {
|
while (elements) {
|
||||||
element = (comp_element *)(elements->data);
|
element = (comp_element *)(elements->data);
|
||||||
|
@ -151,18 +151,18 @@ int main(int argc,char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the partial word is an argument, and it's an enum
|
/* if the partial word is an argument, and it's an enum */
|
||||||
if (strchr(prev_word,'=')) {
|
if (strchr(prev_word,'=')) {
|
||||||
fprintf(stderr,"it's an arg, but dunno what element yet\n");
|
fprintf(stderr,"it's an arg, but dunno what element yet\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the previous word is an element, we need to list both pads and arguments
|
/* if the previous word is an element, we need to list both pads and arguments*/
|
||||||
if ((elements = g_list_find_custom(element_list, prev_word, (GCompareFunc)match_element))) {
|
if ((elements = g_list_find_custom(element_list, prev_word, (GCompareFunc)match_element))) {
|
||||||
element = elements->data;
|
element = elements->data;
|
||||||
// zero the numpads list so we can count them
|
/* zero the numpads list so we can count them */
|
||||||
num_pads = 0;
|
num_pads = 0;
|
||||||
|
|
||||||
// pads
|
/* pads */
|
||||||
pads = element->srcpads;
|
pads = element->srcpads;
|
||||||
while (pads) {
|
while (pads) {
|
||||||
num_pads++;
|
num_pads++;
|
||||||
|
@ -170,7 +170,7 @@ int main(int argc,char *argv[]) {
|
||||||
pads = g_slist_next (pads);
|
pads = g_slist_next (pads);
|
||||||
}
|
}
|
||||||
|
|
||||||
// padtemplates
|
/* padtemplates */
|
||||||
pads = element->srcpadtemplates;
|
pads = element->srcpadtemplates;
|
||||||
while (pads) {
|
while (pads) {
|
||||||
num_pads++;
|
num_pads++;
|
||||||
|
@ -180,12 +180,12 @@ int main(int argc,char *argv[]) {
|
||||||
pads = g_slist_next (pads);
|
pads = g_slist_next (pads);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there is only one pad, add '!' to the list of completions
|
/* if there is only one pad, add '!' to the list of completions */
|
||||||
if (num_pads == 1) {
|
if (num_pads == 1) {
|
||||||
words = g_slist_prepend (words, "!");
|
words = g_slist_prepend (words, "!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// arguments
|
/* arguments */
|
||||||
args = element->arguments;
|
args = element->arguments;
|
||||||
while (args) {
|
while (args) {
|
||||||
argument = (comp_argument *)(args->data);
|
argument = (comp_argument *)(args->data);
|
||||||
|
|
|
@ -48,7 +48,7 @@ int main(int argc,char *argv[]) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write out the padtemplates
|
/* write out the padtemplates */
|
||||||
padtemplates = factory->padtemplates;
|
padtemplates = factory->padtemplates;
|
||||||
while (padtemplates) {
|
while (padtemplates) {
|
||||||
padtemplate = (GstPadTemplate *)(padtemplates->data);
|
padtemplate = (GstPadTemplate *)(padtemplates->data);
|
||||||
|
@ -71,7 +71,7 @@ int main(int argc,char *argv[]) {
|
||||||
padnode = xmlNewChild (factorynode, NULL, "sinkpad", GST_PAD_NAME(pad));
|
padnode = xmlNewChild (factorynode, NULL, "sinkpad", GST_PAD_NAME(pad));
|
||||||
}
|
}
|
||||||
|
|
||||||
// write out the args
|
/* write out the args */
|
||||||
property_specs = g_object_class_list_properties(G_OBJECT_GET_CLASS (element), &num_properties);
|
property_specs = g_object_class_list_properties(G_OBJECT_GET_CLASS (element), &num_properties);
|
||||||
for (i=0;i<num_properties;i++) {
|
for (i=0;i<num_properties;i++) {
|
||||||
GParamSpec *param = property_specs[i];
|
GParamSpec *param = property_specs[i];
|
||||||
|
|
|
@ -54,7 +54,7 @@ load_history(GtkWidget *pipe_combo)
|
||||||
fstat(history_fd, &statbuf);
|
fstat(history_fd, &statbuf);
|
||||||
map = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, history_fd, 0);
|
map = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, history_fd, 0);
|
||||||
|
|
||||||
// scan it once to find out how many entries there are
|
/* scan it once to find out how many entries there are */
|
||||||
current = map;
|
current = map;
|
||||||
while (current){
|
while (current){
|
||||||
if ((next = strstr(current, "\n"))){
|
if ((next = strstr(current, "\n"))){
|
||||||
|
@ -75,7 +75,7 @@ load_history(GtkWidget *pipe_combo)
|
||||||
g_free(entry);
|
g_free(entry);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// show entries_limit of the newest entries
|
/* show entries_limit of the newest entries */
|
||||||
if (num_entries-- < entries_limit){
|
if (num_entries-- < entries_limit){
|
||||||
entry = g_strndup(current, next - current);
|
entry = g_strndup(current, next - current);
|
||||||
last_entry = entry;
|
last_entry = entry;
|
||||||
|
@ -414,7 +414,7 @@ build_props_box(GstElement *element)
|
||||||
prop_object = GTK_OBJECT(gtk_menu_new());
|
prop_object = GTK_OBJECT(gtk_menu_new());
|
||||||
gtk_option_menu_set_menu(GTK_OPTION_MENU(prop_attach_widget), GTK_WIDGET(prop_object));
|
gtk_option_menu_set_menu(GTK_OPTION_MENU(prop_attach_widget), GTK_WIDGET(prop_object));
|
||||||
signal_name = "selection-done";
|
signal_name = "selection-done";
|
||||||
//FIXME when the shim is dead
|
/* FIXME when the shim is dead */
|
||||||
values = gtk_type_enum_get_values (property_specs[i]->value_type);
|
values = gtk_type_enum_get_values (property_specs[i]->value_type);
|
||||||
|
|
||||||
while (values[j].value_name) {
|
while (values[j].value_name) {
|
||||||
|
@ -670,7 +670,7 @@ main (int argc, char *argv[])
|
||||||
gtk_tree_item_expand(GTK_TREE_ITEM(tree_root_item));
|
gtk_tree_item_expand(GTK_TREE_ITEM(tree_root_item));
|
||||||
|
|
||||||
prop_box = gtk_vbox_new(FALSE, 0);
|
prop_box = gtk_vbox_new(FALSE, 0);
|
||||||
//dparam_box = gtk_vbox_new(FALSE, 0);
|
/* dparam_box = gtk_vbox_new(FALSE, 0); */
|
||||||
|
|
||||||
notebook = gtk_notebook_new();
|
notebook = gtk_notebook_new();
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
// this must be built within the gstreamer dir, else this will fail
|
/* this must be built within the gstreamer dir, else this will fail */
|
||||||
#include <gst/gstpropsprivate.h>
|
#include <gst/gstpropsprivate.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -323,7 +323,7 @@ print_element_info (GstElementFactory *factory)
|
||||||
printf("\n (%d): \t%s", values[j].value, values[j].value_nick);
|
printf("\n (%d): \t%s", values[j].value, values[j].value_nick);
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
//g_type_class_unref (ec);
|
/* g_type_class_unref (ec); */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("unknown %d", param->value_type);
|
printf("unknown %d", param->value_type);
|
||||||
|
@ -381,7 +381,7 @@ print_element_info (GstElementFactory *factory)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// for compound elements
|
/* for compound elements */
|
||||||
if (GST_IS_BIN(element)) {
|
if (GST_IS_BIN(element)) {
|
||||||
printf("\nChildren:\n");
|
printf("\nChildren:\n");
|
||||||
children = gst_bin_get_list(GST_BIN(element));
|
children = gst_bin_get_list(GST_BIN(element));
|
||||||
|
@ -522,13 +522,13 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
gst_init(&argc,&argv);
|
gst_init(&argc,&argv);
|
||||||
|
|
||||||
// if no arguments, print out list of elements
|
/* if no arguments, print out list of elements */
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
print_element_list();
|
print_element_list();
|
||||||
|
|
||||||
// else we try to get a factory
|
/* else we try to get a factory */
|
||||||
} else {
|
} else {
|
||||||
// first check for help
|
/* first check for help */
|
||||||
if (strstr(argv[1],"-help")) {
|
if (strstr(argv[1],"-help")) {
|
||||||
printf("Usage: %s\t\t\tList all registered elements\n",argv[0]);
|
printf("Usage: %s\t\t\tList all registered elements\n",argv[0]);
|
||||||
printf(" %s element-name\tShow element details\n",argv[0]);
|
printf(" %s element-name\tShow element details\n",argv[0]);
|
||||||
|
@ -536,23 +536,24 @@ main (int argc, char *argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only search for a factory if there's not a '.so'
|
/* only search for a factory if there's not a '.so' */
|
||||||
if (! strstr(argv[1],".so")) {
|
if (! strstr(argv[1],".so")) {
|
||||||
factory = gst_elementfactory_find (argv[1]);
|
factory = gst_elementfactory_find (argv[1]);
|
||||||
|
|
||||||
// if there's a factory, print out the info
|
/* if there's a factory, print out the info */
|
||||||
if (factory)
|
if (factory)
|
||||||
return print_element_info(factory);
|
return print_element_info(factory);
|
||||||
} else {
|
} else {
|
||||||
// strip the .so
|
/* strip the .so */
|
||||||
so = strstr(argv[1],".so");
|
so = strstr(argv[1],".so");
|
||||||
so[0] = '\0';
|
so[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise assume it's a plugin
|
/* otherwise assume it's a plugin */
|
||||||
plugin = gst_plugin_find (argv[1]);
|
plugin = gst_plugin_find (argv[1]);
|
||||||
|
|
||||||
// if there is such a plugin, print out info
|
/* if there is such a plugin, print out info */
|
||||||
|
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
print_plugin_info(plugin);
|
print_plugin_info(plugin);
|
||||||
|
|
||||||
|
|
|
@ -129,11 +129,11 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("launch");
|
pipeline = gst_pipeline_new ("launch");
|
||||||
|
|
||||||
// make a null-terminated version of argv
|
/* make a null-terminated version of argv */
|
||||||
argvn = g_new0 (char *,argc);
|
argvn = g_new0 (char *,argc);
|
||||||
memcpy (argvn, argv+1, sizeof (char*) * (argc-1));
|
memcpy (argvn, argv+1, sizeof (char*) * (argc-1));
|
||||||
|
|
||||||
// escape spaces
|
/* escape spaces */
|
||||||
for (i=0; i<argc-1; i++) {
|
for (i=0; i<argc-1; i++) {
|
||||||
gchar **split;
|
gchar **split;
|
||||||
|
|
||||||
|
@ -142,12 +142,12 @@ main(int argc, char *argv[])
|
||||||
argvn[i] = g_strjoinv ("\\ ", split);
|
argvn[i] = g_strjoinv ("\\ ", split);
|
||||||
g_strfreev (split);
|
g_strfreev (split);
|
||||||
}
|
}
|
||||||
// join the argvs together
|
/* join the argvs together */
|
||||||
cmdline = g_strjoinv (" ", argvn);
|
cmdline = g_strjoinv (" ", argvn);
|
||||||
// free the null-terminated argv
|
/* free the null-terminated argv */
|
||||||
g_free (argvn);
|
g_free (argvn);
|
||||||
|
|
||||||
// fail if there are no pipes in it (needs pipes for a pipeline
|
/* fail if there are no pipes in it (needs pipes for a pipeline */
|
||||||
if (!strchr(cmdline,'!')) {
|
if (!strchr(cmdline,'!')) {
|
||||||
fprintf(stderr,"ERROR: no pipeline description found on commandline\n");
|
fprintf(stderr,"ERROR: no pipeline description found on commandline\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -109,7 +109,7 @@ static void move_file(const char * nameold,
|
||||||
g_print("Cannot move `%s' to `%s'", nameold, namenew);
|
g_print("Cannot move `%s' to `%s'", nameold, namenew);
|
||||||
error_perm();
|
error_perm();
|
||||||
}
|
}
|
||||||
// set mode again, to make this public
|
/* set mode again, to make this public */
|
||||||
set_filemode(namenew, *newmode);
|
set_filemode(namenew, *newmode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,13 +151,14 @@ static void save_registry(const char *destfile,
|
||||||
g_print("Cannot fopen `%s' to save new registry to.", destfile);
|
g_print("Cannot fopen `%s' to save new registry to.", destfile);
|
||||||
error_perm();
|
error_perm();
|
||||||
}
|
}
|
||||||
// set mode to make this private
|
/* set mode to make this private */
|
||||||
set_filemode(destfile, tmpmode);
|
set_filemode(destfile, tmpmode);
|
||||||
|
|
||||||
// FIXME: no way to check success of xmlDocDump, which is why
|
/* FIXME: no way to check success of xmlDocDump, which is why
|
||||||
// this piece of code is ifdefed out.
|
this piece of code is ifdefed out.
|
||||||
// The version of libxml currently (Jan 2001) in their CVS tree fixes
|
The version of libxml currently (Jan 2001) in their CVS tree fixes
|
||||||
// this problem.
|
this problem. */
|
||||||
|
|
||||||
xmlDocDump(fp, *doc);
|
xmlDocDump(fp, *doc);
|
||||||
|
|
||||||
if (!fclose(fp)) {
|
if (!fclose(fp)) {
|
||||||
|
@ -178,42 +179,42 @@ int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
|
||||||
// Mode of the file we're saving the repository to;
|
/* Mode of the file we're saving the repository to; */
|
||||||
mode_t newmode;
|
mode_t newmode;
|
||||||
|
|
||||||
// Get mode of old repository, or a default.
|
/* Get mode of old repository, or a default. */
|
||||||
if (!get_filemode(GLOBAL_REGISTRY_FILE, &newmode)) {
|
if (!get_filemode(GLOBAL_REGISTRY_FILE, &newmode)) {
|
||||||
mode_t theumask = umask(0);
|
mode_t theumask = umask(0);
|
||||||
umask(theumask);
|
umask(theumask);
|
||||||
newmode = REGISTRY_FILE_PERMS & ~ theumask;
|
newmode = REGISTRY_FILE_PERMS & ~ theumask;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove the old registry file first
|
/* remove the old registry file first
|
||||||
// If this fails, we simply ignore it since we'll overwrite it later
|
If this fails, we simply ignore it since we'll overwrite it later
|
||||||
// anyway.
|
anyway. */
|
||||||
unlink(GLOBAL_REGISTRY_FILE);
|
unlink(GLOBAL_REGISTRY_FILE);
|
||||||
|
|
||||||
// Init gst
|
/* Init gst /*
|
||||||
_gst_plugin_spew = TRUE;
|
_gst_plugin_spew = TRUE;
|
||||||
_gst_warn_old_registry = FALSE;
|
_gst_warn_old_registry = FALSE;
|
||||||
gst_info_enable_category(GST_CAT_PLUGIN_LOADING);
|
gst_info_enable_category(GST_CAT_PLUGIN_LOADING);
|
||||||
gst_init(&argc,&argv);
|
gst_init(&argc,&argv);
|
||||||
|
|
||||||
// Check args
|
/* Check args /*
|
||||||
if (argc != 1) usage(argv[0]);
|
if (argc != 1) usage(argv[0]);
|
||||||
|
|
||||||
// Check that directory for config exists
|
/* Check that directory for config exists */
|
||||||
check_dir(GLOBAL_REGISTRY_DIR);
|
check_dir(GLOBAL_REGISTRY_DIR);
|
||||||
|
|
||||||
// Read the plugins
|
/* Read the plugins */
|
||||||
doc = xmlNewDoc("1.0");
|
doc = xmlNewDoc("1.0");
|
||||||
doc->xmlRootNode = xmlNewDocNode(doc, NULL, "GST-PluginRegistry", NULL);
|
doc->xmlRootNode = xmlNewDocNode(doc, NULL, "GST-PluginRegistry", NULL);
|
||||||
gst_plugin_save_thyself(doc->xmlRootNode);
|
gst_plugin_save_thyself(doc->xmlRootNode);
|
||||||
|
|
||||||
// Save the registry to a tmp file.
|
/* Save the registry to a tmp file. */
|
||||||
save_registry(GLOBAL_REGISTRY_FILE_TMP, &doc);
|
save_registry(GLOBAL_REGISTRY_FILE_TMP, &doc);
|
||||||
|
|
||||||
// Make the tmp file live.
|
/* Make the tmp file live. */
|
||||||
move_file(GLOBAL_REGISTRY_FILE_TMP, GLOBAL_REGISTRY_FILE, &newmode);
|
move_file(GLOBAL_REGISTRY_FILE_TMP, GLOBAL_REGISTRY_FILE, &newmode);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
|
|
Loading…
Reference in a new issue