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

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: addressing comments 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>
xhwang 2015/12/04 18:07:58 hmm, without any reference page. How are people su
qinmin 2015/12/04 20:26:04 like what happened to opensles_output.cc code, the
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 // MediaCodecBridge implementation.
23 MediaCodecStatus Reset() override;
24 bool Start() override;
25 void Stop() override;
26 void GetOutputFormat(int* width, int* height) override;
27 int GetOutputSamplingRate() override;
28 MediaCodecStatus QueueInputBuffer(
29 int index,
30 const uint8* data,
31 size_t data_size,
32 const base::TimeDelta& presentation_time) override;
33 using MediaCodecBridge::QueueSecureInputBuffer;
34 MediaCodecStatus QueueSecureInputBuffer(
35 int index,
36 const uint8* data,
37 size_t data_size,
38 std::vector<char> key_id,
39 std::vector<char> iv,
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 private:
68 struct AMediaCodecDeleter {
69 inline void operator()(AMediaCodec* ptr) const { AMediaCodec_delete(ptr); }
70 };
71
72 scoped_ptr<AMediaCodec, AMediaCodecDeleter> media_codec_;
73
74 DISALLOW_COPY_AND_ASSIGN(NdkMediaCodecBridge);
75 };
76
77 } // namespace media
78
79 #endif // MEDIA_BASE_ANDROID_NDK_MEDIA_CODEC_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698