diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 4 | ||||
-rwxr-xr-x | src/configure | 2 | ||||
-rw-r--r-- | src/daemon.h | 5 | ||||
-rw-r--r-- | src/datatypes.h | 4 | ||||
-rw-r--r-- | src/gstdvbbackend.c | 6 | ||||
-rw-r--r-- | src/log.c | 12 | ||||
-rw-r--r-- | src/log.h | 4 | ||||
-rw-r--r-- | src/log_targets.h | 20 | ||||
-rw-r--r-- | src/options.c | 8 | ||||
-rw-r--r-- | src/options.h | 4 | ||||
-rw-r--r-- | src/sig_handler.c | 18 | ||||
-rw-r--r-- | src/sig_handler.h | 4 | ||||
-rw-r--r-- | src/slist.c | 20 | ||||
-rw-r--r-- | src/slist.h | 4 | ||||
-rw-r--r-- | src/streamer.c | 26 | ||||
-rw-r--r-- | src/streamer.h | 4 | ||||
-rw-r--r-- | src/string_list.c | 8 | ||||
-rw-r--r-- | src/string_list.h | 4 | ||||
-rw-r--r-- | src/sysexec.c | 22 | ||||
-rw-r--r-- | src/sysexec.h | 4 |
20 files changed, 91 insertions, 92 deletions
diff --git a/src/Makefile b/src/Makefile index df4d8d0..17b47be 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,8 +5,8 @@ ## channels from one dvb device and provides the streams via minimal http. ## ## -## Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> -## +## Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> +## ## This file is part of gstdvbbackend. ## ## gstdvbbackend is free software: you can redistribute it and/or modify diff --git a/src/configure b/src/configure index 6932df1..2752afa 100755 --- a/src/configure +++ b/src/configure @@ -6,7 +6,7 @@ # channels from one dvb device and provides the streams via minimal http. # # -# Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> +# Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> # # This file is part of gstdvbbackend. # diff --git a/src/daemon.h b/src/daemon.h index d2e8294..6a264d0 100644 --- a/src/daemon.h +++ b/src/daemon.h @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify @@ -160,4 +160,3 @@ void daemonize() } #endif - diff --git a/src/datatypes.h b/src/datatypes.h index d08af52..ef79b8f 100644 --- a/src/datatypes.h +++ b/src/datatypes.h @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify diff --git a/src/gstdvbbackend.c b/src/gstdvbbackend.c index 859b336..afe5246 100644 --- a/src/gstdvbbackend.c +++ b/src/gstdvbbackend.c @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify @@ -251,5 +251,5 @@ int main(int argc, char* argv[]) gst_deinit(); log_close(); - return ret; + return ret; } @@ -1,12 +1,12 @@ -/* +x/* * gstdvbbackend * * gstdvbbackend is a small programm which captures a given set of dvb * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify @@ -77,7 +77,7 @@ int log_targets_target_exists(log_targets_t* targets, log_target_type_t type) if(tmp->type_ == type) return 1; tmp = tmp->next_; - } + } return 0; } @@ -140,7 +140,7 @@ int log_targets_add(log_targets_t* targets, const char* conf) log_target_t* tmp = targets->first_; while(tmp->next_) tmp = tmp->next_; - + tmp->next_ = new_target; } return 0; @@ -248,7 +248,7 @@ void log_print_hex_dump(log_prio_t prio, const uint8_t* buf, uint32_t len) if(offset < 0) return; uint8_t* ptr = &msg[offset]; - + for(i=0; i < len; i++) { if(((i+1)*3) >= (MSG_LENGTH_MAX - offset)) break; @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify diff --git a/src/log_targets.h b/src/log_targets.h index 8d29c38..27370c5 100644 --- a/src/log_targets.h +++ b/src/log_targets.h @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify @@ -32,7 +32,7 @@ static char* get_time_formatted() { char* time_string; time_t t = time(NULL); - if(t < 0) + if(t < 0) time_string = "<time read error>"; else { time_string = ctime(&t); @@ -70,7 +70,7 @@ int log_target_syslog_init(log_target_t* self, const char* conf) { if(!self || (conf && conf[0] == 0)) return -1; - + self->param_ = malloc(sizeof(log_target_syslog_param_t)); if(!self->param_) return -2; @@ -86,7 +86,7 @@ int log_target_syslog_init(log_target_t* self, const char* conf) if(!len) { free(self->param_); return -1; - } + } logname = malloc(len+1); if(logname) { strncpy(logname, conf, len); @@ -107,13 +107,13 @@ int log_target_syslog_init(log_target_t* self, const char* conf) ((log_target_syslog_param_t*)(self->param_))->facility_ = DAEMON; return 0; } - + if(end[1] == 0 || end[1] == ',') { free(logname); free(self->param_); return -1; } - + const char* start = end + 1; end = strchr(start, ','); int i; @@ -148,7 +148,7 @@ void log_target_syslog_log(log_target_t* self, log_prio_t prio, const char* msg) if(!self || !self->param_ || !self->opened_) return; - syslog((prio + 2) | ((log_target_syslog_param_t*)(self->param_))->facility_, "%s", msg); + syslog((prio + 2) | ((log_target_syslog_param_t*)(self->param_))->facility_, "%s", msg); } void log_target_syslog_close(log_target_t* self) @@ -200,7 +200,7 @@ int log_target_file_init(log_target_t* self, const char* conf) { if(!self || (conf && conf[0] == 0)) return -1; - + self->param_ = malloc(sizeof(log_target_file_param_t)); if(!self->param_) return -2; @@ -215,7 +215,7 @@ int log_target_file_init(log_target_t* self, const char* conf) if(!len) { free(self->param_); return -1; - } + } logfilename = malloc(len+1); if(logfilename) { strncpy(logfilename, conf, len); diff --git a/src/options.c b/src/options.c index 491b4f0..f4874b2 100644 --- a/src/options.c +++ b/src/options.c @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify @@ -139,9 +139,9 @@ int options_parse_hex_string(const char* hex, buffer_t* buffer) if(hex_len%2) return 1; - if(buffer->buf_) + if(buffer->buf_) free(buffer->buf_); - + buffer->length_ = hex_len/2; buffer->buf_ = malloc(buffer->length_); if(!buffer->buf_) { diff --git a/src/options.h b/src/options.h index cb5b962..28857fe 100644 --- a/src/options.h +++ b/src/options.h @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify diff --git a/src/sig_handler.c b/src/sig_handler.c index c4b94b6..1597276 100644 --- a/src/sig_handler.c +++ b/src/sig_handler.c @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify @@ -89,18 +89,18 @@ static gpointer signal_thread_func(gpointer data) } } } - - return NULL; + + return NULL; } int signal_start(GMainLoop *loop) { - g_assert(!signal_thread); + g_assert(!signal_thread); + + signal_thread = g_thread_create_full(signal_thread_func, loop, 8192, FALSE, TRUE, G_THREAD_PRIORITY_HIGH, NULL); + if(!signal_thread) + return -1; - signal_thread = g_thread_create_full(signal_thread_func, loop, 8192, FALSE, TRUE, G_THREAD_PRIORITY_HIGH, NULL); - if(!signal_thread) - return -1; - return 0; } diff --git a/src/sig_handler.h b/src/sig_handler.h index 8d55487..9121dcc 100644 --- a/src/sig_handler.h +++ b/src/sig_handler.h @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify diff --git a/src/slist.c b/src/slist.c index 0491dae..249a3cf 100644 --- a/src/slist.c +++ b/src/slist.c @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify @@ -34,10 +34,10 @@ slist_element_t* slist_get_last(slist_element_t* first) { if(!first) return NULL; - + while(first->next_) first = first->next_; - + return first; } @@ -60,7 +60,7 @@ slist_element_t* slist_add(slist_t* lst, void* data) slist_element_t* new_element = malloc(sizeof(slist_element_t)); if(!new_element) return NULL; - + new_element->data_ = data; new_element->next_ = NULL; @@ -68,7 +68,7 @@ slist_element_t* slist_add(slist_t* lst, void* data) lst->first_ = new_element; else slist_get_last(lst->first_)->next_ = new_element; - + return new_element; } @@ -102,7 +102,7 @@ void slist_clear(slist_t* lst) { if(!lst || !lst->first_) return; - + do { slist_element_t* deletee = lst->first_; lst->first_ = lst->first_->next_; @@ -110,7 +110,7 @@ void slist_clear(slist_t* lst) free(deletee); } while(lst->first_); - + lst->first_ = NULL; } @@ -118,11 +118,11 @@ int slist_length(slist_t* lst) { if(!lst || !lst->first_) return 0; - + int len = 0; slist_element_t* tmp; for(tmp = lst->first_; tmp; tmp = tmp->next_) len++; - + return len; } diff --git a/src/slist.h b/src/slist.h index 6e21e6d..acc8d1a 100644 --- a/src/slist.h +++ b/src/slist.h @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify diff --git a/src/streamer.c b/src/streamer.c index fb3fc0a..4475562 100644 --- a/src/streamer.c +++ b/src/streamer.c @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify @@ -52,14 +52,14 @@ static void added_cb(GstElement* sink, gint fd, gpointer data) static void removed_cb(GstElement* sink, gint fd, gpointer data) { gint num_fds; - g_object_get(G_OBJECT(sink), "num_fds", &num_fds, NULL); + g_object_get(G_OBJECT(sink), "num_fds", &num_fds, NULL); log_printf(INFO, "fdsink: successfully removed client %d (sink has now %d fds)", fd, num_fds); } static void fdremoved_cb(GstElement* sink, gint fd, gpointer data) { gint num_fds; - g_object_get(G_OBJECT(sink), "num_fds", &num_fds, NULL); + g_object_get(G_OBJECT(sink), "num_fds", &num_fds, NULL); log_printf(INFO, "fdsink: successfully removed fd %d (sink has now %d fds)", fd, num_fds); } @@ -88,7 +88,7 @@ int init_server(const char* host, const char* port) freeaddrinfo(res); int server = socket(AF_INET, SOCK_STREAM, 0); - if(server < 0) { + if(server < 0) { log_printf(ERROR, "streamer: socket() call failed"); return -1; } @@ -99,12 +99,12 @@ int init_server(const char* host, const char* port) return -1; } - if(bind(server, (struct sockaddr *)&local_addr, sizeof(local_addr))==-1) { + if(bind(server, (struct sockaddr *)&local_addr, sizeof(local_addr))==-1) { log_printf(ERROR, "streamer: bind() call failed"); return -1; } - if(listen(server, 5)==-1) { + if(listen(server, 5)==-1) { log_printf(ERROR, "streamer: listen() call failed"); return -1; } @@ -168,7 +168,7 @@ static gpointer client_thread_func(gpointer data) free(client); return NULL; } - + if(buf == '\n') nlcnt++; else if(buf != '\r') nlcnt = 0; @@ -184,7 +184,7 @@ static gpointer client_thread_func(gpointer data) free(client); return NULL; } - + written+=len; if(written >= strlen(answer)) break; @@ -194,12 +194,12 @@ static gpointer client_thread_func(gpointer data) free(client); return NULL; } - + static gpointer streamer_thread_func(gpointer data) { streamer_t *streamer = (streamer_t*)data; log_printf(NOTICE, "streamer thread started"); - + GstBuffer* buf = NULL; struct sockaddr_in remote_addr; memset (&remote_addr, 0, sizeof(remote_addr)); @@ -220,7 +220,7 @@ static gpointer streamer_thread_func(gpointer data) client->streamer_ = streamer; g_thread_create(client_thread_func, client, FALSE, NULL); } - + log_printf(NOTICE, "streamer thread stopped"); g_main_loop_quit(streamer->loop_); return NULL; @@ -230,7 +230,7 @@ int streamer_start(streamer_t* streamer) { if(!streamer) return -1; - + streamer->thread_ = g_thread_create(streamer_thread_func, streamer, TRUE, NULL); if(!streamer->thread_) { log_printf(ERROR, "streamer thread could not be started"); diff --git a/src/streamer.h b/src/streamer.h index 3d867ea..a68e874 100644 --- a/src/streamer.h +++ b/src/streamer.h @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify diff --git a/src/string_list.c b/src/string_list.c index ff30b2c..c1beed2 100644 --- a/src/string_list.c +++ b/src/string_list.c @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify @@ -44,7 +44,7 @@ int string_list_add(string_list_t* list, const char* string) { if(!list) return -1; - + char* tmp = strdup(string); if(slist_add(list, tmp) == NULL) { free(tmp); @@ -58,7 +58,7 @@ void string_list_print(string_list_t* list, const char* head, const char* tail) { if(!list) return; - + slist_element_t* tmp = list->first_; while(tmp) { printf("%s%s%s", head, (char*)(tmp->data_), tail); diff --git a/src/string_list.h b/src/string_list.h index ba072b9..7f4c067 100644 --- a/src/string_list.h +++ b/src/string_list.h @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify diff --git a/src/sysexec.c b/src/sysexec.c index 55c9830..1e50e53 100644 --- a/src/sysexec.c +++ b/src/sysexec.c @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify @@ -53,12 +53,12 @@ char** dup_ptrptr(char* const ptrptr[]) int i; for(i = 0; i < n; ++i) { - my_ptrptr[i] = strdup(ptrptr[i]); + my_ptrptr[i] = strdup(ptrptr[i]); if(!my_ptrptr[i]) { i--; for(; i >= 0; --i) free(my_ptrptr[i]); - + free(my_ptrptr); return NULL; } @@ -77,7 +77,7 @@ void free_ptrptr(char** ptrptr) int i; for(i = 0; ptrptr[i]; ++i) free(ptrptr[i]); - + free(ptrptr); } @@ -88,7 +88,7 @@ child_t* new_child(const char* script, char* const argv[], char* const evp[]) new_child = malloc(sizeof(child_t)); if(!new_child) return NULL; - + new_child->pid_ = -1; new_child->err_fd_ = -1; new_child->script_ = strdup(script); @@ -96,15 +96,15 @@ child_t* new_child(const char* script, char* const argv[], char* const evp[]) free(new_child); return NULL; } - + new_child->argv_ = dup_ptrptr(argv); if(!new_child->argv_) { free(new_child->script_); free(new_child); return NULL; - + } - + new_child->evp_ = dup_ptrptr(evp); if(!new_child->evp_) { free_ptrptr(new_child->argv_); @@ -169,7 +169,7 @@ child_t* rh_exec(const char* script, char* const argv[], char* const evp[]) log_printf(WARNING, "can't open stderr"); } execve(child->script_, child->argv_, child->evp_); - // if execve returns, an error occurred, but logging doesn't work + // if execve returns, an error occurred, but logging doesn't work // because we closed all file descriptors, so just write errno to // pipe and call exit write(pipefd[1], (void*)(&errno), sizeof(errno)); @@ -193,7 +193,7 @@ int rh_waitpid(child_t* child, int* status_return) return 0; if(pid < 0) { log_printf(ERROR, "waitpid returned with error: %s", strerror(errno)); // TODO: thread safe strerror - return pid; + return pid; } fd_set rfds; diff --git a/src/sysexec.h b/src/sysexec.h index 5487300..3402581 100644 --- a/src/sysexec.h +++ b/src/sysexec.h @@ -5,8 +5,8 @@ * channels from one dvb device and provides the streams via minimal http. * * - * Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> - * + * Copyright (C) 2011-2016 Christian Pointner <equinox@spreadspace.org> + * * This file is part of gstdvbbackend. * * gstdvbbackend is free software: you can redistribute it and/or modify |