summaryrefslogtreecommitdiffstats
path: root/dom/media/encoder/fmp4_muxer/MuxerOperation.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/encoder/fmp4_muxer/MuxerOperation.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/encoder/fmp4_muxer/MuxerOperation.h')
-rw-r--r--dom/media/encoder/fmp4_muxer/MuxerOperation.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/dom/media/encoder/fmp4_muxer/MuxerOperation.h b/dom/media/encoder/fmp4_muxer/MuxerOperation.h
new file mode 100644
index 000000000..0b83c89b0
--- /dev/null
+++ b/dom/media/encoder/fmp4_muxer/MuxerOperation.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsString.h"
+#include "nsTArray.h"
+
+#ifndef MuxerOperation_h_
+#define MuxerOperation_h_
+
+namespace mozilla {
+
+/**
+ * The interface for ISO box. All Boxes inherit from this interface.
+ * Generate() and Write() are needed to be called to produce a complete box.
+ *
+ * Generate() will generate all the data structures and their size.
+ *
+ * Write() will write all data into muxing output stream (ISOControl actually)
+ * and update the data which can't be known at Generate() (for example, the
+ * offset of the video data in mp4 file).
+ *
+ * ISO base media format is composed of several container boxes and the contained
+ * boxes. The container boxes hold a list of MuxerOperation which is implemented
+ * by contained boxes. The contained boxes will be called via the list.
+ * For example:
+ * MovieBox (container) ---> boxes (array of MuxerOperation)
+ * |---> MovieHeaderBox (full box)
+ * |---> TrakBox (container)
+ * |---> MovieExtendsBox (container)
+ *
+ * The complete box structure can be found at 14496-12 E.2 "The‘isom’brand".
+ */
+class MuxerOperation {
+public:
+ NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MuxerOperation)
+
+ // Generate data of this box and its contained box, and calculate box size.
+ virtual nsresult Generate(uint32_t* aBoxSize) = 0;
+
+ // Write data to stream.
+ virtual nsresult Write() = 0;
+
+ // Find the box type via its name (name is the box type defined in 14496-12;
+ // for example, 'moov' is the name of MovieBox).
+ // It can only look child boxes including itself and the box in the boxes
+ // list if exists. It can't look parent boxes.
+ virtual nsresult Find(const nsACString& aType,
+ nsTArray<RefPtr<MuxerOperation>>& aOperations) = 0;
+
+protected:
+ virtual ~MuxerOperation() {}
+};
+
+}
+#endif