torchcodec 0.8.0__cp313-cp313-macosx_12_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of torchcodec might be problematic. Click here for more details.

Files changed (82) hide show
  1. torchcodec/.dylibs/libc++.1.0.dylib +0 -0
  2. torchcodec/.dylibs/libpython3.13.dylib +0 -0
  3. torchcodec/__init__.py +16 -0
  4. torchcodec/_core/AVIOContextHolder.cpp +60 -0
  5. torchcodec/_core/AVIOContextHolder.h +64 -0
  6. torchcodec/_core/AVIOFileLikeContext.cpp +98 -0
  7. torchcodec/_core/AVIOFileLikeContext.h +55 -0
  8. torchcodec/_core/AVIOTensorContext.cpp +123 -0
  9. torchcodec/_core/AVIOTensorContext.h +43 -0
  10. torchcodec/_core/BetaCudaDeviceInterface.cpp +636 -0
  11. torchcodec/_core/BetaCudaDeviceInterface.h +191 -0
  12. torchcodec/_core/CMakeLists.txt +325 -0
  13. torchcodec/_core/CUDACommon.cpp +315 -0
  14. torchcodec/_core/CUDACommon.h +46 -0
  15. torchcodec/_core/Cache.h +138 -0
  16. torchcodec/_core/CpuDeviceInterface.cpp +347 -0
  17. torchcodec/_core/CpuDeviceInterface.h +132 -0
  18. torchcodec/_core/CudaDeviceInterface.cpp +357 -0
  19. torchcodec/_core/CudaDeviceInterface.h +64 -0
  20. torchcodec/_core/DeviceInterface.cpp +117 -0
  21. torchcodec/_core/DeviceInterface.h +148 -0
  22. torchcodec/_core/Encoder.cpp +807 -0
  23. torchcodec/_core/Encoder.h +173 -0
  24. torchcodec/_core/FFMPEGCommon.cpp +608 -0
  25. torchcodec/_core/FFMPEGCommon.h +245 -0
  26. torchcodec/_core/FilterGraph.cpp +149 -0
  27. torchcodec/_core/FilterGraph.h +59 -0
  28. torchcodec/_core/Frame.cpp +42 -0
  29. torchcodec/_core/Frame.h +72 -0
  30. torchcodec/_core/Metadata.h +72 -0
  31. torchcodec/_core/NVDECCache.cpp +70 -0
  32. torchcodec/_core/NVDECCache.h +104 -0
  33. torchcodec/_core/SingleStreamDecoder.cpp +1719 -0
  34. torchcodec/_core/SingleStreamDecoder.h +405 -0
  35. torchcodec/_core/StreamOptions.h +63 -0
  36. torchcodec/_core/Transform.cpp +60 -0
  37. torchcodec/_core/Transform.h +59 -0
  38. torchcodec/_core/ValidationUtils.cpp +35 -0
  39. torchcodec/_core/ValidationUtils.h +21 -0
  40. torchcodec/_core/__init__.py +41 -0
  41. torchcodec/_core/_metadata.py +317 -0
  42. torchcodec/_core/custom_ops.cpp +875 -0
  43. torchcodec/_core/fetch_and_expose_non_gpl_ffmpeg_libs.cmake +360 -0
  44. torchcodec/_core/nvcuvid_include/cuviddec.h +1374 -0
  45. torchcodec/_core/nvcuvid_include/nvcuvid.h +610 -0
  46. torchcodec/_core/ops.py +498 -0
  47. torchcodec/_core/pybind_ops.cpp +50 -0
  48. torchcodec/_frame.py +145 -0
  49. torchcodec/_internally_replaced_utils.py +67 -0
  50. torchcodec/_samplers/__init__.py +7 -0
  51. torchcodec/_samplers/video_clip_sampler.py +418 -0
  52. torchcodec/decoders/__init__.py +12 -0
  53. torchcodec/decoders/_audio_decoder.py +177 -0
  54. torchcodec/decoders/_decoder_utils.py +112 -0
  55. torchcodec/decoders/_video_decoder.py +500 -0
  56. torchcodec/encoders/__init__.py +1 -0
  57. torchcodec/encoders/_audio_encoder.py +150 -0
  58. torchcodec/libtorchcodec_core4.dylib +0 -0
  59. torchcodec/libtorchcodec_core5.dylib +0 -0
  60. torchcodec/libtorchcodec_core6.dylib +0 -0
  61. torchcodec/libtorchcodec_core7.dylib +0 -0
  62. torchcodec/libtorchcodec_core8.dylib +0 -0
  63. torchcodec/libtorchcodec_custom_ops4.dylib +0 -0
  64. torchcodec/libtorchcodec_custom_ops5.dylib +0 -0
  65. torchcodec/libtorchcodec_custom_ops6.dylib +0 -0
  66. torchcodec/libtorchcodec_custom_ops7.dylib +0 -0
  67. torchcodec/libtorchcodec_custom_ops8.dylib +0 -0
  68. torchcodec/libtorchcodec_pybind_ops4.so +0 -0
  69. torchcodec/libtorchcodec_pybind_ops5.so +0 -0
  70. torchcodec/libtorchcodec_pybind_ops6.so +0 -0
  71. torchcodec/libtorchcodec_pybind_ops7.so +0 -0
  72. torchcodec/libtorchcodec_pybind_ops8.so +0 -0
  73. torchcodec/samplers/__init__.py +2 -0
  74. torchcodec/samplers/_common.py +84 -0
  75. torchcodec/samplers/_index_based.py +287 -0
  76. torchcodec/samplers/_time_based.py +358 -0
  77. torchcodec/version.py +2 -0
  78. torchcodec-0.8.0.dist-info/METADATA +253 -0
  79. torchcodec-0.8.0.dist-info/RECORD +82 -0
  80. torchcodec-0.8.0.dist-info/WHEEL +5 -0
  81. torchcodec-0.8.0.dist-info/licenses/LICENSE +28 -0
  82. torchcodec-0.8.0.dist-info/top_level.txt +2 -0
Binary file
Binary file
torchcodec/__init__.py ADDED
@@ -0,0 +1,16 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ # All rights reserved.
3
+ #
4
+ # This source code is licensed under the BSD-style license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ # Note: usort wants to put Frame and FrameBatch after decoders and samplers,
8
+ # but that results in circular import.
9
+ from ._frame import AudioSamples, Frame, FrameBatch # usort:skip # noqa
10
+ from . import decoders, samplers # noqa
11
+
12
+ try:
13
+ # Note that version.py is generated during install.
14
+ from .version import __version__ # noqa: F401
15
+ except Exception:
16
+ pass
@@ -0,0 +1,60 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // All rights reserved.
3
+ //
4
+ // This source code is licensed under the BSD-style license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+
7
+ #include "src/torchcodec/_core/AVIOContextHolder.h"
8
+ #include <torch/types.h>
9
+
10
+ namespace facebook::torchcodec {
11
+
12
+ void AVIOContextHolder::createAVIOContext(
13
+ AVIOReadFunction read,
14
+ AVIOWriteFunction write,
15
+ AVIOSeekFunction seek,
16
+ void* heldData,
17
+ bool isForWriting,
18
+ int bufferSize) {
19
+ TORCH_CHECK(
20
+ bufferSize > 0,
21
+ "Buffer size must be greater than 0; is " + std::to_string(bufferSize));
22
+ auto buffer = static_cast<uint8_t*>(av_malloc(bufferSize));
23
+ TORCH_CHECK(
24
+ buffer != nullptr,
25
+ "Failed to allocate buffer of size " + std::to_string(bufferSize));
26
+
27
+ TORCH_CHECK(seek != nullptr, "seek method must be defined");
28
+
29
+ if (isForWriting) {
30
+ TORCH_CHECK(write != nullptr, "write method must be defined for writing");
31
+ } else {
32
+ TORCH_CHECK(read != nullptr, "read method must be defined for reading");
33
+ }
34
+
35
+ avioContext_.reset(avioAllocContext(
36
+ buffer,
37
+ bufferSize,
38
+ /*write_flag=*/isForWriting,
39
+ heldData,
40
+ read,
41
+ write,
42
+ seek));
43
+
44
+ if (!avioContext_) {
45
+ av_freep(&buffer);
46
+ TORCH_CHECK(false, "Failed to allocate AVIOContext");
47
+ }
48
+ }
49
+
50
+ AVIOContextHolder::~AVIOContextHolder() {
51
+ if (avioContext_) {
52
+ av_freep(&avioContext_->buffer);
53
+ }
54
+ }
55
+
56
+ AVIOContext* AVIOContextHolder::getAVIOContext() {
57
+ return avioContext_.get();
58
+ }
59
+
60
+ } // namespace facebook::torchcodec
@@ -0,0 +1,64 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // All rights reserved.
3
+ //
4
+ // This source code is licensed under the BSD-style license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+
7
+ #pragma once
8
+
9
+ #include "src/torchcodec/_core/FFMPEGCommon.h"
10
+
11
+ namespace facebook::torchcodec {
12
+
13
+ // The AVIOContextHolder serves several purposes:
14
+ //
15
+ // 1. It is a smart pointer for the AVIOContext. It has the logic to create
16
+ // a new AVIOContext and will appropriately free the AVIOContext when it
17
+ // goes out of scope. Note that this requires more than just having a
18
+ // UniqueAVIOContext, as the AVIOContext points to a buffer which must be
19
+ // freed.
20
+ // 2. It is a base class for AVIOContext specializations. When specializing a
21
+ // AVIOContext, we need to provide four things:
22
+ // 1. A read callback function, for decoding.
23
+ // 2. A seek callback function, for decoding and encoding.
24
+ // 3. A write callback function, for encoding.
25
+ // 4. A pointer to some context object that has the same lifetime as the
26
+ // AVIOContext itself. This context object holds the custom state that
27
+ // tracks the custom behavior of reading, seeking and writing. It is
28
+ // provided upon AVIOContext creation and to the read, seek and
29
+ // write callback functions.
30
+ // The callback functions do not need to be members of the derived class,
31
+ // but the derived class must have access to them. The context object must
32
+ // be a member of the derived class. Derived classes need to call
33
+ // createAVIOContext(), ideally in their constructor.
34
+ // 3. A generic handle for those that just need to manage having access to an
35
+ // AVIOContext, but aren't necessarily concerned with how it was customized:
36
+ // typically, the SingleStreamDecoder.
37
+ class AVIOContextHolder {
38
+ public:
39
+ virtual ~AVIOContextHolder();
40
+ AVIOContext* getAVIOContext();
41
+
42
+ protected:
43
+ // Make constructor protected to prevent anyone from constructing
44
+ // an AVIOContextHolder without deriving it. (Ordinarily this would be
45
+ // enforced by having a pure virtual methods, but we don't have any.)
46
+ AVIOContextHolder() = default;
47
+
48
+ // Deriving classes should call this function in their constructor.
49
+ void createAVIOContext(
50
+ AVIOReadFunction read,
51
+ AVIOWriteFunction write,
52
+ AVIOSeekFunction seek,
53
+ void* heldData,
54
+ bool isForWriting,
55
+ int bufferSize = defaultBufferSize);
56
+
57
+ private:
58
+ UniqueAVIOContext avioContext_;
59
+
60
+ // Defaults to 64 KB
61
+ static const int defaultBufferSize = 64 * 1024;
62
+ };
63
+
64
+ } // namespace facebook::torchcodec
@@ -0,0 +1,98 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // All rights reserved.
3
+ //
4
+ // This source code is licensed under the BSD-style license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+
7
+ #include "src/torchcodec/_core/AVIOFileLikeContext.h"
8
+ #include <torch/types.h>
9
+
10
+ namespace facebook::torchcodec {
11
+
12
+ AVIOFileLikeContext::AVIOFileLikeContext(
13
+ const py::object& fileLike,
14
+ bool isForWriting)
15
+ : fileLike_{UniquePyObject(new py::object(fileLike))} {
16
+ {
17
+ // TODO: Is it necessary to acquire the GIL here? Is it maybe even
18
+ // harmful? At the moment, this is only called from within a pybind
19
+ // function, and pybind guarantees we have the GIL.
20
+ py::gil_scoped_acquire gil;
21
+
22
+ if (isForWriting) {
23
+ TORCH_CHECK(
24
+ py::hasattr(fileLike, "write"),
25
+ "File like object must implement a write method for writing.");
26
+ } else {
27
+ TORCH_CHECK(
28
+ py::hasattr(fileLike, "read"),
29
+ "File like object must implement a read method for reading.");
30
+ }
31
+
32
+ TORCH_CHECK(
33
+ py::hasattr(fileLike, "seek"),
34
+ "File like object must implement a seek method.");
35
+ }
36
+ createAVIOContext(&read, &write, &seek, &fileLike_, isForWriting);
37
+ }
38
+
39
+ int AVIOFileLikeContext::read(void* opaque, uint8_t* buf, int buf_size) {
40
+ auto fileLike = static_cast<UniquePyObject*>(opaque);
41
+
42
+ // Note that we acquire the GIL outside of the loop. This is likely more
43
+ // efficient than releasing and acquiring it each loop iteration.
44
+ py::gil_scoped_acquire gil;
45
+
46
+ int totalNumRead = 0;
47
+ while (totalNumRead < buf_size) {
48
+ int request = buf_size - totalNumRead;
49
+
50
+ // The Python method returns the actual bytes, which we access through the
51
+ // py::bytes wrapper. That wrapper, however, does not provide us access to
52
+ // the underlying data pointer, which we need for the memcpy below. So we
53
+ // convert the bytes to a string_view to get access to the data pointer.
54
+ // Becauase it's a view and not a copy, it should be cheap.
55
+ auto bytesRead = static_cast<py::bytes>((*fileLike)->attr("read")(request));
56
+ auto bytesView = static_cast<std::string_view>(bytesRead);
57
+
58
+ int numBytesRead = static_cast<int>(bytesView.size());
59
+ if (numBytesRead == 0) {
60
+ break;
61
+ }
62
+
63
+ TORCH_CHECK(
64
+ numBytesRead <= request,
65
+ "Requested up to ",
66
+ request,
67
+ " bytes but, received ",
68
+ numBytesRead,
69
+ " bytes. The given object does not conform to read protocol of file object.");
70
+
71
+ std::memcpy(buf, bytesView.data(), numBytesRead);
72
+ buf += numBytesRead;
73
+ totalNumRead += numBytesRead;
74
+ }
75
+
76
+ return totalNumRead == 0 ? AVERROR_EOF : totalNumRead;
77
+ }
78
+
79
+ int64_t AVIOFileLikeContext::seek(void* opaque, int64_t offset, int whence) {
80
+ // We do not know the file size.
81
+ if (whence == AVSEEK_SIZE) {
82
+ return AVERROR(EIO);
83
+ }
84
+
85
+ auto fileLike = static_cast<UniquePyObject*>(opaque);
86
+ py::gil_scoped_acquire gil;
87
+ return py::cast<int64_t>((*fileLike)->attr("seek")(offset, whence));
88
+ }
89
+
90
+ int AVIOFileLikeContext::write(void* opaque, const uint8_t* buf, int buf_size) {
91
+ auto fileLike = static_cast<UniquePyObject*>(opaque);
92
+ py::gil_scoped_acquire gil;
93
+ py::bytes bytes_obj(reinterpret_cast<const char*>(buf), buf_size);
94
+
95
+ return py::cast<int>((*fileLike)->attr("write")(bytes_obj));
96
+ }
97
+
98
+ } // namespace facebook::torchcodec
@@ -0,0 +1,55 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // All rights reserved.
3
+ //
4
+ // This source code is licensed under the BSD-style license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+
7
+ #pragma once
8
+
9
+ #include <pybind11/pybind11.h>
10
+ #include <pybind11/stl.h>
11
+
12
+ #include "src/torchcodec/_core/AVIOContextHolder.h"
13
+
14
+ namespace py = pybind11;
15
+
16
+ namespace facebook::torchcodec {
17
+
18
+ // Enables uers to pass in a Python file-like object. We then forward all read
19
+ // and seek calls back up to the methods on the Python object.
20
+ class AVIOFileLikeContext : public AVIOContextHolder {
21
+ public:
22
+ explicit AVIOFileLikeContext(const py::object& fileLike, bool isForWriting);
23
+
24
+ private:
25
+ static int read(void* opaque, uint8_t* buf, int buf_size);
26
+ static int64_t seek(void* opaque, int64_t offset, int whence);
27
+ static int write(void* opaque, const uint8_t* buf, int buf_size);
28
+
29
+ // Note that we dynamically allocate the Python object because we need to
30
+ // strictly control when its destructor is called. We must hold the GIL
31
+ // when its destructor gets called, as it needs to update the reference
32
+ // count. It's easiest to control that when it's dynamic memory. Otherwise,
33
+ // we'd have to ensure whatever enclosing scope holds the object has the GIL,
34
+ // and that's, at least, hard. For all of the common pitfalls, see:
35
+ //
36
+ // https://pybind11.readthedocs.io/en/stable/advanced/misc.html#common-sources-of-global-interpreter-lock-errors
37
+ //
38
+ // We maintain a reference to the file-like object because the file-like
39
+ // object that was created on the Python side must live as long as our
40
+ // potential use. That is, even if there are no more references to the object
41
+ // on the Python side, we require that the object is still live.
42
+ struct PyObjectDeleter {
43
+ inline void operator()(py::object* obj) const {
44
+ if (obj) {
45
+ py::gil_scoped_acquire gil;
46
+ delete obj;
47
+ }
48
+ }
49
+ };
50
+
51
+ using UniquePyObject = std::unique_ptr<py::object, PyObjectDeleter>;
52
+ UniquePyObject fileLike_;
53
+ };
54
+
55
+ } // namespace facebook::torchcodec
@@ -0,0 +1,123 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // All rights reserved.
3
+ //
4
+ // This source code is licensed under the BSD-style license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+
7
+ #include "src/torchcodec/_core/AVIOTensorContext.h"
8
+ #include <torch/types.h>
9
+
10
+ namespace facebook::torchcodec {
11
+
12
+ namespace {
13
+
14
+ constexpr int64_t INITIAL_TENSOR_SIZE = 10'000'000; // 10 MB
15
+ constexpr int64_t MAX_TENSOR_SIZE = 320'000'000; // 320 MB
16
+
17
+ // The signature of this function is defined by FFMPEG.
18
+ int read(void* opaque, uint8_t* buf, int buf_size) {
19
+ auto tensorContext = static_cast<detail::TensorContext*>(opaque);
20
+ TORCH_CHECK(
21
+ tensorContext->current <= tensorContext->data.numel(),
22
+ "Tried to read outside of the buffer: current=",
23
+ tensorContext->current,
24
+ ", size=",
25
+ tensorContext->data.numel());
26
+
27
+ int64_t numBytesRead = std::min(
28
+ static_cast<int64_t>(buf_size),
29
+ tensorContext->data.numel() - tensorContext->current);
30
+
31
+ TORCH_CHECK(
32
+ numBytesRead >= 0,
33
+ "Tried to read negative bytes: numBytesRead=",
34
+ numBytesRead,
35
+ ", size=",
36
+ tensorContext->data.numel(),
37
+ ", current=",
38
+ tensorContext->current);
39
+
40
+ if (numBytesRead == 0) {
41
+ return AVERROR_EOF;
42
+ }
43
+
44
+ std::memcpy(
45
+ buf,
46
+ tensorContext->data.data_ptr<uint8_t>() + tensorContext->current,
47
+ numBytesRead);
48
+ tensorContext->current += numBytesRead;
49
+ return numBytesRead;
50
+ }
51
+
52
+ // The signature of this function is defined by FFMPEG.
53
+ int write(void* opaque, const uint8_t* buf, int buf_size) {
54
+ auto tensorContext = static_cast<detail::TensorContext*>(opaque);
55
+
56
+ int64_t bufSize = static_cast<int64_t>(buf_size);
57
+ if (tensorContext->current + bufSize > tensorContext->data.numel()) {
58
+ TORCH_CHECK(
59
+ tensorContext->data.numel() * 2 <= MAX_TENSOR_SIZE,
60
+ "We tried to allocate an output encoded tensor larger than ",
61
+ MAX_TENSOR_SIZE,
62
+ " bytes. If you think this should be supported, please report.");
63
+
64
+ // We double the size of the outpout tensor. Calling cat() may not be the
65
+ // most efficient, but it's simple.
66
+ tensorContext->data =
67
+ torch::cat({tensorContext->data, tensorContext->data});
68
+ }
69
+
70
+ TORCH_CHECK(
71
+ tensorContext->current + bufSize <= tensorContext->data.numel(),
72
+ "Re-allocation of the output tensor didn't work. ",
73
+ "This should not happen, please report on TorchCodec bug tracker");
74
+
75
+ uint8_t* outputTensorData = tensorContext->data.data_ptr<uint8_t>();
76
+ std::memcpy(outputTensorData + tensorContext->current, buf, bufSize);
77
+ tensorContext->current += bufSize;
78
+ return buf_size;
79
+ }
80
+
81
+ // The signature of this function is defined by FFMPEG.
82
+ int64_t seek(void* opaque, int64_t offset, int whence) {
83
+ auto tensorContext = static_cast<detail::TensorContext*>(opaque);
84
+ int64_t ret = -1;
85
+
86
+ switch (whence) {
87
+ case AVSEEK_SIZE:
88
+ ret = tensorContext->data.numel();
89
+ break;
90
+ case SEEK_SET:
91
+ tensorContext->current = offset;
92
+ ret = offset;
93
+ break;
94
+ default:
95
+ break;
96
+ }
97
+
98
+ return ret;
99
+ }
100
+
101
+ } // namespace
102
+
103
+ AVIOFromTensorContext::AVIOFromTensorContext(torch::Tensor data)
104
+ : tensorContext_{data, 0} {
105
+ TORCH_CHECK(data.numel() > 0, "data must not be empty");
106
+ TORCH_CHECK(data.is_contiguous(), "data must be contiguous");
107
+ TORCH_CHECK(data.scalar_type() == torch::kUInt8, "data must be kUInt8");
108
+ createAVIOContext(
109
+ &read, nullptr, &seek, &tensorContext_, /*isForWriting=*/false);
110
+ }
111
+
112
+ AVIOToTensorContext::AVIOToTensorContext()
113
+ : tensorContext_{torch::empty({INITIAL_TENSOR_SIZE}, {torch::kUInt8}), 0} {
114
+ createAVIOContext(
115
+ nullptr, &write, &seek, &tensorContext_, /*isForWriting=*/true);
116
+ }
117
+
118
+ torch::Tensor AVIOToTensorContext::getOutputTensor() {
119
+ return tensorContext_.data.narrow(
120
+ /*dim=*/0, /*start=*/0, /*length=*/tensorContext_.current);
121
+ }
122
+
123
+ } // namespace facebook::torchcodec
@@ -0,0 +1,43 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // All rights reserved.
3
+ //
4
+ // This source code is licensed under the BSD-style license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+
7
+ #pragma once
8
+
9
+ #include <torch/types.h>
10
+ #include "src/torchcodec/_core/AVIOContextHolder.h"
11
+
12
+ namespace facebook::torchcodec {
13
+
14
+ namespace detail {
15
+
16
+ struct TensorContext {
17
+ torch::Tensor data;
18
+ int64_t current;
19
+ };
20
+
21
+ } // namespace detail
22
+
23
+ // For Decoding: enables users to pass in the entire video or audio as bytes.
24
+ // Our read and seek functions then traverse the bytes in memory.
25
+ class AVIOFromTensorContext : public AVIOContextHolder {
26
+ public:
27
+ explicit AVIOFromTensorContext(torch::Tensor data);
28
+
29
+ private:
30
+ detail::TensorContext tensorContext_;
31
+ };
32
+
33
+ // For Encoding: used to encode into an output uint8 (bytes) tensor.
34
+ class AVIOToTensorContext : public AVIOContextHolder {
35
+ public:
36
+ explicit AVIOToTensorContext();
37
+ torch::Tensor getOutputTensor();
38
+
39
+ private:
40
+ detail::TensorContext tensorContext_;
41
+ };
42
+
43
+ } // namespace facebook::torchcodec