content/media/encoder/fmp4_muxer/MuxerOperation.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsString.h"
michael@0 7 #include "nsTArray.h"
michael@0 8
michael@0 9 #ifndef MuxerOperation_h_
michael@0 10 #define MuxerOperation_h_
michael@0 11
michael@0 12 namespace mozilla {
michael@0 13
michael@0 14 /**
michael@0 15 * The interface for ISO box. All Boxes inherit from this interface.
michael@0 16 * Generate() and Write() are needed to be called to produce a complete box.
michael@0 17 *
michael@0 18 * Generate() will generate all the data structures and their size.
michael@0 19 *
michael@0 20 * Write() will write all data into muxing output stream (ISOControl actually)
michael@0 21 * and update the data which can't be known at Generate() (for example, the
michael@0 22 * offset of the video data in mp4 file).
michael@0 23 *
michael@0 24 * ISO base media format is composed of several container boxes and the contained
michael@0 25 * boxes. The container boxes hold a list of MuxerOperation which is implemented
michael@0 26 * by contained boxes. The contained boxes will be called via the list.
michael@0 27 * For example:
michael@0 28 * MovieBox (container) ---> boxes (array of MuxerOperation)
michael@0 29 * |---> MovieHeaderBox (full box)
michael@0 30 * |---> TrakBox (container)
michael@0 31 * |---> MovieExtendsBox (container)
michael@0 32 *
michael@0 33 * The complete box structure can be found at 14496-12 E.2 "The‘isom’brand".
michael@0 34 */
michael@0 35 class MuxerOperation {
michael@0 36 public:
michael@0 37 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MuxerOperation)
michael@0 38
michael@0 39 // Generate data of this box and its contained box, and calculate box size.
michael@0 40 virtual nsresult Generate(uint32_t* aBoxSize) = 0;
michael@0 41
michael@0 42 // Write data to stream.
michael@0 43 virtual nsresult Write() = 0;
michael@0 44
michael@0 45 // Find the box type via its name (name is the box type defined in 14496-12;
michael@0 46 // for example, 'moov' is the name of MovieBox).
michael@0 47 // It can only look child boxes including itself and the box in the boxes
michael@0 48 // list if exists. It can't look parent boxes.
michael@0 49 virtual nsresult Find(const nsACString& aType,
michael@0 50 nsTArray<nsRefPtr<MuxerOperation>>& aOperations) = 0;
michael@0 51
michael@0 52 virtual ~MuxerOperation() {}
michael@0 53 };
michael@0 54
michael@0 55 }
michael@0 56 #endif

mercurial