MetadataRetrieverClient.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. **
  3. ** Copyright (C) 2008 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. #ifndef ANDROID_MEDIAMETADATARETRIEVERSERVICE_H
  18. #define ANDROID_MEDIAMETADATARETRIEVERSERVICE_H
  19. #include <utils/Log.h>
  20. #include <utils/threads.h>
  21. #include <utils/List.h>
  22. #include <utils/Errors.h>
  23. #include <utils/KeyedVector.h>
  24. #include <binder/IMemory.h>
  25. #include <media/MediaMetadataRetrieverInterface.h>
  26. namespace android {
  27. struct IMediaHTTPService;
  28. class IMediaPlayerService;
  29. class MemoryDealer;
  30. class MetadataRetrieverClient : public BnMediaMetadataRetriever
  31. {
  32. public:
  33. MetadataRetrieverClient(const sp<IMediaPlayerService>& service, pid_t pid, int32_t connId);
  34. // Implements IMediaMetadataRetriever interface
  35. // These methods are called in IMediaMetadataRetriever.cpp?
  36. virtual void disconnect();
  37. virtual status_t setDataSource(
  38. const sp<IMediaHTTPService> &httpService,
  39. const char *url,
  40. const KeyedVector<String8, String8> *headers);
  41. virtual status_t setDataSource(int fd, int64_t offset, int64_t length);
  42. virtual status_t setDataSource(const sp<IDataSource>& source, const char *mime);
  43. virtual sp<IMemory> getFrameAtTime(
  44. int64_t timeUs, int option, int colorFormat, bool metaOnly);
  45. virtual sp<IMemory> getImageAtIndex(
  46. int index, int colorFormat, bool metaOnly, bool thumbnail);
  47. virtual sp<IMemory> getImageRectAtIndex(
  48. int index, int colorFormat, int left, int top, int right, int bottom);
  49. virtual status_t getFrameAtIndex(
  50. std::vector<sp<IMemory> > *frames,
  51. int frameIndex, int numFrames, int colorFormat, bool metaOnly);
  52. virtual sp<IMemory> extractAlbumArt();
  53. virtual const char* extractMetadata(int keyCode);
  54. virtual status_t dump(int fd, const Vector<String16>& args);
  55. private:
  56. friend class MediaPlayerService;
  57. explicit MetadataRetrieverClient(pid_t pid);
  58. virtual ~MetadataRetrieverClient();
  59. mutable Mutex mLock;
  60. static Mutex sLock;
  61. sp<MediaMetadataRetrieverBase> mRetriever;
  62. pid_t mPid;
  63. // Keep the shared memory copy of album art
  64. sp<IMemory> mAlbumArt;
  65. };
  66. }; // namespace android
  67. #endif // ANDROID_MEDIAMETADATARETRIEVERSERVICE_H