-
Notifications
You must be signed in to change notification settings - Fork 39
Support encoding into a bytes tensor #635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7921558
2a19014
73bdc85
54f5543
24842b6
c3ac80a
5b39c8f
1f9f904
f525848
9150137
872b569
a0dcafd
f49d507
ee3a199
485ee2e
27fdbac
8467b92
ee7a217
7b3847f
d85baa2
42c6373
254529f
3f0417c
290c96e
5f42d15
0f415c1
2954c9b
29866fc
9cb31c9
ff6c1e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ namespace facebook::torchcodec { | |
|
||
void AVIOContextHolder::createAVIOContext( | ||
AVIOReadFunction read, | ||
AVIOWriteFunction write, | ||
AVIOSeekFunction seek, | ||
void* heldData, | ||
int bufferSize) { | ||
|
@@ -22,13 +23,17 @@ void AVIOContextHolder::createAVIOContext( | |
buffer != nullptr, | ||
"Failed to allocate buffer of size " + std::to_string(bufferSize)); | ||
|
||
avioContext_.reset(avio_alloc_context( | ||
TORCH_CHECK( | ||
(seek != nullptr) && ((write != nullptr) ^ (read != nullptr)), | ||
"seek method must be defined, and either write or read must be defined. " | ||
"But not both!") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may relax the mutual-exclusivity check above eventually, if we implement both |
||
avioContext_.reset(avioAllocContext( | ||
buffer, | ||
bufferSize, | ||
0, | ||
/*write_flag=*/write != nullptr, | ||
heldData, | ||
read, | ||
nullptr, // write function; not supported yet | ||
write, | ||
seek)); | ||
|
||
if (!avioContext_) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,8 +65,9 @@ function(make_torchcodec_libraries | |
set(decoder_library_name "libtorchcodec_decoder${ffmpeg_major_version}") | ||
set(decoder_sources | ||
AVIOContextHolder.cpp | ||
AVIOBytesContext.cpp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Alternatively, I think we could make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed on not making I think the issue here is that the |
||
FFMPEGCommon.cpp | ||
DeviceInterface.cpp | ||
DeviceInterface.cpp | ||
SingleStreamDecoder.cpp | ||
# TODO: lib name should probably not be "*_decoder*" now that it also | ||
# contains an encoder | ||
|
Uh oh!
There was an error while loading. Please reload this page.