Dharmaray Kundargi | 643290d | 2011-01-16 16:02:42 -0800 | [diff] [blame] | 1 | /*
|
| 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"
|
James Dong | c9dedc4 | 2011-05-01 12:36:22 -0700 | [diff] [blame^] | 30 | #include "AudioPlayerBase.h"
|
| 31 | #include "PreviewPlayerBase.h"
|
Dharmaray Kundargi | 643290d | 2011-01-16 16:02:42 -0800 | [diff] [blame] | 32 |
|
| 33 | namespace android {
|
| 34 |
|
| 35 | class MediaSource;
|
| 36 | class AudioTrack;
|
| 37 | class PreviewPlayer;
|
| 38 |
|
| 39 |
|
James Dong | c9dedc4 | 2011-05-01 12:36:22 -0700 | [diff] [blame^] | 40 | class VideoEditorAudioPlayer : public AudioPlayerBase {
|
Dharmaray Kundargi | 643290d | 2011-01-16 16:02:42 -0800 | [diff] [blame] | 41 | public:
|
| 42 | enum {
|
| 43 | REACHED_EOS,
|
| 44 | SEEK_COMPLETE
|
| 45 | };
|
| 46 |
|
| 47 | VideoEditorAudioPlayer(const sp<MediaPlayerBase::AudioSink> &audioSink,
|
James Dong | c9dedc4 | 2011-05-01 12:36:22 -0700 | [diff] [blame^] | 48 | PreviewPlayerBase *audioObserver = NULL);
|
Dharmaray Kundargi | 643290d | 2011-01-16 16:02:42 -0800 | [diff] [blame] | 49 |
|
| 50 | virtual ~VideoEditorAudioPlayer();
|
| 51 |
|
| 52 | status_t start(bool sourceAlreadyStarted = false);
|
Rajneesh Chowdury | 1c97d9a | 2011-02-21 15:43:33 -0800 | [diff] [blame] | 53 | void resume();
|
Dharmaray Kundargi | 643290d | 2011-01-16 16:02:42 -0800 | [diff] [blame] | 54 |
|
| 55 | void setAudioMixSettings(M4xVSS_AudioMixingSettings* pAudioMixSettings);
|
| 56 | void setAudioMixPCMFileHandle(M4OSA_Context pBGAudioPCMFileHandle);
|
| 57 | void setAudioMixStoryBoardSkimTimeStamp(
|
| 58 | M4OSA_UInt32 pBGAudioStoryBoardSkimTimeStamp,
|
| 59 | M4OSA_UInt32 pBGAudioCurrentMediaBeginCutTS,
|
| 60 | M4OSA_UInt32 pBGAudioCurrentMediaVolumeVal);
|
| 61 |
|
James Dong | c9dedc4 | 2011-05-01 12:36:22 -0700 | [diff] [blame^] | 62 | void setObserver(PreviewPlayerBase *observer);
|
Rajneesh Chowdury | 1c97d9a | 2011-02-21 15:43:33 -0800 | [diff] [blame] | 63 | void setSource(const sp<MediaSource> &source);
|
| 64 | sp<MediaSource> getSource();
|
| 65 |
|
| 66 | bool isStarted();
|
Dharmaray Kundargi | 643290d | 2011-01-16 16:02:42 -0800 | [diff] [blame] | 67 | private:
|
| 68 |
|
| 69 | M4xVSS_AudioMixingSettings *mAudioMixSettings;
|
| 70 | VideoEditorBGAudioProcessing *mAudioProcess;
|
| 71 |
|
| 72 | M4OSA_Context mBGAudioPCMFileHandle;
|
| 73 | int64_t mBGAudioPCMFileLength;
|
| 74 | int64_t mBGAudioPCMFileTrimmedLength;
|
| 75 | int64_t mBGAudioPCMFileDuration;
|
| 76 | int64_t mBGAudioPCMFileSeekPoint;
|
| 77 | int64_t mBGAudioPCMFileOriginalSeekPoint;
|
| 78 | int64_t mBGAudioStoryBoardSkimTimeStamp;
|
| 79 | int64_t mBGAudioStoryBoardCurrentMediaBeginCutTS;
|
| 80 | int64_t mBGAudioStoryBoardCurrentMediaVolumeVal;
|
| 81 |
|
| 82 | size_t fillBuffer(void *data, size_t size);
|
| 83 |
|
| 84 | void reset();
|
| 85 | void setPrimaryTrackVolume(M4OSA_Int16 *data, M4OSA_UInt32 size, M4OSA_Float volLevel);
|
| 86 |
|
| 87 | static size_t AudioSinkCallback(
|
| 88 | MediaPlayerBase::AudioSink *audioSink,
|
| 89 | void *data, size_t size, void *me);
|
| 90 |
|
| 91 | VideoEditorAudioPlayer(const VideoEditorAudioPlayer &);
|
| 92 | VideoEditorAudioPlayer &operator=(const VideoEditorAudioPlayer &);
|
| 93 | };
|
| 94 |
|
| 95 | } // namespace android
|
| 96 |
|
| 97 | #endif // VE_AUDIO_PLAYER_H_
|