1/* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 * express or implied.
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
17 */
18/*********************************************************************************/
19/*     -------------------------------------------------------------------       */
20/*                       MPEG-4 HintMediaHeaderAtom Class                        */
21/*     -------------------------------------------------------------------       */
22/*********************************************************************************/
23/*
24    This HintMediaHeaderAtom Class contains general presentation information,
25    independent of coding, about the audio media within the stream.
26*/
27
28
29#define IMPLEMENT_HintMediaHeaderAtom
30
31#include "hintmediaheaderatom.h"
32#include "atomutils.h"
33#include "atomdefs.h"
34
35// Stream-in ctor
36HintMediaHeaderAtom::HintMediaHeaderAtom(MP4_FF_FILE *fp, uint32 size, uint32 type)
37        : MediaInformationHeaderAtom(fp, size, type)
38{
39    if (_success)
40    {
41
42        _pparent = NULL;
43
44        if (!AtomUtils::read16(fp, _maxPDUSize))
45            _success = false;
46        if (!AtomUtils::read16(fp, _avgPDUSize))
47            _success = false;
48        if (!AtomUtils::read32(fp, _maxBitrate))
49            _success = false;
50        if (!AtomUtils::read32(fp, _avgBitrate))
51            _success = false;
52        if (!AtomUtils::read32(fp, _slidingAvgBitrate))
53            _success = false;
54
55        if (!_success)
56            _mp4ErrorCode = READ_HINT_MEDIA_HEADER_ATOM_FAILED;
57    }
58    else
59    {
60        if (_mp4ErrorCode != ATOM_VERSION_NOT_SUPPORTED)
61            _mp4ErrorCode = READ_HINT_MEDIA_HEADER_ATOM_FAILED;
62    }
63
64}
65
66// Destructor
67HintMediaHeaderAtom::~HintMediaHeaderAtom()
68{
69    // Empty
70}
71
72uint32
73HintMediaHeaderAtom::getMediaInformationHeaderType() const
74{
75    return (uint32)MEDIA_INFORMATION_HEADER_TYPE_HINT;
76}
77
78
79