changeset 36459:e6953c9c223a

Add mpctx_get_stream(). This avoids direct context access.
author ib
date Tue, 17 Dec 2013 22:40:51 +0000
parents 4634a3085efc
children d66bfbf37cd2
files access_mpcontext.h gui/util/string.c mplayer.c
diffstat 3 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/access_mpcontext.h	Tue Dec 17 22:31:30 2013 +0000
+++ b/access_mpcontext.h	Tue Dec 17 22:40:51 2013 +0000
@@ -28,5 +28,6 @@
 int mpctx_get_global_sub_size(struct MPContext *mpctx);
 int mpctx_get_global_sub_pos(struct MPContext *mpctx);
 int mpctx_get_osd_function(struct MPContext *mpctx);
+void *mpctx_get_stream(struct MPContext *mpctx);
 
 #endif /* MPLAYER_ACCESS_MPCONTEXT_H */
--- a/gui/util/string.c	Tue Dec 17 22:31:30 2013 +0000
+++ b/gui/util/string.c	Tue Dec 17 22:40:51 2013 +0000
@@ -28,6 +28,7 @@
 #include "gui/interface.h"
 #include "gui/app/gui.h"
 
+#include "access_mpcontext.h"
 #include "config.h"
 #include "help_mp.h"
 #include "libavutil/avstring.h"
@@ -271,6 +272,7 @@
 {
     char *p;
     size_t len;
+    stream_t *stream;
 
     switch (guiInfo.StreamType) {
     case STREAMTYPE_FILE:
@@ -329,9 +331,10 @@
     case STREAMTYPE_DVB:
 
         p = MSGTR_NoChannelName;
+        stream = mpctx_get_stream(guiInfo.mpcontext);
 
-        if (guiInfo.mpcontext->stream)
-            stream_control(guiInfo.mpcontext->stream, STREAM_CTRL_GET_CURRENT_CHANNEL, &p);
+        if (stream)
+            stream_control(stream, STREAM_CTRL_GET_CURRENT_CHANNEL, &p);
 
         av_strlcpy(fname, p, maxlen);
         break;
--- a/mplayer.c	Tue Dec 17 22:31:30 2013 +0000
+++ b/mplayer.c	Tue Dec 17 22:40:51 2013 +0000
@@ -375,6 +375,11 @@
     return mpctx->osd_function;
 }
 
+void *mpctx_get_stream(MPContext *mpctx)
+{
+    return mpctx->stream;
+}
+
 static int is_valid_metadata_type(metadata_t type)
 {
     switch (type) {