Revision cea8d274 src/pschannel.c

View differences:

src/pschannel.c
190 190
	return res;
191 191
}
192 192

  
193
int8_t pschannel_bucket_save2file(struct pschannel_bucket * psb)
194
{
195
	int8_t res = -1;
196
	FILE *fp;
197
	char sdpfile_out[MAX_SDPFILENAME_LENGTH+4];
198
	char ** tokens;
199
	uint32_t ntoks;
200
	const struct pschannel * iter = NULL;
201
	
202
	if (psb && psb->csvfile)
203
	{
204
		tokens = tokens_create(psb->csvfile, '.', &ntoks);
205
		snprintf(sdpfile_out, MAX_SDPFILENAME_LENGTH, "%s_out.csv", tokens[0]);
206
		tokens_destroy(&tokens, ntoks);
207

  
208
		if ((fp = fopen(sdpfile_out, "w")))
209
		{
210
			if (ftrylockfile(fp) == 0)
211
			{
212
				debug("Dumping channel list to file\n");
213
				for(iter = NULL; (iter = pschannel_bucket_iter(psb, iter));)
214
					fprintf(fp, "%s,%s,%s,%s,%s\n", iter->name, iter->ipaddr, iter->port,
215
							iter->quality, iter->sdpfile);
216
				funlockfile(fp);
217
				res = 0;
218
			}
219
			fclose(fp);
220
		}
221
	}
222
	return res;
223
}
224

  
193 225
int8_t pschannel_bucket_load_local_streams(struct pschannel_bucket * pb)
194 226
{
195 227
	int8_t res = -1;
......
197 229

  
198 230
	if (pb && pb->psm)
199 231
	{
200
		while (ps = pstreamer_manager_source_iter(pb->psm, ps))
232
		while ((ps = pstreamer_manager_source_iter(pb->psm, ps)))
201 233
			if (pstreamer_get_display_name(ps))
202 234
				pschannel_bucket_insert(pb, pstreamer_get_display_name(ps), pstreamer_source_ipaddr(ps), pstreamer_source_port(ps), "good", "nosdpfile");
203 235
		res = 0;

Also available in: Unified diff