Browse Source

Merge branch 'master' into reproducible-build

Georgi Chorbadzhiyski 6 years ago
parent
commit
52db752265
No account linked to committer's email address
7 changed files with 42 additions and 21 deletions
  1. 3
    2
      Makefile
  2. 2
    0
      README
  3. 2
    2
      config.c
  4. 15
    3
      data.c
  5. 3
    2
      data.h
  6. 6
    4
      input.c
  7. 11
    8
      mptsd.conf

+ 3
- 2
Makefile View File

1
-CC = $(CROSS)$(TARGET)gcc
1
+CC? = $(CROSS)$(TARGET)gcc
2
 STRIP = $(CROSS)$(TARGET)strip
2
 STRIP = $(CROSS)$(TARGET)strip
3
 VERSION="v1.1"
3
 VERSION="v1.1"
4
 ifndef REPRODUCIBLE_BUILD
4
 ifndef REPRODUCIBLE_BUILD
5
 BUILD_ID = $(shell date +%F_%R)
5
 BUILD_ID = $(shell date +%F_%R)
6
 GIT_VER = $(shell git describe --tags --dirty --always 2>/dev/null)
6
 GIT_VER = $(shell git describe --tags --dirty --always 2>/dev/null)
7
 endif
7
 endif
8
-CFLAGS = -ggdb -Wall -Wextra -Wshadow -Wformat-security -Wno-strict-aliasing -O2 -D_GNU_SOURCE -DBUILD_ID=\"$(BUILD_ID)\"
8
+CFLAGS ?= -ggdb -O2
9
+CFLAGS += -Wall -Wextra -Wshadow -Wformat-security -Wno-strict-aliasing -D_GNU_SOURCE -DBUILD_ID=\"$(BUILD_ID)\"
9
 ifneq "$(GIT_VER)" ""
10
 ifneq "$(GIT_VER)" ""
10
 CFLAGS += -DGIT_VER=\"$(GIT_VER)\"
11
 CFLAGS += -DGIT_VER=\"$(GIT_VER)\"
11
 else
12
 else

+ 2
- 0
README View File

47
    git clone git://github.com/gfto/mptsd.git
47
    git clone git://github.com/gfto/mptsd.git
48
    git submodule init
48
    git submodule init
49
    git submodule update
49
    git submodule update
50
+     OR
51
+   git submodule update --recursive --remote  // if you like to checkout HEAD submodules.
50
 
52
 
51
 Compiling
53
 Compiling
52
 =========
54
 =========

+ 2
- 2
config.c View File

142
 				}
142
 				}
143
 				// Init channel
143
 				// Init channel
144
 				if (channel == NULL) {
144
 				if (channel == NULL) {
145
-					channel = channel_new(service_id, is_radio, id, name, source);
145
+					channel = channel_new(service_id, is_radio, id, name, source, i);
146
 				} else {
146
 				} else {
147
 					chansrc_add(channel, source);
147
 					chansrc_add(channel, source);
148
 				}
148
 				}
222
 		if (r->cookie != cookie) {
222
 		if (r->cookie != cookie) {
223
 			proxy_log(r, "Remove");
223
 			proxy_log(r, "Remove");
224
 			/* Replace channel reference with real object and instruct free_restreamer to free it */
224
 			/* Replace channel reference with real object and instruct free_restreamer to free it */
225
-			r->channel = channel_new(r->channel->service_id, r->channel->radio, r->channel->id, r->channel->name, r->channel->source);
225
+			r->channel = channel_new(r->channel->service_id, r->channel->radio, r->channel->id, r->channel->name, r->channel->source, r->channel->index);
226
 			r->freechannel = 1;
226
 			r->freechannel = 1;
227
 			r->dienow = 1;
227
 			r->dienow = 1;
228
 		}
228
 		}

+ 15
- 3
data.c View File

88
 	}
88
 	}
89
 };
89
 };
90
 
90
 
91
-void chansrc_add(CHANNEL *c, char *src) {
91
+void chansrc_add(CHANNEL *c, const char *src) {
92
 	if (c->num_src >= MAX_CHANNEL_SOURCES-1)
92
 	if (c->num_src >= MAX_CHANNEL_SOURCES-1)
93
 		return;
93
 		return;
94
 	c->sources[c->num_src] = strdup(src);
94
 	c->sources[c->num_src] = strdup(src);
121
 
121
 
122
 
122
 
123
 
123
 
124
-CHANNEL *channel_new(int service_id, int is_radio, char *id, char *name, char *source) {
124
+CHANNEL *channel_new(int service_id, int is_radio, const char *id, const char *name, const char *source, int channel_index){
125
+
126
+    if (channel_index<=0 || channel_index>=256)
127
+    {
128
+        
129
+	    LOGf("CONFIG: Error channel_new invalid index %d\n", channel_index);
130
+        return NULL;
131
+    }
132
+    //LOGf("CONFIG: ------------------channel_new() serviceid %d id %s name %s source %s index %d\n", service_id, id, name , source , channel_index);
133
+    
125
 	CHANNEL *c = calloc(1, sizeof(CHANNEL));
134
 	CHANNEL *c = calloc(1, sizeof(CHANNEL));
126
 	c->service_id = service_id;
135
 	c->service_id = service_id;
127
 	c->radio = is_radio;
136
 	c->radio = is_radio;
128
-	c->base_pid = service_id * 32; // The first pid is saved for PMT
137
+	c->index = channel_index;
138
+	c->base_pid = c->index * 32; // The first pid is saved for PMT , channel_index must > 0
129
 	c->pmt_pid = c->base_pid; // The first pid is saved for PMT
139
 	c->pmt_pid = c->base_pid; // The first pid is saved for PMT
130
 	c->id = strdup(id);
140
 	c->id = strdup(id);
131
 	c->name = strdup(name);
141
 	c->name = strdup(name);
132
 	chansrc_add(c, source);
142
 	chansrc_add(c, source);
143
+
144
+
133
 	return c;
145
 	return c;
134
 }
146
 }
135
 
147
 

+ 3
- 2
data.h View File

59
 
59
 
60
 typedef struct {
60
 typedef struct {
61
 	/* Config */
61
 	/* Config */
62
+	int			index;
62
 	int			base_pid;
63
 	int			base_pid;
63
 	int			service_id;
64
 	int			service_id;
64
 	int			pmt_pid;
65
 	int			pmt_pid;
219
 void		epg_free		(EPG_ENTRY **e);
220
 void		epg_free		(EPG_ENTRY **e);
220
 int			epg_changed		(EPG_ENTRY *a, EPG_ENTRY *b);
221
 int			epg_changed		(EPG_ENTRY *a, EPG_ENTRY *b);
221
 
222
 
222
-CHANNEL *	channel_new		(int service_id, int is_radio, char *id, char *name, char *source);
223
+CHANNEL *	channel_new		(int service_id, int is_radio, const char *id, const char *name, const char *source, int channel_index);
223
 void		channel_free	(CHANNEL **c);
224
 void		channel_free	(CHANNEL **c);
224
 void		channel_free_epg(CHANNEL *c);
225
 void		channel_free_epg(CHANNEL *c);
225
 
226
 
228
 
229
 
229
 CHANSRC *	chansrc_init	(char *url);
230
 CHANSRC *	chansrc_init	(char *url);
230
 void		chansrc_free	(CHANSRC **url);
231
 void		chansrc_free	(CHANSRC **url);
231
-void		chansrc_add		(CHANNEL *c, char *src);
232
+void		chansrc_add		(CHANNEL *c, const char *src);
232
 void		chansrc_next	(CHANNEL *c);
233
 void		chansrc_next	(CHANNEL *c);
233
 void		chansrc_set		(CHANNEL *c, uint8_t src_id);
234
 void		chansrc_set		(CHANNEL *c, uint8_t src_id);
234
 
235
 

+ 6
- 4
input.c View File

185
 	
185
 	
186
 	if (s->last_pat->initialized) {
186
 	if (s->last_pat->initialized) {
187
 		if (!ts_pat_is_same(s->pat, s->last_pat)) {
187
 		if (!ts_pat_is_same(s->pat, s->last_pat)) {
188
-			proxy_log(r, "PAT changed.");
188
+			proxy_log(r, "========================PAT changed.========================");
189
 			return -1; // Reconnect
189
 			return -1; // Reconnect
190
 		}
190
 		}
191
 		ts_pat_free(&s->last_pat);
191
 		ts_pat_free(&s->last_pat);
192
 		s->last_pat = ts_pat_alloc();
192
 		s->last_pat = ts_pat_alloc();
193
 	}
193
 	}
194
-    s->last_pat = ts_pat_push_packet(s->last_pat, ts_packet);
194
+	s->last_pat = ts_pat_push_packet(s->last_pat, ts_packet);
195
 	if (s->pat->initialized) {
195
 	if (s->pat->initialized) {
196
 		// PMT pid is still unknown
196
 		// PMT pid is still unknown
197
 		if (!s->pmt_pid) {
197
 		if (!s->pmt_pid) {
243
 
243
 
244
 	s->pmt = ts_pmt_push_packet(s->pmt, ts_packet);
244
 	s->pmt = ts_pmt_push_packet(s->pmt, ts_packet);
245
 
245
 
246
-	s->last_pmt = ts_pmt_push_packet(s->last_pmt, ts_packet);
246
+	
247
 	if (s->last_pmt->initialized) {
247
 	if (s->last_pmt->initialized) {
248
 		if (!ts_pmt_is_same(s->pmt, s->last_pmt)) {
248
 		if (!ts_pmt_is_same(s->pmt, s->last_pmt)) {
249
-			proxy_log(r, "PMT changed.");
249
+			proxy_log(r, "========================PMT changed.========================");
250
 			return -2; // Reconnect
250
 			return -2; // Reconnect
251
 		}
251
 		}
252
 		ts_pmt_free(&s->last_pmt);
252
 		ts_pmt_free(&s->last_pmt);
253
 		s->last_pmt = ts_pmt_alloc();
253
 		s->last_pmt = ts_pmt_alloc();
254
 	}
254
 	}
255
 
255
 
256
+	s->last_pmt = ts_pmt_push_packet(s->last_pmt, ts_packet);
257
+
256
 	if (s->pmt->initialized) {
258
 	if (s->pmt->initialized) {
257
 		if (!s->pmt_rewritten || !s->pmt_rewritten->initialized) {
259
 		if (!s->pmt_rewritten || !s->pmt_rewritten->initialized) {
258
 			input_rewrite_pmt(r);
260
 			input_rewrite_pmt(r);

+ 11
- 8
mptsd.conf View File

2
 network_id=1
2
 network_id=1
3
 
3
 
4
 [Timeouts]
4
 [Timeouts]
5
-pat = 100
6
-pmt = 200
7
-sdt = 500
8
-nit = 2000
9
-eit = 1000
10
-tdt = 5000
11
-tot = 15000
12
-stats = 1000
5
+pat = 100       // Min:25 Max:500
6
+#cat = 200      // Min:25 Max:500       ** unused **
7
+pmt = 200       // Min:25 Max:500
8
+nit = 2000      // Min:25 Max:10000
9
+sdt = 500       // Min:25 Max:2000
10
+#bat = 5000     // Min:25 Max:10000     ** unused **
11
+eit = 1000      // Min:25 Max:2000
12
+#rst = 20000    // Min:25 Max: -        ** unused **
13
+tdt = 5000      // Min:25 Max:30000
14
+tot = 15000     // Min:25 Max:30000
15
+stats = 1000    // No limits

Loading…
Cancel
Save