]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Add saving/loading of audio_type, and also display it in the webui
authorDave Chapman <dave@dchapman.com>
Mon, 13 May 2013 09:39:35 +0000 (10:39 +0100)
committerDave Chapman <dave@dchapman.com>
Mon, 13 May 2013 09:39:35 +0000 (10:39 +0100)
src/psi.c
src/psi.h
src/webui/extjs.c
src/webui/static/app/tvadapters.js

index dc8ec97901587bba03a13df2933e3eacecec7b3e..378cc4c46d5aa38402bfb42a4e95e6ec0c4dc9a0 100644 (file)
--- a/src/psi.c
+++ b/src/psi.c
@@ -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;
    
index 34c9736bcc7affb35c41f1e1f71181f1526ef2e4..5dfc98b5c0101e15e20d662c6f2210ee56dba814 100644 (file)
--- a/src/psi.h
+++ b/src/psi.h
@@ -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);
index c7a6dfcba7ac2a518fa9a3865ca7bc507c6f1822..dd2b07d166df03351c6a1d99f8780a061bf605cd 100644 (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:
index 3661fabd1ebbf1e5c805c758b37fc18b90ed818a..8da843f14cc07eeec1d9583b0501824a4776e0e5 100644 (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',