JMedia2HTTPConnection.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright 2017, 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. #ifndef _J_MEDIA2_HTTP_CONNECTION_H_
  17. #define _J_MEDIA2_HTTP_CONNECTION_H_
  18. #include "jni.h"
  19. #include <media/MediaHTTPConnection.h>
  20. #include <media/stagefright/foundation/ABase.h>
  21. namespace android {
  22. struct JMedia2HTTPConnection : public MediaHTTPConnection {
  23. JMedia2HTTPConnection(JNIEnv *env, jobject thiz);
  24. virtual bool connect(
  25. const char *uri, const KeyedVector<String8, String8> *headers) override;
  26. virtual void disconnect() override;
  27. virtual ssize_t readAt(off64_t offset, void *data, size_t size) override;
  28. virtual off64_t getSize() override;
  29. virtual status_t getMIMEType(String8 *mimeType) override;
  30. virtual status_t getUri(String8 *uri) override;
  31. protected:
  32. virtual ~JMedia2HTTPConnection();
  33. private:
  34. jobject mMedia2HTTPConnectionObj;
  35. jmethodID mConnectMethod;
  36. jmethodID mDisconnectMethod;
  37. jmethodID mReadAtMethod;
  38. jmethodID mGetSizeMethod;
  39. jmethodID mGetMIMETypeMethod;
  40. jmethodID mGetUriMethod;
  41. jbyteArray mByteArrayObj;
  42. DISALLOW_EVIL_CONSTRUCTORS(JMedia2HTTPConnection);
  43. };
  44. } // namespace android
  45. #endif // _J_MEDIA2_HTTP_CONNECTION_H_