changeset 32443:5aae26f4bb59

Simplify and fix capture feature to not always return an error.
author reimar
date Sat, 23 Oct 2010 10:14:43 +0000
parents bf593e3827d9
children 99efb38a4f4e
files command.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/command.c	Fri Oct 22 20:39:43 2010 +0000
+++ b/command.c	Sat Oct 23 10:14:43 2010 +0000
@@ -1118,18 +1118,20 @@
 
     if (!mpctx->stream)
         return M_PROPERTY_UNAVAILABLE;
+    if (!capture_dump) {
+        mp_msg(MSGT_GLOBAL, MSGL_ERR,
+               "Capturing not enabled (forgot -capture parameter?)\n");
+        return M_PROPERTY_ERROR;
+    }
 
     ret = m_property_flag(prop, action, arg, &capturing);
     if (ret == M_PROPERTY_OK && capturing != !!mpctx->stream->capture_file) {
         if (capturing) {
-            if (capture_dump && !(mpctx->stream->capture_file = fopen(stream_dump_name, "wb"))) {
+            mpctx->stream->capture_file = fopen(stream_dump_name, "wb");
+            if (!mpctx->stream->capture_file) {
                 mp_msg(MSGT_GLOBAL, MSGL_ERR,
                        "Error opening capture file: %s\n", strerror(errno));
                 ret = M_PROPERTY_ERROR;
-            } else {
-                mp_msg(MSGT_GLOBAL, MSGL_ERR,
-                       "Capturing not enabled (forgot -capture parameter?)\n");
-                ret = M_PROPERTY_ERROR;
             }
         } else {
             fclose(mpctx->stream->capture_file);