]> git.sesse.net Git - casparcg/blobdiff - protocol/amcp/AMCPCommandQueue.h
[decklink_consumer] Don't schedule final empty frame at shutdown
[casparcg] / protocol / amcp / AMCPCommandQueue.h
index 21829006fe9161a16665d0d8b6654dc8868094ab..ff78f3e04c05f71511624a605897cd8699886a41 100644 (file)
@@ -1,47 +1,60 @@
-/*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
-*\r
-*  This file is part of CasparCG.\r
-*\r
-*    CasparCG is free software: you can redistribute it and/or modify\r
-*    it under the terms of the GNU General Public License as published by\r
-*    the Free Software Foundation, either version 3 of the License, or\r
-*    (at your option) any later version.\r
-*\r
-*    CasparCG is distributed in the hope that it will be useful,\r
-*    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-*    GNU General Public License for more details.\r
-\r
-*    You should have received a copy of the GNU General Public License\r
-*    along with CasparCG.  If not, see <http://www.gnu.org/licenses/>.\r
-*\r
-*/\r
-#pragma once\r
-\r
-#include "../util/thread.h"\r
-\r
-#include "AMCPCommand.h"\r
-\r
-#include <common/concurrency/executor.h>\r
-\r
-#include <tbb\mutex.h>\r
-\r
-namespace caspar { namespace protocol { namespace amcp {\r
-\r
-class AMCPCommandQueue\r
-{\r
-       AMCPCommandQueue(const AMCPCommandQueue&);\r
-       AMCPCommandQueue& operator=(const AMCPCommandQueue&);\r
-public:\r
-       AMCPCommandQueue();\r
-       ~AMCPCommandQueue();\r
-\r
-       void AddCommand(AMCPCommandPtr pCommand);\r
-\r
-private:\r
-       executor                        executor_;\r
-};\r
-typedef std::tr1::shared_ptr<AMCPCommandQueue> AMCPCommandQueuePtr;\r
-\r
-}}}\r
+/*
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
+*
+* This file is part of CasparCG (www.casparcg.com).
+*
+* CasparCG is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* CasparCG is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
+*
+* Author: Nicklas P Andersson
+*/
+
+#pragma once
+
+#include "AMCPCommand.h"
+
+#include <common/executor.h>
+#include <common/memory.h>
+#include <common/timer.h>
+
+#include <boost/property_tree/ptree_fwd.hpp>
+
+#include <tbb/mutex.h>
+
+namespace caspar { namespace protocol { namespace amcp {
+
+class AMCPCommandQueue
+{
+       AMCPCommandQueue(const AMCPCommandQueue&);
+       AMCPCommandQueue& operator=(const AMCPCommandQueue&);
+public:
+       typedef spl::shared_ptr<AMCPCommandQueue> ptr_type;
+
+       AMCPCommandQueue(const std::wstring& name);
+       ~AMCPCommandQueue();
+
+       void AddCommand(AMCPCommand::ptr_type pCommand);
+
+       boost::property_tree::wptree info() const;
+
+       static boost::property_tree::wptree info_all_queues();
+private:
+       executor                                executor_;
+       mutable tbb::spin_mutex running_command_mutex_;
+       bool                                    running_command_                = false;
+       std::wstring                    running_command_name_;
+       std::wstring                    running_command_params_;
+       caspar::timer                   running_command_since_;
+};
+
+}}}