]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Define ST_UNSET, extend type list and cleanup
authorspdfrk <spdfrk123456@gmail.com>
Tue, 23 Feb 2016 12:29:23 +0000 (13:29 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 24 Feb 2016 08:08:03 +0000 (09:08 +0100)
src/service.c
src/service.h

index 708ad6a09d2fdb15259afc319e4650f646e38aac..91d5e3324c1f3e5d93ee39cd394eca0ec8030de4 100644 (file)
@@ -150,9 +150,12 @@ static htsmsg_t *
 service_type_auto_list ( void *o, const char *lang )
 {
   static const struct strtab tab[] = {
-    { N_("Override disabled"),  -1 },
-    { N_("Radio (0x02)"), 0x02 },
-    { N_("MPEG2 HD TV (0x11)"),  0x11 },
+    { N_("Override disabled"),  ST_UNSET },
+    { N_("None (0)"),           ST_NONE },
+    { N_("MPEG2 SD TV (0x01)"), 0x01 },
+    { N_("Radio       (0x02)"), 0x02 },
+    { N_("MPEG2 HD TV (0x11)"), 0x11 },
+    { N_("H.264 SD TV (0x16)"), 0x16 },
     { N_("H.264 HD TV (0x19)"), 0x19 }
   };
   return strtab2htsmsg(tab, 1, lang);
@@ -960,7 +963,7 @@ service_create0
   pthread_mutex_init(&t->s_stream_mutex, NULL);
   pthread_cond_init(&t->s_tss_cond, NULL);
   t->s_type = service_type;
-  t->s_type_user = -1;
+  t->s_type_user = ST_UNSET;
   t->s_source_type = source_type;
   t->s_refcount = 1;
   t->s_enabled = 1;
@@ -1158,10 +1161,10 @@ int
 service_is_sdtv(service_t *t)
 {
   char s_type;
-  if(t->s_type_user > -1)
-    s_type = t->s_type_user;
-  else
+  if(t->s_type_user == ST_UNSET)
     s_type = t->s_servicetype;
+  else
+    s_type = t->s_type_user;
   if (s_type == ST_SDTV)
     return 1;
   else if (s_type == ST_NONE) {
@@ -1177,10 +1180,10 @@ int
 service_is_hdtv(service_t *t)
 {
   char s_type;
-  if(t->s_type_user > -1)
-    s_type = t->s_type_user;
-  else
+  if(t->s_type_user == ST_UNSET)
     s_type = t->s_servicetype;
+  else
+    s_type = t->s_type_user;
   if (s_type == ST_HDTV)
     return 1;
   else if (s_type == ST_NONE) {
@@ -1200,10 +1203,10 @@ service_is_radio(service_t *t)
 {
   int ret = 0;
   char s_type;
-  if(t->s_type_user > -1)
-    s_type = t->s_type_user;
-  else
+  if(t->s_type_user == ST_UNSET)
     s_type = t->s_servicetype;
+  else
+    s_type = t->s_type_user;
   if (s_type == ST_RADIO)
     return 1;
   else if (s_type == ST_NONE) {
index c721ccd123f2c395bf25d7a81bf4e60f87c14c83..3c28659beaa4c8a7fddfbc8be80502929c41d4a8 100644 (file)
@@ -274,7 +274,8 @@ typedef struct service {
    * Service type
    */
   enum {
-    ST_NONE,
+    ST_UNSET = -1,
+    ST_NONE = 0,
     ST_OTHER,
     ST_SDTV,
     ST_HDTV,