diff stream/cache2.c @ 34648:26eddbd6353a

Code cleanup: Use a stream_control instead of global functions to get the language associate with a audio or subtitle stream from the streaming layer.
author reimar
date Sun, 19 Feb 2012 13:15:41 +0000
parents 01c19d9b1e83
children 4ccdcd1ff6ba
line wrap: on
line diff
--- a/stream/cache2.c	Sat Feb 18 19:33:47 2012 +0000
+++ b/stream/cache2.c	Sun Feb 19 13:15:41 2012 +0000
@@ -93,6 +93,7 @@
   volatile int control;
   volatile unsigned control_uint_arg;
   volatile double control_double_arg;
+  volatile struct stream_lang_req control_lang_arg;
   volatile int control_res;
   volatile double stream_time_length;
   volatile double stream_time_pos;
@@ -318,6 +319,9 @@
       s->control_res = s->stream->control(s->stream, s->control, &uint_res);
       s->control_uint_arg = uint_res;
       break;
+    case STREAM_CTRL_GET_LANG:
+      s->control_res = s->stream->control(s->stream, s->control, (void *)&s->control_lang_arg);
+      break;
     default:
       s->control_res = STREAM_UNSUPPORTED;
       break;
@@ -628,6 +632,8 @@
     case STREAM_CTRL_GET_CURRENT_TIME:
       *(double *)arg = s->stream_time_pos;
       return s->stream_time_pos != MP_NOPTS_VALUE ? STREAM_OK : STREAM_UNSUPPORTED;
+    case STREAM_CTRL_GET_LANG:
+      s->control_lang_arg = *(struct stream_lang_req *)arg;
     case STREAM_CTRL_GET_NUM_CHAPTERS:
     case STREAM_CTRL_GET_CURRENT_CHAPTER:
     case STREAM_CTRL_GET_ASPECT_RATIO:
@@ -673,6 +679,9 @@
     case STREAM_CTRL_GET_ANGLE:
       *(unsigned *)arg = s->control_uint_arg;
       break;
+    case STREAM_CTRL_GET_LANG:
+      *(struct stream_lang_req *)arg = s->control_lang_arg;
+      break;
   }
   return s->control_res;
 }