Add saving/loading of audio_type, and also display it in the webui

This commit is contained in:
Dave Chapman 2013-05-13 10:39:35 +01:00
parent 4b86d2fd20
commit 477fa0a846
4 changed files with 31 additions and 2 deletions

View file

@ -912,6 +912,20 @@ psi_caid2name(uint16_t caid)
return buf;
}
const char *
psi_audio_type2desc(uint8_t audio_type)
{
/* From ISO 13818-1 - ISO 639 language descriptor */
switch(audio_type) {
case 0: return ""; /* "Undefined" in the standard, but used for normal audio */
case 1: return "Clean effects";
case 2: return "Hearing impaired";
case 3: return "Visually impaired commentary";
}
return "Reserved";
}
/**
*
*/
@ -977,6 +991,9 @@ psi_save_service_settings(htsmsg_t *m, service_t *t)
if(st->es_lang[0])
htsmsg_add_str(sub, "language", st->es_lang);
if (SCT_ISAUDIO(st->es_type))
htsmsg_add_u32(sub, "audio_type", st->es_audio_type);
if(st->es_type == SCT_CA) {
caid_t *c;
@ -1127,6 +1144,11 @@ psi_load_service_settings(htsmsg_t *m, service_t *t)
if((v = htsmsg_get_str(c, "language")) != NULL)
strncpy(st->es_lang, lang_code_get(v), 3);
if (SCT_ISAUDIO(type)) {
if(!htsmsg_get_u32(c, "audio_type", &u32))
st->es_audio_type = u32;
}
if(!htsmsg_get_u32(c, "position", &u32))
st->es_position = u32;

View file

@ -46,6 +46,7 @@ int psi_build_pmt(const streaming_start_t *ss, uint8_t *buf, int maxlen,
int version, int pcrpid);
const char *psi_caid2name(uint16_t caid);
const char *psi_audio_type2desc(uint8_t audio_type);
void psi_load_service_settings(htsmsg_t *m, struct service *t);
void psi_save_service_settings(htsmsg_t *m, struct service *t);

View file

@ -1634,7 +1634,13 @@ extjs_servicedetails(http_connection_t *hc,
case SCT_MP4A:
case SCT_AAC:
case SCT_MPEG2AUDIO:
htsmsg_add_str(c, "details", st->es_lang);
if (st->es_audio_type) {
snprintf(buf, sizeof(buf), "%s (%s)", st->es_lang,
psi_audio_type2desc(st->es_audio_type));
htsmsg_add_str(c, "details", buf);
} else {
htsmsg_add_str(c, "details", st->es_lang);
}
break;
case SCT_DVBSUB:

View file

@ -99,7 +99,7 @@ tvheadend.showTransportDetails = function(data) {
win = new Ext.Window({
title : 'Service details for ' + data.title,
layout : 'fit',
width : 400,
width : 450,
height : 400,
plain : true,
bodyStyle : 'padding: 5px',