Merge pull request #189 from ferdnyc/rename-rshift

Rename RSHIFT macro
This commit is contained in:
Jonathan Thomas
2019-05-02 13:35:31 -05:00
committed by GitHub
2 changed files with 45 additions and 0 deletions

View File

@@ -117,6 +117,13 @@
#define PIX_FMT_YUV420P AV_PIX_FMT_YUV420P
#endif
// FFmpeg's libavutil/common.h defines an RSHIFT incompatible with Ruby's
// definition in ruby/config.h, so we move it to FF_RSHIFT
#ifdef RSHIFT
#define FF_RSHIFT(a, b) RSHIFT(a, b)
#undef RSHIFT
#endif
#ifdef USE_SW
#define SWR_CONVERT(ctx, out, linesize, out_count, in, linesize2, in_count) \
swr_convert(ctx, out, out_count, (const uint8_t **)in, in_count)

View File

@@ -57,6 +57,14 @@ namespace std {
%{
/* Ruby and FFmpeg define competing RSHIFT macros,
* so we move Ruby's out of the way for now. We'll
* restore it after dealing with FFmpeg's
*/
#ifdef RSHIFT
#define RB_RSHIFT(a, b) RSHIFT(a, b)
#undef RSHIFT
#endif
#include "../../../include/Version.h"
#include "../../../include/ReaderBase.h"
#include "../../../include/WriterBase.h"
@@ -93,6 +101,15 @@ namespace std {
#include "../../../include/ZmqLogger.h"
#include "../../../include/AudioDeviceInfo.h"
/* Move FFmpeg's RSHIFT to FF_RSHIFT, if present */
#ifdef RSHIFT
#define FF_RSHIFT(a, b) RSHIFT(a, b)
#undef RSHIFT
#endif
/* And restore Ruby's RSHIFT, if we captured it */
#ifdef RB_RSHIFT
#define RSHIFT(a, b) RB_RSHIFT(a, b)
#endif
%}
#ifdef USE_BLACKMAGIC
@@ -133,8 +150,29 @@ namespace std {
%include "../../../include/EffectInfo.h"
%include "../../../include/Enums.h"
%include "../../../include/Exceptions.h"
/* Ruby and FFmpeg define competing RSHIFT macros,
* so we move Ruby's out of the way for now. We'll
* restore it after dealing with FFmpeg's
*/
#ifdef RSHIFT
#define RB_RSHIFT(a, b) RSHIFT(a, b)
#undef RSHIFT
#endif
%include "../../../include/FFmpegReader.h"
%include "../../../include/FFmpegWriter.h"
/* Move FFmpeg's RSHIFT to FF_RSHIFT, if present */
#ifdef RSHIFT
#define FF_RSHIFT(a, b) RSHIFT(a, b)
#undef RSHIFT
#endif
/* And restore Ruby's RSHIFT, if we captured it */
#ifdef RB_RSHIFT
#define RSHIFT(a, b) RB_RSHIFT(a, b)
#endif
%include "../../../include/Fraction.h"
%include "../../../include/Frame.h"
%include "../../../include/FrameMapper.h"