• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef MP3_TIMESTAMP_H_INCLUDED
19 #define MP3_TIMESTAMP_H_INCLUDED
20 
21 #ifndef OSCL_BASE_H_INCLUDED
22 #include "oscl_base.h"
23 #endif
24 
25 #ifndef OMX_Component_h
26 #include "OMX_Component.h"
27 #endif
28 
29 
30 
31 #define DEFAULT_SAMPLING_FREQ_MP3 44100
32 #define DEFAULT_SAMPLES_PER_FRAME_MP3 1152
33 
34 class Mp3TimeStampCalc
35 {
36     public:
37 
Mp3TimeStampCalc()38         Mp3TimeStampCalc()
39         {
40             iSamplingFreq = DEFAULT_SAMPLING_FREQ_MP3;
41             iCurrentTs = 0;
42             iCurrentSamples = 0;
43             iSamplesPerFrame = DEFAULT_SAMPLES_PER_FRAME_MP3;
44         };
45 
46         void SetParameters(uint32 aFreq, uint32 aSamples);
47 
48         void SetFromInputTimestamp(OMX_TICKS aValue);
49 
50         void UpdateTimestamp(uint32 aValue);
51 
52         OMX_TICKS GetConvertedTs();
53 
54         OMX_TICKS GetCurrentTimestamp();
55 
56         OMX_TICKS GetFrameDuration();
57 
58 
59     private:
60         uint32 iSamplingFreq;
61         OMX_TICKS iCurrentTs;
62         uint32 iCurrentSamples;
63         uint32 iSamplesPerFrame;
64 };
65 
66 #endif  //#ifndef MP3_TIMESTAMP_H_INCLUDED
67