SDPLoader.h revision 1b86fe063badb5f28c467ade39be0f4008688947
1/* 2 * Copyright (C) 2012 The Android Open Source Project 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 express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef SDP_LOADER_H_ 18 19#define SDP_LOADER_H_ 20 21#include <media/stagefright/foundation/AMessage.h> 22#include <media/stagefright/foundation/AHandler.h> 23#include <utils/String8.h> 24 25namespace android { 26 27struct HTTPBase; 28struct IMediaHTTPService; 29 30struct SDPLoader : public AHandler { 31 enum Flags { 32 // Don't log any URLs. 33 kFlagIncognito = 1, 34 }; 35 enum { 36 kWhatSDPLoaded = 'sdpl' 37 }; 38 SDPLoader( 39 const sp<AMessage> ¬ify, 40 uint32_t flags, 41 const sp<IMediaHTTPService> &httpService, 42 bool uidValid = false, 43 uid_t uid = 0); 44 45 void load(const char* url, const KeyedVector<String8, String8> *headers); 46 47 void cancel(); 48 49protected: 50 virtual ~SDPLoader() {} 51 52 virtual void onMessageReceived(const sp<AMessage> &msg); 53 54private: 55 enum { 56 kWhatLoad = 'load', 57 }; 58 59 void onLoad(const sp<AMessage> &msg); 60 61 sp<AMessage> mNotify; 62 const char* mUrl; 63 uint32_t mFlags; 64 bool mUIDValid; 65 uid_t mUID; 66 sp<ALooper> mNetLooper; 67 bool mCancelled; 68 69 sp<HTTPBase> mHTTPDataSource; 70 71 DISALLOW_EVIL_CONSTRUCTORS(SDPLoader); 72}; 73 74} // namespace android 75 76#endif // SDP_LOADER_H_ 77