tomcast reads mpeg transport streams over http or udp (multicast or unicast) and outputs them to chosen multicast group. Basically a simple http2multicast daemon designed to work 24/7.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.h 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * mptsd configuration header file
  3. * Copyright (C) 2010-2011 Unix Solutions Ltd.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2
  7. * as published by the Free Software Foundation.
  8. *
  9. * This program 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
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  17. */
  18. #ifndef CONFIG_H
  19. #define CONFIG_H
  20. #include <pthread.h>
  21. #include <arpa/inet.h>
  22. #include <netinet/in.h>
  23. #include "libfuncs/libfuncs.h"
  24. typedef enum { udp_sock, tcp_sock } channel_source;
  25. typedef struct {
  26. channel_source sproto;
  27. char *proto;
  28. char *host;
  29. char *path;
  30. unsigned int port;
  31. } CHANSRC;
  32. #define MAX_CHANNEL_SOURCES 8
  33. typedef struct {
  34. char *name;
  35. char *source; /* Full source url */
  36. char *sources[MAX_CHANNEL_SOURCES];
  37. uint8_t num_src;
  38. uint8_t curr_src;
  39. char *dest_host;
  40. int dest_port;
  41. } CHANNEL;
  42. typedef struct {
  43. char *name;
  44. CHANNEL *channel;
  45. int sock; /* Server socket */
  46. struct sockaddr_in src_sockname;
  47. int clientsock; /* The udp socket */
  48. struct sockaddr_in dst_sockname;
  49. int reconnect:1, /* Set to 1 to force proxy reconnect */
  50. connected:1, /* It's set to 1 when proxy is connected and serving clients */
  51. dienow:1, /* Stop serving clients and exit now */
  52. freechannel:1; /* Free channel data on object free (this is used in chanconf) */
  53. int cookie; /* Used in chanconf to determine if the restreamer is alrady checked */
  54. pthread_t thread;
  55. pthread_rwlock_t lock;
  56. time_t conn_ts;
  57. uint64_t read_bytes;
  58. int64_t last_decrypted_input_ts;
  59. char status[64];
  60. } RESTREAMER;
  61. struct config {
  62. char *ident;
  63. char *pidfile;
  64. int syslog_active;
  65. char *logident;
  66. char *loghost;
  67. int logport;
  68. struct sockaddr_in server;
  69. char *server_addr;
  70. int server_port;
  71. int server_socket;
  72. pthread_t server_thread;
  73. int detect_encrypted_input;
  74. char *channels_file;
  75. LIST *chanconf;
  76. LIST *restreamer;
  77. pthread_mutex_t channels_lock;
  78. };
  79. extern void do_reconnect(int sig);
  80. extern void do_reconf(int sig);
  81. extern struct config *get_config(void);
  82. #endif