blob: 92b77b69da1d0aceddf3292b6b695745549aa742 [file] [log] [blame]
Dharmaray Kundargi643290d2011-01-16 16:02:42 -08001/*
2 * Copyright (C) 2011 NXP Software
3 * Copyright (C) 2011 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef VE_AUDIO_PLAYER_H_
19
20#define VE_AUDIO_PLAYER_H_
21
22#include <media/MediaPlayerInterface.h>
23#include <media/stagefright/MediaBuffer.h>
24#include <media/stagefright/TimeSource.h>
25#include <utils/threads.h>
26#include "M4xVSS_API.h"
27#include "VideoEditorMain.h"
28#include "M4OSA_FileReader.h"
29#include "VideoEditorBGAudioProcessing.h"
30#include <media/stagefright/AudioPlayer.h>
31
32namespace android {
33
34class MediaSource;
35class AudioTrack;
36class PreviewPlayer;
37
38
39class VideoEditorAudioPlayer : public AudioPlayer {
40public:
41 enum {
42 REACHED_EOS,
43 SEEK_COMPLETE
44 };
45
46 VideoEditorAudioPlayer(const sp<MediaPlayerBase::AudioSink> &audioSink,
47 AwesomePlayer *audioObserver = NULL);
48
49 virtual ~VideoEditorAudioPlayer();
50
51 status_t start(bool sourceAlreadyStarted = false);
52
53 void setAudioMixSettings(M4xVSS_AudioMixingSettings* pAudioMixSettings);
54 void setAudioMixPCMFileHandle(M4OSA_Context pBGAudioPCMFileHandle);
55 void setAudioMixStoryBoardSkimTimeStamp(
56 M4OSA_UInt32 pBGAudioStoryBoardSkimTimeStamp,
57 M4OSA_UInt32 pBGAudioCurrentMediaBeginCutTS,
58 M4OSA_UInt32 pBGAudioCurrentMediaVolumeVal);
59
60private:
61
62 M4xVSS_AudioMixingSettings *mAudioMixSettings;
63 VideoEditorBGAudioProcessing *mAudioProcess;
64
65 M4OSA_Context mBGAudioPCMFileHandle;
66 int64_t mBGAudioPCMFileLength;
67 int64_t mBGAudioPCMFileTrimmedLength;
68 int64_t mBGAudioPCMFileDuration;
69 int64_t mBGAudioPCMFileSeekPoint;
70 int64_t mBGAudioPCMFileOriginalSeekPoint;
71 int64_t mBGAudioStoryBoardSkimTimeStamp;
72 int64_t mBGAudioStoryBoardCurrentMediaBeginCutTS;
73 int64_t mBGAudioStoryBoardCurrentMediaVolumeVal;
74
75 size_t fillBuffer(void *data, size_t size);
76
77 void reset();
78 void setPrimaryTrackVolume(M4OSA_Int16 *data, M4OSA_UInt32 size, M4OSA_Float volLevel);
79
80 static size_t AudioSinkCallback(
81 MediaPlayerBase::AudioSink *audioSink,
82 void *data, size_t size, void *me);
83
84 VideoEditorAudioPlayer(const VideoEditorAudioPlayer &);
85 VideoEditorAudioPlayer &operator=(const VideoEditorAudioPlayer &);
86};
87
88} // namespace android
89
90#endif // VE_AUDIO_PLAYER_H_