mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-24 05:49:58 +00:00
Merge pull request #8651 from unknownbrackets/android-clang
Switch Android build to using clang (needs buildbot update)
This commit is contained in:
commit
a1e815e356
13
.travis.sh
13
.travis.sh
@ -2,7 +2,7 @@
|
||||
|
||||
export USE_CCACHE=1
|
||||
export NDK_CCACHE=ccache
|
||||
NDK_VER=android-ndk-r10d
|
||||
NDK_VER=android-ndk-r12b
|
||||
|
||||
download_extract() {
|
||||
aria2c -x 16 $1 -o $2
|
||||
@ -10,17 +10,12 @@ download_extract() {
|
||||
}
|
||||
|
||||
# This is used for the Android NDK.
|
||||
download_extract_xz() {
|
||||
download_extract_zip() {
|
||||
aria2c --file-allocation=none --timeout=120 --retry-wait=5 --max-tries=20 -Z -c $1 -o $2
|
||||
stat -c 'ATTEMPT 1 - %s' $2
|
||||
md5sum $2
|
||||
# This resumes the download, in case it failed.
|
||||
aria2c --file-allocation=none --timeout=120 --retry-wait=5 --max-tries=20 -Z -c $1 -o $2
|
||||
stat -c 'ATTEMPT 2 - %s' $2
|
||||
md5sum $2
|
||||
|
||||
# Keep some output going during the extract, so the build doesn't timeout.
|
||||
pv $2 | xz -vd | tar -x
|
||||
unzip $2 2>&1 | pv > /dev/null
|
||||
}
|
||||
|
||||
travis_before_install() {
|
||||
@ -73,7 +68,7 @@ travis_install() {
|
||||
if [ "$PPSSPP_BUILD_TYPE" = "Android" ]; then
|
||||
free -m
|
||||
sudo apt-get install ant -qq
|
||||
download_extract_xz http://hdkr.co/${NDK_VER}-x86_64.tar.xz ${NDK_VER}-x86_64.tar.xz
|
||||
download_extract_zip http://dl.google.com/android/repository/${NDK_VER}-linux-x86_64.zip ${NDK_VER}-linux-x86_64.zip
|
||||
fi
|
||||
|
||||
# Blackberry NDK: 10.3.0.440 + GCC: 4.8.2
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <android/native_window.h>
|
||||
#include "Common/Log.h"
|
||||
#include "Common/GL/GLInterface/EGLAndroid.h"
|
||||
|
||||
|
@ -457,9 +457,13 @@ struct Atrac {
|
||||
avcodec_close(codecCtx_);
|
||||
av_freep(&codecCtx_);
|
||||
#endif
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
||||
av_packet_free(&packet_);
|
||||
#else
|
||||
av_free_packet(packet_);
|
||||
delete packet_;
|
||||
packet_ = nullptr;
|
||||
#endif
|
||||
}
|
||||
#endif // USE_FFMPEG
|
||||
|
||||
@ -552,7 +556,11 @@ struct Atrac {
|
||||
|
||||
int got_frame = 0;
|
||||
int bytes_read = avcodec_decode_audio4(codecCtx_, frame_, &got_frame, packet_);
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
||||
av_packet_unref(packet_);
|
||||
#else
|
||||
av_free_packet(packet_);
|
||||
#endif
|
||||
if (bytes_read == AVERROR_PATCHWELCOME) {
|
||||
ERROR_LOG(ME, "Unsupported feature in ATRAC audio.");
|
||||
// Let's try the next packet.
|
||||
@ -1836,10 +1844,14 @@ int __AtracSetContext(Atrac *atrac) {
|
||||
|
||||
// alloc audio frame
|
||||
atrac->frame_ = av_frame_alloc();
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
||||
atrac->packet_ = av_packet_alloc();
|
||||
#else
|
||||
atrac->packet_ = new AVPacket;
|
||||
av_init_packet(atrac->packet_);
|
||||
atrac->packet_->data = nullptr;
|
||||
atrac->packet_->size = 0;
|
||||
#endif
|
||||
// reinit decodePos, because ffmpeg had changed it.
|
||||
atrac->decodePos_ = 0;
|
||||
#endif
|
||||
|
@ -99,6 +99,7 @@ static bool pmp_oldStateLoaded = false; // for dostate
|
||||
|
||||
extern "C" {
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libswscale/swscale.h"
|
||||
}
|
||||
static AVPixelFormat pmp_want_pix_fmt;
|
||||
@ -801,7 +802,11 @@ static bool InitPmp(MpegContext * ctx){
|
||||
}
|
||||
|
||||
// get RGBA picture buffer
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
||||
mediaengine->m_bufSize = av_image_get_buffer_size(pmp_want_pix_fmt, pmp_CodecCtx->width, pmp_CodecCtx->height, 1);
|
||||
#else
|
||||
mediaengine->m_bufSize = avpicture_get_size(pmp_want_pix_fmt, pmp_CodecCtx->width, pmp_CodecCtx->height);
|
||||
#endif
|
||||
mediaengine->m_buffer = (u8*)av_malloc(mediaengine->m_bufSize);
|
||||
|
||||
return true;
|
||||
@ -947,7 +952,12 @@ static bool decodePmpVideo(PSPPointer<SceMpegRingBuffer> ringbuffer, u32 pmpctxA
|
||||
av_frame_unref(pFrameRGB);
|
||||
|
||||
// hook pFrameRGB output to buffer
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
||||
av_image_fill_arrays(pFrameRGB->data, pFrameRGB->linesize, mediaengine->m_buffer, pmp_want_pix_fmt, pCodecCtx->width, pCodecCtx->height, 1);
|
||||
#else
|
||||
avpicture_fill((AVPicture *)pFrameRGB, mediaengine->m_buffer, pmp_want_pix_fmt, pCodecCtx->width, pCodecCtx->height);
|
||||
#endif
|
||||
|
||||
|
||||
// decode video frame
|
||||
int len = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, &packet);
|
||||
@ -992,7 +1002,11 @@ static bool decodePmpVideo(PSPPointer<SceMpegRingBuffer> ringbuffer, u32 pmpctxA
|
||||
// SaveFrame(pNewFrameRGB, pCodecCtx->width, pCodecCtx->height);
|
||||
}
|
||||
// free some pointers
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
||||
av_packet_unref(&packet);
|
||||
#else
|
||||
av_free_packet(&packet);
|
||||
#endif
|
||||
pmpframes->~H264Frames();
|
||||
// must reset pmp_VideoSource address to zero after decoding.
|
||||
pmp_videoSource = 0;
|
||||
|
@ -34,6 +34,7 @@ extern "C" {
|
||||
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libswscale/swscale.h"
|
||||
|
||||
}
|
||||
@ -449,11 +450,19 @@ bool MediaEngine::setVideoDim(int width, int height)
|
||||
|
||||
// Allocate video frame for RGB24
|
||||
m_pFrameRGB = av_frame_alloc();
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
||||
int numBytes = av_image_get_buffer_size((AVPixelFormat)m_sws_fmt, m_desWidth, m_desHeight, 1);
|
||||
#else
|
||||
int numBytes = avpicture_get_size((AVPixelFormat)m_sws_fmt, m_desWidth, m_desHeight);
|
||||
#endif
|
||||
m_buffer = (u8*)av_malloc(numBytes * sizeof(uint8_t));
|
||||
|
||||
// Assign appropriate parts of buffer to image planes in m_pFrameRGB
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
||||
av_image_fill_arrays(m_pFrameRGB->data, m_pFrameRGB->linesize, m_buffer, (AVPixelFormat)m_sws_fmt, m_desWidth, m_desHeight, 1);
|
||||
#else
|
||||
avpicture_fill((AVPicture *)m_pFrameRGB, m_buffer, (AVPixelFormat)m_sws_fmt, m_desWidth, m_desHeight);
|
||||
#endif
|
||||
#endif // USE_FFMPEG
|
||||
return true;
|
||||
}
|
||||
@ -522,8 +531,13 @@ bool MediaEngine::stepVideo(int videoPixelMode, bool skipFrame) {
|
||||
// Still need to decode those, so keep calling avcodec_decode_video2().
|
||||
if (dataEnd || packet.stream_index == m_videoStream) {
|
||||
// avcodec_decode_video2() gives us the re-ordered frames with a NULL packet.
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
||||
if (dataEnd)
|
||||
av_packet_unref(&packet);
|
||||
#else
|
||||
if (dataEnd)
|
||||
av_free_packet(&packet);
|
||||
#endif
|
||||
|
||||
int result = avcodec_decode_video2(m_pCodecCtx, m_pFrame, &frameFinished, &packet);
|
||||
if (frameFinished) {
|
||||
@ -547,7 +561,11 @@ bool MediaEngine::stepVideo(int videoPixelMode, bool skipFrame) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
||||
av_packet_unref(&packet);
|
||||
#else
|
||||
av_free_packet(&packet);
|
||||
#endif
|
||||
}
|
||||
return bGetFrame;
|
||||
#else
|
||||
|
@ -186,12 +186,16 @@ bool SimpleAudio::Decode(void *inbuf, int inbytes, uint8_t *outbuf, int *outbyte
|
||||
*outbytes = 0;
|
||||
srcPos = 0;
|
||||
int len = avcodec_decode_audio4(codecCtx_, frame_, &got_frame, &packet);
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
||||
av_packet_unref(&packet);
|
||||
#else
|
||||
av_free_packet(&packet);
|
||||
#endif
|
||||
|
||||
if (len < 0) {
|
||||
ERROR_LOG(ME, "Error decoding Audio frame (%i bytes): %i (%08x)", inbytes, len, len);
|
||||
// TODO: cleanup
|
||||
return false;
|
||||
}
|
||||
av_free_packet(&packet);
|
||||
|
||||
// get bytes consumed in source
|
||||
srcPos = len;
|
||||
|
@ -2,4 +2,4 @@ APP_STL := gnustl_static
|
||||
APP_PLATFORM := android-9
|
||||
APP_ABI := arm64-v8a armeabi-v7a x86 x86_64
|
||||
APP_GNUSTL_CPP_FEATURES :=
|
||||
NDK_TOOLCHAIN_VERSION := 4.9
|
||||
NDK_TOOLCHAIN_VERSION := clang
|
||||
|
@ -1,10 +1,10 @@
|
||||
# These are definitions for LOCAL_ variables for PPSSPP.
|
||||
# They are shared between ppsspp_jni (lib for Android app) and ppsspp_headless.
|
||||
|
||||
LOCAL_CFLAGS := -DUSE_FFMPEG -DUSING_GLES2 -DMOBILE_DEVICE -O3 -fsigned-char -Wall -Wno-multichar -Wno-psabi -Wno-unused-variable -fno-strict-aliasing -D__STDC_CONSTANT_MACROS -Wno-format
|
||||
LOCAL_CFLAGS := -DUSE_FFMPEG -DUSING_GLES2 -DMOBILE_DEVICE -O3 -fsigned-char -Wall -Wno-multichar -Wno-unused-variable -fno-strict-aliasing -D__STDC_CONSTANT_MACROS -Wno-format
|
||||
# yes, it's really CPPFLAGS for C++
|
||||
# literal-suffix is generated by Android default code and causes noise.
|
||||
LOCAL_CPPFLAGS := -fno-exceptions -std=gnu++11 -fno-rtti -Wno-reorder -Wno-literal-suffix -Wno-format
|
||||
# deprecated-register is generated by Android default code and causes noise.
|
||||
LOCAL_CPPFLAGS := -fno-exceptions -std=gnu++11 -fno-rtti -Wno-reorder -Wno-format -Wno-deprecated-register
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/../../Common \
|
||||
$(LOCAL_PATH)/../.. \
|
||||
@ -16,7 +16,14 @@ LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := native libzip glslang
|
||||
LOCAL_LDLIBS := -lz -landroid -lGLESv2 -lOpenSLES -lEGL -ldl -llog
|
||||
LOCAL_LDLIBS := -lz -landroid -lGLESv2 -lOpenSLES -lEGL -ldl -llog -latomic
|
||||
ifneq ($(NDK_DEBUG),1)
|
||||
# Prettier stack traces are nice on other platforms.
|
||||
# Maybe we can switch to storing the pre-stripped builds at some point.
|
||||
ifeq ($(TARGET_ARCH_ABI),x86_64)
|
||||
LOCAL_LDFLAGS += -Wl,--gc-sections -Wl,--exclude-libs,ALL
|
||||
endif
|
||||
endif
|
||||
|
||||
# ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
ifeq ($(findstring armeabi-v7a,$(TARGET_ARCH_ABI)),armeabi-v7a)
|
||||
|
@ -59,6 +59,7 @@ typedef void (EGLAPIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (
|
||||
#endif
|
||||
extern PFNGLBLITFRAMEBUFFERNVPROC glBlitFramebufferNV;
|
||||
|
||||
#ifdef IOS
|
||||
extern PFNGLDISCARDFRAMEBUFFEREXTPROC glDiscardFramebufferEXT;
|
||||
extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOES;
|
||||
extern PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOES;
|
||||
@ -70,6 +71,7 @@ extern PFNGLISVERTEXARRAYOESPROC glIsVertexArrayOES;
|
||||
#define glBindVertexArray glBindVertexArrayOES
|
||||
#define glDeleteVertexArrays glDeleteVertexArraysOES
|
||||
#define glIsVertexArray glIsVertexArrayOES
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
2
ffmpeg
2
ffmpeg
@ -1 +1 @@
|
||||
Subproject commit a7cae9c5a5b48e903ae97f4c8afecc82b41eb218
|
||||
Subproject commit b49a12fcafbdd62326556a7587517362a05d2cba
|
Loading…
Reference in New Issue
Block a user