# HG changeset patch # User reimar # Date 1261922807 0 # Node ID 4bd9b89b2b85448f05c5abab5b11078fa2c74e9b # Parent fb239b3fd07578430671afdf35f4b8ab7af639be Use the same condition to decide if the audio/video id property is not available for all commands (get, set and print). diff -r fb239b3fd075 -r 4bd9b89b2b85 command.c --- a/command.c Sun Dec 27 14:02:20 2009 +0000 +++ b/command.c Sun Dec 27 14:06:47 2009 +0000 @@ -796,18 +796,16 @@ MPContext * mpctx) { int current_id = -1, tmp; + if (!mpctx->demuxer || !mpctx->demuxer->audio) + return M_PROPERTY_UNAVAILABLE; switch (action) { case M_PROPERTY_GET: - if (!mpctx->sh_audio) - return M_PROPERTY_UNAVAILABLE; if (!arg) return M_PROPERTY_ERROR; *(int *) arg = audio_id; return M_PROPERTY_OK; case M_PROPERTY_PRINT: - if (!mpctx->sh_audio) - return M_PROPERTY_UNAVAILABLE; if (!arg) return M_PROPERTY_ERROR; @@ -840,8 +838,6 @@ case M_PROPERTY_STEP_UP: case M_PROPERTY_SET: - if (!mpctx->demuxer || !mpctx->demuxer->audio) - return M_PROPERTY_UNAVAILABLE; if (action == M_PROPERTY_SET && arg) tmp = *((int *) arg); else @@ -874,18 +870,16 @@ MPContext * mpctx) { int current_id = -1, tmp; + if (!mpctx->demuxer || !mpctx->demuxer->video) + return M_PROPERTY_UNAVAILABLE; switch (action) { case M_PROPERTY_GET: - if (!mpctx->sh_video) - return M_PROPERTY_UNAVAILABLE; if (!arg) return M_PROPERTY_ERROR; *(int *) arg = video_id; return M_PROPERTY_OK; case M_PROPERTY_PRINT: - if (!mpctx->sh_video) - return M_PROPERTY_UNAVAILABLE; if (!arg) return M_PROPERTY_ERROR; @@ -900,8 +894,6 @@ case M_PROPERTY_STEP_UP: case M_PROPERTY_SET: - if (!mpctx->demuxer || !mpctx->demuxer->video) - return M_PROPERTY_UNAVAILABLE; if (action == M_PROPERTY_SET && arg) tmp = *((int *) arg); else