[MPlayer-cvslog] r35300 - trunk/command.c

reimar subversion at mplayerhq.hu
Tue Oct 30 19:16:54 CET 2012


Author: reimar
Date: Tue Oct 30 19:16:54 2012
New Revision: 35300

Log:
Make checks for STREAMTYPE simpler and more consistent.

Modified:
   trunk/command.c

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	Tue Oct 30 19:03:30 2012	(r35299)
+++ trunk/command.c	Tue Oct 30 19:16:54 2012	(r35300)
@@ -73,6 +73,8 @@
 #include "libavutil/avstring.h"
 #include "edl.h"
 
+#define IS_STREAMTYPE(t) (mpctx->stream && mpctx->stream->type == STREAMTYPE_##t)
+
 static void rescale_input_coordinates(int ix, int iy, double *dx, double *dy)
 {
     //remove the borders, if any, and rescale to the range [0,1],[0,1]
@@ -1592,8 +1594,8 @@ static int mp_property_sub(m_option_t *p
     }
 #ifdef CONFIG_DVDREAD
     if (vo_spudec
-        && (mpctx->stream->type == STREAMTYPE_DVD
-            || mpctx->stream->type == STREAMTYPE_DVDNAV)
+        && (IS_STREAMTYPE(DVD)
+            || IS_STREAMTYPE(DVDNAV))
         && dvdsub_id < 0 && reset_spu) {
         d_sub->id = -2;
         d_sub->sh = NULL;
@@ -2948,7 +2950,7 @@ int run_command(MPContext *mpctx, mp_cmd
 
 #ifdef CONFIG_RADIO
         case MP_CMD_RADIO_STEP_CHANNEL:
-            if (mpctx->demuxer->stream->type == STREAMTYPE_RADIO) {
+            if (IS_STREAMTYPE(RADIO)) {
                 int v = cmd->args[0].v.i;
                 if (v > 0)
                     radio_step_channel(mpctx->demuxer->stream,
@@ -2965,7 +2967,7 @@ int run_command(MPContext *mpctx, mp_cmd
             break;
 
         case MP_CMD_RADIO_SET_CHANNEL:
-            if (mpctx->demuxer->stream->type == STREAMTYPE_RADIO) {
+            if (IS_STREAMTYPE(RADIO)) {
                 radio_set_channel(mpctx->demuxer->stream, cmd->args[0].v.s);
                 if (radio_get_channel_name(mpctx->demuxer->stream)) {
                     set_osd_msg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration,
@@ -2976,12 +2978,12 @@ int run_command(MPContext *mpctx, mp_cmd
             break;
 
         case MP_CMD_RADIO_SET_FREQ:
-            if (mpctx->demuxer->stream->type == STREAMTYPE_RADIO)
+            if (IS_STREAMTYPE(RADIO))
                 radio_set_freq(mpctx->demuxer->stream, cmd->args[0].v.f);
             break;
 
         case MP_CMD_RADIO_STEP_FREQ:
-            if (mpctx->demuxer->stream->type == STREAMTYPE_RADIO)
+            if (IS_STREAMTYPE(RADIO))
                 radio_step_freq(mpctx->demuxer->stream, cmd->args[0].v.f);
             break;
 #endif
@@ -2996,7 +2998,7 @@ int run_command(MPContext *mpctx, mp_cmd
                 tv_set_freq((tvi_handle_t *) (mpctx->demuxer->priv),
                             cmd->args[0].v.f * 16.0);
 #ifdef CONFIG_PVR
-            else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
+            else if (IS_STREAMTYPE(PVR)) {
               pvr_set_freq (mpctx->stream, ROUND (cmd->args[0].v.f));
               set_osd_msg (OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
                            pvr_get_current_channelname (mpctx->stream),
@@ -3010,7 +3012,7 @@ int run_command(MPContext *mpctx, mp_cmd
                 tv_step_freq((tvi_handle_t *) (mpctx->demuxer->priv),
                             cmd->args[0].v.f * 16.0);
 #ifdef CONFIG_PVR
-            else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
+            else if (IS_STREAMTYPE(PVR)) {
               pvr_force_freq_step (mpctx->stream, ROUND (cmd->args[0].v.f));
               set_osd_msg (OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: f %d",
                            pvr_get_current_channelname (mpctx->stream),
@@ -3044,8 +3046,7 @@ int run_command(MPContext *mpctx, mp_cmd
                     }
                 }
 #ifdef CONFIG_PVR
-                else if (mpctx->stream &&
-                         mpctx->stream->type == STREAMTYPE_PVR) {
+                else if (IS_STREAMTYPE(PVR)) {
                   pvr_set_channel_step (mpctx->stream, cmd->args[0].v.i);
                   set_osd_msg (OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
                                pvr_get_current_channelname (mpctx->stream),
@@ -3054,7 +3055,7 @@ int run_command(MPContext *mpctx, mp_cmd
 #endif /* CONFIG_PVR */
             }
 #ifdef CONFIG_DVBIN
-            if (mpctx->stream->type == STREAMTYPE_DVB) {
+            if (IS_STREAMTYPE(DVB)) {
                     int dir;
                     int v = cmd->args[0].v.i;
 
@@ -3082,7 +3083,7 @@ int run_command(MPContext *mpctx, mp_cmd
                 }
             }
 #ifdef CONFIG_PVR
-            else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
+            else if (IS_STREAMTYPE(PVR)) {
               pvr_set_channel (mpctx->stream, cmd->args[0].v.s);
               set_osd_msg (OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
                            pvr_get_current_channelname (mpctx->stream),
@@ -3093,7 +3094,7 @@ int run_command(MPContext *mpctx, mp_cmd
 
 #ifdef CONFIG_DVBIN
         case MP_CMD_DVB_SET_CHANNEL:
-            if (mpctx->stream->type == STREAMTYPE_DVB) {
+            if (IS_STREAMTYPE(DVB)) {
                         mpctx->last_dvb_step = 1;
 
                     if (dvb_set_channel
@@ -3113,7 +3114,7 @@ int run_command(MPContext *mpctx, mp_cmd
                 }
             }
 #ifdef CONFIG_PVR
-            else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
+            else if (IS_STREAMTYPE(PVR)) {
               pvr_set_lastchannel (mpctx->stream);
               set_osd_msg (OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
                            pvr_get_current_channelname (mpctx->stream),
@@ -3373,7 +3374,7 @@ int run_command(MPContext *mpctx, mp_cmd
                 pointer_y = cmd->args[1].v.i;
                 rescale_input_coordinates(pointer_x, pointer_y, &dx, &dy);
 #ifdef CONFIG_DVDNAV
-                if (mpctx->stream->type == STREAMTYPE_DVDNAV
+                if (IS_STREAMTYPE(DVDNAV)
                     && dx > 0.0 && dy > 0.0) {
                     int button = -1;
                     pointer_x = (int) (dx * (double) sh_video->disp_w);
@@ -3397,7 +3398,7 @@ int run_command(MPContext *mpctx, mp_cmd
                 int button = -1;
                 int i;
                 mp_command_type command = 0;
-                if (mpctx->stream->type != STREAMTYPE_DVDNAV)
+                if (!IS_STREAMTYPE(DVDNAV))
                     break;
 
                 for (i = 0; mp_dvdnav_bindings[i].name; i++)
@@ -3414,7 +3415,7 @@ int run_command(MPContext *mpctx, mp_cmd
             break;
 
         case MP_CMD_SWITCH_TITLE:
-            if (mpctx->stream->type == STREAMTYPE_DVDNAV)
+            if (IS_STREAMTYPE(DVDNAV))
                 mp_dvdnav_switch_title(mpctx->stream, cmd->args[0].v.i);
             break;
 


More information about the MPlayer-cvslog mailing list