Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: media/base/android/ndk_media_codec_bridge.h

Issue 1472943002: Refactor MediaCodecBridge to add support for NDK APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_BASE_ANDROID_NDK_MEDIA_CODEC_BRIDGE_H_
6 #define MEDIA_BASE_ANDROID_NDK_MEDIA_CODEC_BRIDGE_H_
7
8 #include <media/NdkMediaCodec.h>
9
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/time/time.h"
13 #include "media/base/android/media_codec_bridge.h"
14 #include "media/base/media_export.h"
15
16 namespace media {
17
18 class MEDIA_EXPORT NdkMediaCodecBridge : public MediaCodecBridge {
19 public:
20 ~NdkMediaCodecBridge() override;
21
22 MediaCodecStatus Reset() override;
23 void Stop() override;
24 void GetOutputFormat(int* width, int* height) override;
25 int GetOutputSamplingRate() override;
26 MediaCodecStatus QueueInputBuffer(
27 int index,
28 const uint8* data,
29 size_t data_size,
30 const base::TimeDelta& presentation_time) override;
31 using MediaCodecBridge::QueueSecureInputBuffer;
32 MediaCodecStatus QueueSecureInputBuffer(
33 int index,
34 const uint8* data,
35 size_t data_size,
36 const uint8* key_id,
37 int key_id_size,
38 const uint8* iv,
39 int iv_size,
40 const SubsampleEntry* subsamples,
41 int subsamples_size,
42 const base::TimeDelta& presentation_time) override;
43 void QueueEOS(int input_buffer_index);
44 MediaCodecStatus DequeueInputBuffer(const base::TimeDelta& timeout,
45 int* index) override;
46 MediaCodecStatus DequeueOutputBuffer(const base::TimeDelta& timeout,
47 int* index,
48 size_t* offset,
49 size_t* size,
50 base::TimeDelta* presentation_time,
51 bool* end_of_stream,
52 bool* key_frame) override;
53 void ReleaseOutputBuffer(int index, bool render) override;
54 void GetInputBuffer(int input_buffer_index,
55 uint8** data,
56 size_t* capacity) override;
57 bool CopyFromOutputBuffer(int index,
58 size_t offset,
59 void* dst,
60 int dst_size) override;
61
62 protected:
63 NdkMediaCodecBridge(const std::string& mime,
64 bool is_secure,
65 MediaCodecDirection direction);
66
67 bool StartInternal() override;
68
69 private:
70 struct AMediaCodecDeleter {
71 inline void operator()(AMediaCodec* ptr) const { AMediaCodec_delete(ptr); }
72 };
73
74 scoped_ptr<AMediaCodec, AMediaCodecDeleter> media_codec_;
75
76 DISALLOW_COPY_AND_ASSIGN(NdkMediaCodecBridge);
77 };
78
79 } // namespace media
80
81 #endif // MEDIA_BASE_ANDROID_NDK_MEDIA_CODEC_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698