content/media/encoder/fmp4_muxer/MP4ESDS.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/encoder/fmp4_muxer/MP4ESDS.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,87 @@
     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 MP4ESDS_h_
    1.10 +#define MP4ESDS_h_
    1.11 +
    1.12 +#include "nsTArray.h"
    1.13 +#include "MuxerOperation.h"
    1.14 +
    1.15 +namespace mozilla {
    1.16 +
    1.17 +class ISOControl;
    1.18 +
    1.19 +/**
    1.20 + * ESDS tag
    1.21 + */
    1.22 +#define ESDescrTag        0x03
    1.23 +
    1.24 +/**
    1.25 + * 14496-1 '8.3.3 ES_Descriptor'.
    1.26 + * It will get DecoderConfigDescriptor and SLConfigDescriptor from
    1.27 + * AAC CSD data.
    1.28 + */
    1.29 +class ES_Descriptor : public MuxerOperation {
    1.30 +public:
    1.31 +  // ISO BMFF members
    1.32 +  uint8_t tag;      // ESDescrTag
    1.33 +  uint8_t length;
    1.34 +  uint16_t ES_ID;
    1.35 +  std::bitset<1> streamDependenceFlag;
    1.36 +  std::bitset<1> URL_Flag;
    1.37 +  std::bitset<1> reserved;
    1.38 +  std::bitset<5> streamPriority;
    1.39 +
    1.40 +  nsTArray<uint8_t> DecodeSpecificInfo;
    1.41 +
    1.42 +  // MuxerOperation methods
    1.43 +  nsresult Generate(uint32_t* aBoxSize) MOZ_OVERRIDE;
    1.44 +  nsresult Write() MOZ_OVERRIDE;
    1.45 +  nsresult Find(const nsACString& aType,
    1.46 +                nsTArray<nsRefPtr<MuxerOperation>>& aOperations) MOZ_OVERRIDE;
    1.47 +
    1.48 +  // ES_Descriptor methods
    1.49 +  ES_Descriptor(ISOControl* aControl);
    1.50 +  ~ES_Descriptor();
    1.51 +
    1.52 +protected:
    1.53 +  ISOControl* mControl;
    1.54 +};
    1.55 +
    1.56 +// 14496-14 5.6 'Sample Description Boxes'
    1.57 +// Box type: 'esds'
    1.58 +class ESDBox : public FullBox {
    1.59 +public:
    1.60 +  // ISO BMFF members
    1.61 +  nsRefPtr<ES_Descriptor> es_descriptor;
    1.62 +
    1.63 +  // MuxerOperation methods
    1.64 +  nsresult Generate(uint32_t* aBoxSize) MOZ_OVERRIDE;
    1.65 +  nsresult Write() MOZ_OVERRIDE;
    1.66 +
    1.67 +  // ESDBox methods
    1.68 +  ESDBox(ISOControl* aControl);
    1.69 +  ~ESDBox();
    1.70 +};
    1.71 +
    1.72 +// 14496-14 5.6 'Sample Description Boxes'
    1.73 +// Box type: 'mp4a'
    1.74 +class MP4AudioSampleEntry : public AudioSampleEntry {
    1.75 +public:
    1.76 +  // ISO BMFF members
    1.77 +  nsRefPtr<ESDBox> es;
    1.78 +
    1.79 +  // MuxerOperation methods
    1.80 +  nsresult Generate(uint32_t* aBoxSize) MOZ_OVERRIDE;
    1.81 +  nsresult Write() MOZ_OVERRIDE;
    1.82 +
    1.83 +  // MP4AudioSampleEntry methods
    1.84 +  MP4AudioSampleEntry(ISOControl* aControl);
    1.85 +  ~MP4AudioSampleEntry();
    1.86 +};
    1.87 +
    1.88 +}
    1.89 +
    1.90 +#endif // MP4ESDS_h_

mercurial