* fixes #2729

* don't commit vscode stuff

* Update ffmpeg_utils.h

typo

---------

Co-authored-by: pf <pf@me>
This commit is contained in:
pfeatherstone 2023-02-21 01:01:13 +00:00 committed by GitHub
parent e006bfe5e8
commit dc94754607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ docs/docs/git-logs.xml
docs/docs/python/classes.txt docs/docs/python/classes.txt
docs/docs/python/functions.txt docs/docs/python/functions.txt
docs/docs/python/constants.txt docs/docs/python/constants.txt
**/.vscode

View File

@ -802,7 +802,14 @@ namespace dlib
f->format = h > 0 && w > 0 ? (int)pixfmt : (int)samplefmt; f->format = h > 0 && w > 0 ? (int)pixfmt : (int)samplefmt;
timestamp = timestamp_; timestamp = timestamp_;
int ret = av_frame_get_buffer(f.get(), 0); //use default alignment, which is likely 32 // The ffmpeg documentation recommends you always use align==0.
// However, in ffmpeg 3.2, there is a bug where if you do that, data buffers don't get allocated.
// So workaround is to manually set align==32
// Not ideal, but i've checked the source code in ffmpeg 3.3, 4.4 and 5.0 libavutil/frame.c
// and in every case, if align==0, then align=32
const int align = 32;
const int ret = av_frame_get_buffer(f.get(), align);
if (ret < 0) if (ret < 0)
{ {
f = nullptr; f = nullptr;
@ -1135,7 +1142,7 @@ namespace dlib
f.height(), f.height(),
1); 1);
DLIB_ASSERT(ret == expsize, "av_image_copy_to_buffer() error : " << details::get_av_error(ret)); DLIB_ASSERT(ret == (int)expsize, "av_image_copy_to_buffer() error : " << details::get_av_error(ret));
(void)ret; (void)ret;
} }

View File

@ -63,7 +63,7 @@ try
} }
const std::string filepath = get_option(parser, "i", ""); const std::string filepath = get_option(parser, "i", "");
const std::string codec = get_option(parser, "codec", ""); const std::string codec = get_option(parser, "codec", "h264");
image_window win; image_window win;