1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/media/encoder/fmp4_muxer/AVCBox.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef AVCBox_h_ 1.10 +#define AVCBox_h_ 1.11 + 1.12 +#include "nsTArray.h" 1.13 +#include "nsAutoPtr.h" 1.14 +#include "ISOMediaBoxes.h" 1.15 + 1.16 +namespace mozilla { 1.17 + 1.18 +class ISOControl; 1.19 + 1.20 +// 14496-12 8.5.2.2 1.21 +#define resolution_72_dpi 0x00480000 1.22 +#define video_depth 0x0018 1.23 + 1.24 +// 14496-15 5.3.4.1 'Sample description name and format' 1.25 +// Box type: 'avcC' 1.26 +class AVCConfigurationBox : public Box { 1.27 +public: 1.28 + // ISO BMFF members 1.29 + 1.30 + // avcConfig is CodecSpecificData from 14496-15 '5.3.4.1 Sample description 1.31 + // name and format. 1.32 + // These data are generated by encoder and we encapsulated the generated 1.33 + // bitstream into box directly. 1.34 + nsTArray<uint8_t> avcConfig; 1.35 + 1.36 + // MuxerOperation methods 1.37 + nsresult Generate(uint32_t* aBoxSize) MOZ_OVERRIDE; 1.38 + nsresult Write() MOZ_OVERRIDE; 1.39 + 1.40 + // AVCConfigurationBox methods 1.41 + AVCConfigurationBox(ISOControl* aControl); 1.42 + ~AVCConfigurationBox(); 1.43 +}; 1.44 + 1.45 +// 14496-15 5.3.4.1 'Sample description name and format' 1.46 +// Box type: 'avc1' 1.47 +class AVCSampleEntry : public VisualSampleEntry { 1.48 +public: 1.49 + // ISO BMFF members 1.50 + nsRefPtr<AVCConfigurationBox> avcConfigBox; 1.51 + 1.52 + // MuxerOperation methods 1.53 + nsresult Generate(uint32_t* aBoxSize) MOZ_OVERRIDE; 1.54 + nsresult Write() MOZ_OVERRIDE; 1.55 + 1.56 + // VisualSampleEntry methods 1.57 + AVCSampleEntry(ISOControl* aControl); 1.58 + ~AVCSampleEntry(); 1.59 +}; 1.60 + 1.61 +} 1.62 + 1.63 +#endif // AVCBox_h_