Skip to content
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

Use AV_INPUT_BUFFER_PADDING_SIZE to determine padding size #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/utils/ffmpeg-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ static inline int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
extern "C" {
#endif

#ifndef AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
#endif

#ifndef HAVE_FUN_avcodec_encode_video2
int avcodec_encode_video2 (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/videofilters/ffmpegnowebcam.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef NO_FFMPEG
#include "ffmpeg-priv.h"
#else
#define FF_INPUT_BUFFER_PADDING_SIZE 32
#define AV_INPUT_BUFFER_PADDING_SIZE 32
#endif

#if LIBAVCODEC_VERSION_MAJOR >= 57
Expand Down
8 changes: 6 additions & 2 deletions src/videofilters/nowebcam.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif

#define FF_INPUT_BUFFER_PADDING_SIZE 32
#ifndef NO_FFMPEG
#include "ffmpeg-priv.h"
#else
#define AV_INPUT_BUFFER_PADDING_SIZE 32
#endif

#if LIBAVCODEC_VERSION_MAJOR >= 57

Expand Down Expand Up @@ -130,7 +134,7 @@ static mblk_t *_ms_load_jpeg_as_yuv(const char *jpgpath, MSVideoSize *reqsize) {
ms_error("Cannot load %s", jpgpath);
return NULL;
}
jpgbuf=(uint8_t*)ms_malloc0(statbuf.st_size + FF_INPUT_BUFFER_PADDING_SIZE);
jpgbuf=(uint8_t*)ms_malloc0(statbuf.st_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (jpgbuf == NULL) {
close(fd);
ms_error("Cannot allocate buffer for %s", jpgpath);
Expand Down