blob: 460eac319337c2fd7b2203276704eb846465af7c [file] [log] [blame]
glaznev@webrtc.org18c92472015-02-18 18:42:55 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
glaznev@webrtc.org18c92472015-02-18 18:42:55 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
glaznev@webrtc.org18c92472015-02-18 18:42:55 +00009 */
10
Henrik Kjellander15583c12016-02-10 10:53:12 +010011#ifndef WEBRTC_API_JAVA_JNI_ANDROIDMEDIAENCODER_JNI_H_
12#define WEBRTC_API_JAVA_JNI_ANDROIDMEDIAENCODER_JNI_H_
glaznev@webrtc.org18c92472015-02-18 18:42:55 +000013
14#include <vector>
15
sakald34a7112016-07-01 05:10:51 -070016#include "webrtc/api/android/jni/jni_helpers.h"
kjellander@webrtc.org5ad12972016-02-12 06:39:40 +010017#include "webrtc/media/engine/webrtcvideoencoderfactory.h"
glaznev@webrtc.org18c92472015-02-18 18:42:55 +000018
19namespace webrtc_jni {
20
21// Implementation of Android MediaCodec based encoder factory.
22class MediaCodecVideoEncoderFactory
23 : public cricket::WebRtcVideoEncoderFactory {
24 public:
25 MediaCodecVideoEncoderFactory();
26 virtual ~MediaCodecVideoEncoderFactory();
27
perkj461121c2016-02-15 06:28:36 -080028 void SetEGLContext(JNIEnv* jni, jobject egl_context);
perkj30e91822015-11-20 01:31:25 -080029
glaznev@webrtc.org18c92472015-02-18 18:42:55 +000030 // WebRtcVideoEncoderFactory implementation.
31 webrtc::VideoEncoder* CreateVideoEncoder(webrtc::VideoCodecType type)
32 override;
33 const std::vector<VideoCodec>& codecs() const override;
34 void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) override;
35
36 private:
perkj461121c2016-02-15 06:28:36 -080037 jobject egl_context_;
Perec2922f2016-01-27 15:25:46 +010038
glaznev@webrtc.org18c92472015-02-18 18:42:55 +000039 // Empty if platform support is lacking, const after ctor returns.
40 std::vector<VideoCodec> supported_codecs_;
41};
42
43} // namespace webrtc_jni
44
Henrik Kjellander15583c12016-02-10 10:53:12 +010045#endif // WEBRTC_API_JAVA_JNI_ANDROIDMEDIAENCODER_JNI_H_