blob: 3e3fec47588da515d5e2a5038c3de0fe728bfbcb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ANDROID_V4L2_CODEC2_COMPONENTS_VIDEO_DECODER_H
#define ANDROID_V4L2_CODEC2_COMPONENTS_VIDEO_DECODER_H
#include <stdint.h>
#include <memory>
#include <base/callback.h>
#include <v4l2_codec2/common/VideoTypes.h>
#include <v4l2_codec2/components/BitstreamBuffer.h>
#include <v4l2_codec2/components/VideoFrame.h>
#include <v4l2_codec2/components/VideoFramePool.h>
namespace android {
class VideoDecoder {
public:
enum class DecodeStatus {
kOk = 0, // Everything went as planned.
kAborted, // Read aborted due to Flush() during pending read.
kError, // Decoder returned decode error.
};
static const char* DecodeStatusToString(DecodeStatus status);
using GetPoolCB = ::base::RepeatingCallback<std::unique_ptr<VideoFramePool>(
const ui::Size& size, HalPixelFormat pixelFormat, size_t numOutputBuffers)>;
using DecodeCB = ::base::OnceCallback<void(DecodeStatus)>;
using OutputCB = ::base::RepeatingCallback<void(std::unique_ptr<VideoFrame>)>;
using ErrorCB = ::base::RepeatingCallback<void()>;
virtual ~VideoDecoder();
virtual void decode(std::unique_ptr<ConstBitstreamBuffer> buffer, DecodeCB decodeCb) = 0;
virtual void drain(DecodeCB drainCb) = 0;
virtual void flush() = 0;
};
} // namespace android
#endif // ANDROID_V4L2_CODEC2_COMPONENTS_VIDEO_DECODER_H
|