Skip to content

Commit 9ee45b4

Browse files
committed
Fix build after FF_INPUT_BUFFER_PADDING_SIZE/AV_CODEC_FLAG_GLOBAL_HEADER were removed
1 parent 3f57937 commit 9ee45b4

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

StMoviePlayer/StVideo/StVideoQueue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ bool StVideoQueue::init(AVFormatContext* theFormatCtx,
309309
&& (getCodedSizeY() == 1080 || getCodedSizeY() == 1088);
310310
#if(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 0, 0))
311311
if(is720in1080) {
312-
myCodecCtx->flags2 |= CODEC_FLAG2_IGNORE_CROP;
312+
myCodecCtx->flags2 |= AV_CODEC_FLAG2_IGNORE_CROP;
313313
}
314314
#endif
315315

StShared/StAVIOContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace {
4848
StAVIOContext::StAVIOContext()
4949
: myAvioCtx(NULL) {
5050
const int aBufferSize = 32768;
51-
unsigned char* aBufferIO = (unsigned char* )av_malloc(aBufferSize + FF_INPUT_BUFFER_PADDING_SIZE);
51+
unsigned char* aBufferIO = (unsigned char* )av_malloc(aBufferSize + AV_INPUT_BUFFER_PADDING_SIZE);
5252
myAvioCtx = avio_alloc_context(aBufferIO, aBufferSize, 0, this, readCallback, writeCallback, seekCallback);
5353
}
5454

StShared/StAVPacket.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ void StAVPacket::setAVpkt(const AVPacket& theCopy) {
108108
#endif
109109

110110
// now copy data with special padding space
111-
myPacket.data = stMemAllocAligned<uint8_t*>((theCopy.size + FF_INPUT_BUFFER_PADDING_SIZE), 16); // data must be aligned to 16 bytes for SSE!
111+
myPacket.data = stMemAllocAligned<uint8_t*>((theCopy.size + AV_INPUT_BUFFER_PADDING_SIZE), 16); // data must be aligned to 16 bytes for SSE!
112112
stMemCpy (myPacket.data, theCopy.data, theCopy.size);
113-
stMemZero(myPacket.data + (ptrdiff_t )theCopy.size, FF_INPUT_BUFFER_PADDING_SIZE);
113+
stMemZero(myPacket.data + (ptrdiff_t )theCopy.size, AV_INPUT_BUFFER_PADDING_SIZE);
114114

115115
#if(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 118, 0))
116116
if(myPacket.side_data_elems > 0) {
@@ -121,9 +121,9 @@ void StAVPacket::setAVpkt(const AVPacket& theCopy) {
121121
for(int anIter = 0; anIter < theCopy.side_data_elems; ++anIter) {
122122
aSize = theCopy.side_data[anIter].size;
123123
myPacket.side_data[anIter] = theCopy.side_data[anIter];
124-
myPacket.side_data[anIter].data = stMemAllocAligned<uint8_t*>(aSize + FF_INPUT_BUFFER_PADDING_SIZE, 16);
124+
myPacket.side_data[anIter].data = stMemAllocAligned<uint8_t*>(aSize + AV_INPUT_BUFFER_PADDING_SIZE, 16);
125125
stMemCpy (myPacket.side_data[anIter].data, theCopy.side_data[anIter].data, aSize);
126-
stMemZero(myPacket.side_data[anIter].data + (ptrdiff_t )aSize, FF_INPUT_BUFFER_PADDING_SIZE);
126+
stMemZero(myPacket.side_data[anIter].data + (ptrdiff_t )aSize, AV_INPUT_BUFFER_PADDING_SIZE);
127127
}
128128
}
129129
#endif

StShared/StAVVideoMuxer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ bool StAVVideoMuxer::addStream(AVFormatContext* theContext,
219219
}
220220

221221
if(theContext->oformat->flags & AVFMT_GLOBALHEADER) {
222-
aCodecCtxNew->flags |= CODEC_FLAG_GLOBAL_HEADER;
222+
aCodecCtxNew->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
223223
}
224224
return true;
225225
}

include/StAV/stAV.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ extern "C" {
4949
#define AV_NUM_DATA_POINTERS 4
5050
#endif
5151

52+
// Compatibility with older FFmpeg (API change since 2015-07-27 - lavc 56.56.100 / 56.35.0)
53+
#ifndef AV_INPUT_BUFFER_PADDING_SIZE
54+
#define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
55+
#endif
56+
#ifndef AV_CODEC_FLAG_GLOBAL_HEADER
57+
#define AV_CODEC_FLAG_GLOBAL_HEADER CODEC_FLAG_GLOBAL_HEADER
58+
#endif
59+
#ifndef AV_CODEC_FLAG2_IGNORE_CROP
60+
#define AV_CODEC_FLAG2_IGNORE_CROP CODEC_FLAG2_IGNORE_CROP
61+
#endif
62+
5263
#ifdef _MSC_VER
5364
#pragma warning(default : 4244)
5465
#endif

0 commit comments

Comments
 (0)