2 * Copyright (C) 2010 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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 express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <binder/IServiceManager.h>
20 //--------------------------------------------------------------------------------------------------
24 class StreamSourceAppProxy : public BnStreamSource {
26 StreamSourceAppProxy(slAndroidBufferQueueCallback callback, void *appContext,
28 virtual ~StreamSourceAppProxy();
30 // IStreamSource implementation
31 virtual void setListener(const sp<IStreamListener> &listener);
32 virtual void setBuffers(const Vector<sp<IMemory> > &buffers);
33 virtual void onBufferAvailable(size_t index);
35 void receivedFromAppCommand(IStreamListener::Command cmd);
36 void receivedFromAppBuffer(size_t buffIndex, size_t buffLength);
40 sp<IStreamListener> mListener;
41 Vector<sp<IMemory> > mBuffers;
43 slAndroidBufferQueueCallback mCallback;
47 DISALLOW_EVIL_CONSTRUCTORS(StreamSourceAppProxy);
51 //--------------------------------------------------------------------------------------------------
52 class StreamPlayer : public GenericMediaPlayer
55 StreamPlayer(AudioPlayback_Parameters* params, bool hasVideo);
56 virtual ~StreamPlayer();
58 void registerQueueCallback(slAndroidBufferQueueCallback callback, void *context,
60 void appEnqueue(SLuint32 bufferId, SLuint32 length, SLAbufferQueueEvent event, void *pData);
64 sp<StreamSourceAppProxy> mAppProxy; // application proxy for the android buffer queue source
66 // overridden from GenericMediaPlayer
67 virtual void onPrepare();
72 DISALLOW_EVIL_CONSTRUCTORS(StreamPlayer);
75 } // namespace android
78 //--------------------------------------------------------------------------------------------------
80 * xxx_l functions are called with a lock on the CAudioPlayer mObject
82 extern void android_StreamPlayer_realize_l(CAudioPlayer *ap, const notif_cbf_t cbf,
84 extern void android_StreamPlayer_destroy(CAudioPlayer *ap);
85 extern void android_StreamPlayer_androidBufferQueue_registerCallback(
86 android::StreamPlayer *splr,
87 slAndroidBufferQueueCallback callback, void* context, const void* callerItf);
88 extern void android_StreamPlayer_enqueue_l(CAudioPlayer *ap,
89 SLuint32 bufferId, SLuint32 length, SLAbufferQueueEvent event, void *pData);
90 extern void android_StreamPlayer_clear_l(CAudioPlayer *ap);