Index: media/gpu/tegra_v4l2_device.cc |
diff --git a/media/gpu/tegra_v4l2_device.cc b/media/gpu/tegra_v4l2_device.cc |
index 25b1c6a5180c8ff481ab9bc72d324c3d9a005929..309462f46bb0a942357fcd7dbcb0ba5bcaa750b8 100644 |
--- a/media/gpu/tegra_v4l2_device.cc |
+++ b/media/gpu/tegra_v4l2_device.cc |
@@ -56,10 +56,8 @@ class TegraFunctionSymbolFinder { |
public: |
TegraFunctionSymbolFinder() : initialized_(false) { |
if (!dlopen("/usr/lib/libtegrav4l2.so", |
- RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE)) { |
- DLOG(ERROR) << "Failed to load libtegrav4l2.so"; |
+ RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE)) |
return; |
- } |
#define TEGRAV4L2_DLSYM_OR_RETURN_ON_ERROR(name) \ |
do { \ |
TegraV4L2_##name = reinterpret_cast<TegraV4L2##name>( \ |
@@ -144,23 +142,28 @@ bool TegraV4L2Device::ClearDevicePollInterrupt() { |
} |
bool TegraV4L2Device::Initialize() { |
- const char* device_path = NULL; |
+ return g_tegra_function_symbol_finder_.Get().initialized(); |
+} |
+ |
+bool TegraV4L2Device::Open(uint32_t /* v4l2_pixfmt */) { |
+ return OpenInternal(); |
+} |
+ |
+bool TegraV4L2Device::OpenInternal() { |
+ const char* device_path = nullptr; |
+ |
switch (type_) { |
- case kDecoder: |
+ case V4L2Device::Type::kDecoder: |
device_path = kDecoderDevice; |
break; |
- case kEncoder: |
+ case V4L2Device::Type::kEncoder: |
device_path = kEncoderDevice; |
break; |
default: |
- DVLOG(1) << "Device type " << type_ << " not supported on this platform"; |
+ DVLOG(1) << "Device type not supported on this platform"; |
return false; |
} |
- if (!g_tegra_function_symbol_finder_.Get().initialized()) { |
- DLOG(ERROR) << "Unable to initialize functions"; |
- return false; |
- } |
device_fd_ = HANDLE_EINTR( |
TegraV4L2_Open(device_path, O_RDWR | O_NONBLOCK | O_CLOEXEC)); |
if (device_fd_ == -1) { |
@@ -229,8 +232,34 @@ GLenum TegraV4L2Device::GetTextureTarget() { |
uint32_t TegraV4L2Device::PreferredInputFormat() { |
// TODO(posciak): We should support "dontcare" returns here once we |
// implement proper handling (fallback, negotiation) for this in users. |
- CHECK_EQ(type_, kEncoder); |
+ CHECK_EQ(type_, Type::kEncoder); |
return V4L2_PIX_FMT_YUV420M; |
} |
+std::vector<uint32_t> TegraV4L2Device::GetSupportedImageProcessorPixelformats( |
+ v4l2_buf_type buf_type) { |
+ return std::vector<uint32_t>(); |
+} |
+ |
+VideoDecodeAccelerator::SupportedProfiles |
+TegraV4L2Device::GetSupportedDecodeProfiles(const size_t num_formats, |
+ const uint32_t pixelformats[]) { |
+ if (!OpenInternal()) |
+ return VideoDecodeAccelerator::SupportedProfiles(); |
+ |
+ return EnumerateSupportedDecodeProfiles(num_formats, pixelformats); |
+} |
+ |
+VideoEncodeAccelerator::SupportedProfiles |
+TegraV4L2Device::GetSupportedEncodeProfiles() { |
+ if (!OpenInternal()) |
+ return VideoEncodeAccelerator::SupportedProfiles(); |
+ |
+ return EnumerateSupportedEncodeProfiles(); |
+} |
+ |
+bool TegraV4L2Device::IsJpegDecodingSupported() { |
+ return false; |
+} |
+ |
} // namespace media |