Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define Service Type of Service #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ int config_load_channels(CONFIG *conf) {
if (!service_id)
continue;

// keep for backware compatibility
int is_radio = ini_get_bool(ini, 0, "Channel%d:radio", i);

int service_type = ini_get_int(ini, is_radio ? 2 : 1, "Channel%d:service_type", i);

int lcn = ini_get_int(ini, 0, "Channel%d:lcn", i);
int is_lcn_visible = ini_get_bool(ini, 0, "Channel%d:lcn_visible", i);

Expand Down Expand Up @@ -147,7 +151,7 @@ int config_load_channels(CONFIG *conf) {
}
// Init channel
if (channel == NULL) {
channel = channel_new(service_id, is_radio, id, name, eit_mode, source, i, lcn, is_lcn_visible);
channel = channel_new(service_id, service_type, id, name, eit_mode, source, i, lcn, is_lcn_visible);
} else {
chansrc_add(channel, source);
}
Expand Down Expand Up @@ -227,7 +231,7 @@ int config_load_channels(CONFIG *conf) {
if (r->cookie != cookie) {
proxy_log(r, "Remove");
/* Replace channel reference with real object and instruct free_restreamer to free it */
r->channel = channel_new(r->channel->service_id, r->channel->radio, r->channel->id, r->channel->name, r->channel->eit_mode, r->channel->source, r->channel->index, r->channel->lcn, r->channel->lcn_visible);
r->channel = channel_new(r->channel->service_id, r->channel->service_type, r->channel->id, r->channel->name, r->channel->eit_mode, r->channel->source, r->channel->index, r->channel->lcn, r->channel->lcn_visible);
r->freechannel = 1;
r->dienow = 1;
}
Expand Down
7 changes: 3 additions & 4 deletions data.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,18 @@ void chansrc_set(CHANNEL *c, uint8_t src_id) {



CHANNEL *channel_new(int service_id, int is_radio, const char *id, const char *name, int eit_mode, const char *source, int channel_index, int lcn, int is_lcn_visible){
CHANNEL *channel_new(int service_id, int service_type, const char *id, const char *name, int eit_mode, const char *source, int channel_index, int lcn, int is_lcn_visible){

if (channel_index<=0 || channel_index>=256)
{

LOGf("CONFIG: Error channel_new invalid index %d\n", channel_index);
return NULL;
}
//LOGf("CONFIG: ------------------channel_new() serviceid %d id %s name %s source %s index %d\n", service_id, id, name , source , channel_index);

CHANNEL *c = calloc(1, sizeof(CHANNEL));
c->service_id = service_id;
c->radio = is_radio;
c->service_type = service_type;
c->index = channel_index;
c->lcn = lcn;
c->lcn_visible = is_lcn_visible;
Expand Down
4 changes: 2 additions & 2 deletions data.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ typedef struct {
int base_pid;
int service_id;
int pmt_pid;
int radio;
int service_type;
int lcn;
int lcn_visible;
char * id;
Expand Down Expand Up @@ -231,7 +231,7 @@ EPG_ENTRY * epg_new (time_t start, int duration, char *encoding, char *event,
void epg_free (EPG_ENTRY **e);
int epg_changed (EPG_ENTRY *a, EPG_ENTRY *b);

CHANNEL * channel_new (int service_id, int is_radio, const char *id, const char *name, int eit_mode, const char *source, int channel_index, int lcn, int is_lcn_visible);
CHANNEL * channel_new (int service_id, int service_type, const char *id, const char *name, int eit_mode, const char *source, int channel_index, int lcn, int is_lcn_visible);
void channel_free (CHANNEL **c);
void channel_free_epg(CHANNEL *c);

Expand Down
2 changes: 2 additions & 0 deletions mptsd_channels.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ source1 = http://signal-server/stb/btv.mpg
#worktime = 14:18-14:19
lcn = 2
lcn_visible = yes
radio = yes # is this a radio service?
service_type = 31 # overrides optional parameter "radio" and specifies service type

[Channel2]
service_id = 2
Expand Down
6 changes: 3 additions & 3 deletions output_psi.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void output_psi_init_nit(CONFIG *conf, OUTPUT *o) {
uint32_t srv = 0;
srv = (c->service_id &~ 0x00ff) << 8;
srv |= (c->service_id &~ 0xff00) << 8;
srv |= c->radio ? 0x02 : 0x01;
srv |= (c->service_type &~ 0xff);
services[num++] = srv;
}
list_unlock(conf->channels);
Expand Down Expand Up @@ -133,7 +133,7 @@ static void output_psi_init_nit(CONFIG *conf, OUTPUT *o) {
uint32_t srv = 0;
srv = (c->service_id &~ 0x00ff) << 8;
srv |= (c->service_id &~ 0xff00) << 8;
srv |= c->radio ? 0x02 : 0x01;
srv |= (c->service_type &~ 0xff);
svc_services[num++] = srv;
}
list_unlock(conf->channels);
Expand Down Expand Up @@ -167,7 +167,7 @@ static void output_psi_init_sdt(CONFIG *conf, OUTPUT *o) {
list_lock(conf->channels);
list_for_each(conf->channels, lc, lctmp) {
CHANNEL *c = lc->data;
ts_sdt_add_service_descriptor(sdt, c->service_id, c->radio == 0, conf->provider_name, c->name);
ts_sdt_add_service_descriptor(sdt, c->service_id, c->service_type, conf->provider_name, c->name);
}
list_unlock(conf->channels);
gettimeofday(&o->sdt_ts, NULL);
Expand Down