├── LICENSE
├── README.txt
├── compile.sh
├── contrib
├── .gitignore
├── compile-contrib.sh
├── tarballs
│ ├── fdk-aac-0.1.4.zip
│ ├── openssl-1.0.2g.tar.gz
│ ├── rtmpdump.tar.gz
│ └── x264.zip
└── vlclibs
│ ├── libanw.10.so
│ ├── libanw.13.so
│ ├── libanw.14.so
│ ├── libanw.18.so
│ ├── libanw.21.so
│ ├── libiomx.10.so
│ ├── libiomx.13.so
│ ├── libiomx.14.so
│ └── libvlcjni.so
└── player-android
├── .classpath
├── .gitignore
├── .project
├── AndroidManifest.xml
├── build.xml
├── compile-player-android.sh
├── ic_launcher-web.png
├── jni
├── Android.mk
├── Application.mk
├── audio_encoder.cpp
├── audio_encoder.h
├── common.cpp
├── common.h
├── config.h
├── flv_muxer.cpp
├── flv_muxer.h
├── jitter_buffer.cpp
├── jitter_buffer.h
├── libfqrtmp_events.cpp
├── libfqrtmp_events.h
├── libfqrtmpjni.cpp
├── libyuv
│ ├── .gitignore
│ ├── AUTHORS
│ ├── Android.mk
│ ├── BUILD.gn
│ ├── CMakeLists.txt
│ ├── DEPS
│ ├── LICENSE
│ ├── LICENSE_THIRD_PARTY
│ ├── OWNERS
│ ├── PATENTS
│ ├── PRESUBMIT.py
│ ├── README.chromium
│ ├── all.gyp
│ ├── chromium
│ │ ├── .gclient
│ │ └── README
│ ├── codereview.settings
│ ├── download_vs_toolchain.py
│ ├── drover.properties
│ ├── gyp_libyuv
│ ├── gyp_libyuv.py
│ ├── include
│ │ ├── libyuv.h
│ │ └── libyuv
│ │ │ ├── basic_types.h
│ │ │ ├── compare.h
│ │ │ ├── compare_row.h
│ │ │ ├── convert.h
│ │ │ ├── convert_argb.h
│ │ │ ├── convert_from.h
│ │ │ ├── convert_from_argb.h
│ │ │ ├── cpu_id.h
│ │ │ ├── mjpeg_decoder.h
│ │ │ ├── planar_functions.h
│ │ │ ├── rotate.h
│ │ │ ├── rotate_argb.h
│ │ │ ├── rotate_row.h
│ │ │ ├── row.h
│ │ │ ├── scale.h
│ │ │ ├── scale_argb.h
│ │ │ ├── scale_row.h
│ │ │ ├── version.h
│ │ │ └── video_common.h
│ ├── libyuv.gyp
│ ├── libyuv.gypi
│ ├── libyuv_nacl.gyp
│ ├── libyuv_test.gyp
│ ├── linux.mk
│ ├── public.mk
│ ├── setup_links.py
│ ├── source
│ │ ├── compare.cc
│ │ ├── compare_common.cc
│ │ ├── compare_gcc.cc
│ │ ├── compare_neon.cc
│ │ ├── compare_neon64.cc
│ │ ├── compare_win.cc
│ │ ├── convert.cc
│ │ ├── convert_argb.cc
│ │ ├── convert_from.cc
│ │ ├── convert_from_argb.cc
│ │ ├── convert_jpeg.cc
│ │ ├── convert_to_argb.cc
│ │ ├── convert_to_i420.cc
│ │ ├── cpu_id.cc
│ │ ├── mjpeg_decoder.cc
│ │ ├── mjpeg_validate.cc
│ │ ├── planar_functions.cc
│ │ ├── rotate.cc
│ │ ├── rotate_any.cc
│ │ ├── rotate_argb.cc
│ │ ├── rotate_common.cc
│ │ ├── rotate_gcc.cc
│ │ ├── rotate_mips.cc
│ │ ├── rotate_neon.cc
│ │ ├── rotate_neon64.cc
│ │ ├── rotate_win.cc
│ │ ├── row_any.cc
│ │ ├── row_common.cc
│ │ ├── row_gcc.cc
│ │ ├── row_mips.cc
│ │ ├── row_neon.cc
│ │ ├── row_neon64.cc
│ │ ├── row_win.cc
│ │ ├── scale.cc
│ │ ├── scale_any.cc
│ │ ├── scale_argb.cc
│ │ ├── scale_common.cc
│ │ ├── scale_gcc.cc
│ │ ├── scale_mips.cc
│ │ ├── scale_neon.cc
│ │ ├── scale_neon64.cc
│ │ ├── scale_win.cc
│ │ └── video_common.cc
│ ├── sync_chromium.py
│ ├── third_party
│ │ └── gflags
│ │ │ ├── BUILD.gn
│ │ │ ├── LICENSE
│ │ │ ├── README.libyuv
│ │ │ └── gflags.gyp
│ ├── tools
│ │ └── valgrind-libyuv
│ │ │ ├── libyuv_tests.bat
│ │ │ ├── libyuv_tests.py
│ │ │ ├── libyuv_tests.sh
│ │ │ ├── memcheck
│ │ │ ├── OWNERS
│ │ │ ├── PRESUBMIT.py
│ │ │ ├── suppressions.txt
│ │ │ ├── suppressions_mac.txt
│ │ │ └── suppressions_win32.txt
│ │ │ └── tsan
│ │ │ ├── OWNERS
│ │ │ ├── PRESUBMIT.py
│ │ │ ├── suppressions.txt
│ │ │ ├── suppressions_mac.txt
│ │ │ └── suppressions_win32.txt
│ ├── unit_test
│ │ ├── basictypes_test.cc
│ │ ├── color_test.cc
│ │ ├── compare_test.cc
│ │ ├── convert_test.cc
│ │ ├── cpu_test.cc
│ │ ├── math_test.cc
│ │ ├── planar_test.cc
│ │ ├── rotate_argb_test.cc
│ │ ├── rotate_test.cc
│ │ ├── scale_argb_test.cc
│ │ ├── scale_test.cc
│ │ ├── testdata
│ │ │ ├── arm_v7.txt
│ │ │ ├── juno.txt
│ │ │ └── tegra3.txt
│ │ ├── unit_test.cc
│ │ ├── unit_test.h
│ │ ├── version_test.cc
│ │ └── video_common_test.cc
│ ├── util
│ │ ├── Makefile
│ │ ├── android
│ │ │ └── test_runner.py
│ │ ├── compare.cc
│ │ ├── convert.cc
│ │ ├── cpuid.c
│ │ ├── psnr.cc
│ │ ├── psnr.h
│ │ ├── psnr_main.cc
│ │ ├── ssim.cc
│ │ └── ssim.h
│ └── winarm.mk
├── native_crash_handler.cpp
├── native_crash_handler.h
├── raw_parser.cpp
├── raw_parser.h
├── rtmp_handler.cpp
├── rtmp_handler.h
├── video_encoder.cpp
├── video_encoder.h
└── xutil
│ ├── get_bits.h
│ ├── xfile.cpp
│ ├── xfile.h
│ ├── xlog.h
│ ├── xmedia.cpp
│ ├── xmedia.h
│ ├── xqueue.h
│ ├── xtype.h
│ ├── xutil.cpp
│ ├── xutil.h
│ └── xutil_macros.h
├── proguard-project.txt
├── project.properties
├── res
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-mdpi
│ ├── bg_camera_pattern.png
│ ├── border_view_finder.9.png
│ ├── ic_launcher.png
│ ├── ic_viewfinder_camera_facing_back.png
│ └── ic_viewfinder_camera_facing_front.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── drawable-xxhdpi
│ └── ic_launcher.png
├── drawable
│ └── camera_background.xml
├── layout
│ ├── info.xml
│ ├── live.xml
│ └── player.xml
├── menu
│ └── main.xml
└── values
│ ├── colors.xml
│ └── strings.xml
└── src
├── com
└── dxyh
│ ├── fqrtmpplayer
│ ├── AudioPlayer.java
│ ├── FQRtmpCrashHandler.java
│ ├── FQRtmpPlayer.java
│ ├── FQRtmpPusher.java
│ ├── IFQRtmp.java
│ ├── MyApplication.java
│ ├── PlayerService.java
│ ├── aidl
│ │ ├── IClientCallback.aidl
│ │ └── IPlayer.aidl
│ ├── camera
│ │ ├── CameraHardwareException.java
│ │ └── CameraHolder.java
│ ├── gui
│ │ ├── MainActivity.java
│ │ ├── PreviewFrameLayout.java
│ │ ├── RotateImageView.java
│ │ └── UiTools.java
│ ├── player
│ │ ├── VLCPlayer.java
│ │ ├── media
│ │ │ └── MediaWrapper.java
│ │ └── util
│ │ │ ├── VLCInstance.java
│ │ │ └── VLCOptions.java
│ └── util
│ │ ├── AndroidDevices.java
│ │ ├── FileUtils.java
│ │ ├── Logcat.java
│ │ ├── Strings.java
│ │ └── Util.java
│ └── libfqrtmp
│ ├── Event.java
│ └── LibFQRtmp.java
└── org
└── videolan
└── libvlc
├── AWindow.java
├── IAWindowNativeHandler.java
├── IVLCVout.java
├── LibVLC.java
├── Media.java
├── MediaDiscoverer.java
├── MediaList.java
├── MediaPlayer.java
├── VLCEvent.java
├── VLCObject.java
└── util
├── AndroidUtil.java
├── Extensions.java
├── HWDecoderUtil.java
├── MediaBrowser.java
└── VLCUtil.java
/README.txt:
--------------------------------------------------------------------------------
1 | README for the fqrtmpplayer
2 | ===============================
3 | This is a player as well as a tool for Android rtmp live streaming.
4 | You can broadcast the world in landscape mode.
5 | Compile it on a Linux operating system.
6 |
7 | Compile
8 | ====================
9 | export ANDROID_NDK=/opt/android-ndk-r10c/
10 | export ANDROID_SDK=/opt/android-sdks/
11 | ./compile.sh
12 |
13 | Run
14 | ====================
15 | adb install -r player-android/bin/FQRtmpPlayer-debug.apk
16 | Click "Menu" to choose "Play" or "Live".
17 |
18 | Other
19 | ====================
20 | Any bugs or questions please feel free to let me know.
21 | mail: dengxiayehu@yeah.net
22 |
--------------------------------------------------------------------------------
/compile.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 | # compile.sh
3 |
4 | if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then
5 | echo "You must define ANDROID_NDK, ANDROID_SDK before starting."
6 | echo "They must point to your NDK and SDK directories."
7 | exit 1
8 | fi
9 |
10 | if [ -z "$MKFLAGS" ]; then
11 | UNAMES=$(uname -s)
12 | MKFLAGS=
13 | if which nproc >/dev/null; then
14 | export MKFLAGS=-j`nproc`
15 | elif [ "$UNAMES" == "Darwin" ] && which sysctl >/dev/null; then
16 | export MKFLAGS=-j`sysctl -n machdep.cpu.thread_count`
17 | fi
18 | fi
19 |
20 | bash contrib/compile-contrib.sh
21 | bash player-android/compile-player-android.sh
22 |
--------------------------------------------------------------------------------
/contrib/.gitignore:
--------------------------------------------------------------------------------
1 | contrib-arm-linux-androideabi
2 | install
3 | toolchain
4 |
--------------------------------------------------------------------------------
/contrib/tarballs/fdk-aac-0.1.4.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/tarballs/fdk-aac-0.1.4.zip
--------------------------------------------------------------------------------
/contrib/tarballs/openssl-1.0.2g.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/tarballs/openssl-1.0.2g.tar.gz
--------------------------------------------------------------------------------
/contrib/tarballs/rtmpdump.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/tarballs/rtmpdump.tar.gz
--------------------------------------------------------------------------------
/contrib/tarballs/x264.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/tarballs/x264.zip
--------------------------------------------------------------------------------
/contrib/vlclibs/libanw.10.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/vlclibs/libanw.10.so
--------------------------------------------------------------------------------
/contrib/vlclibs/libanw.13.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/vlclibs/libanw.13.so
--------------------------------------------------------------------------------
/contrib/vlclibs/libanw.14.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/vlclibs/libanw.14.so
--------------------------------------------------------------------------------
/contrib/vlclibs/libanw.18.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/vlclibs/libanw.18.so
--------------------------------------------------------------------------------
/contrib/vlclibs/libanw.21.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/vlclibs/libanw.21.so
--------------------------------------------------------------------------------
/contrib/vlclibs/libiomx.10.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/vlclibs/libiomx.10.so
--------------------------------------------------------------------------------
/contrib/vlclibs/libiomx.13.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/vlclibs/libiomx.13.so
--------------------------------------------------------------------------------
/contrib/vlclibs/libiomx.14.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/vlclibs/libiomx.14.so
--------------------------------------------------------------------------------
/contrib/vlclibs/libvlcjni.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/contrib/vlclibs/libvlcjni.so
--------------------------------------------------------------------------------
/player-android/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/player-android/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | gen
3 | libs
4 | obj
5 |
--------------------------------------------------------------------------------
/player-android/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | FQRtmpPlayer
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/player-android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
30 |
39 |
40 |
41 |
42 |
43 |
44 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/player-android/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
24 |
25 |
26 |
30 |
31 |
32 |
33 |
34 |
35 |
44 |
45 |
46 |
47 |
51 |
52 |
64 |
65 |
66 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/player-android/compile-player-android.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 | # compile-player-android.sh
3 |
4 | ABS_DIR="$(cd "$(dirname "$0")"; pwd)"
5 | cd "$ABS_DIR"
6 |
7 | "$ANDROID_NDK"/ndk-build NDK_DEBUG=1 V=1
8 |
9 | ant debug
10 |
--------------------------------------------------------------------------------
/player-android/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/player-android/ic_launcher-web.png
--------------------------------------------------------------------------------
/player-android/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_MODULE := rtmp
5 |
6 | LOCAL_SRC_FILES := ../../contrib/install/lib/librtmp.so
7 | include $(PREBUILT_SHARED_LIBRARY)
8 | ###################################
9 | include $(CLEAR_VARS)
10 |
11 | LOCAL_MODULE := fdk-aac
12 |
13 | LOCAL_SRC_FILES := ../../contrib/install/lib/libfdk-aac.a
14 | include $(PREBUILT_STATIC_LIBRARY)
15 | ###################################
16 | include $(CLEAR_VARS)
17 |
18 | LOCAL_MODULE := x264
19 |
20 | LOCAL_SRC_FILES := ../../contrib/install/lib/libx264.a
21 | include $(PREBUILT_STATIC_LIBRARY)
22 | ###################################
23 | include $(CLEAR_VARS)
24 |
25 | LOCAL_MODULE := anw.10
26 |
27 | LOCAL_SRC_FILES := ../../contrib/vlclibs/libanw.10.so
28 | include $(PREBUILT_SHARED_LIBRARY)
29 | ###################################
30 | include $(CLEAR_VARS)
31 |
32 | LOCAL_MODULE := anw.13
33 |
34 | LOCAL_SRC_FILES := ../../contrib/vlclibs/libanw.13.so
35 | include $(PREBUILT_SHARED_LIBRARY)
36 | ###################################
37 | include $(CLEAR_VARS)
38 |
39 | LOCAL_MODULE := anw.14
40 |
41 | LOCAL_SRC_FILES := ../../contrib/vlclibs/libanw.14.so
42 | include $(PREBUILT_SHARED_LIBRARY)
43 | ###################################
44 | include $(CLEAR_VARS)
45 |
46 | LOCAL_MODULE := anw.18
47 |
48 | LOCAL_SRC_FILES := ../../contrib/vlclibs/libanw.18.so
49 | include $(PREBUILT_SHARED_LIBRARY)
50 | ###################################
51 | include $(CLEAR_VARS)
52 |
53 | LOCAL_MODULE := anw.21
54 |
55 | LOCAL_SRC_FILES := ../../contrib/vlclibs/libanw.21.so
56 | include $(PREBUILT_SHARED_LIBRARY)
57 | ###################################
58 | include $(CLEAR_VARS)
59 |
60 | LOCAL_MODULE := iomx.10
61 |
62 | LOCAL_SRC_FILES := ../../contrib/vlclibs/libiomx.10.so
63 | include $(PREBUILT_SHARED_LIBRARY)
64 | ###################################
65 | include $(CLEAR_VARS)
66 |
67 | LOCAL_MODULE := iomx.13
68 |
69 | LOCAL_SRC_FILES := ../../contrib/vlclibs/libiomx.13.so
70 | include $(PREBUILT_SHARED_LIBRARY)
71 | ###################################
72 | include $(CLEAR_VARS)
73 |
74 | LOCAL_MODULE := iomx.14
75 |
76 | LOCAL_SRC_FILES := ../../contrib/vlclibs/libiomx.14.so
77 | include $(PREBUILT_SHARED_LIBRARY)
78 | ###################################
79 | include $(CLEAR_VARS)
80 |
81 | LOCAL_MODULE := vlcjni
82 |
83 | LOCAL_SRC_FILES := ../../contrib/vlclibs/libvlcjni.so
84 | include $(PREBUILT_SHARED_LIBRARY)
85 | ###################################
86 | include $(CLEAR_VARS)
87 |
88 | CONTRIB_INSTALL := $(LOCAL_PATH)/../../contrib/install
89 | PRIVATE_INCDIR := $(CONTRIB_INSTALL)/include
90 |
91 | LOCAL_MODULE := libfqrtmpjni
92 |
93 | LOCAL_SRC_FILES := libfqrtmpjni.cpp \
94 | native_crash_handler.cpp \
95 | libfqrtmp_events.cpp \
96 | audio_encoder.cpp \
97 | video_encoder.cpp \
98 | rtmp_handler.cpp \
99 | raw_parser.cpp \
100 | common.cpp \
101 | jitter_buffer.cpp \
102 | flv_muxer.cpp \
103 | xutil/xfile.cpp \
104 | xutil/xutil.cpp \
105 | xutil/xmedia.cpp
106 |
107 | LOCAL_C_INCLUDES := $(PRIVATE_INCDIR) $(LOCAL_PATH)/xutil $(LOCAL_PATH)/libyuv/include
108 | LOCAL_CFLAGS := -Wall
109 | LOCAL_LDLIBS := -llog
110 | LOCAL_SHARED_LIBRARIES := rtmp
111 | LOCAL_STATIC_LIBRARIES := fdk-aac x264 libyuv_static
112 | include $(BUILD_SHARED_LIBRARY)
113 | ####################################
114 | include $(call all-makefiles-under,$(LOCAL_PATH))
115 |
--------------------------------------------------------------------------------
/player-android/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_PLATFORM:=android-11
2 |
3 | NDK_TOOLCHAIN_VERSION = 4.8
4 |
5 | APP_STL := stlport_static
6 |
--------------------------------------------------------------------------------
/player-android/jni/audio_encoder.h:
--------------------------------------------------------------------------------
1 | #ifndef _AUDIO_ENCODER_H_
2 | #define _AUDIO_ENCODER_H_
3 |
4 | #include
5 | #include
6 |
7 | #include "xutil.h"
8 | #include "xfile.h"
9 |
10 | #ifdef __cplusplus
11 | extern "C" {
12 | #endif
13 |
14 | class AudioEncoder {
15 | public:
16 | AudioEncoder();
17 | ~AudioEncoder();
18 |
19 | int init(jobject audio_config);
20 | int feed(uint8_t *buffer, int len);
21 | volatile bool quit() const;
22 |
23 | private:
24 | DISALLOW_COPY_AND_ASSIGN(AudioEncoder);
25 | xutil::Frac m_pts;
26 | HANDLE_AACENCODER m_hdlr;
27 | AACENC_InfoStruct m_info;
28 | int m_aot;
29 | int m_samplerate;
30 | int m_channels;
31 | int m_bits_per_sample;
32 | xutil::RecursiveMutex m_mutex;
33 | xutil::Condition m_cond;
34 | DECL_THREAD_ROUTINE(AudioEncoder, encode_routine);
35 | xutil::Thread *m_thrd;
36 | xutil::IOBuffer *m_iobuf;
37 | volatile bool m_quit;
38 | xfile::File *m_file;
39 | };
40 |
41 | jint openAudioEncoder(JNIEnv *env, jobject, jobject);
42 | jint closeAudioEncoder(JNIEnv *env, jobject);
43 | jint sendRawAudio(JNIEnv *env, jobject thiz, jbyteArray byte_arr, jint len);
44 |
45 | #ifdef __cplusplus
46 | }
47 | #endif
48 | #endif /* end of _AUDIO_ENCODER_H_ */
49 |
--------------------------------------------------------------------------------
/player-android/jni/common.h:
--------------------------------------------------------------------------------
1 | #ifndef _COMMON_H_
2 | #define _COMMON_H_
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | #include "xtype.h"
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 | struct Rational {
21 | int num;
22 | int den;
23 | };
24 |
25 | struct Packet {
26 | uint8_t *data;
27 | int size;
28 | uint64_t pts, dts;
29 |
30 | Packet();
31 | Packet(uint8_t *data_, int size_, uint64_t pts_, uint64_t dts_);
32 | virtual ~Packet();
33 | };
34 |
35 | typedef std::pair NaluItem;
36 | typedef struct Nalu {
37 | std::vector *dat;
38 | } Nalu;
39 |
40 | enum RTMPChannel {
41 | RTMP_NETWORK_CHANNEL = 2,
42 | RTMP_SYSTEM_CHANNEL,
43 | RTMP_AUDIO_CHANNEL,
44 | RTMP_VIDEO_CHANNEL = 6,
45 | RTMP_SOURCE_CHANNEL = 8,
46 | };
47 |
48 | class AudioEncoder;
49 | class VideoEncoder;
50 | class RtmpHandler;
51 |
52 | struct LibFQRtmp {
53 | jclass clazz;
54 | jobject weak_thiz;
55 | struct {
56 | jclass clazz;
57 | } IllegalArgumentException;
58 | struct {
59 | jclass clazz;
60 | } String;
61 | jmethodID onNativeCrashID;
62 | jmethodID dispatchEventFromNativeID;
63 | AudioEncoder *audio_enc;
64 | VideoEncoder *video_enc;
65 | RtmpHandler *rtmp_hdlr;
66 | };
67 |
68 | extern struct LibFQRtmp gfq;
69 |
70 | jstring jnu_new_string(const char *str);
71 |
72 | static inline void throw_IllegalArgumentException(JNIEnv *env, const char *error)
73 | {
74 | env->ThrowNew(gfq.IllegalArgumentException.clazz, error);
75 | }
76 |
77 | jvalue jnu_get_field_by_name(jboolean *has_exception, jobject obj,
78 | const char *name, const char *signature);
79 | void jnu_set_field_by_name(jboolean *hasException, jobject obj,
80 | const char *name, const char *signature, ...);
81 | jvalue jnu_call_method_by_name(jboolean *has_exception, jobject obj,
82 | const char *name, const char *signature, ...);
83 | jvalue jnu_call_method_by_name_v(jboolean *has_exception, jobject obj,
84 | const char *name, const char *signature, va_list args);
85 |
86 | void rtmp_log(int level, const char *fmt, va_list args);
87 |
88 | #ifdef __cplusplus
89 | }
90 | #endif
91 | #endif /* end of _COMMON_H_ */
92 |
--------------------------------------------------------------------------------
/player-android/jni/config.h:
--------------------------------------------------------------------------------
1 | #ifndef _CONFIG_H_
2 | #define _CONFIG_H_
3 |
4 | #define VERSION_MESSAGE "0.1"
5 |
6 | #define SOCK_TIMEOUT 30 // In seconds
7 | #define RTMP_LOGLEVEL RTMP_LOGDEBUG
8 | #define RTMP_DEF_BUFTIME (10*60*60*1000) // 10 hours default
9 | #define RTMP_MAX_PLAY_BUFSIZE (10*1024*1024) // 10M
10 |
11 | #define NEW_STREAM_TIMESTAMP_THESHO 300
12 |
13 | #endif /* end of _CONFIG_H_ */
14 |
--------------------------------------------------------------------------------
/player-android/jni/flv_muxer.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "flv_muxer.h"
4 |
5 | using namespace xutil;
6 |
7 | FLVMuxer::FLVMuxer() :
8 | m_file(NULL), m_tm_offset(-1)
9 | {
10 | m_file = new xfile::File;
11 | }
12 |
13 | FLVMuxer::~FLVMuxer()
14 | {
15 | SAFE_DELETE(m_file);
16 | }
17 |
18 | int FLVMuxer::set_file(const std::string &flvpath)
19 | {
20 | if (!m_file->open(flvpath, "wb"))
21 | return -1;
22 |
23 | m_file->write_string("FLV");
24 | m_file->writeui8(1);
25 | m_file->writeui8(0x04 + 0x01);
26 | m_file->writeui32(0x09, true);
27 | m_file->writeui32(0x0);
28 | return 0;
29 | }
30 |
31 | bool FLVMuxer::is_opened() const
32 | {
33 | return m_file && m_file->is_opened();
34 | }
35 |
36 | const char *FLVMuxer::get_path() const
37 | {
38 | if (is_opened()) {
39 | return m_file->get_path();
40 | }
41 | return "";
42 | }
43 |
44 | int FLVMuxer::write_tag(int typ, int ts, const uint8_t *buf, int buf_size)
45 | {
46 | if (typ != RTMP_PACKET_TYPE_VIDEO &&
47 | typ != RTMP_PACKET_TYPE_AUDIO &&
48 | typ != RTMP_PACKET_TYPE_INFO)
49 | return 0;
50 |
51 | if (m_tm_offset == -1) {
52 | m_tm_offset = -ts;
53 | }
54 | ts += m_tm_offset;
55 |
56 | m_file->writeui8(typ);
57 | m_file->writeui24(buf_size, true);
58 | m_file->writeui24(ts&0xFFFFFF, true);
59 | m_file->writeui8(ts&0xFF000000);
60 | m_file->writeui24(0, true);
61 | m_file->write_buffer(buf, buf_size);
62 | m_file->writeui32(buf_size+11, true);
63 | return 0;
64 | }
65 |
--------------------------------------------------------------------------------
/player-android/jni/flv_muxer.h:
--------------------------------------------------------------------------------
1 | #ifndef _FLV_MUXER_H_
2 | #define _FLV_MUXER_H_
3 |
4 | #include "xutil.h"
5 | #include "xfile.h"
6 |
7 | class FLVMuxer {
8 | public:
9 | FLVMuxer();
10 | ~FLVMuxer();
11 |
12 | int set_file(const std::string &flvpath);
13 |
14 | bool is_opened() const;
15 |
16 | int write_tag(int typ, int ts, const uint8_t *buf, int buf_size);
17 |
18 | const char *get_path() const;
19 |
20 | private:
21 | xfile::File *m_file;
22 | int m_tm_offset;
23 | };
24 |
25 | #endif /* end of _FLV_MUXER_H_ */
26 |
--------------------------------------------------------------------------------
/player-android/jni/jitter_buffer.h:
--------------------------------------------------------------------------------
1 | #ifndef _JITTER_BUFFER_H_
2 | #define _JITTER_BUFFER_H_
3 |
4 | #include "common.h"
5 |
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 |
10 | struct RtmpPacket : public Packet {
11 | int pkttype;
12 |
13 | RtmpPacket();
14 | RtmpPacket(int pkttype, uint8_t *data_, int size_, uint64_t pts_, uint64_t dts_);
15 | virtual ~RtmpPacket();
16 |
17 | int clone(RtmpPacket *pkt, bool reuse_buffer = false);
18 | };
19 |
20 | struct PacketList {
21 | RtmpPacket pkt;
22 | PacketList *next;
23 | };
24 |
25 | struct PacketCallback {
26 | void *opaque;
27 | bool (*cb) (void *opaque, int pkttype,
28 | uint32_t pts, const byte *buf, uint32_t pktsize);
29 | };
30 |
31 | class JitterBuffer {
32 | public:
33 | JitterBuffer(int max_interleave_delta = 1000);
34 | ~JitterBuffer();
35 |
36 | int add_packet(RtmpPacket *pkt);
37 |
38 | int set_packet_callback(PacketCallback pc);
39 |
40 | private:
41 | int interleave_packet_per_pts(RtmpPacket *out, RtmpPacket *pkt);
42 | int interleave_add_packet(RtmpPacket *pkt,
43 | int (*compare)(JitterBuffer *s, RtmpPacket *, RtmpPacket *));
44 | static int interleave_compare_pts(JitterBuffer *s,
45 | RtmpPacket *next, RtmpPacket *pkt);
46 | PacketList *&locate_last(int pkttype);
47 |
48 | private:
49 | PacketList *m_packet_buffer;
50 | PacketList *m_packet_buffer_end;
51 | uint64_t m_max_interleave_delta;
52 | enum { STREAM_NUM = 2 };
53 | PacketList *m_last_pktl[STREAM_NUM];
54 | PacketCallback m_pc;
55 | volatile bool m_quit;
56 | };
57 |
58 | #ifdef __cplusplus
59 | }
60 | #endif
61 |
62 | #endif /* end of _JITTER_BUFFER_H_ */
63 |
--------------------------------------------------------------------------------
/player-android/jni/libfqrtmp_events.cpp:
--------------------------------------------------------------------------------
1 | #include "libfqrtmp_events.h"
2 | #include "common.h"
3 |
4 | #define THREAD_NAME "libfqrtmp_events"
5 | extern JNIEnv *jni_get_env(const char *name);
6 |
7 | void libfqrtmp_event_send(libfqrtmp_event type, jlong arg1, jstring arg2)
8 | {
9 | JNIEnv *env = NULL;
10 |
11 | if (!(env = jni_get_env(THREAD_NAME)))
12 | return;
13 |
14 | if (!env->IsSameObject(gfq.weak_thiz, NULL)) {
15 | env->CallVoidMethod(gfq.weak_thiz,
16 | gfq.dispatchEventFromNativeID, (jint) type, arg1, arg2);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/player-android/jni/libfqrtmp_events.h:
--------------------------------------------------------------------------------
1 | #ifndef _LIBFQRTMP_EVENTS_H_
2 | #define _LIBFQRTMP_EVENTS_H_
3 |
4 | #include
5 |
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 |
10 | typedef enum {
11 | OPENING,
12 | CONNECTED,
13 | ENCOUNTERED_ERROR,
14 | } libfqrtmp_event;
15 |
16 | void libfqrtmp_event_send(libfqrtmp_event type, jlong arg0, jstring arg2);
17 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 | #endif /* end of _LIBFQRTMP_EVENTS_H_ */
22 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 | .gn
3 | pin-log.txt
4 | /base
5 | /build
6 | /buildtools
7 | /chromium/.gclient.tmp
8 | /chromium/.gclient.tmp_entries
9 | /chromium/.last_sync_chromium
10 | /chromium/src/
11 | /google_apis
12 | /links
13 | /net
14 | /out
15 | /sde-avx-sse-transition-out.txt
16 | /testing
17 | /third_party/android_platform
18 | /third_party/android_testrunner
19 | /third_party/android_tools
20 | /third_party/appurify-python
21 | /third_party/asan
22 | /third_party/ashmem
23 | /third_party/binutils
24 | /third_party/boringssl
25 | /third_party/BUILD.gn
26 | /third_party/clang_format
27 | /third_party/class-dump
28 | /third_party/colorama
29 | /third_party/cygwin
30 | /third_party/directxsdk
31 | /third_party/drmemory
32 | /third_party/expat
33 | /third_party/gaeunit
34 | /third_party/gflags/src
35 | /third_party/icu
36 | /third_party/instrumented_libraries
37 | /third_party/ijar
38 | /third_party/jsoncpp
39 | /third_party/jsr-305
40 | /third_party/junit
41 | /third_party/junit-jar
42 | /third_party/libc++
43 | /third_party/libc++abi
44 | /third_party/libevent
45 | /third_party/libjingle
46 | /third_party/libjpeg
47 | /third_party/libjpeg_turbo
48 | /third_party/libsrtp
49 | /third_party/libvpx_new
50 | /third_party/libxml
51 | /third_party/libudev
52 | /third_party/libyuv
53 | /third_party/llvm
54 | /third_party/llvm-build
55 | /third_party/lss
56 | /third_party/mockito
57 | /third_party/modp_b64
58 | /third_party/nss
59 | /third_party/oauth2
60 | /third_party/ocmock
61 | /third_party/openmax_dl
62 | /third_party/opus
63 | /third_party/proguard
64 | /third_party/protobuf
65 | /third_party/requests
66 | /third_party/robolectric
67 | /third_party/sqlite
68 | /third_party/syzygy
69 | /third_party/usrsctp
70 | /third_party/valgrind
71 | /third_party/WebKit
72 | /third_party/winsdk_samples/src
73 | /third_party/yasm
74 | /third_party/zlib
75 | /tools/android
76 | /tools/clang
77 | /tools/find_depot_tools.py
78 | /tools/generate_library_loader
79 | /tools/gn
80 | /tools/grit
81 | /tools/gyp
82 | /tools/isolate_driver.py
83 | /tools/memory
84 | /tools/protoc_wrapper
85 | /tools/python
86 | /tools/relocation_packer
87 | /tools/sanitizer_options
88 | /tools/swarming_client
89 | /tools/tsan_suppressions
90 | /tools/valgrind
91 | /tools/vim
92 | /tools/win
93 |
94 | # Files generated by CMake build
95 | cmake_install.cmake
96 | CMakeCache.txt
97 | CMakeFiles/
98 | convert
99 | libgtest.a
100 | libyuv.a
101 | libyuv_unittest
102 |
103 | # Files generated by winarm.mk build
104 | libyuv_arm.lib
105 | source/*.o
106 |
107 |
108 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/AUTHORS:
--------------------------------------------------------------------------------
1 | # Names should be added to this file like so:
2 | # Name or Organization
3 |
4 | Google Inc.
5 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/Android.mk:
--------------------------------------------------------------------------------
1 | # This is the Android makefile for libyuv for both platform and NDK.
2 | LOCAL_PATH:= $(call my-dir)
3 |
4 | include $(CLEAR_VARS)
5 |
6 | LOCAL_CPP_EXTENSION := .cc
7 |
8 | LOCAL_SRC_FILES := \
9 | source/compare.cc \
10 | source/compare_common.cc \
11 | source/compare_neon64.cc \
12 | source/compare_gcc.cc \
13 | source/convert.cc \
14 | source/convert_argb.cc \
15 | source/convert_from.cc \
16 | source/convert_from_argb.cc \
17 | source/convert_to_argb.cc \
18 | source/convert_to_i420.cc \
19 | source/cpu_id.cc \
20 | source/planar_functions.cc \
21 | source/rotate.cc \
22 | source/rotate_any.cc \
23 | source/rotate_argb.cc \
24 | source/rotate_common.cc \
25 | source/rotate_mips.cc \
26 | source/rotate_neon64.cc \
27 | source/rotate_gcc.cc \
28 | source/row_any.cc \
29 | source/row_common.cc \
30 | source/row_mips.cc \
31 | source/row_neon64.cc \
32 | source/row_gcc.cc \
33 | source/scale.cc \
34 | source/scale_any.cc \
35 | source/scale_argb.cc \
36 | source/scale_common.cc \
37 | source/scale_mips.cc \
38 | source/scale_neon64.cc \
39 | source/scale_gcc.cc \
40 | source/video_common.cc
41 |
42 | # TODO(fbarchard): Enable mjpeg encoder.
43 | # source/mjpeg_decoder.cc
44 | # source/convert_jpeg.cc
45 | # source/mjpeg_validate.cc
46 |
47 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
48 | LOCAL_CFLAGS += -DLIBYUV_NEON
49 | LOCAL_SRC_FILES += \
50 | source/compare_neon.cc.neon \
51 | source/rotate_neon.cc.neon \
52 | source/row_neon.cc.neon \
53 | source/scale_neon.cc.neon
54 | endif
55 |
56 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
57 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
58 |
59 | LOCAL_MODULE := libyuv_static
60 | LOCAL_MODULE_TAGS := optional
61 |
62 | include $(BUILD_STATIC_LIBRARY)
63 |
64 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/BUILD.gn:
--------------------------------------------------------------------------------
1 | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
2 | #
3 | # Use of this source code is governed by a BSD-style license
4 | # that can be found in the LICENSE file in the root of the source
5 | # tree. An additional intellectual property rights grant can be found
6 | # in the file PATENTS. All contributing project authors may
7 | # be found in the AUTHORS file in the root of the source tree.
8 |
9 | import("//build/config/arm.gni")
10 | import("//build/config/sanitizers/sanitizers.gni")
11 |
12 | config("libyuv_config") {
13 | include_dirs = [
14 | ".",
15 | "include",
16 | ]
17 | }
18 |
19 | use_neon = current_cpu == "arm" && (arm_use_neon || arm_optionally_use_neon)
20 |
21 | source_set("libyuv") {
22 | sources = [
23 | "include/libyuv.h",
24 | "include/libyuv/basic_types.h",
25 | "include/libyuv/compare.h",
26 | "include/libyuv/convert.h",
27 | "include/libyuv/convert_argb.h",
28 | "include/libyuv/convert_from.h",
29 | "include/libyuv/convert_from_argb.h",
30 | "include/libyuv/cpu_id.h",
31 | "include/libyuv/mjpeg_decoder.h",
32 | "include/libyuv/planar_functions.h",
33 | "include/libyuv/rotate.h",
34 | "include/libyuv/rotate_argb.h",
35 | "include/libyuv/rotate_row.h",
36 | "include/libyuv/row.h",
37 | "include/libyuv/scale.h",
38 | "include/libyuv/scale_argb.h",
39 | "include/libyuv/scale_row.h",
40 | "include/libyuv/version.h",
41 | "include/libyuv/video_common.h",
42 |
43 | # sources.
44 | "source/compare.cc",
45 | "source/compare_common.cc",
46 | "source/compare_gcc.cc",
47 | "source/compare_win.cc",
48 | "source/convert.cc",
49 | "source/convert_argb.cc",
50 | "source/convert_from.cc",
51 | "source/convert_from_argb.cc",
52 | "source/convert_jpeg.cc",
53 | "source/convert_to_argb.cc",
54 | "source/convert_to_i420.cc",
55 | "source/cpu_id.cc",
56 | "source/mjpeg_decoder.cc",
57 | "source/mjpeg_validate.cc",
58 | "source/planar_functions.cc",
59 | "source/rotate.cc",
60 | "source/rotate_any.cc",
61 | "source/rotate_argb.cc",
62 | "source/rotate_common.cc",
63 | "source/rotate_mips.cc",
64 | "source/rotate_gcc.cc",
65 | "source/rotate_win.cc",
66 | "source/row_any.cc",
67 | "source/row_common.cc",
68 | "source/row_mips.cc",
69 | "source/row_gcc.cc",
70 | "source/row_win.cc",
71 | "source/scale.cc",
72 | "source/scale_any.cc",
73 | "source/scale_argb.cc",
74 | "source/scale_common.cc",
75 | "source/scale_mips.cc",
76 | "source/scale_gcc.cc",
77 | "source/scale_win.cc",
78 | "source/video_common.cc",
79 | ]
80 |
81 | configs -= [ "//build/config/compiler:chromium_code" ]
82 | configs += [ "//build/config/compiler:no_chromium_code" ]
83 |
84 | public_configs = [ ":libyuv_config" ]
85 |
86 | defines = []
87 |
88 | if (!is_ios) {
89 | defines += [ "HAVE_JPEG" ]
90 | }
91 |
92 | if (is_msan) {
93 | # MemorySanitizer does not support assembly code yet.
94 | # http://crbug.com/344505
95 | defines += [ "LIBYUV_DISABLE_X86" ]
96 | }
97 |
98 | deps = [
99 | "//third_party:jpeg",
100 | ]
101 |
102 | if (use_neon) {
103 | deps += [ ":libyuv_neon" ]
104 | }
105 |
106 | if (is_nacl) {
107 | # Always enable optimization under NaCl to workaround crbug.com/538243 .
108 | configs -= [ "//build/config/compiler:default_optimization" ]
109 | configs += [ "//build/config/compiler:optimize_max" ]
110 | }
111 | }
112 |
113 | if (use_neon) {
114 | static_library("libyuv_neon") {
115 | sources = [
116 | "source/compare_neon.cc",
117 | "source/compare_neon64.cc",
118 | "source/rotate_neon.cc",
119 | "source/rotate_neon64.cc",
120 | "source/row_neon.cc",
121 | "source/row_neon64.cc",
122 | "source/scale_neon.cc",
123 | "source/scale_neon64.cc",
124 | ]
125 |
126 | public_configs = [ ":libyuv_config" ]
127 |
128 | configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
129 | cflags = [ "-mfpu=neon" ]
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/DEPS:
--------------------------------------------------------------------------------
1 | vars = {
2 | # Override root_dir in your .gclient's custom_vars to specify a custom root
3 | # folder name.
4 | 'root_dir': 'libyuv',
5 | 'extra_gyp_flag': '-Dextra_gyp_flag=0',
6 | 'chromium_git': 'https://chromium.googlesource.com',
7 |
8 | # Roll the Chromium Git hash to pick up newer versions of all the
9 | # dependencies and tools linked to in setup_links.py.
10 | 'chromium_revision': 'bb79186c63ff4eff7a2a318a21731005c53f269b',
11 | }
12 |
13 | # NOTE: Prefer revision numbers to tags for svn deps. Use http rather than
14 | # https; the latter can cause problems for users behind proxies.
15 | deps = {
16 | Var('root_dir') + '/third_party/gflags/src':
17 | Var('chromium_git') + '/external/gflags/src@e7390f9185c75f8d902c05ed7d20bb94eb914d0c', # from svn revision 82
18 | }
19 |
20 | # Define rules for which include paths are allowed in our source.
21 | include_rules = [ '+gflags' ]
22 |
23 | hooks = [
24 | {
25 | # Clone chromium and its deps.
26 | 'name': 'sync chromium',
27 | 'pattern': '.',
28 | 'action': ['python', '-u', Var('root_dir') + '/sync_chromium.py',
29 | '--target-revision', Var('chromium_revision')],
30 | },
31 | {
32 | # Create links to shared dependencies in Chromium.
33 | 'name': 'setup_links',
34 | 'pattern': '.',
35 | 'action': ['python', Var('root_dir') + '/setup_links.py'],
36 | },
37 | {
38 | # A change to a .gyp, .gypi, or to GYP itself should run the generator.
39 | 'pattern': '.',
40 | 'action': ['python', Var('root_dir') + '/gyp_libyuv'],
41 | },
42 | ]
43 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2011 The LibYuv Project Authors. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright
11 | notice, this list of conditions and the following disclaimer in
12 | the documentation and/or other materials provided with the
13 | distribution.
14 |
15 | * Neither the name of Google nor the names of its contributors may
16 | be used to endorse or promote products derived from this software
17 | without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/LICENSE_THIRD_PARTY:
--------------------------------------------------------------------------------
1 | This source tree contains third party source code which is governed by third
2 | party licenses. This file contains references to files which are under other
3 | licenses than the one provided in the LICENSE file in the root of the source
4 | tree.
5 |
6 | Files governed by third party licenses:
7 | source/x86inc.asm
8 |
9 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/OWNERS:
--------------------------------------------------------------------------------
1 | fbarchard@chromium.org
2 | mflodman@chromium.org
3 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/PATENTS:
--------------------------------------------------------------------------------
1 | Additional IP Rights Grant (Patents)
2 |
3 | "This implementation" means the copyrightable works distributed by
4 | Google as part of the LibYuv code package.
5 |
6 | Google hereby grants to you a perpetual, worldwide, non-exclusive,
7 | no-charge, irrevocable (except as stated in this section) patent
8 | license to make, have made, use, offer to sell, sell, import,
9 | transfer, and otherwise run, modify and propagate the contents of this
10 | implementation of the LibYuv code package, where such license applies
11 | only to those patent claims, both currently owned by Google and
12 | acquired in the future, licensable by Google that are necessarily
13 | infringed by this implementation of the LibYuv code package. This
14 | grant does not include claims that would be infringed only as a
15 | consequence of further modification of this implementation. If you or
16 | your agent or exclusive licensee institute or order or agree to the
17 | institution of patent litigation against any entity (including a
18 | cross-claim or counterclaim in a lawsuit) alleging that this
19 | implementation of the LibYuv code package or any code incorporated
20 | within this implementation of the LibYuv code package constitutes
21 | direct or contributory patent infringement, or inducement of patent
22 | infringement, then any patent rights granted to you under this License
23 | for this implementation of the LibYuv code package shall terminate as
24 | of the date such litigation is filed.
--------------------------------------------------------------------------------
/player-android/jni/libyuv/PRESUBMIT.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
2 | #
3 | # Use of this source code is governed by a BSD-style license
4 | # that can be found in the LICENSE file in the root of the source
5 | # tree. An additional intellectual property rights grant can be found
6 | # in the file PATENTS. All contributing project authors may
7 | # be found in the AUTHORS file in the root of the source tree.
8 |
9 | import re
10 | import sys
11 |
12 |
13 | def GetDefaultTryConfigs(bots=None):
14 | """Returns a list of ('bot', set(['tests']), optionally filtered by [bots].
15 |
16 | For WebRTC purposes, we always return an empty list of tests, since we want
17 | to run all tests by default on all our trybots.
18 | """
19 | return { 'tryserver.libyuv': dict((bot, []) for bot in bots)}
20 |
21 |
22 | # pylint: disable=W0613
23 | def GetPreferredTryMasters(project, change):
24 | files = change.LocalPaths()
25 | bots = [
26 | 'win',
27 | 'win_rel',
28 | 'win_x64_rel',
29 | 'mac',
30 | 'mac_rel',
31 | 'mac_x64_rel',
32 | 'ios',
33 | 'ios_rel',
34 | 'ios_arm64',
35 | 'ios_arm64_rel',
36 | 'mac_asan',
37 | 'linux',
38 | 'linux_rel',
39 | 'linux_memcheck',
40 | 'linux_tsan2',
41 | 'linux_asan',
42 | 'android',
43 | 'android_rel',
44 | 'android_clang',
45 | 'android_arm64',
46 | ]
47 | if not files or all(re.search(r'[\\/]OWNERS$', f) for f in files):
48 | return {}
49 | return GetDefaultTryConfigs(bots)
50 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/README.chromium:
--------------------------------------------------------------------------------
1 | Name: libyuv
2 | URL: http://code.google.com/p/libyuv/
3 | Version: 1514
4 | License: BSD
5 | License File: LICENSE
6 |
7 | Description:
8 | libyuv is an open source project that includes YUV conversion and scaling functionality.
9 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/all.gyp:
--------------------------------------------------------------------------------
1 | # Copyright 2013 The LibYuv Project Authors. All rights reserved.
2 | #
3 | # Use of this source code is governed by a BSD-style license
4 | # that can be found in the LICENSE file in the root of the source
5 | # tree. An additional intellectual property rights grant can be found
6 | # in the file PATENTS. All contributing project authors may
7 | # be found in the AUTHORS file in the root of the source tree.
8 |
9 | # all.gyp and All target are for benefit of android gyp build.
10 | {
11 | 'targets': [
12 | {
13 | 'target_name': 'All',
14 | 'type': 'none',
15 | 'dependencies': [
16 | 'libyuv.gyp:*',
17 | 'libyuv_test.gyp:*',
18 | ],
19 | },
20 | ],
21 | }
22 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/chromium/.gclient:
--------------------------------------------------------------------------------
1 | solutions = [{
2 | 'name': 'src',
3 | 'url': 'https://chromium.googlesource.com/chromium/src.git',
4 | 'deps_file': '.DEPS.git',
5 | 'managed': False,
6 | 'custom_deps': {
7 | # Skip syncing some large dependencies Libyuv will never need.
8 | 'src/chrome/tools/test/reference_build/chrome_linux': None,
9 | 'src/chrome/tools/test/reference_build/chrome_mac': None,
10 | 'src/chrome/tools/test/reference_build/chrome_win': None,
11 | 'src/native_client': None,
12 | 'src/third_party/ffmpeg': None,
13 | 'src/third_party/WebKit': None,
14 | 'src/v8': None,
15 | },
16 | 'safesync_url': ''
17 | }]
18 |
19 | cache_dir = None
20 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/chromium/README:
--------------------------------------------------------------------------------
1 | This .gclient file is used to do download a copy of Chromium.
2 | Libyuv uses the Chromium build toolchain and a number of shared
3 | dependencies by creating symlinks to folders in this checkout,
4 | using the ../setup_links.py script.
5 |
6 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/codereview.settings:
--------------------------------------------------------------------------------
1 | # This file is used by gcl to get repository specific information.
2 | CODE_REVIEW_SERVER: codereview.chromium.org
3 | #CC_LIST:
4 | VIEW_VC: https://chromium.googlesource.com/libyuv/libyuv/+/
5 | #STATUS:
6 | FORCE_HTTPS_COMMIT_URL: True
7 | PROJECT: libyuv
8 | TRY_ON_UPLOAD: False
9 | TRYSERVER_ROOT: src
10 | TRYSERVER_SVN_URL: svn://svn.chromium.org/chrome-try/try-libyuv
11 | #GITCL_PREUPLOAD:
12 | #GITCL_PREDCOMMIT:
13 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/download_vs_toolchain.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
4 | #
5 | # Use of this source code is governed by a BSD-style license
6 | # that can be found in the LICENSE file in the root of the source
7 | # tree. An additional intellectual property rights grant can be found
8 | # in the file PATENTS. All contributing project authors may
9 | # be found in the AUTHORS file in the root of the source tree.
10 |
11 | # This script is used to run the vs_toolchain.py script to download the
12 | # Visual Studio toolchain. It's just a temporary measure while waiting for the
13 | # Chrome team to move find_depot_tools into src/build to get rid of these
14 | # workarounds (similar one in gyp_libyuv).
15 |
16 | import os
17 | import sys
18 |
19 |
20 | checkout_root = os.path.dirname(os.path.realpath(__file__))
21 | sys.path.insert(0, os.path.join(checkout_root, 'build'))
22 | sys.path.insert(0, os.path.join(checkout_root, 'tools', 'find_depot_tools'))
23 |
24 |
25 | import vs_toolchain
26 |
27 |
28 | if __name__ == '__main__':
29 | sys.exit(vs_toolchain.main())
30 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/drover.properties:
--------------------------------------------------------------------------------
1 | BASE_URL = "https://libyuv.googlecode.com/svn"
2 | TRUNK_URL = BASE_URL + "/trunk"
3 | BRANCH_URL = BASE_URL + "/branches/$branch"
4 | SKIP_CHECK_WORKING = True
5 | FILE_PATTERN = file_pattern_ = r"[ ]+([MADUC])[ ]+/((?:trunk|branches/.*?)(.*)/(.*))"
6 | PROMPT_FOR_AUTHOR = False
7 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/gyp_libyuv:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
4 | #
5 | # Use of this source code is governed by a BSD-style license
6 | # that can be found in the LICENSE file in the root of the source
7 | # tree. An additional intellectual property rights grant can be found
8 | # in the file PATENTS. All contributing project authors may
9 | # be found in the AUTHORS file in the root of the source tree.
10 |
11 | # This script is used to run GYP for libyuv. It contains selected parts of the
12 | # main function from the src/build/gyp_chromium file.
13 |
14 | import glob
15 | import os
16 | import shlex
17 | import sys
18 |
19 | checkout_root = os.path.dirname(os.path.realpath(__file__))
20 |
21 | sys.path.insert(0, os.path.join(checkout_root, 'build'))
22 | import gyp_chromium
23 | import gyp_helper
24 | import vs_toolchain
25 |
26 | sys.path.insert(0, os.path.join(checkout_root, 'tools', 'gyp', 'pylib'))
27 | import gyp
28 |
29 | def GetSupplementalFiles():
30 | """Returns a list of the supplemental files that are included in all GYP
31 | sources."""
32 | # Can't use the one in gyp_chromium since the directory location of the root
33 | # is different.
34 | return glob.glob(os.path.join(checkout_root, '*', 'supplement.gypi'))
35 |
36 |
37 | if __name__ == '__main__':
38 | args = sys.argv[1:]
39 |
40 | # This could give false positives since it doesn't actually do real option
41 | # parsing. Oh well.
42 | gyp_file_specified = False
43 | for arg in args:
44 | if arg.endswith('.gyp'):
45 | gyp_file_specified = True
46 | break
47 |
48 | # If we didn't get a file, assume 'all.gyp' in the root of the checkout.
49 | if not gyp_file_specified:
50 | # Because of a bug in gyp, simply adding the abspath to all.gyp doesn't
51 | # work, but chdir'ing and adding the relative path does. Spooky :/
52 | os.chdir(checkout_root)
53 | args.append('all.gyp')
54 |
55 | # There shouldn't be a circular dependency relationship between .gyp files,
56 | args.append('--no-circular-check')
57 |
58 | # Default to ninja unless GYP_GENERATORS is set.
59 | if not os.environ.get('GYP_GENERATORS'):
60 | os.environ['GYP_GENERATORS'] = 'ninja'
61 |
62 | vs2013_runtime_dll_dirs = None
63 | if int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')):
64 | vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
65 |
66 | # Enforce gyp syntax checking. This adds about 20% execution time.
67 | args.append('--check')
68 |
69 | supplemental_includes = gyp_chromium.GetSupplementalFiles()
70 | gyp_vars_dict = gyp_chromium.GetGypVars(supplemental_includes)
71 |
72 | # Automatically turn on crosscompile support for platforms that need it.
73 | if all(('ninja' in os.environ.get('GYP_GENERATORS', ''),
74 | gyp_vars_dict.get('OS') in ['android', 'ios'],
75 | 'GYP_CROSSCOMPILE' not in os.environ)):
76 | os.environ['GYP_CROSSCOMPILE'] = '1'
77 |
78 | args.extend(['-I' + i for i in
79 | gyp_chromium.additional_include_files(supplemental_includes,
80 | args)])
81 |
82 | # Set the gyp depth variable to the root of the checkout.
83 | args.append('--depth=' + os.path.relpath(checkout_root))
84 |
85 | print 'Updating projects from gyp files...'
86 | sys.stdout.flush()
87 |
88 | # Off we go...
89 | gyp_rc = gyp.main(args)
90 |
91 | if vs2013_runtime_dll_dirs:
92 | x64_runtime, x86_runtime = vs2013_runtime_dll_dirs
93 | vs_toolchain.CopyVsRuntimeDlls(
94 | os.path.join(checkout_root, gyp_chromium.GetOutputDirectory()),
95 | (x86_runtime, x64_runtime))
96 |
97 | sys.exit(gyp_rc)
98 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/gyp_libyuv.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
4 | #
5 | # Use of this source code is governed by a BSD-style license
6 | # that can be found in the LICENSE file in the root of the source
7 | # tree. An additional intellectual property rights grant can be found
8 | # in the file PATENTS. All contributing project authors may
9 | # be found in the AUTHORS file in the root of the source tree.
10 |
11 |
12 | # This script is a modified copy of the src/build/gyp_chromium.py file.
13 | # It is needed for parallel processing.
14 |
15 | # This file is (possibly, depending on python version) imported by
16 | # gyp_libyuv when GYP_PARALLEL=1 and it creates sub-processes
17 | # through the multiprocessing library.
18 |
19 | # Importing in Python 2.6 (fixed in 2.7) on Windows doesn't search for
20 | # imports that don't end in .py (and aren't directories with an
21 | # __init__.py). This wrapper makes "import gyp_libyuv" work with
22 | # those old versions and makes it possible to execute gyp_libyuv.py
23 | # directly on Windows where the extension is useful.
24 |
25 | import os
26 |
27 | path = os.path.abspath(os.path.split(__file__)[0])
28 | execfile(os.path.join(path, 'gyp_libyuv'))
29 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/include/libyuv.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_H_ // NOLINT
12 | #define INCLUDE_LIBYUV_H_
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/compare.h"
16 | #include "libyuv/convert.h"
17 | #include "libyuv/convert_argb.h"
18 | #include "libyuv/convert_from.h"
19 | #include "libyuv/convert_from_argb.h"
20 | #include "libyuv/cpu_id.h"
21 | #include "libyuv/mjpeg_decoder.h"
22 | #include "libyuv/planar_functions.h"
23 | #include "libyuv/rotate.h"
24 | #include "libyuv/rotate_argb.h"
25 | #include "libyuv/row.h"
26 | #include "libyuv/scale.h"
27 | #include "libyuv/scale_argb.h"
28 | #include "libyuv/scale_row.h"
29 | #include "libyuv/version.h"
30 | #include "libyuv/video_common.h"
31 |
32 | #endif // INCLUDE_LIBYUV_H_ NOLINT
33 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/include/libyuv/basic_types.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_BASIC_TYPES_H_ // NOLINT
12 | #define INCLUDE_LIBYUV_BASIC_TYPES_H_
13 |
14 | #include // for NULL, size_t
15 |
16 | #if defined(__ANDROID__) || (defined(_MSC_VER) && (_MSC_VER < 1600))
17 | #include // for uintptr_t on x86
18 | #else
19 | #include // for uintptr_t
20 | #endif
21 |
22 | #ifndef GG_LONGLONG
23 | #ifndef INT_TYPES_DEFINED
24 | #define INT_TYPES_DEFINED
25 | #ifdef COMPILER_MSVC
26 | typedef unsigned __int64 uint64;
27 | typedef __int64 int64;
28 | #ifndef INT64_C
29 | #define INT64_C(x) x ## I64
30 | #endif
31 | #ifndef UINT64_C
32 | #define UINT64_C(x) x ## UI64
33 | #endif
34 | #define INT64_F "I64"
35 | #else // COMPILER_MSVC
36 | #if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
37 | typedef unsigned long uint64; // NOLINT
38 | typedef long int64; // NOLINT
39 | #ifndef INT64_C
40 | #define INT64_C(x) x ## L
41 | #endif
42 | #ifndef UINT64_C
43 | #define UINT64_C(x) x ## UL
44 | #endif
45 | #define INT64_F "l"
46 | #else // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
47 | typedef unsigned long long uint64; // NOLINT
48 | typedef long long int64; // NOLINT
49 | #ifndef INT64_C
50 | #define INT64_C(x) x ## LL
51 | #endif
52 | #ifndef UINT64_C
53 | #define UINT64_C(x) x ## ULL
54 | #endif
55 | #define INT64_F "ll"
56 | #endif // __LP64__
57 | #endif // COMPILER_MSVC
58 | typedef unsigned int uint32;
59 | typedef int int32;
60 | typedef unsigned short uint16; // NOLINT
61 | typedef short int16; // NOLINT
62 | typedef unsigned char uint8;
63 | typedef signed char int8;
64 | #endif // INT_TYPES_DEFINED
65 | #endif // GG_LONGLONG
66 |
67 | // Detect compiler is for x86 or x64.
68 | #if defined(__x86_64__) || defined(_M_X64) || \
69 | defined(__i386__) || defined(_M_IX86)
70 | #define CPU_X86 1
71 | #endif
72 | // Detect compiler is for ARM.
73 | #if defined(__arm__) || defined(_M_ARM)
74 | #define CPU_ARM 1
75 | #endif
76 |
77 | #ifndef ALIGNP
78 | #ifdef __cplusplus
79 | #define ALIGNP(p, t) \
80 | (reinterpret_cast(((reinterpret_cast(p) + \
81 | ((t) - 1)) & ~((t) - 1))))
82 | #else
83 | #define ALIGNP(p, t) \
84 | ((uint8*)((((uintptr_t)(p) + ((t) - 1)) & ~((t) - 1)))) /* NOLINT */
85 | #endif
86 | #endif
87 |
88 | #if !defined(LIBYUV_API)
89 | #if defined(_WIN32) || defined(__CYGWIN__)
90 | #if defined(LIBYUV_BUILDING_SHARED_LIBRARY)
91 | #define LIBYUV_API __declspec(dllexport)
92 | #elif defined(LIBYUV_USING_SHARED_LIBRARY)
93 | #define LIBYUV_API __declspec(dllimport)
94 | #else
95 | #define LIBYUV_API
96 | #endif // LIBYUV_BUILDING_SHARED_LIBRARY
97 | #elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__APPLE__) && \
98 | (defined(LIBYUV_BUILDING_SHARED_LIBRARY) || \
99 | defined(LIBYUV_USING_SHARED_LIBRARY))
100 | #define LIBYUV_API __attribute__ ((visibility ("default")))
101 | #else
102 | #define LIBYUV_API
103 | #endif // __GNUC__
104 | #endif // LIBYUV_API
105 |
106 | #define LIBYUV_BOOL int
107 | #define LIBYUV_FALSE 0
108 | #define LIBYUV_TRUE 1
109 |
110 | // Visual C x86 or GCC little endian.
111 | #if defined(__x86_64__) || defined(_M_X64) || \
112 | defined(__i386__) || defined(_M_IX86) || \
113 | defined(__arm__) || defined(_M_ARM) || \
114 | (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
115 | #define LIBYUV_LITTLE_ENDIAN
116 | #endif
117 |
118 | #endif // INCLUDE_LIBYUV_BASIC_TYPES_H_ NOLINT
119 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/include/libyuv/compare.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_COMPARE_H_ // NOLINT
12 | #define INCLUDE_LIBYUV_COMPARE_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | // Compute a hash for specified memory. Seed of 5381 recommended.
22 | LIBYUV_API
23 | uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed);
24 |
25 | // Scan an opaque argb image and return fourcc based on alpha offset.
26 | // Returns FOURCC_ARGB, FOURCC_BGRA, or 0 if unknown.
27 | LIBYUV_API
28 | uint32 ARGBDetect(const uint8* argb, int stride_argb, int width, int height);
29 |
30 | // Sum Square Error - used to compute Mean Square Error or PSNR.
31 | LIBYUV_API
32 | uint64 ComputeSumSquareError(const uint8* src_a,
33 | const uint8* src_b, int count);
34 |
35 | LIBYUV_API
36 | uint64 ComputeSumSquareErrorPlane(const uint8* src_a, int stride_a,
37 | const uint8* src_b, int stride_b,
38 | int width, int height);
39 |
40 | static const int kMaxPsnr = 128;
41 |
42 | LIBYUV_API
43 | double SumSquareErrorToPsnr(uint64 sse, uint64 count);
44 |
45 | LIBYUV_API
46 | double CalcFramePsnr(const uint8* src_a, int stride_a,
47 | const uint8* src_b, int stride_b,
48 | int width, int height);
49 |
50 | LIBYUV_API
51 | double I420Psnr(const uint8* src_y_a, int stride_y_a,
52 | const uint8* src_u_a, int stride_u_a,
53 | const uint8* src_v_a, int stride_v_a,
54 | const uint8* src_y_b, int stride_y_b,
55 | const uint8* src_u_b, int stride_u_b,
56 | const uint8* src_v_b, int stride_v_b,
57 | int width, int height);
58 |
59 | LIBYUV_API
60 | double CalcFrameSsim(const uint8* src_a, int stride_a,
61 | const uint8* src_b, int stride_b,
62 | int width, int height);
63 |
64 | LIBYUV_API
65 | double I420Ssim(const uint8* src_y_a, int stride_y_a,
66 | const uint8* src_u_a, int stride_u_a,
67 | const uint8* src_v_a, int stride_v_a,
68 | const uint8* src_y_b, int stride_y_b,
69 | const uint8* src_u_b, int stride_u_b,
70 | const uint8* src_v_b, int stride_v_b,
71 | int width, int height);
72 |
73 | #ifdef __cplusplus
74 | } // extern "C"
75 | } // namespace libyuv
76 | #endif
77 |
78 | #endif // INCLUDE_LIBYUV_COMPARE_H_ NOLINT
79 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/include/libyuv/compare_row.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_COMPARE_ROW_H_ // NOLINT
12 | #define INCLUDE_LIBYUV_COMPARE_ROW_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | #if defined(__pnacl__) || defined(__CLR_VER) || \
22 | (defined(__i386__) && !defined(__SSE2__))
23 | #define LIBYUV_DISABLE_X86
24 | #endif
25 |
26 | // Visual C 2012 required for AVX2.
27 | #if defined(_M_IX86) && !defined(__clang__) && \
28 | defined(_MSC_VER) && _MSC_VER >= 1700
29 | #define VISUALC_HAS_AVX2 1
30 | #endif // VisualStudio >= 2012
31 |
32 | // clang >= 3.4.0 required for AVX2.
33 | #if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
34 | #if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4))
35 | #define CLANG_HAS_AVX2 1
36 | #endif // clang >= 3.4
37 | #endif // __clang__
38 |
39 | #if defined(_M_IX86) && (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2))
40 | #define HAS_HASHDJB2_AVX2
41 | #endif
42 |
43 | // The following are available for Visual C and GCC:
44 | #if !defined(LIBYUV_DISABLE_X86) && \
45 | (defined(__x86_64__) || (defined(__i386__) || defined(_M_IX86)))
46 | #define HAS_HASHDJB2_SSE41
47 | #define HAS_SUMSQUAREERROR_SSE2
48 | #endif
49 |
50 | // The following are available for Visual C and clangcl 32 bit:
51 | #if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && \
52 | (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2))
53 | #define HAS_HASHDJB2_AVX2
54 | #define HAS_SUMSQUAREERROR_AVX2
55 | #endif
56 |
57 | // The following are available for Neon:
58 | #if !defined(LIBYUV_DISABLE_NEON) && \
59 | (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__))
60 | #define HAS_SUMSQUAREERROR_NEON
61 | #endif
62 |
63 | uint32 SumSquareError_C(const uint8* src_a, const uint8* src_b, int count);
64 | uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count);
65 | uint32 SumSquareError_AVX2(const uint8* src_a, const uint8* src_b, int count);
66 | uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count);
67 |
68 | uint32 HashDjb2_C(const uint8* src, int count, uint32 seed);
69 | uint32 HashDjb2_SSE41(const uint8* src, int count, uint32 seed);
70 | uint32 HashDjb2_AVX2(const uint8* src, int count, uint32 seed);
71 |
72 | #ifdef __cplusplus
73 | } // extern "C"
74 | } // namespace libyuv
75 | #endif
76 |
77 | #endif // INCLUDE_LIBYUV_COMPARE_ROW_H_ NOLINT
78 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/include/libyuv/cpu_id.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_CPU_ID_H_ // NOLINT
12 | #define INCLUDE_LIBYUV_CPU_ID_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | // TODO(fbarchard): Consider overlapping bits for different architectures.
22 | // Internal flag to indicate cpuid requires initialization.
23 | #define kCpuInit 0x1
24 |
25 | // These flags are only valid on ARM processors.
26 | static const int kCpuHasARM = 0x2;
27 | static const int kCpuHasNEON = 0x4;
28 | // 0x8 reserved for future ARM flag.
29 |
30 | // These flags are only valid on x86 processors.
31 | static const int kCpuHasX86 = 0x10;
32 | static const int kCpuHasSSE2 = 0x20;
33 | static const int kCpuHasSSSE3 = 0x40;
34 | static const int kCpuHasSSE41 = 0x80;
35 | static const int kCpuHasSSE42 = 0x100;
36 | static const int kCpuHasAVX = 0x200;
37 | static const int kCpuHasAVX2 = 0x400;
38 | static const int kCpuHasERMS = 0x800;
39 | static const int kCpuHasFMA3 = 0x1000;
40 | // 0x2000, 0x4000, 0x8000 reserved for future X86 flags.
41 |
42 | // These flags are only valid on MIPS processors.
43 | static const int kCpuHasMIPS = 0x10000;
44 | static const int kCpuHasMIPS_DSP = 0x20000;
45 | static const int kCpuHasMIPS_DSPR2 = 0x40000;
46 |
47 | // Internal function used to auto-init.
48 | LIBYUV_API
49 | int InitCpuFlags(void);
50 |
51 | // Internal function for parsing /proc/cpuinfo.
52 | LIBYUV_API
53 | int ArmCpuCaps(const char* cpuinfo_name);
54 |
55 | // Detect CPU has SSE2 etc.
56 | // Test_flag parameter should be one of kCpuHas constants above.
57 | // returns non-zero if instruction set is detected
58 | static __inline int TestCpuFlag(int test_flag) {
59 | LIBYUV_API extern int cpu_info_;
60 | return (cpu_info_ == kCpuInit ? InitCpuFlags() : cpu_info_) & test_flag;
61 | }
62 |
63 | // For testing, allow CPU flags to be disabled.
64 | // ie MaskCpuFlags(~kCpuHasSSSE3) to disable SSSE3.
65 | // MaskCpuFlags(-1) to enable all cpu specific optimizations.
66 | // MaskCpuFlags(0) to disable all cpu specific optimizations.
67 | LIBYUV_API
68 | void MaskCpuFlags(int enable_flags);
69 |
70 | // Low level cpuid for X86. Returns zeros on other CPUs.
71 | // eax is the info type that you want.
72 | // ecx is typically the cpu number, and should normally be zero.
73 | LIBYUV_API
74 | void CpuId(uint32 eax, uint32 ecx, uint32* cpu_info);
75 |
76 | #ifdef __cplusplus
77 | } // extern "C"
78 | } // namespace libyuv
79 | #endif
80 |
81 | #endif // INCLUDE_LIBYUV_CPU_ID_H_ NOLINT
82 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/include/libyuv/rotate.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_ROTATE_H_ // NOLINT
12 | #define INCLUDE_LIBYUV_ROTATE_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | // Supported rotation.
22 | typedef enum RotationMode {
23 | kRotate0 = 0, // No rotation.
24 | kRotate90 = 90, // Rotate 90 degrees clockwise.
25 | kRotate180 = 180, // Rotate 180 degrees.
26 | kRotate270 = 270, // Rotate 270 degrees clockwise.
27 |
28 | // Deprecated.
29 | kRotateNone = 0,
30 | kRotateClockwise = 90,
31 | kRotateCounterClockwise = 270,
32 | } RotationModeEnum;
33 |
34 | // Rotate I420 frame.
35 | LIBYUV_API
36 | int I420Rotate(const uint8* src_y, int src_stride_y,
37 | const uint8* src_u, int src_stride_u,
38 | const uint8* src_v, int src_stride_v,
39 | uint8* dst_y, int dst_stride_y,
40 | uint8* dst_u, int dst_stride_u,
41 | uint8* dst_v, int dst_stride_v,
42 | int src_width, int src_height, enum RotationMode mode);
43 |
44 | // Rotate NV12 input and store in I420.
45 | LIBYUV_API
46 | int NV12ToI420Rotate(const uint8* src_y, int src_stride_y,
47 | const uint8* src_uv, int src_stride_uv,
48 | uint8* dst_y, int dst_stride_y,
49 | uint8* dst_u, int dst_stride_u,
50 | uint8* dst_v, int dst_stride_v,
51 | int src_width, int src_height, enum RotationMode mode);
52 |
53 | // Rotate a plane by 0, 90, 180, or 270.
54 | LIBYUV_API
55 | int RotatePlane(const uint8* src, int src_stride,
56 | uint8* dst, int dst_stride,
57 | int src_width, int src_height, enum RotationMode mode);
58 |
59 | // Rotate planes by 90, 180, 270. Deprecated.
60 | LIBYUV_API
61 | void RotatePlane90(const uint8* src, int src_stride,
62 | uint8* dst, int dst_stride,
63 | int width, int height);
64 |
65 | LIBYUV_API
66 | void RotatePlane180(const uint8* src, int src_stride,
67 | uint8* dst, int dst_stride,
68 | int width, int height);
69 |
70 | LIBYUV_API
71 | void RotatePlane270(const uint8* src, int src_stride,
72 | uint8* dst, int dst_stride,
73 | int width, int height);
74 |
75 | LIBYUV_API
76 | void RotateUV90(const uint8* src, int src_stride,
77 | uint8* dst_a, int dst_stride_a,
78 | uint8* dst_b, int dst_stride_b,
79 | int width, int height);
80 |
81 | // Rotations for when U and V are interleaved.
82 | // These functions take one input pointer and
83 | // split the data into two buffers while
84 | // rotating them. Deprecated.
85 | LIBYUV_API
86 | void RotateUV180(const uint8* src, int src_stride,
87 | uint8* dst_a, int dst_stride_a,
88 | uint8* dst_b, int dst_stride_b,
89 | int width, int height);
90 |
91 | LIBYUV_API
92 | void RotateUV270(const uint8* src, int src_stride,
93 | uint8* dst_a, int dst_stride_a,
94 | uint8* dst_b, int dst_stride_b,
95 | int width, int height);
96 |
97 | // The 90 and 270 functions are based on transposes.
98 | // Doing a transpose with reversing the read/write
99 | // order will result in a rotation by +- 90 degrees.
100 | // Deprecated.
101 | LIBYUV_API
102 | void TransposePlane(const uint8* src, int src_stride,
103 | uint8* dst, int dst_stride,
104 | int width, int height);
105 |
106 | LIBYUV_API
107 | void TransposeUV(const uint8* src, int src_stride,
108 | uint8* dst_a, int dst_stride_a,
109 | uint8* dst_b, int dst_stride_b,
110 | int width, int height);
111 |
112 | #ifdef __cplusplus
113 | } // extern "C"
114 | } // namespace libyuv
115 | #endif
116 |
117 | #endif // INCLUDE_LIBYUV_ROTATE_H_ NOLINT
118 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/include/libyuv/rotate_argb.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_ROTATE_ARGB_H_ // NOLINT
12 | #define INCLUDE_LIBYUV_ROTATE_ARGB_H_
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/rotate.h" // For RotationMode.
16 |
17 | #ifdef __cplusplus
18 | namespace libyuv {
19 | extern "C" {
20 | #endif
21 |
22 | // Rotate ARGB frame
23 | LIBYUV_API
24 | int ARGBRotate(const uint8* src_argb, int src_stride_argb,
25 | uint8* dst_argb, int dst_stride_argb,
26 | int src_width, int src_height, enum RotationMode mode);
27 |
28 | #ifdef __cplusplus
29 | } // extern "C"
30 | } // namespace libyuv
31 | #endif
32 |
33 | #endif // INCLUDE_LIBYUV_ROTATE_ARGB_H_ NOLINT
34 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/include/libyuv/scale.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_SCALE_H_ // NOLINT
12 | #define INCLUDE_LIBYUV_SCALE_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | // Supported filtering.
22 | typedef enum FilterMode {
23 | kFilterNone = 0, // Point sample; Fastest.
24 | kFilterLinear = 1, // Filter horizontally only.
25 | kFilterBilinear = 2, // Faster than box, but lower quality scaling down.
26 | kFilterBox = 3 // Highest quality.
27 | } FilterModeEnum;
28 |
29 | // Scale a YUV plane.
30 | LIBYUV_API
31 | void ScalePlane(const uint8* src, int src_stride,
32 | int src_width, int src_height,
33 | uint8* dst, int dst_stride,
34 | int dst_width, int dst_height,
35 | enum FilterMode filtering);
36 |
37 | LIBYUV_API
38 | void ScalePlane_16(const uint16* src, int src_stride,
39 | int src_width, int src_height,
40 | uint16* dst, int dst_stride,
41 | int dst_width, int dst_height,
42 | enum FilterMode filtering);
43 |
44 | // Scales a YUV 4:2:0 image from the src width and height to the
45 | // dst width and height.
46 | // If filtering is kFilterNone, a simple nearest-neighbor algorithm is
47 | // used. This produces basic (blocky) quality at the fastest speed.
48 | // If filtering is kFilterBilinear, interpolation is used to produce a better
49 | // quality image, at the expense of speed.
50 | // If filtering is kFilterBox, averaging is used to produce ever better
51 | // quality image, at further expense of speed.
52 | // Returns 0 if successful.
53 |
54 | LIBYUV_API
55 | int I420Scale(const uint8* src_y, int src_stride_y,
56 | const uint8* src_u, int src_stride_u,
57 | const uint8* src_v, int src_stride_v,
58 | int src_width, int src_height,
59 | uint8* dst_y, int dst_stride_y,
60 | uint8* dst_u, int dst_stride_u,
61 | uint8* dst_v, int dst_stride_v,
62 | int dst_width, int dst_height,
63 | enum FilterMode filtering);
64 |
65 | LIBYUV_API
66 | int I420Scale_16(const uint16* src_y, int src_stride_y,
67 | const uint16* src_u, int src_stride_u,
68 | const uint16* src_v, int src_stride_v,
69 | int src_width, int src_height,
70 | uint16* dst_y, int dst_stride_y,
71 | uint16* dst_u, int dst_stride_u,
72 | uint16* dst_v, int dst_stride_v,
73 | int dst_width, int dst_height,
74 | enum FilterMode filtering);
75 |
76 | #ifdef __cplusplus
77 | // Legacy API. Deprecated.
78 | LIBYUV_API
79 | int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v,
80 | int src_stride_y, int src_stride_u, int src_stride_v,
81 | int src_width, int src_height,
82 | uint8* dst_y, uint8* dst_u, uint8* dst_v,
83 | int dst_stride_y, int dst_stride_u, int dst_stride_v,
84 | int dst_width, int dst_height,
85 | LIBYUV_BOOL interpolate);
86 |
87 | // Legacy API. Deprecated.
88 | LIBYUV_API
89 | int ScaleOffset(const uint8* src_i420, int src_width, int src_height,
90 | uint8* dst_i420, int dst_width, int dst_height, int dst_yoffset,
91 | LIBYUV_BOOL interpolate);
92 |
93 | // For testing, allow disabling of specialized scalers.
94 | LIBYUV_API
95 | void SetUseReferenceImpl(LIBYUV_BOOL use);
96 | #endif // __cplusplus
97 |
98 | #ifdef __cplusplus
99 | } // extern "C"
100 | } // namespace libyuv
101 | #endif
102 |
103 | #endif // INCLUDE_LIBYUV_SCALE_H_ NOLINT
104 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/include/libyuv/scale_argb.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_SCALE_ARGB_H_ // NOLINT
12 | #define INCLUDE_LIBYUV_SCALE_ARGB_H_
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/scale.h" // For FilterMode
16 |
17 | #ifdef __cplusplus
18 | namespace libyuv {
19 | extern "C" {
20 | #endif
21 |
22 | LIBYUV_API
23 | int ARGBScale(const uint8* src_argb, int src_stride_argb,
24 | int src_width, int src_height,
25 | uint8* dst_argb, int dst_stride_argb,
26 | int dst_width, int dst_height,
27 | enum FilterMode filtering);
28 |
29 | // Clipped scale takes destination rectangle coordinates for clip values.
30 | LIBYUV_API
31 | int ARGBScaleClip(const uint8* src_argb, int src_stride_argb,
32 | int src_width, int src_height,
33 | uint8* dst_argb, int dst_stride_argb,
34 | int dst_width, int dst_height,
35 | int clip_x, int clip_y, int clip_width, int clip_height,
36 | enum FilterMode filtering);
37 |
38 | // TODO(fbarchard): Implement this.
39 | // Scale with YUV conversion to ARGB and clipping.
40 | LIBYUV_API
41 | int YUVToARGBScaleClip(const uint8* src_y, int src_stride_y,
42 | const uint8* src_u, int src_stride_u,
43 | const uint8* src_v, int src_stride_v,
44 | uint32 src_fourcc,
45 | int src_width, int src_height,
46 | uint8* dst_argb, int dst_stride_argb,
47 | uint32 dst_fourcc,
48 | int dst_width, int dst_height,
49 | int clip_x, int clip_y, int clip_width, int clip_height,
50 | enum FilterMode filtering);
51 |
52 | #ifdef __cplusplus
53 | } // extern "C"
54 | } // namespace libyuv
55 | #endif
56 |
57 | #endif // INCLUDE_LIBYUV_SCALE_ARGB_H_ NOLINT
58 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/include/libyuv/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
12 | #define INCLUDE_LIBYUV_VERSION_H_
13 |
14 | #define LIBYUV_VERSION 1514
15 |
16 | #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
17 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/libyuv.gypi:
--------------------------------------------------------------------------------
1 | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
2 | #
3 | # Use of this source code is governed by a BSD-style license
4 | # that can be found in the LICENSE file in the root of the source
5 | # tree. An additional intellectual property rights grant can be found
6 | # in the file PATENTS. All contributing project authors may
7 | # be found in the AUTHORS file in the root of the source tree.
8 |
9 | {
10 | 'variables': {
11 | 'libyuv_sources': [
12 | # includes.
13 | 'include/libyuv.h',
14 | 'include/libyuv/basic_types.h',
15 | 'include/libyuv/compare.h',
16 | 'include/libyuv/convert.h',
17 | 'include/libyuv/convert_argb.h',
18 | 'include/libyuv/convert_from.h',
19 | 'include/libyuv/convert_from_argb.h',
20 | 'include/libyuv/cpu_id.h',
21 | 'include/libyuv/mjpeg_decoder.h',
22 | 'include/libyuv/planar_functions.h',
23 | 'include/libyuv/rotate.h',
24 | 'include/libyuv/rotate_argb.h',
25 | 'include/libyuv/rotate_row.h',
26 | 'include/libyuv/row.h',
27 | 'include/libyuv/scale.h',
28 | 'include/libyuv/scale_argb.h',
29 | 'include/libyuv/scale_row.h',
30 | 'include/libyuv/version.h',
31 | 'include/libyuv/video_common.h',
32 |
33 | # sources.
34 | 'source/compare.cc',
35 | 'source/compare_common.cc',
36 | 'source/compare_gcc.cc',
37 | 'source/compare_neon.cc',
38 | 'source/compare_neon64.cc',
39 | 'source/compare_win.cc',
40 | 'source/convert.cc',
41 | 'source/convert_argb.cc',
42 | 'source/convert_from.cc',
43 | 'source/convert_from_argb.cc',
44 | 'source/convert_jpeg.cc',
45 | 'source/convert_to_argb.cc',
46 | 'source/convert_to_i420.cc',
47 | 'source/cpu_id.cc',
48 | 'source/mjpeg_decoder.cc',
49 | 'source/mjpeg_validate.cc',
50 | 'source/planar_functions.cc',
51 | 'source/rotate.cc',
52 | 'source/rotate_any.cc',
53 | 'source/rotate_argb.cc',
54 | 'source/rotate_common.cc',
55 | 'source/rotate_gcc.cc',
56 | 'source/rotate_mips.cc',
57 | 'source/rotate_neon.cc',
58 | 'source/rotate_neon64.cc',
59 | 'source/rotate_win.cc',
60 | 'source/row_any.cc',
61 | 'source/row_common.cc',
62 | 'source/row_gcc.cc',
63 | 'source/row_mips.cc',
64 | 'source/row_neon.cc',
65 | 'source/row_neon64.cc',
66 | 'source/row_win.cc',
67 | 'source/scale.cc',
68 | 'source/scale_any.cc',
69 | 'source/scale_argb.cc',
70 | 'source/scale_common.cc',
71 | 'source/scale_gcc.cc',
72 | 'source/scale_mips.cc',
73 | 'source/scale_neon.cc',
74 | 'source/scale_neon64.cc',
75 | 'source/scale_win.cc',
76 | 'source/video_common.cc',
77 | ],
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/libyuv_nacl.gyp:
--------------------------------------------------------------------------------
1 | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
2 | #
3 | # Use of this source code is governed by a BSD-style license
4 | # that can be found in the LICENSE file in the root of the source
5 | # tree. An additional intellectual property rights grant can be found
6 | # in the file PATENTS. All contributing project authors may
7 | # be found in the AUTHORS file in the root of the source tree.
8 |
9 | {
10 | 'includes': [
11 | 'libyuv.gypi',
12 | '../../native_client/build/untrusted.gypi',
13 | ],
14 | 'targets': [
15 | {
16 | 'target_name': 'libyuv_nacl',
17 | 'type': 'none',
18 | 'variables': {
19 | 'nlib_target': 'libyuv_nacl.a',
20 | 'build_glibc': 0,
21 | 'build_newlib': 0,
22 | 'build_pnacl_newlib': 1,
23 | },
24 | 'include_dirs': [
25 | 'include',
26 | ],
27 | 'direct_dependent_settings': {
28 | 'include_dirs': [
29 | 'include',
30 | ],
31 | },
32 | 'sources': [
33 | '<@(libyuv_sources)',
34 | ],
35 | }, # target libyuv_nacl
36 | ]
37 | }
38 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/linux.mk:
--------------------------------------------------------------------------------
1 | # This is a generic makefile for libyuv for gcc.
2 | # make -f linux.mk CXX=clang++
3 |
4 | CXX?=g++
5 | CXXFLAGS?=-O2 -fomit-frame-pointer
6 | CXXFLAGS+=-Iinclude/
7 |
8 | LOCAL_OBJ_FILES := \
9 | source/compare.o \
10 | source/compare_common.o \
11 | source/compare_gcc.o \
12 | source/convert.o \
13 | source/convert_argb.o \
14 | source/convert_from.o \
15 | source/convert_from_argb.o \
16 | source/convert_to_argb.o \
17 | source/convert_to_i420.o \
18 | source/cpu_id.o \
19 | source/planar_functions.o \
20 | source/rotate.o \
21 | source/rotate_any.o \
22 | source/rotate_argb.o \
23 | source/rotate_common.o \
24 | source/rotate_gcc.o \
25 | source/rotate_mips.o \
26 | source/row_any.o \
27 | source/row_common.o \
28 | source/row_mips.o \
29 | source/row_gcc.o \
30 | source/scale.o \
31 | source/scale_any.o \
32 | source/scale_argb.o \
33 | source/scale_common.o \
34 | source/scale_gcc.o \
35 | source/scale_mips.o \
36 | source/video_common.o
37 |
38 | .cc.o:
39 | $(CXX) -c $(CXXFLAGS) $*.cc -o $*.o
40 |
41 | all: libyuv.a convert
42 |
43 | libyuv.a: $(LOCAL_OBJ_FILES)
44 | $(AR) $(ARFLAGS) $@ $(LOCAL_OBJ_FILES)
45 |
46 | # A test utility that uses libyuv conversion.
47 | convert: util/convert.cc libyuv.a
48 | $(CXX) $(CXXFLAGS) -Iutil/ -o $@ util/convert.cc libyuv.a
49 |
50 | clean:
51 | /bin/rm -f source/*.o *.ii *.s libyuv.a convert
52 |
53 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/public.mk:
--------------------------------------------------------------------------------
1 | # This file contains all the common make variables which are useful for
2 | # anyone depending on this library.
3 | # Note that dependencies on NDK are not directly listed since NDK auto adds
4 | # them.
5 |
6 | LIBYUV_INCLUDES := $(LIBYUV_PATH)/include
7 |
8 | LIBYUV_C_FLAGS :=
9 |
10 | LIBYUV_CPP_FLAGS :=
11 |
12 | LIBYUV_LDLIBS :=
13 | LIBYUV_DEP_MODULES :=
14 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/source/compare_common.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/basic_types.h"
12 |
13 | #include "libyuv/compare_row.h"
14 |
15 | #ifdef __cplusplus
16 | namespace libyuv {
17 | extern "C" {
18 | #endif
19 |
20 | uint32 SumSquareError_C(const uint8* src_a, const uint8* src_b, int count) {
21 | uint32 sse = 0u;
22 | int i;
23 | for (i = 0; i < count; ++i) {
24 | int diff = src_a[i] - src_b[i];
25 | sse += (uint32)(diff * diff);
26 | }
27 | return sse;
28 | }
29 |
30 | // hash seed of 5381 recommended.
31 | // Internal C version of HashDjb2 with int sized count for efficiency.
32 | uint32 HashDjb2_C(const uint8* src, int count, uint32 seed) {
33 | uint32 hash = seed;
34 | int i;
35 | for (i = 0; i < count; ++i) {
36 | hash += (hash << 5) + src[i];
37 | }
38 | return hash;
39 | }
40 |
41 | #ifdef __cplusplus
42 | } // extern "C"
43 | } // namespace libyuv
44 | #endif
45 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/source/compare_neon.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/basic_types.h"
12 |
13 | #include "libyuv/compare_row.h"
14 | #include "libyuv/row.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | #if !defined(LIBYUV_DISABLE_NEON) && defined(__ARM_NEON__) && \
22 | !defined(__aarch64__)
23 |
24 | uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count) {
25 | volatile uint32 sse;
26 | asm volatile (
27 | "vmov.u8 q8, #0 \n"
28 | "vmov.u8 q10, #0 \n"
29 | "vmov.u8 q9, #0 \n"
30 | "vmov.u8 q11, #0 \n"
31 |
32 | "1: \n"
33 | MEMACCESS(0)
34 | "vld1.8 {q0}, [%0]! \n"
35 | MEMACCESS(1)
36 | "vld1.8 {q1}, [%1]! \n"
37 | "subs %2, %2, #16 \n"
38 | "vsubl.u8 q2, d0, d2 \n"
39 | "vsubl.u8 q3, d1, d3 \n"
40 | "vmlal.s16 q8, d4, d4 \n"
41 | "vmlal.s16 q9, d6, d6 \n"
42 | "vmlal.s16 q10, d5, d5 \n"
43 | "vmlal.s16 q11, d7, d7 \n"
44 | "bgt 1b \n"
45 |
46 | "vadd.u32 q8, q8, q9 \n"
47 | "vadd.u32 q10, q10, q11 \n"
48 | "vadd.u32 q11, q8, q10 \n"
49 | "vpaddl.u32 q1, q11 \n"
50 | "vadd.u64 d0, d2, d3 \n"
51 | "vmov.32 %3, d0[0] \n"
52 | : "+r"(src_a),
53 | "+r"(src_b),
54 | "+r"(count),
55 | "=r"(sse)
56 | :
57 | : "memory", "cc", "q0", "q1", "q2", "q3", "q8", "q9", "q10", "q11");
58 | return sse;
59 | }
60 |
61 | #endif // defined(__ARM_NEON__) && !defined(__aarch64__)
62 |
63 | #ifdef __cplusplus
64 | } // extern "C"
65 | } // namespace libyuv
66 | #endif
67 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/source/compare_neon64.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/basic_types.h"
12 |
13 | #include "libyuv/compare_row.h"
14 | #include "libyuv/row.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | #if !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__)
22 |
23 | uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count) {
24 | volatile uint32 sse;
25 | asm volatile (
26 | "eor v16.16b, v16.16b, v16.16b \n"
27 | "eor v18.16b, v18.16b, v18.16b \n"
28 | "eor v17.16b, v17.16b, v17.16b \n"
29 | "eor v19.16b, v19.16b, v19.16b \n"
30 |
31 | "1: \n"
32 | MEMACCESS(0)
33 | "ld1 {v0.16b}, [%0], #16 \n"
34 | MEMACCESS(1)
35 | "ld1 {v1.16b}, [%1], #16 \n"
36 | "subs %w2, %w2, #16 \n"
37 | "usubl v2.8h, v0.8b, v1.8b \n"
38 | "usubl2 v3.8h, v0.16b, v1.16b \n"
39 | "smlal v16.4s, v2.4h, v2.4h \n"
40 | "smlal v17.4s, v3.4h, v3.4h \n"
41 | "smlal2 v18.4s, v2.8h, v2.8h \n"
42 | "smlal2 v19.4s, v3.8h, v3.8h \n"
43 | "b.gt 1b \n"
44 |
45 | "add v16.4s, v16.4s, v17.4s \n"
46 | "add v18.4s, v18.4s, v19.4s \n"
47 | "add v19.4s, v16.4s, v18.4s \n"
48 | "addv s0, v19.4s \n"
49 | "fmov %w3, s0 \n"
50 | : "+r"(src_a),
51 | "+r"(src_b),
52 | "+r"(count),
53 | "=r"(sse)
54 | :
55 | : "cc", "v0", "v1", "v2", "v3", "v16", "v17", "v18", "v19");
56 | return sse;
57 | }
58 |
59 | #endif // !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__)
60 |
61 | #ifdef __cplusplus
62 | } // extern "C"
63 | } // namespace libyuv
64 | #endif
65 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/source/mjpeg_validate.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/mjpeg_decoder.h"
12 |
13 | #include // For memchr.
14 |
15 | #ifdef __cplusplus
16 | namespace libyuv {
17 | extern "C" {
18 | #endif
19 |
20 | // Helper function to scan for EOI marker (0xff 0xd9).
21 | static LIBYUV_BOOL ScanEOI(const uint8* sample, size_t sample_size) {
22 | if (sample_size >= 2) {
23 | const uint8* end = sample + sample_size - 1;
24 | const uint8* it = sample;
25 | while (it < end) {
26 | // TODO(fbarchard): scan for 0xd9 instead.
27 | it = static_cast(memchr(it, 0xff, end - it));
28 | if (it == NULL) {
29 | break;
30 | }
31 | if (it[1] == 0xd9) {
32 | return LIBYUV_TRUE; // Success: Valid jpeg.
33 | }
34 | ++it; // Skip over current 0xff.
35 | }
36 | }
37 | // ERROR: Invalid jpeg end code not found. Size sample_size
38 | return LIBYUV_FALSE;
39 | }
40 |
41 | // Helper function to validate the jpeg appears intact.
42 | LIBYUV_BOOL ValidateJpeg(const uint8* sample, size_t sample_size) {
43 | // Maximum size that ValidateJpeg will consider valid.
44 | const size_t kMaxJpegSize = 0x7fffffffull;
45 | const size_t kBackSearchSize = 1024;
46 | if (sample_size < 64 || sample_size > kMaxJpegSize || !sample) {
47 | // ERROR: Invalid jpeg size: sample_size
48 | return LIBYUV_FALSE;
49 | }
50 | if (sample[0] != 0xff || sample[1] != 0xd8) { // SOI marker
51 | // ERROR: Invalid jpeg initial start code
52 | return LIBYUV_FALSE;
53 | }
54 |
55 | // Look for the End Of Image (EOI) marker near the end of the buffer.
56 | if (sample_size > kBackSearchSize) {
57 | if (ScanEOI(sample + sample_size - kBackSearchSize, kBackSearchSize)) {
58 | return LIBYUV_TRUE; // Success: Valid jpeg.
59 | }
60 | // Reduce search size for forward search.
61 | sample_size = sample_size - kBackSearchSize + 1;
62 | }
63 | // Step over SOI marker and scan for EOI.
64 | return ScanEOI(sample + 2, sample_size - 2);
65 | }
66 |
67 | #ifdef __cplusplus
68 | } // extern "C"
69 | } // namespace libyuv
70 | #endif
71 |
72 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/source/rotate_any.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/rotate.h"
12 | #include "libyuv/rotate_row.h"
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | #define TANY(NAMEANY, TPOS_SIMD, MASK) \
22 | void NAMEANY(const uint8* src, int src_stride, \
23 | uint8* dst, int dst_stride, int width) { \
24 | int r = width & MASK; \
25 | int n = width - r; \
26 | if (n > 0) { \
27 | TPOS_SIMD(src, src_stride, dst, dst_stride, n); \
28 | } \
29 | TransposeWx8_C(src + n, src_stride, dst + n * dst_stride, dst_stride, r);\
30 | }
31 |
32 | #ifdef HAS_TRANSPOSEWX8_NEON
33 | TANY(TransposeWx8_Any_NEON, TransposeWx8_NEON, 7)
34 | #endif
35 | #ifdef HAS_TRANSPOSEWX8_SSSE3
36 | TANY(TransposeWx8_Any_SSSE3, TransposeWx8_SSSE3, 7)
37 | #endif
38 | #ifdef HAS_TRANSPOSEWX8_FAST_SSSE3
39 | TANY(TransposeWx8_Fast_Any_SSSE3, TransposeWx8_Fast_SSSE3, 15)
40 | #endif
41 | #ifdef HAS_TRANSPOSEWX8_MIPS_DSPR2
42 | TANY(TransposeWx8_Any_MIPS_DSPR2, TransposeWx8_MIPS_DSPR2, 7)
43 | #endif
44 | #undef TANY
45 |
46 | #define TUVANY(NAMEANY, TPOS_SIMD, MASK) \
47 | void NAMEANY(const uint8* src, int src_stride, \
48 | uint8* dst_a, int dst_stride_a, \
49 | uint8* dst_b, int dst_stride_b, int width) { \
50 | int r = width & MASK; \
51 | int n = width - r; \
52 | if (n > 0) { \
53 | TPOS_SIMD(src, src_stride, dst_a, dst_stride_a, dst_b, dst_stride_b, \
54 | n); \
55 | } \
56 | TransposeUVWx8_C(src + n * 2, src_stride, \
57 | dst_a + n * dst_stride_a, dst_stride_a, \
58 | dst_b + n * dst_stride_b, dst_stride_b, r); \
59 | }
60 |
61 | #ifdef HAS_TRANSPOSEUVWX8_NEON
62 | TUVANY(TransposeUVWx8_Any_NEON, TransposeUVWx8_NEON, 7)
63 | #endif
64 | #ifdef HAS_TRANSPOSEUVWX8_SSE2
65 | TUVANY(TransposeUVWx8_Any_SSE2, TransposeUVWx8_SSE2, 7)
66 | #endif
67 | #ifdef HAS_TRANSPOSEUVWX8_MIPS_DSPR2
68 | TUVANY(TransposeUVWx8_Any_MIPS_DSPR2, TransposeUVWx8_MIPS_DSPR2, 7)
69 | #endif
70 | #undef TUVANY
71 |
72 | #ifdef __cplusplus
73 | } // extern "C"
74 | } // namespace libyuv
75 | #endif
76 |
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/source/rotate_common.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/row.h"
12 | #include "libyuv/rotate_row.h"
13 |
14 | #ifdef __cplusplus
15 | namespace libyuv {
16 | extern "C" {
17 | #endif
18 |
19 | void TransposeWx8_C(const uint8* src, int src_stride,
20 | uint8* dst, int dst_stride, int width) {
21 | int i;
22 | for (i = 0; i < width; ++i) {
23 | dst[0] = src[0 * src_stride];
24 | dst[1] = src[1 * src_stride];
25 | dst[2] = src[2 * src_stride];
26 | dst[3] = src[3 * src_stride];
27 | dst[4] = src[4 * src_stride];
28 | dst[5] = src[5 * src_stride];
29 | dst[6] = src[6 * src_stride];
30 | dst[7] = src[7 * src_stride];
31 | ++src;
32 | dst += dst_stride;
33 | }
34 | }
35 |
36 | void TransposeUVWx8_C(const uint8* src, int src_stride,
37 | uint8* dst_a, int dst_stride_a,
38 | uint8* dst_b, int dst_stride_b, int width) {
39 | int i;
40 | for (i = 0; i < width; ++i) {
41 | dst_a[0] = src[0 * src_stride + 0];
42 | dst_b[0] = src[0 * src_stride + 1];
43 | dst_a[1] = src[1 * src_stride + 0];
44 | dst_b[1] = src[1 * src_stride + 1];
45 | dst_a[2] = src[2 * src_stride + 0];
46 | dst_b[2] = src[2 * src_stride + 1];
47 | dst_a[3] = src[3 * src_stride + 0];
48 | dst_b[3] = src[3 * src_stride + 1];
49 | dst_a[4] = src[4 * src_stride + 0];
50 | dst_b[4] = src[4 * src_stride + 1];
51 | dst_a[5] = src[5 * src_stride + 0];
52 | dst_b[5] = src[5 * src_stride + 1];
53 | dst_a[6] = src[6 * src_stride + 0];
54 | dst_b[6] = src[6 * src_stride + 1];
55 | dst_a[7] = src[7 * src_stride + 0];
56 | dst_b[7] = src[7 * src_stride + 1];
57 | src += 2;
58 | dst_a += dst_stride_a;
59 | dst_b += dst_stride_b;
60 | }
61 | }
62 |
63 | void TransposeWxH_C(const uint8* src, int src_stride,
64 | uint8* dst, int dst_stride,
65 | int width, int height) {
66 | int i;
67 | for (i = 0; i < width; ++i) {
68 | int j;
69 | for (j = 0; j < height; ++j) {
70 | dst[i * dst_stride + j] = src[j * src_stride + i];
71 | }
72 | }
73 | }
74 |
75 | void TransposeUVWxH_C(const uint8* src, int src_stride,
76 | uint8* dst_a, int dst_stride_a,
77 | uint8* dst_b, int dst_stride_b,
78 | int width, int height) {
79 | int i;
80 | for (i = 0; i < width * 2; i += 2) {
81 | int j;
82 | for (j = 0; j < height; ++j) {
83 | dst_a[j + ((i >> 1) * dst_stride_a)] = src[i + (j * src_stride)];
84 | dst_b[j + ((i >> 1) * dst_stride_b)] = src[i + (j * src_stride) + 1];
85 | }
86 | }
87 | }
88 |
89 | #ifdef __cplusplus
90 | } // extern "C"
91 | } // namespace libyuv
92 | #endif
93 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/source/video_common.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 |
12 | #include "libyuv/video_common.h"
13 |
14 | #ifdef __cplusplus
15 | namespace libyuv {
16 | extern "C" {
17 | #endif
18 |
19 | #define ARRAY_SIZE(x) (int)(sizeof(x) / sizeof(x[0]))
20 |
21 | struct FourCCAliasEntry {
22 | uint32 alias;
23 | uint32 canonical;
24 | };
25 |
26 | static const struct FourCCAliasEntry kFourCCAliases[] = {
27 | {FOURCC_IYUV, FOURCC_I420},
28 | {FOURCC_YU16, FOURCC_I422},
29 | {FOURCC_YU24, FOURCC_I444},
30 | {FOURCC_YUYV, FOURCC_YUY2},
31 | {FOURCC_YUVS, FOURCC_YUY2}, // kCMPixelFormat_422YpCbCr8_yuvs
32 | {FOURCC_HDYC, FOURCC_UYVY},
33 | {FOURCC_2VUY, FOURCC_UYVY}, // kCMPixelFormat_422YpCbCr8
34 | {FOURCC_JPEG, FOURCC_MJPG}, // Note: JPEG has DHT while MJPG does not.
35 | {FOURCC_DMB1, FOURCC_MJPG},
36 | {FOURCC_BA81, FOURCC_BGGR}, // deprecated.
37 | {FOURCC_RGB3, FOURCC_RAW },
38 | {FOURCC_BGR3, FOURCC_24BG},
39 | {FOURCC_CM32, FOURCC_BGRA}, // kCMPixelFormat_32ARGB
40 | {FOURCC_CM24, FOURCC_RAW }, // kCMPixelFormat_24RGB
41 | {FOURCC_L555, FOURCC_RGBO}, // kCMPixelFormat_16LE555
42 | {FOURCC_L565, FOURCC_RGBP}, // kCMPixelFormat_16LE565
43 | {FOURCC_5551, FOURCC_RGBO}, // kCMPixelFormat_16LE5551
44 | };
45 | // TODO(fbarchard): Consider mapping kCMPixelFormat_32BGRA to FOURCC_ARGB.
46 | // {FOURCC_BGRA, FOURCC_ARGB}, // kCMPixelFormat_32BGRA
47 |
48 | LIBYUV_API
49 | uint32 CanonicalFourCC(uint32 fourcc) {
50 | int i;
51 | for (i = 0; i < ARRAY_SIZE(kFourCCAliases); ++i) {
52 | if (kFourCCAliases[i].alias == fourcc) {
53 | return kFourCCAliases[i].canonical;
54 | }
55 | }
56 | // Not an alias, so return it as-is.
57 | return fourcc;
58 | }
59 |
60 | #ifdef __cplusplus
61 | } // extern "C"
62 | } // namespace libyuv
63 | #endif
64 |
65 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/third_party/gflags/BUILD.gn:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
3 | #
4 | # Use of this source code is governed by a BSD-style license
5 | # that can be found in the LICENSE file in the root of the source
6 | # tree. An additional intellectual property rights grant can be found
7 | # in the file PATENTS. All contributing project authors may
8 | # be found in the AUTHORS file in the root of the source tree.
9 |
10 | # This is a copy of WebRTC's BUILD.gn.
11 |
12 | if (is_win) {
13 | gflags_gen_arch_root = "gen/win"
14 | } else {
15 | gflags_gen_arch_root = "gen/posix"
16 | }
17 |
18 | config("gflags_config") {
19 | include_dirs = [
20 | "$gflags_gen_arch_root/include", # For configured files.
21 | "src", # For everything else.
22 | ]
23 |
24 | defines = [
25 | # These macros exist so flags and symbols are properly exported when
26 | # building DLLs. Since we don't build DLLs, we need to disable them.
27 | "GFLAGS_DLL_DECL=",
28 | "GFLAGS_DLL_DECLARE_FLAG=",
29 | "GFLAGS_DLL_DEFINE_FLAG=",
30 | ]
31 | }
32 |
33 | source_set("gflags") {
34 | sources = [
35 | "src/gflags.cc",
36 | "src/gflags_completions.cc",
37 | "src/gflags_reporting.cc",
38 | ]
39 | if (is_win) {
40 | sources += [ "src/windows/port.cc" ]
41 |
42 | cflags = [
43 | "/wd4005", # WIN32_LEAN_AND_MEAN.
44 | "/wd4267", # Conversion from size_t to "type".
45 | ]
46 | }
47 |
48 | include_dirs = [
49 | "$gflags_gen_arch_root/include/private", # For config.h
50 | ]
51 |
52 | public_configs = [ ":gflags_config" ]
53 |
54 | configs -= [ "//build/config/compiler:chromium_code" ]
55 | configs += [ "//build/config/compiler:no_chromium_code" ]
56 |
57 | if (is_clang) {
58 | # TODO(andrew): Look into fixing this warning upstream:
59 | # http://code.google.com/p/webrtc/issues/detail?id=760
60 | configs -= [ "//build/config/clang:extra_warnings" ]
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/third_party/gflags/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006, Google Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | * Redistributions in binary form must reproduce the above
11 | copyright notice, this list of conditions and the following disclaimer
12 | in the documentation and/or other materials provided with the
13 | distribution.
14 | * Neither the name of Google Inc. nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/third_party/gflags/README.libyuv:
--------------------------------------------------------------------------------
1 | URL: http://code.google.com/p/gflags/
2 | Version: 2.0
3 | License: New BSD
4 | License File: LICENSE
5 |
6 | Description:
7 | The gflags package contains a library that implements commandline
8 | flags processing. As such it's a replacement for getopt(). It has
9 | increased flexibility, including built-in support for C++ types like
10 | string, and the ability to define flags in the source file in which
11 | they're used.
12 |
13 | Local Modifications: None
14 |
15 |
16 | How to update platform configuration files:
17 | The gen/ directory contains pre-generated configuration header files.
18 | Historically, all operating systems and architectures have generated
19 | similar configurations except for Windows. This is why there's only
20 | posix and win directories below gen/.
21 | When rolling gflags to a newer version, it's a good idea to check if
22 | new configuration files needs to be generated as well.
23 | Do this by running ./configure in the newly checked out version of
24 | gflags. Then diff the generated files with the ones below gen/.
25 | If you notice a diff, update the files with the updated ones.
26 | If you suspect platform dependend changes other than Windows, you'll
27 | have to checkout gflags on the other platforms as well and run
28 | ./configure there too.
29 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/third_party/gflags/gflags.gyp:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
3 | #
4 | # Use of this source code is governed by a BSD-style license
5 | # that can be found in the LICENSE file in the root of the source
6 | # tree. An additional intellectual property rights grant can be found
7 | # in the file PATENTS. All contributing project authors may
8 | # be found in the AUTHORS file in the root of the source tree.
9 |
10 | # This is a copy of WebRTC's gflags.gyp.
11 |
12 | {
13 | 'variables': {
14 | 'gflags_root': '<(DEPTH)/third_party/gflags',
15 | 'conditions': [
16 | ['OS=="win"', {
17 | 'gflags_gen_arch_root': '<(gflags_root)/gen/win',
18 | }, {
19 | 'gflags_gen_arch_root': '<(gflags_root)/gen/posix',
20 | }],
21 | ],
22 | },
23 | 'targets': [
24 | {
25 | 'target_name': 'gflags',
26 | 'type': 'static_library',
27 | 'include_dirs': [
28 | '<(gflags_gen_arch_root)/include/private', # For config.h
29 | '<(gflags_gen_arch_root)/include', # For configured files.
30 | '<(gflags_root)/src', # For everything else.
31 | ],
32 | 'defines': [
33 | # These macros exist so flags and symbols are properly
34 | # exported when building DLLs. Since we don't build DLLs, we
35 | # need to disable them.
36 | 'GFLAGS_DLL_DECL=',
37 | 'GFLAGS_DLL_DECLARE_FLAG=',
38 | 'GFLAGS_DLL_DEFINE_FLAG=',
39 | ],
40 | 'direct_dependent_settings': {
41 | 'include_dirs': [
42 | '<(gflags_gen_arch_root)/include', # For configured files.
43 | '<(gflags_root)/src', # For everything else.
44 | ],
45 | 'defines': [
46 | 'GFLAGS_DLL_DECL=',
47 | 'GFLAGS_DLL_DECLARE_FLAG=',
48 | 'GFLAGS_DLL_DEFINE_FLAG=',
49 | ],
50 | },
51 | 'sources': [
52 | 'src/gflags.cc',
53 | 'src/gflags_completions.cc',
54 | 'src/gflags_reporting.cc',
55 | ],
56 | 'conditions': [
57 | ['OS=="win"', {
58 | 'sources': [
59 | 'src/windows/port.cc',
60 | ],
61 | # Suppress warnings about WIN32_LEAN_AND_MEAN and size_t truncation.
62 | 'msvs_disabled_warnings': [4005, 4267],
63 | }],
64 | # TODO(andrew): Look into fixing this warning upstream:
65 | # http://code.google.com/p/webrtc/issues/detail?id=760
66 | ['clang==1', {
67 | 'cflags!': ['-Wheader-hygiene',],
68 | 'xcode_settings': {
69 | 'WARNING_CFLAGS!': ['-Wheader-hygiene',],
70 | },
71 | }],
72 | ],
73 | },
74 | ],
75 | }
76 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/tools/valgrind-libyuv/libyuv_tests.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | :: Copyright (c) 2012 The LibYuv Project Authors. All rights reserved.
3 | ::
4 | :: Use of this source code is governed by a BSD-style license
5 | :: that can be found in the LICENSE file in the root of the source
6 | :: tree. An additional intellectual property rights grant can be found
7 | :: in the file PATENTS. All contributing project authors may
8 | :: be found in the AUTHORS file in the root of the source tree.
9 |
10 | :: This script is a copy of chrome_tests.bat with the following changes:
11 | :: - Invokes libyuv_tests.py instead of chrome_tests.py
12 | :: - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make
13 | :: it possible to execute the Python scripts properly.
14 |
15 | :: TODO(timurrrr): batch files 'export' all the variables to the parent shell
16 | set THISDIR=%~dp0
17 | set TOOL_NAME="unknown"
18 |
19 | :: Get the tool name and put it into TOOL_NAME {{{1
20 | :: NB: SHIFT command doesn't modify %*
21 | :PARSE_ARGS_LOOP
22 | if %1 == () GOTO:TOOLNAME_NOT_FOUND
23 | if %1 == --tool GOTO:TOOLNAME_FOUND
24 | SHIFT
25 | goto :PARSE_ARGS_LOOP
26 |
27 | :TOOLNAME_NOT_FOUND
28 | echo "Please specify a tool (tsan or drmemory) by using --tool flag"
29 | exit /B 1
30 |
31 | :TOOLNAME_FOUND
32 | SHIFT
33 | set TOOL_NAME=%1
34 | :: }}}
35 | if "%TOOL_NAME%" == "drmemory" GOTO :SETUP_DRMEMORY
36 | if "%TOOL_NAME%" == "drmemory_light" GOTO :SETUP_DRMEMORY
37 | if "%TOOL_NAME%" == "drmemory_full" GOTO :SETUP_DRMEMORY
38 | if "%TOOL_NAME%" == "drmemory_pattern" GOTO :SETUP_DRMEMORY
39 | if "%TOOL_NAME%" == "tsan" GOTO :SETUP_TSAN
40 | echo "Unknown tool: `%TOOL_NAME%`! Only tsan and drmemory are supported."
41 | exit /B 1
42 |
43 | :SETUP_DRMEMORY
44 | if NOT "%DRMEMORY_COMMAND%"=="" GOTO :RUN_TESTS
45 | :: Set up DRMEMORY_COMMAND to invoke Dr. Memory {{{1
46 | set DRMEMORY_PATH=%THISDIR%..\..\third_party\drmemory
47 | set DRMEMORY_SFX=%DRMEMORY_PATH%\drmemory-windows-sfx.exe
48 | if EXIST %DRMEMORY_SFX% GOTO DRMEMORY_BINARY_OK
49 | echo "Can't find Dr. Memory executables."
50 | echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory"
51 | echo "for the instructions on how to get them."
52 | exit /B 1
53 |
54 | :DRMEMORY_BINARY_OK
55 | %DRMEMORY_SFX% -o%DRMEMORY_PATH%\unpacked -y
56 | set DRMEMORY_COMMAND=%DRMEMORY_PATH%\unpacked\bin\drmemory.exe
57 | :: }}}
58 | goto :RUN_TESTS
59 |
60 | :SETUP_TSAN
61 | :: Set up PIN_COMMAND to invoke TSan {{{1
62 | set TSAN_PATH=%THISDIR%..\..\third_party\tsan
63 | set TSAN_SFX=%TSAN_PATH%\tsan-x86-windows-sfx.exe
64 | if EXIST %TSAN_SFX% GOTO TSAN_BINARY_OK
65 | echo "Can't find ThreadSanitizer executables."
66 | echo "See http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer/threadsanitizer-on-windows"
67 | echo "for the instructions on how to get them."
68 | exit /B 1
69 |
70 | :TSAN_BINARY_OK
71 | %TSAN_SFX% -o%TSAN_PATH%\unpacked -y
72 | set PIN_COMMAND=%TSAN_PATH%\unpacked\tsan-x86-windows\tsan.bat
73 | :: }}}
74 | goto :RUN_TESTS
75 |
76 | :RUN_TESTS
77 | set PYTHONPATH=%THISDIR%..\python\google;%THISDIR%..\valgrind
78 | set RUNNING_ON_VALGRIND=yes
79 | python %THISDIR%libyuv_tests.py %*
80 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/tools/valgrind-libyuv/memcheck/OWNERS:
--------------------------------------------------------------------------------
1 | *
2 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/tools/valgrind-libyuv/memcheck/PRESUBMIT.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Copyright (c) 2012 The LibYuv Project Authors. All rights reserved.
3 | #
4 | # Use of this source code is governed by a BSD-style license
5 | # that can be found in the LICENSE file in the root of the source
6 | # tree. An additional intellectual property rights grant can be found
7 | # in the file PATENTS. All contributing project authors may
8 | # be found in the AUTHORS file in the root of the source tree.
9 |
10 | """
11 | Copied from Chrome's src/tools/valgrind/memcheck/PRESUBMIT.py
12 |
13 | See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
14 | for more details on the presubmit API built into gcl.
15 | """
16 |
17 | import os
18 | import re
19 | import sys
20 |
21 | def CheckChange(input_api, output_api):
22 | """Checks the memcheck suppressions files for bad data."""
23 |
24 | # Add the path to the Chrome valgrind dir to the import path:
25 | tools_vg_path = os.path.join(input_api.PresubmitLocalPath(), '..', '..',
26 | 'valgrind')
27 | sys.path.append(tools_vg_path)
28 | import suppressions
29 |
30 | sup_regex = re.compile('suppressions.*\.txt$')
31 | suppressions = {}
32 | errors = []
33 | check_for_memcheck = False
34 | # skip_next_line has 3 possible values:
35 | # - False: don't skip the next line.
36 | # - 'skip_suppression_name': the next line is a suppression name, skip.
37 | # - 'skip_param': the next line is a system call parameter error, skip.
38 | skip_next_line = False
39 | for f in filter(lambda x: sup_regex.search(x.LocalPath()),
40 | input_api.AffectedFiles()):
41 | for line, line_num in zip(f.NewContents(),
42 | xrange(1, len(f.NewContents()) + 1)):
43 | line = line.lstrip()
44 | if line.startswith('#') or not line:
45 | continue
46 |
47 | if skip_next_line:
48 | if skip_next_line == 'skip_suppression_name':
49 | if 'insert_a_suppression_name_here' in line:
50 | errors.append('"insert_a_suppression_name_here" is not a valid '
51 | 'suppression name')
52 | if suppressions.has_key(line):
53 | if f.LocalPath() == suppressions[line][1]:
54 | errors.append('suppression with name "%s" at %s line %s '
55 | 'has already been defined at line %s' %
56 | (line, f.LocalPath(), line_num,
57 | suppressions[line][1]))
58 | else:
59 | errors.append('suppression with name "%s" at %s line %s '
60 | 'has already been defined at %s line %s' %
61 | (line, f.LocalPath(), line_num,
62 | suppressions[line][0], suppressions[line][1]))
63 | else:
64 | suppressions[line] = (f, line_num)
65 | check_for_memcheck = True;
66 | skip_next_line = False
67 | continue
68 | if check_for_memcheck:
69 | if not line.startswith('Memcheck:'):
70 | errors.append('"%s" should be "Memcheck:..." in %s line %s' %
71 | (line, f.LocalPath(), line_num))
72 | check_for_memcheck = False;
73 | if line == '{':
74 | skip_next_line = 'skip_suppression_name'
75 | continue
76 | if line == "Memcheck:Param":
77 | skip_next_line = 'skip_param'
78 | continue
79 |
80 | if (line.startswith('fun:') or line.startswith('obj:') or
81 | line.startswith('Memcheck:') or line == '}' or
82 | line == '...'):
83 | continue
84 | errors.append('"%s" is probably wrong: %s line %s' % (line, f.LocalPath(),
85 | line_num))
86 | if errors:
87 | return [output_api.PresubmitError('\n'.join(errors))]
88 | return []
89 |
90 | def CheckChangeOnUpload(input_api, output_api):
91 | return CheckChange(input_api, output_api)
92 |
93 | def CheckChangeOnCommit(input_api, output_api):
94 | return CheckChange(input_api, output_api)
95 |
96 | def GetPreferredTrySlaves():
97 | # We don't have any memcheck slaves yet, so there's no use for this method.
98 | # When we have, the slave name(s) should be put into this list.
99 | return []
100 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/tools/valgrind-libyuv/memcheck/suppressions.txt:
--------------------------------------------------------------------------------
1 | # This file is used in addition to the one already maintained in Chrome.
2 | # It acts as a place holder for future additions for this project.
3 | # It must exist for the Python wrapper script to work properly.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/tools/valgrind-libyuv/memcheck/suppressions_mac.txt:
--------------------------------------------------------------------------------
1 | # This file is used in addition to the one already maintained in Chrome.
2 | # It acts as a place holder for future additions for this project.
3 | # It must exist for the Python wrapper script to work properly.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/tools/valgrind-libyuv/memcheck/suppressions_win32.txt:
--------------------------------------------------------------------------------
1 | # This file is used in addition to the one already maintained in Chrome.
2 | # It acts as a place holder for future additions for this project.
3 | # It must exist for the Python wrapper script to work properly.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/tools/valgrind-libyuv/tsan/OWNERS:
--------------------------------------------------------------------------------
1 | *
2 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/tools/valgrind-libyuv/tsan/PRESUBMIT.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Copyright (c) 2012 The LibYuv Project Authors. All rights reserved.
3 | #
4 | # Use of this source code is governed by a BSD-style license
5 | # that can be found in the LICENSE file in the root of the source
6 | # tree. An additional intellectual property rights grant can be found
7 | # in the file PATENTS. All contributing project authors may
8 | # be found in the AUTHORS file in the root of the source tree.
9 |
10 | import os
11 | import re
12 | import sys
13 |
14 | """
15 | Copied from Chrome's src/tools/valgrind/tsan/PRESUBMIT.py
16 |
17 | See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
18 | for more details on the presubmit API built into gcl.
19 | """
20 |
21 | def CheckChange(input_api, output_api):
22 | """Checks the TSan suppressions files for bad suppressions."""
23 |
24 | # Add the path to the Chrome valgrind dir to the import path:
25 | tools_vg_path = os.path.join(input_api.PresubmitLocalPath(), '..', '..',
26 | 'valgrind')
27 | sys.path.append(tools_vg_path)
28 | import suppressions
29 |
30 | return suppressions.PresubmitCheck(input_api, output_api)
31 |
32 | def CheckChangeOnUpload(input_api, output_api):
33 | return CheckChange(input_api, output_api)
34 |
35 | def CheckChangeOnCommit(input_api, output_api):
36 | return CheckChange(input_api, output_api)
37 |
38 | def GetPreferredTrySlaves():
39 | # We don't have any tsan slaves yet, so there's no use for this method.
40 | # When we have, the slave name(s) should be put into this list.
41 | return []
42 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/tools/valgrind-libyuv/tsan/suppressions.txt:
--------------------------------------------------------------------------------
1 | # This file is used in addition to the one already maintained in Chrome.
2 | # It acts as a place holder for future additions for this project.
3 | # It must exist for the Python wrapper script to work properly.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/tools/valgrind-libyuv/tsan/suppressions_mac.txt:
--------------------------------------------------------------------------------
1 | # This file is used in addition to the one already maintained in Chrome.
2 | # It acts as a place holder for future additions for this project.
3 | # It must exist for the Python wrapper script to work properly.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/tools/valgrind-libyuv/tsan/suppressions_win32.txt:
--------------------------------------------------------------------------------
1 | # This file is used in addition to the one already maintained in Chrome.
2 | # It acts as a place holder for future additions for this project.
3 | # It must exist for the Python wrapper script to work properly.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/unit_test/basictypes_test.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "../unit_test/unit_test.h"
12 | #include "libyuv/basic_types.h"
13 |
14 | namespace libyuv {
15 |
16 | TEST_F(LibYUVBaseTest, Endian) {
17 | uint16 v16 = 0x1234u;
18 | uint8 first_byte = *reinterpret_cast(&v16);
19 | #if defined(LIBYUV_LITTLE_ENDIAN)
20 | EXPECT_EQ(0x34u, first_byte);
21 | #else
22 | EXPECT_EQ(0x12u, first_byte);
23 | #endif
24 | }
25 |
26 | TEST_F(LibYUVBaseTest, SizeOfTypes) {
27 | int8 i8 = -1;
28 | uint8 u8 = 1u;
29 | int16 i16 = -1;
30 | uint16 u16 = 1u;
31 | int32 i32 = -1;
32 | uint32 u32 = 1u;
33 | int64 i64 = -1;
34 | uint64 u64 = 1u;
35 | EXPECT_EQ(1u, sizeof(i8));
36 | EXPECT_EQ(1u, sizeof(u8));
37 | EXPECT_EQ(2u, sizeof(i16));
38 | EXPECT_EQ(2u, sizeof(u16));
39 | EXPECT_EQ(4u, sizeof(i32));
40 | EXPECT_EQ(4u, sizeof(u32));
41 | EXPECT_EQ(8u, sizeof(i64));
42 | EXPECT_EQ(8u, sizeof(u64));
43 | EXPECT_GT(0, i8);
44 | EXPECT_LT(0u, u8);
45 | EXPECT_GT(0, i16);
46 | EXPECT_LT(0u, u16);
47 | EXPECT_GT(0, i32);
48 | EXPECT_LT(0u, u32);
49 | EXPECT_GT(0, i64);
50 | EXPECT_LT(0u, u64);
51 | }
52 |
53 | TEST_F(LibYUVBaseTest, SizeOfConstants) {
54 | EXPECT_EQ(8u, sizeof(INT64_C(0)));
55 | EXPECT_EQ(8u, sizeof(UINT64_C(0)));
56 | EXPECT_EQ(8u, sizeof(INT64_C(0x1234567887654321)));
57 | EXPECT_EQ(8u, sizeof(UINT64_C(0x8765432112345678)));
58 | }
59 |
60 | } // namespace libyuv
61 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/unit_test/testdata/arm_v7.txt:
--------------------------------------------------------------------------------
1 | Processor : ARMv7 Processor rev 5 (v7l)
2 | BogoMIPS : 795.44
3 | Features : swp half thumb fastmult vfp edsp iwmmxt thumbee vfpv3 vfpv3d16
4 | CPU implementer : 0x56
5 | CPU architecture: 7
6 | CPU variant : 0x0
7 | CPU part : 0x581
8 | CPU revision : 5
9 |
10 | Hardware : OLPC XO-1.75
11 | Revision : 0000
12 | Serial : 0000000000000000
13 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/unit_test/testdata/juno.txt:
--------------------------------------------------------------------------------
1 | Processor : AArch64 Processor rev 0 (aarch64)
2 | processor : 0
3 | processor : 1
4 | processor : 2
5 | processor : 3
6 | processor : 4
7 | processor : 5
8 | Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
9 | CPU implementer : 0x41
10 | CPU architecture: AArch64
11 | CPU variant : 0x0
12 | CPU part : 0xd07
13 | CPU revision : 0
14 |
15 | Hardware : Juno
16 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/unit_test/testdata/tegra3.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/player-android/jni/libyuv/unit_test/testdata/tegra3.txt
--------------------------------------------------------------------------------
/player-android/jni/libyuv/unit_test/version_test.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include
12 | #include
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/version.h"
16 | #include "../unit_test/unit_test.h"
17 |
18 | namespace libyuv {
19 |
20 | // Tests SVN version against include/libyuv/version.h
21 | // SVN version is bumped by documentation changes as well as code.
22 | // Although the versions should match, once checked in, a tolerance is allowed.
23 | TEST_F(LibYUVBaseTest, DISABLED_TestVersion) {
24 | EXPECT_GE(LIBYUV_VERSION, 169); // 169 is first version to support version.
25 | printf("LIBYUV_VERSION %d\n", LIBYUV_VERSION);
26 | #ifdef LIBYUV_SVNREVISION
27 | const char *ver = strchr(LIBYUV_SVNREVISION, ':');
28 | if (ver) {
29 | ++ver;
30 | } else {
31 | ver = LIBYUV_SVNREVISION;
32 | }
33 | int svn_revision = atoi(ver); // NOLINT
34 | printf("LIBYUV_SVNREVISION %d\n", svn_revision);
35 | EXPECT_NEAR(LIBYUV_VERSION, svn_revision, 20); // Allow version to be close.
36 | if (LIBYUV_VERSION != svn_revision) {
37 | printf("WARNING - Versions do not match.\n");
38 | }
39 | #else
40 | printf("WARNING - SVN Version unavailable. Test not run.\n");
41 | #endif
42 | }
43 |
44 | } // namespace libyuv
45 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/util/Makefile:
--------------------------------------------------------------------------------
1 | psnr: psnr.cc ssim.cc psnr_main.cc
2 | ifeq ($(CXX),icl)
3 | $(CXX) /arch:SSE2 /Ox /openmp psnr.cc ssim.cc psnr_main.cc
4 | else
5 | $(CXX) -msse2 -O3 -fopenmp -static -o psnr psnr.cc ssim.cc psnr_main.cc -Wl,--strip-all
6 | endif
7 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/util/android/test_runner.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
3 | #
4 | # Use of this source code is governed by a BSD-style license
5 | # that can be found in the LICENSE file in the root of the source
6 | # tree. An additional intellectual property rights grant can be found
7 | # in the file PATENTS. All contributing project authors may
8 | # be found in the AUTHORS file in the root of the source tree.
9 |
10 | """
11 | Runs tests on Android devices.
12 |
13 | This script exists to avoid Libyuv being broken by changes in the Chrome Android
14 | test execution toolchain. It also conveniently sets the CHECKOUT_SOURCE_ROOT
15 | environment variable.
16 | """
17 |
18 | import os
19 | import sys
20 |
21 | SCRIPT_DIR = os.path.dirname(__file__)
22 | ROOT_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
23 | CHROMIUM_BUILD_ANDROID_DIR = os.path.join(ROOT_DIR, 'build', 'android')
24 | sys.path.insert(0, CHROMIUM_BUILD_ANDROID_DIR)
25 |
26 |
27 | import test_runner # pylint: disable=W0406
28 |
29 | def main():
30 | # Override environment variable to make it possible for the scripts to find
31 | # the root directory (our symlinking of the Chromium build toolchain would
32 | # otherwise make them fail to do so).
33 | os.environ['CHECKOUT_SOURCE_ROOT'] = ROOT_DIR
34 | return test_runner.main()
35 |
36 | if __name__ == '__main__':
37 | sys.exit(main())
38 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/util/compare.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | #include "libyuv/basic_types.h"
17 | #include "libyuv/compare.h"
18 | #include "libyuv/version.h"
19 |
20 | int main(int argc, char** argv) {
21 | if (argc < 1) {
22 | printf("libyuv compare v%d\n", LIBYUV_VERSION);
23 | printf("compare file1.yuv file2.yuv\n");
24 | return -1;
25 | }
26 | char* name1 = argv[1];
27 | char* name2 = (argc > 2) ? argv[2] : NULL;
28 | FILE* fin1 = fopen(name1, "rb");
29 | FILE* fin2 = name2 ? fopen(name2, "rb") : NULL;
30 |
31 | const int kBlockSize = 32768;
32 | uint8 buf1[kBlockSize];
33 | uint8 buf2[kBlockSize];
34 | uint32 hash1 = 5381;
35 | uint32 hash2 = 5381;
36 | uint64 sum_square_err = 0;
37 | uint64 size_min = 0;
38 | int amt1 = 0;
39 | int amt2 = 0;
40 | do {
41 | amt1 = static_cast(fread(buf1, 1, kBlockSize, fin1));
42 | if (amt1 > 0) hash1 = libyuv::HashDjb2(buf1, amt1, hash1);
43 | if (fin2) {
44 | amt2 = static_cast(fread(buf2, 1, kBlockSize, fin2));
45 | if (amt2 > 0) hash2 = libyuv::HashDjb2(buf2, amt2, hash2);
46 | int amt_min = (amt1 < amt2) ? amt1 : amt2;
47 | size_min += amt_min;
48 | sum_square_err += libyuv::ComputeSumSquareError(buf1, buf2, amt_min);
49 | }
50 | } while (amt1 > 0 || amt2 > 0);
51 |
52 | printf("hash1 %x", hash1);
53 | if (fin2) {
54 | printf(", hash2 %x", hash2);
55 | double mse = static_cast(sum_square_err) /
56 | static_cast(size_min);
57 | printf(", mse %.2f", mse);
58 | double psnr = libyuv::SumSquareErrorToPsnr(sum_square_err, size_min);
59 | printf(", psnr %.2f\n", psnr);
60 | fclose(fin2);
61 | }
62 | fclose(fin1);
63 | }
64 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/util/cpuid.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | #define INCLUDE_LIBYUV_COMPARE_H_
16 | #include "libyuv.h"
17 | #include "./psnr.h"
18 | #include "./ssim.h"
19 |
20 | int main(int argc, const char* argv[]) {
21 | int cpu_flags = TestCpuFlag(-1);
22 | int has_arm = TestCpuFlag(kCpuHasARM);
23 | int has_mips = TestCpuFlag(kCpuHasMIPS);
24 | int has_x86 = TestCpuFlag(kCpuHasX86);
25 | #if defined(__i386__) || defined(__x86_64__) || \
26 | defined(_M_IX86) || defined(_M_X64)
27 | if (has_x86) {
28 | uint32 family, model, cpu_info[4];
29 | // Vendor ID:
30 | // AuthenticAMD AMD processor
31 | // CentaurHauls Centaur processor
32 | // CyrixInstead Cyrix processor
33 | // GenuineIntel Intel processor
34 | // GenuineTMx86 Transmeta processor
35 | // Geode by NSC National Semiconductor processor
36 | // NexGenDriven NexGen processor
37 | // RiseRiseRise Rise Technology processor
38 | // SiS SiS SiS SiS processor
39 | // UMC UMC UMC UMC processor
40 | CpuId(0, 0, &cpu_info[0]);
41 | cpu_info[0] = cpu_info[1]; // Reorder output
42 | cpu_info[1] = cpu_info[3];
43 | cpu_info[3] = 0;
44 | printf("Cpu Vendor: %s\n", (char*)(&cpu_info[0]));
45 |
46 | // CPU Family and Model
47 | // 3:0 - Stepping
48 | // 7:4 - Model
49 | // 11:8 - Family
50 | // 13:12 - Processor Type
51 | // 19:16 - Extended Model
52 | // 27:20 - Extended Family
53 | CpuId(1, 0, &cpu_info[0]);
54 | family = ((cpu_info[0] >> 8) & 0x0f) | ((cpu_info[0] >> 16) & 0xff0);
55 | model = ((cpu_info[0] >> 4) & 0x0f) | ((cpu_info[0] >> 12) & 0xf0);
56 | printf("Cpu Family %d (0x%x), Model %d (0x%x)\n", family, family,
57 | model, model);
58 | }
59 | #endif
60 | printf("Cpu Flags %x\n", cpu_flags);
61 | printf("Has ARM %x\n", has_arm);
62 | printf("Has MIPS %x\n", has_mips);
63 | printf("Has X86 %x\n", has_x86);
64 | if (has_arm) {
65 | int has_neon = TestCpuFlag(kCpuHasNEON);
66 | printf("Has NEON %x\n", has_neon);
67 | }
68 | if (has_mips) {
69 | int has_mips_dsp = TestCpuFlag(kCpuHasMIPS_DSP);
70 | int has_mips_dspr2 = TestCpuFlag(kCpuHasMIPS_DSPR2);
71 | printf("Has MIPS DSP %x\n", has_mips_dsp);
72 | printf("Has MIPS DSPR2 %x\n", has_mips_dspr2);
73 | }
74 | if (has_x86) {
75 | int has_sse2 = TestCpuFlag(kCpuHasSSE2);
76 | int has_ssse3 = TestCpuFlag(kCpuHasSSSE3);
77 | int has_sse41 = TestCpuFlag(kCpuHasSSE41);
78 | int has_sse42 = TestCpuFlag(kCpuHasSSE42);
79 | int has_avx = TestCpuFlag(kCpuHasAVX);
80 | int has_avx2 = TestCpuFlag(kCpuHasAVX2);
81 | int has_erms = TestCpuFlag(kCpuHasERMS);
82 | int has_fma3 = TestCpuFlag(kCpuHasFMA3);
83 | printf("Has SSE2 %x\n", has_sse2);
84 | printf("Has SSSE3 %x\n", has_ssse3);
85 | printf("Has SSE4.1 %x\n", has_sse41);
86 | printf("Has SSE4.2 %x\n", has_sse42);
87 | printf("Has AVX %x\n", has_avx);
88 | printf("Has AVX2 %x\n", has_avx2);
89 | printf("Has ERMS %x\n", has_erms);
90 | printf("Has FMA3 %x\n", has_fma3);
91 | }
92 | return 0;
93 | }
94 |
95 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/util/psnr.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | // Get PSNR for video sequence. Assuming RAW 4:2:0 Y:Cb:Cr format
12 |
13 | #ifndef UTIL_PSNR_H_ // NOLINT
14 | #define UTIL_PSNR_H_
15 |
16 | #include // For log10()
17 |
18 | #ifdef __cplusplus
19 | extern "C" {
20 | #endif
21 |
22 | #if !defined(INT_TYPES_DEFINED) && !defined(UINT8_TYPE_DEFINED)
23 | typedef unsigned char uint8;
24 | #define UINT8_TYPE_DEFINED
25 | #endif
26 |
27 | static const double kMaxPSNR = 128.0;
28 |
29 | // libyuv provides this function when linking library for jpeg support.
30 | // TODO(fbarchard): make psnr lib compatible subset of libyuv.
31 | #if !defined(HAVE_JPEG)
32 | // Computer Sum of Squared Error (SSE).
33 | // Pass this to ComputePSNR for final result.
34 | double ComputeSumSquareError(const uint8* org, const uint8* rec, int size);
35 | #endif
36 |
37 | // PSNR formula: psnr = 10 * log10 (Peak Signal^2 * size / sse)
38 | // Returns 128.0 (kMaxPSNR) if sse is 0 (perfect match).
39 | double ComputePSNR(double sse, double size);
40 |
41 | #ifdef __cplusplus
42 | } // extern "C"
43 | #endif
44 |
45 | #endif // UTIL_PSNR_H_ // NOLINT
46 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/util/ssim.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | // Get SSIM for video sequence. Assuming RAW 4:2:0 Y:Cb:Cr format
12 |
13 | #ifndef UTIL_SSIM_H_ // NOLINT
14 | #define UTIL_SSIM_H_
15 |
16 | #include // For log10()
17 |
18 | #ifdef __cplusplus
19 | extern "C" {
20 | #endif
21 |
22 | #if !defined(INT_TYPES_DEFINED) && !defined(UINT8_TYPE_DEFINED)
23 | typedef unsigned char uint8;
24 | #define UINT8_TYPE_DEFINED
25 | #endif
26 |
27 | double CalcSSIM(const uint8* org, const uint8* rec,
28 | const int image_width, const int image_height);
29 |
30 | double CalcLSSIM(double ssim);
31 |
32 | #ifdef __cplusplus
33 | } // extern "C"
34 | #endif
35 |
36 | #endif // UTIL_SSIM_H_ // NOLINT
37 |
--------------------------------------------------------------------------------
/player-android/jni/libyuv/winarm.mk:
--------------------------------------------------------------------------------
1 | # This is a generic makefile for libyuv for Windows Arm.
2 | # call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm\vcvarsx86_arm.bat"
3 | # nmake /f winarm.mk
4 | # make -f winarm.mk
5 | # nmake /f winarm.mk clean
6 | # consider /arch:ARMv7VE
7 | CC=cl
8 | CCFLAGS=/Ox /nologo /Iinclude /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
9 | AR=lib
10 | ARFLAGS=/MACHINE:ARM /NOLOGO /SUBSYSTEM:NATIVE
11 | RM=cmd /c del
12 |
13 | LOCAL_OBJ_FILES = \
14 | source/compare.o\
15 | source/compare_common.o\
16 | source/convert.o\
17 | source/convert_argb.o\
18 | source/convert_from.o\
19 | source/convert_from_argb.o\
20 | source/convert_to_argb.o\
21 | source/convert_to_i420.o\
22 | source/cpu_id.o\
23 | source/planar_functions.o\
24 | source/rotate.o\
25 | source/rotate_any.o\
26 | source/rotate_argb.o\
27 | source/rotate_common.o\
28 | source/row_any.o\
29 | source/row_common.o\
30 | source/scale.o\
31 | source/scale_any.o\
32 | source/scale_argb.o\
33 | source/scale_common.o\
34 | source/video_common.o
35 |
36 | .cc.o:
37 | $(CC) /c $(CCFLAGS) $*.cc /Fo$@
38 |
39 | all: libyuv_arm.lib winarm.mk
40 |
41 | libyuv_arm.lib: $(LOCAL_OBJ_FILES) winarm.mk
42 | $(AR) $(ARFLAGS) /OUT:$@ $(LOCAL_OBJ_FILES)
43 |
44 | clean:
45 | $(RM) "source\*.o" libyuv_arm.lib
46 |
47 |
--------------------------------------------------------------------------------
/player-android/jni/native_crash_handler.cpp:
--------------------------------------------------------------------------------
1 | #include "native_crash_handler.h"
2 | #include "common.h"
3 | #include "xutil.h"
4 |
5 | static struct sigaction old_actions[NSIG];
6 |
7 | #define THREAD_NAME "native_crash_handler"
8 | extern JNIEnv *jni_get_env(const char *name);
9 |
10 | static const int monitored_signals[] = {
11 | SIGILL,
12 | SIGABRT,
13 | SIGBUS,
14 | SIGFPE,
15 | SIGSEGV,
16 | SIGSTKFLT,
17 | SIGPIPE
18 | };
19 |
20 | void sigaction_callback(int signal, siginfo_t *info, void *reserved)
21 | {
22 | JNIEnv *env;
23 | if (!(env = jni_get_env(THREAD_NAME)))
24 | return;
25 |
26 | env->CallStaticVoidMethod(gfq.clazz, gfq.onNativeCrashID);
27 |
28 | old_actions[signal].sa_handler(signal);
29 | }
30 |
31 | void init_native_crash_handler()
32 | {
33 | unsigned i;
34 | struct sigaction handler;
35 | memset(&handler, 0, sizeof(struct sigaction));
36 |
37 | handler.sa_sigaction = sigaction_callback;
38 | handler.sa_flags = SA_RESETHAND;
39 |
40 | for (i = 0; i < NELEM(monitored_signals); ++i) {
41 | const int s = monitored_signals[i];
42 | sigaction(s, &handler, &old_actions[s]);
43 | }
44 | }
45 |
46 | void destroy_native_crash_handler()
47 | {
48 | unsigned i;
49 | for (i = 0; i < NELEM(monitored_signals); ++i) {
50 | const int s = monitored_signals[i];
51 | sigaction(s, &old_actions[s], NULL);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/player-android/jni/native_crash_handler.h:
--------------------------------------------------------------------------------
1 | #ifndef _NATIVE_CRASH_HANDLER_H_
2 | #define _NATIVE_CRASH_HANDLER_H_
3 |
4 | #include
5 |
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 |
10 | void init_native_crash_handler();
11 | void destroy_native_crash_handler();
12 |
13 | #ifdef __cplusplus
14 | }
15 | #endif
16 | #endif /* end of _NATIVE_CRASH_HANDLER_H_ */
17 |
--------------------------------------------------------------------------------
/player-android/jni/raw_parser.h:
--------------------------------------------------------------------------------
1 | #ifndef _RAW_PARSER_H_
2 | #define _RAW_PARSER_H_
3 |
4 | #include "xutil.h"
5 | #include "common.h"
6 |
7 | class RawParserBase {
8 | public:
9 | RawParserBase();
10 | virtual ~RawParserBase() = 0;
11 |
12 | virtual int process(byte *dat, uint32_t len) = 0;
13 |
14 | protected:
15 | xutil::MemHolder m_mem_pool;
16 | uint32_t m_raw_len;
17 | };
18 |
19 | /////////////////////////////////////////////////////////////
20 |
21 | class VideoRawParser : public RawParserBase {
22 | public:
23 | VideoRawParser();
24 | virtual ~VideoRawParser();
25 |
26 | virtual int process(byte *dat, uint32_t len);
27 |
28 | uint32_t get_nalu_num() const { return m_nalus.size(); }
29 | const byte *get_nalu_data(uint32_t idx) const;
30 | uint32_t get_nalu_length(uint32_t idx) const;
31 |
32 | const byte *get_sps() const { return m_sps; }
33 | uint32_t get_sps_length() const { return m_sps_len; }
34 | const byte *get_pps() const { return m_pps; }
35 | uint32_t get_pps_length() const { return m_pps_len; }
36 |
37 | bool is_key_frame() const { return m_key_frame; }
38 |
39 | bool sps_pps_changed() { return m_sps_pps_changed; }
40 |
41 | private:
42 | void reset();
43 |
44 | private:
45 | std::vector m_nalus;
46 |
47 | byte m_sps[128];
48 | uint32_t m_sps_len;
49 | byte m_pps[128];
50 | uint32_t m_pps_len;
51 |
52 | bool m_key_frame;
53 |
54 | bool m_sps_pps_changed;
55 | };
56 |
57 | /////////////////////////////////////////////////////////////
58 |
59 | class AudioRawParser : public RawParserBase {
60 | public:
61 | virtual int process(byte *dat, uint32_t len);
62 |
63 | const byte *get_asc() const { return m_asc; }
64 |
65 | private:
66 | static void adts_header2asc(
67 | const byte adts_header[7], byte asc[2]);
68 |
69 | private:
70 | byte m_asc[2]; // AudioSpecificConfig
71 | };
72 |
73 | #endif /* end of _RAW_PARSER_H_ */
74 |
--------------------------------------------------------------------------------
/player-android/jni/rtmp_handler.h:
--------------------------------------------------------------------------------
1 | #ifndef _RTMP_HANDLER_H_
2 | #define _RTMP_HANDLER_H_
3 |
4 | #include
5 |
6 | #include "flv_muxer.h"
7 | #include "xutil.h"
8 |
9 | #ifdef __cplusplus
10 | extern "C" {
11 | #endif
12 |
13 | class VideoRawParser;
14 | class AudioRawParser;
15 | class JitterBuffer;
16 |
17 | class RtmpHandler {
18 | public:
19 | RtmpHandler(const std::string &flvpath);
20 | ~RtmpHandler();
21 |
22 | int connect(const std::string &liveurl);
23 | int disconnect();
24 |
25 | int send_video(int32_t timestamp, byte *dat, uint32_t length);
26 | int send_audio(int32_t timestamp, byte *dat, uint32_t length);
27 |
28 | bool send_rtmp_pkt(int pkttype, uint32_t ts,
29 | const byte *buf, uint32_t pktsize);
30 |
31 | private:
32 | struct DataInfo {
33 | int32_t lts;
34 | int32_t tm_offset;
35 | bool need_cfg;
36 |
37 | DataInfo() :
38 | lts(0), tm_offset(0), need_cfg(true) { }
39 | };
40 |
41 | private:
42 | static int make_asc_body(const byte asc[], byte buf[], uint32_t len);
43 | static int make_audio_body(const byte *dat, uint32_t dat_len, byte buf[], uint32_t len);
44 |
45 | static int make_avc_dcr_body(byte *buf,
46 | const byte *sps, uint32_t sps_len,
47 | const byte *pps, uint32_t pps_len);
48 | static int make_video_body(byte *buf, uint32_t dat_len, bool key_frame);
49 |
50 | static byte pkttyp2channel(byte typ);
51 |
52 | static bool packet_cb(void *opaque, int pkttype,
53 | uint32_t pts, const byte *buf, uint32_t pktsize);
54 |
55 | private:
56 | std::string m_url;
57 |
58 | RTMP *m_rtmp;
59 |
60 | VideoRawParser *m_vparser;
61 | AudioRawParser *m_aparser;
62 |
63 | DataInfo m_vinfo;
64 | DataInfo m_ainfo;
65 |
66 | xutil::MemHolder m_mem_pool;
67 | xutil::RecursiveMutex m_mutex;
68 |
69 | JitterBuffer *m_jitter;
70 |
71 | FLVMuxer m_flvmuxer;
72 | };
73 |
74 | #ifdef __cplusplus
75 | }
76 | #endif
77 | #endif /* end of _RTMP_HANDLER_H_ */
78 |
--------------------------------------------------------------------------------
/player-android/jni/video_encoder.h:
--------------------------------------------------------------------------------
1 | #ifndef _VIDEO_ENCODER_H_
2 | #define _VIDEO_ENCODER_H_
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "common.h"
9 | #include "xqueue.h"
10 | #include "xfile.h"
11 | #include "xmedia.h"
12 | #include "xutil.h"
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | class VideoEncoder {
19 | public:
20 | VideoEncoder();
21 | ~VideoEncoder();
22 |
23 | int init(jobject video_config);
24 | int feed(uint8_t *buffer, int len, int rotation);
25 | volatile bool quit() const;
26 |
27 | private:
28 | int load_config(jobject video_config);
29 | void dump_config() const;
30 |
31 | int encode_nals(Packet *pkt, const x264_nal_t *nals, int nnal);
32 |
33 | struct FPSCtrl {
34 | int64_t a, b;
35 | int last_frame;
36 | int get_frame;
37 | int n;
38 | int64_t dropped_frames;
39 | int64_t adoped_frames;
40 | uint64_t capture_start_time;
41 | uint64_t start_timestamp;
42 | bool first_timestamp;
43 | uint64_t avg_timestamp_per_frame;
44 | uint64_t tgt_avg_time_per_frame;
45 | int64_t low_diff_accept_frames;
46 | int tgt_fps;
47 |
48 | int init(int tgt_fps, int orig_fps = 30);
49 | };
50 |
51 | private:
52 | std::string m_preset;
53 | std::string m_tune;
54 | std::string m_profile;
55 | int m_level_idc;
56 | int m_input_csp;
57 | int m_bitrate;
58 | int m_width;
59 | int m_height;
60 | Rational m_fps;
61 | Rational m_orig_fps;
62 | int m_i_frame_interval;
63 | bool m_repeat_headers;
64 | int m_b_frames;
65 | bool m_deblocking_filter;
66 | x264_param_t m_params;
67 | x264_t *m_enc;
68 | x264_picture_t m_pic;
69 | uint64_t m_start_pts;
70 | int m_frame_num;
71 | DECL_THREAD_ROUTINE(VideoEncoder, encode_routine);
72 | xutil::Thread *m_thrd;
73 | Queue m_queue;
74 | volatile bool m_quit;
75 | xfile::File *m_file_yuv;
76 | xfile::File *m_file_x264;
77 | xmedia::FPSCalc m_fps_calc;
78 | FPSCtrl m_fps_ctrl;
79 | };
80 |
81 | jint openVideoEncoder(JNIEnv *env, jobject, jobject);
82 | jint closeVideoEncoder(JNIEnv *env, jobject);
83 | jint sendRawVideo(JNIEnv *env, jobject thiz, jbyteArray byte_arr, jint len, int rotation);
84 |
85 | #ifdef __cplusplus
86 | }
87 | #endif
88 | #endif /* end of _VIDEO_ENCODER_H_ */
89 |
--------------------------------------------------------------------------------
/player-android/jni/xutil/xfile.h:
--------------------------------------------------------------------------------
1 | #ifndef _FILE_H_
2 | #define _FILE_H_
3 |
4 | #include "xutil.h"
5 |
6 | namespace xfile {
7 |
8 | class File {
9 | public:
10 | File();
11 | ~File();
12 |
13 | bool open(const std::string &path, const char *mode);
14 | bool flush();
15 | void close();
16 |
17 | off_t cursor() const;
18 | off_t size() const { return m_filesz; }
19 | const char *get_path() const { return m_path.c_str(); }
20 | bool eof() const { return !!feof(m_fp); }
21 | bool is_opened() const { return m_fp != NULL; }
22 |
23 | bool seek_begin() const;
24 | bool seek_end() const;
25 | bool seek_ahead(off_t cnt) const; // cursor move forward
26 | bool seek_behind(off_t cnt) const; // cursor move backward
27 | bool seek_to(off_t pos) const;
28 |
29 | bool readi8(int8_t *val) const;
30 | bool readi16(int16_t *val, bool net_order = false) const;
31 | bool readi24(int32_t *val, bool net_order = false) const;
32 | bool readi32(int32_t *val, bool net_order = false) const;
33 | bool readi64(int64_t *val, bool net_order = false) const;
34 | bool readui8(uint8_t *val) const;
35 | bool readui16(uint16_t *val, bool net_order = false) const;
36 | bool readui24(uint32_t *val, bool net_order = false) const;
37 | bool readui32(uint32_t *val, bool net_order = false) const;
38 | bool readui64(uint64_t *val, bool net_order = false) const;
39 | bool read_buffer(uint8_t *buf, size_t sz) const;
40 | bool read_line(char *buf, size_t sz) const;
41 |
42 | bool writei8(int8_t val) const;
43 | bool writei16(int16_t val, bool net_order = false) const;
44 | bool writei24(int32_t val, bool net_order = false) const;
45 | bool writei32(int32_t val, bool net_order = false) const;
46 | bool writei64(int64_t val, bool net_order = false) const;
47 | bool writeui8(uint8_t val) const;
48 | bool writeui16(uint16_t val, bool net_order = false) const;
49 | bool writeui24(uint32_t val, bool net_order = false) const;
50 | bool writeui32(uint32_t val, bool net_order = false) const;
51 | bool writeui64(uint64_t val, bool net_order = false) const;
52 | bool write_string(const char *val) const;
53 | bool write_buffer(const uint8_t *buffer, long len) const;
54 |
55 | static std::string read_content(const std::string &path);
56 | static int flush_content(const std::string &path, const uint8_t *buf, int buf_size, const char *mode = "w");
57 |
58 | private:
59 | FILE *m_fp;
60 | off_t m_filesz;
61 | std::string m_path;
62 | };
63 |
64 | }
65 |
66 | #endif /* end of _FILE_H_ */
67 |
--------------------------------------------------------------------------------
/player-android/jni/xutil/xlog.h:
--------------------------------------------------------------------------------
1 | #ifndef _XLOG_H_
2 | #define _XLOG_H_
3 |
4 | #include
5 | #include
6 |
7 | #ifndef LOG_TAG
8 | #define LOG_TAG "FQRtmp"
9 | #endif
10 |
11 | #define V(fmt, ...) libfqrtmp_log_print(basename(__FILE__), __LINE__, ANDROID_LOG_VERBOSE, LOG_TAG, fmt, ##__VA_ARGS__)
12 | #define D(fmt, ...) libfqrtmp_log_print(basename(__FILE__), __LINE__, ANDROID_LOG_DEBUG, LOG_TAG, fmt, ##__VA_ARGS__)
13 | #define I(fmt, ...) libfqrtmp_log_print(basename(__FILE__), __LINE__, ANDROID_LOG_INFO, LOG_TAG, fmt, ##__VA_ARGS__)
14 | #define W(fmt, ...) libfqrtmp_log_print(basename(__FILE__), __LINE__, ANDROID_LOG_WARN, LOG_TAG, fmt, ##__VA_ARGS__)
15 | #define E(fmt, ...) libfqrtmp_log_print(basename(__FILE__), __LINE__, ANDROID_LOG_ERROR, LOG_TAG, fmt, ##__VA_ARGS__)
16 |
17 | #ifdef __cplusplus
18 | extern "C" {
19 | #endif
20 |
21 | static inline int libfqrtmp_log_print(const char *file, const int line,
22 | const android_LogPriority prio, const char *tag,
23 | const char *fmt, ...)
24 | {
25 | char buf[4096];
26 | int ret;
27 |
28 | ret = snprintf(buf, 4096, "[%s:%04d] ", file, line);
29 |
30 | va_list args;
31 | va_start(args, fmt);
32 | vsnprintf(buf + ret, 4096 - ret, fmt, args);
33 | va_end(args);
34 |
35 | __android_log_write(prio, tag, buf);
36 | return 0;
37 | }
38 |
39 | #ifdef __cplusplus
40 | }
41 | #endif
42 | #endif /* end of _XLOG_H_ */
43 |
--------------------------------------------------------------------------------
/player-android/jni/xutil/xmedia.h:
--------------------------------------------------------------------------------
1 | #ifndef _XMEDIA_H_
2 | #define _XMEDIA_H_
3 |
4 | #include
5 | #include
6 |
7 | #define AAC_ADTS_HEADER_SIZE 7
8 |
9 | // Startcode: |0x00 0x00 0x01|
10 | #define STARTCODE3(nalu) \
11 | (nalu[0]==0 && nalu[1]==0 && nalu[2]==1)
12 | // Startcode: |0x00 0x00 0x00 0x01|
13 | #define STARTCODE4(nalu) \
14 | (nalu[0]==0 && nalu[1]==0 && nalu[2]==0 && nalu[3]==1)
15 |
16 | namespace xmedia {
17 |
18 | const static byte nalu_startcode[] = {0, 0, 0, 1};
19 |
20 | struct AVCDecorderConfigurationRecord {
21 | byte version;
22 | byte profile;
23 | byte profile_compatibility;
24 | byte level;
25 | byte length_size_minus_one : 2;
26 | byte : 6;
27 | byte num_of_sps : 5;
28 | byte : 3;
29 | uint16_t sps_length;
30 | byte *sps;
31 | byte num_of_pps;
32 | uint16_t pps_length;
33 | byte *pps;
34 | };
35 |
36 | void print_avc_dcr(const AVCDecorderConfigurationRecord &avc_dcr);
37 |
38 | struct AudioSpecificConfig {
39 | byte dat[2];
40 | };
41 | int generate_asc(AudioSpecificConfig &asc,
42 | uint8_t profile, uint8_t sample_rate_idx, uint8_t channel);
43 | int parse_asc(const AudioSpecificConfig &asc,
44 | uint8_t &profile, uint8_t &sample_rate_idx, uint8_t &channel);
45 | void print_asc(const AudioSpecificConfig &asc);
46 |
47 | int generate_adts_header(const AudioSpecificConfig &asc,
48 | uint32_t aac_len, byte adts_hdr[7]);
49 | int generate_adts_header(const uint8_t asc_buf[2],
50 | uint32_t aac_len, byte adts_hdr[7]);
51 |
52 | int str_to_audioprof(const char *str);
53 | const char *audioprof_to_str(int aprof);
54 | int str_to_samplerate_idx(const char *str);
55 | const char *samplerate_idx_to_str(int rate_idx);
56 |
57 | struct SPS {
58 | unsigned int sps_id;
59 | int profile_idc;
60 | int level_idc;
61 | int chroma_format_idc;
62 | int residual_color_transform_flag;
63 | int bit_depth_luma;
64 | int bit_depth_chroma;
65 | int transform_bypass;
66 | uint8_t scaling_matrix4[6][16];
67 | uint8_t scaling_matrix8[6][64];
68 | int scaling_matrix_present;
69 | int colorspace;
70 | int mb_width;
71 | int mb_height;
72 | int frame_mbs_only_flag;
73 | int log2_max_frame_num;
74 | int poc_type;
75 | int log2_max_poc_lsb;
76 | int delta_pic_order_always_zero_flag;
77 | int offset_for_non_ref_pic;
78 | int offset_for_top_to_bottom_field;
79 | int poc_cycle_length;
80 | short offset_for_ref_frame[256];
81 | int ref_frame_count;
82 | int gaps_in_frame_num_allowed_flag;
83 | };
84 |
85 | struct PPS {
86 | int transform_8x8_mode;
87 | int OTHER_NOT_SUPPORTED;
88 | };
89 |
90 | int h264_decode_sps(xutil::GetBitContext *gb, SPS *sps);
91 |
92 | class BitrateCalc {
93 | public:
94 | BitrateCalc() :
95 | m_bits(0), m_bitrate(0), m_tm_last(0) { }
96 |
97 | void check(uint32_t bits = 0,
98 | uint32_t interval = 1000); // 1000ms
99 | uint32_t get_bitrate();
100 |
101 | private:
102 | uint64_t m_bits;
103 | uint64_t m_bitrate;
104 | uint64_t m_tm_last;
105 | };
106 |
107 | class FPSCalc {
108 | public:
109 | FPSCalc() :
110 | m_frame_num(0), m_fps(0), m_tm_last(0) { }
111 |
112 | void check(uint32_t frame_count = 1,
113 | uint32_t interval = 1000); // Ditto
114 | float get_fps();
115 |
116 | private:
117 | uint32_t m_frame_num;
118 | float m_fps;
119 | uint64_t m_tm_last;
120 | };
121 |
122 | }
123 |
124 | #endif /* end of _XMEDIA_H_ */
125 |
--------------------------------------------------------------------------------
/player-android/jni/xutil/xqueue.h:
--------------------------------------------------------------------------------
1 | #ifndef _XQUEUE_H_
2 | #define _XQUEUE_H_
3 |
4 | #include
5 |
6 | #include "xutil.h"
7 |
8 | template
9 | class Queue {
10 | public:
11 | Queue();
12 | ~Queue();
13 |
14 | int push(const T &item);
15 | int pop(T &item);
16 | int front(T &item) const;
17 | int back(T &item) const;
18 |
19 | int size() const;
20 | void cancel_wait();
21 |
22 | private:
23 | std::queue m_queue;
24 | volatile bool m_cancel_wait;
25 |
26 | mutable xutil::RecursiveMutex m_mutex;
27 | mutable xutil::Condition m_cond;
28 | };
29 |
30 | template
31 | Queue::Queue() :
32 | m_cancel_wait(false),
33 | m_cond(m_mutex)
34 | {
35 | }
36 |
37 | template
38 | Queue::~Queue()
39 | {
40 | }
41 |
42 | template
43 | int Queue::push(const T &item)
44 | {
45 | xutil::AutoLock _l(m_mutex);
46 |
47 | m_queue.push(item);
48 |
49 | if (m_queue.size() == 1) {
50 | if (m_cond.signal() < 0)
51 | return -1;
52 | }
53 |
54 | return 0;
55 | }
56 |
57 | template
58 | int Queue::front(T &item) const
59 | {
60 | xutil::AutoLock _l(m_mutex);
61 |
62 | while (m_queue.empty() && !m_cancel_wait) {
63 | if (m_cond.wait() < 0)
64 | return -1;
65 | }
66 |
67 | if (m_queue.empty())
68 | return -1;
69 |
70 | item = m_queue.front();
71 | return 0;
72 | }
73 |
74 | template
75 | int Queue::back(T &item) const
76 | {
77 | xutil::AutoLock _l(m_mutex);
78 |
79 | while (m_queue.empty() && !m_cancel_wait) {
80 | if (m_cond.wait() < 0)
81 | return -1;
82 | }
83 |
84 | if (m_queue.empty())
85 | return -1;
86 |
87 | item = m_queue.back();
88 | return 0;
89 | }
90 |
91 | template
92 | int Queue::pop(T &item)
93 | {
94 | if (front(item) < 0)
95 | return -1;
96 |
97 | xutil::AutoLock _l(m_mutex);
98 | m_queue.pop();
99 | return 0;
100 | }
101 |
102 | template
103 | int Queue::size() const
104 | {
105 | xutil::AutoLock _l(m_mutex);
106 |
107 | return m_queue.size();
108 | }
109 |
110 | template
111 | void Queue::cancel_wait()
112 | {
113 | xutil::AutoLock _l(m_mutex);
114 |
115 | m_cancel_wait = true;
116 | m_cond.broadcast();
117 | }
118 |
119 | #endif /* end of _XQUEUE_H_ */
120 |
--------------------------------------------------------------------------------
/player-android/jni/xutil/xtype.h:
--------------------------------------------------------------------------------
1 | #ifndef _XTYPE_H_
2 | #define _XTYPE_H_
3 |
4 | #define __STDC_LIMIT_MACROS
5 | #include
6 |
7 | typedef uint8_t uint24_t[3];
8 | typedef uint8_t byte;
9 |
10 | #endif /* end of _XTYPE_H_ */
11 |
--------------------------------------------------------------------------------
/player-android/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/player-android/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-23
15 |
--------------------------------------------------------------------------------
/player-android/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/player-android/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/player-android/res/drawable-mdpi/bg_camera_pattern.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/player-android/res/drawable-mdpi/bg_camera_pattern.png
--------------------------------------------------------------------------------
/player-android/res/drawable-mdpi/border_view_finder.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/player-android/res/drawable-mdpi/border_view_finder.9.png
--------------------------------------------------------------------------------
/player-android/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/player-android/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/player-android/res/drawable-mdpi/ic_viewfinder_camera_facing_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/player-android/res/drawable-mdpi/ic_viewfinder_camera_facing_back.png
--------------------------------------------------------------------------------
/player-android/res/drawable-mdpi/ic_viewfinder_camera_facing_front.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/player-android/res/drawable-mdpi/ic_viewfinder_camera_facing_front.png
--------------------------------------------------------------------------------
/player-android/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/player-android/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/player-android/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dengxiayehu/fqrtmpplayer/5d11979021b82f8840ed218779c009850c650e46/player-android/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/player-android/res/drawable/camera_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/player-android/res/layout/info.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
12 |
22 |
32 |
--------------------------------------------------------------------------------
/player-android/res/layout/live.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
12 |
16 |
19 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/player-android/res/layout/player.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
--------------------------------------------------------------------------------
/player-android/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
21 |
--------------------------------------------------------------------------------
/player-android/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #89079010
4 | #89079010
5 |
6 |
--------------------------------------------------------------------------------
/player-android/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | FQRtmpPlayer
4 |
5 | Play
6 | Live
7 | About
8 |
9 | Input rtmp url
10 |
11 | OK
12 | Cancel
13 |
14 | Press again to exit
15 |
16 | Invalid rtmp url
17 |
18 | Press menu to start
19 |
20 | mail: dengxiayehu@yeah.net
21 | QQ: 947980562
22 |
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/FQRtmpCrashHandler.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer;
2 |
3 | import java.io.BufferedWriter;
4 | import java.io.FileNotFoundException;
5 | import java.io.FileOutputStream;
6 | import java.io.IOException;
7 | import java.io.OutputStreamWriter;
8 | import java.io.PrintWriter;
9 | import java.io.StringWriter;
10 | import java.io.Writer;
11 | import java.lang.Thread.UncaughtExceptionHandler;
12 |
13 | import com.dxyh.fqrtmpplayer.util.AndroidDevices;
14 | import com.dxyh.fqrtmpplayer.util.Logcat;
15 | import com.dxyh.fqrtmpplayer.util.Util;
16 |
17 | import android.os.Environment;
18 | import android.text.format.DateFormat;
19 | import android.util.Log;
20 |
21 | public class FQRtmpCrashHandler implements UncaughtExceptionHandler {
22 | private static final String TAG = "FQRtmpCrashHandler";
23 |
24 | private UncaughtExceptionHandler defaultUEH;
25 |
26 | public FQRtmpCrashHandler() {
27 | this.defaultUEH = Thread.getDefaultUncaughtExceptionHandler();
28 | }
29 |
30 | @Override
31 | public void uncaughtException(Thread thread, Throwable ex) {
32 | final Writer result = new StringWriter();
33 | final PrintWriter printWriter = new PrintWriter(result);
34 |
35 | StackTraceElement[] trace = ex.getStackTrace();
36 | StackTraceElement[] trace2 = new StackTraceElement[trace.length + 3];
37 | System.arraycopy(trace, 0, trace2, 0, trace.length);
38 | trace2[trace.length + 0] = new StackTraceElement("Android", "MODEL", android.os.Build.MODEL, -1);
39 | trace2[trace.length + 1] = new StackTraceElement("Android", "VERSION", android.os.Build.VERSION.RELEASE, -1);
40 | trace2[trace.length + 2] = new StackTraceElement("Android", "FINGERPRINT", android.os.Build.FINGERPRINT, -1);
41 | ex.setStackTrace(trace2);
42 |
43 | ex.printStackTrace(printWriter);
44 | String stacktrace = result.toString();
45 | printWriter.close();
46 | Log.e(TAG, stacktrace);
47 |
48 | if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
49 | writeLog(stacktrace, AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY + "/vlc_crash");
50 | writeLogcat(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY + "/vlc_logcat");
51 | }
52 |
53 | defaultUEH.uncaughtException(thread, ex);
54 | }
55 |
56 | private void writeLog(String log, String name) {
57 | CharSequence timestamp = DateFormat.format("yyyyMMdd_kkmmss", System.currentTimeMillis());
58 | String filename = name + "_" + timestamp + ".log";
59 |
60 | FileOutputStream stream;
61 | try {
62 | stream = new FileOutputStream(filename);
63 | } catch (FileNotFoundException e) {
64 | e.printStackTrace();
65 | return;
66 | }
67 |
68 | OutputStreamWriter output = new OutputStreamWriter(stream);
69 | BufferedWriter bw = new BufferedWriter(output);
70 |
71 | try {
72 | bw.write(log);
73 | bw.newLine();
74 | } catch (IOException e) {
75 | e.printStackTrace();
76 | } finally {
77 | Util.close(bw);
78 | Util.close(output);
79 | }
80 | }
81 |
82 | private void writeLogcat(String name) {
83 | CharSequence timestamp = DateFormat.format("yyyyMMdd_kkmmss", System.currentTimeMillis());
84 | String filename = name + "_" + timestamp + ".log";
85 | try {
86 | Logcat.writeLogcat(filename);
87 | } catch (IOException e) {
88 | Log.e(TAG, "Cannot write logcat to disk");
89 | }
90 | }
91 | }
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/IFQRtmp.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer;
2 |
3 | public interface IFQRtmp {
4 | public void process(final String url);
5 | public void onResume();
6 | public void onPause();
7 | public void close();
8 | }
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/MyApplication.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer;
2 |
3 | import java.util.concurrent.LinkedBlockingQueue;
4 | import java.util.concurrent.ThreadPoolExecutor;
5 | import java.util.concurrent.TimeUnit;
6 |
7 | import android.app.Application;
8 | import android.content.Context;
9 | import android.content.res.Resources;
10 | import android.util.Log;
11 |
12 | import com.dxyh.libfqrtmp.LibFQRtmp;
13 |
14 | public class MyApplication extends Application implements LibFQRtmp.OnNativeCrashListener {
15 | private final static String TAG = "MyApplication";
16 | private static MyApplication instance;
17 |
18 | private ThreadPoolExecutor mThreadPool = new ThreadPoolExecutor(0, 3, 2, TimeUnit.SECONDS,
19 | new LinkedBlockingQueue());
20 |
21 | @Override
22 | public void onCreate() {
23 | super.onCreate();
24 |
25 | instance = this;
26 |
27 | LibFQRtmp.setOnNativeCrashListener(this);
28 | }
29 |
30 | @Override
31 | public void onNativeCrash() {
32 | Log.e(TAG, "FQRtmpPlayer crashed");
33 | }
34 |
35 | @Override
36 | public void onLowMemory() {
37 | super.onLowMemory();
38 | Log.w(TAG, "System is running low on memory");
39 | }
40 |
41 | public static MyApplication getInstance() {
42 | return instance;
43 | }
44 |
45 | public static Context getAppContext() {
46 | return instance;
47 | }
48 |
49 | public static Resources getAppResources() {
50 | return instance.getResources();
51 | }
52 |
53 | public static void runBackground(Runnable runnable) {
54 | instance.mThreadPool.execute(runnable);
55 | }
56 | }
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/aidl/IClientCallback.aidl:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.aidl;
2 |
3 | import com.dxyh.fqrtmpplayer.aidl.IPlayer;
4 |
5 | interface IClientCallback {
6 | void onPrepared(IPlayer player);
7 | void onCompletion(IPlayer player);
8 | void onBufferingUpdateListener(IPlayer player, int percent);
9 | boolean onError(IPlayer player, int what, int extra);
10 | }
11 |
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/aidl/IPlayer.aidl:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.aidl;
2 |
3 | import android.view.Surface;
4 |
5 | import com.dxyh.fqrtmpplayer.aidl.IClientCallback;
6 |
7 | interface IPlayer {
8 | void create();
9 | void setDataSource(String path);
10 | void prepare();
11 | void setDisplay(in Surface surf);
12 | void start();
13 | void stop();
14 | void pause();
15 | void release();
16 | int getVideoWidth();
17 | int getVideoHeight();
18 | boolean isPlaying();
19 | boolean isSeekable();
20 | int getCurrentPosition();
21 | int getDuration();
22 | long getTime();
23 | void setTime(long time);
24 | int getVolume();
25 | int setVolume(int volume);
26 | void setPosition(float pos);
27 | int getAudioTracksCount();
28 | int getAudioTrack();
29 | boolean setAudioTrack(int index);
30 | void seekTo(int delta);
31 | void selectTrack(int index);
32 | void registerClientCallback(IClientCallback cb);
33 | }
34 |
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/camera/CameraHardwareException.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.camera;
2 |
3 | public class CameraHardwareException extends Exception {
4 | private static final long serialVersionUID = 1989071319901001520L;
5 |
6 | public CameraHardwareException(Throwable t) {
7 | super(t);
8 | }
9 | }
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/gui/PreviewFrameLayout.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.gui;
2 |
3 | import com.dxyh.fqrtmpplayer.R;
4 |
5 | import android.content.Context;
6 | import android.util.AttributeSet;
7 | import android.util.Log;
8 | import android.view.ViewGroup;
9 | import android.widget.FrameLayout;
10 |
11 | public class PreviewFrameLayout extends ViewGroup {
12 | private static final String TAG = "PreviewFrameLayout";
13 |
14 | public interface OnSizeChangedListener {
15 | public void onSizeChanged();
16 | }
17 |
18 | private double mAspectRatio = 4.0 / 3.0;
19 | private FrameLayout mFrame;
20 | private OnSizeChangedListener mSizeListener;
21 |
22 | public PreviewFrameLayout(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | public void setOnSizeChangedListener(OnSizeChangedListener listener) {
27 | mSizeListener = listener;
28 | }
29 |
30 | @Override
31 | protected void onFinishInflate() {
32 | mFrame = (FrameLayout) findViewById(R.id.frame);
33 | if (mFrame == null) {
34 | throw new IllegalStateException(
35 | "must provide child with id as \"frame\"");
36 | }
37 | }
38 |
39 | public void setAspectRatio(double ratio) {
40 | if (ratio <= 0.0) throw new IllegalArgumentException();
41 |
42 | if (mAspectRatio != ratio) {
43 | mAspectRatio = ratio;
44 | requestLayout();
45 | }
46 | }
47 |
48 | @Override
49 | protected void onLayout(boolean changed, int l, int t, int r, int b) {
50 | Log.d(TAG, "onLayout (changed=" + changed + ", l=" + l + ", t=" + t + ", r=" + r + ", b=" + b);
51 |
52 | int frameWidth = getWidth();
53 | int frameHeight = getHeight();
54 |
55 | FrameLayout f = mFrame;
56 | int horizontalPadding = f.getPaddingLeft() + f.getPaddingRight();
57 | int verticalPadding = f.getPaddingBottom() + f.getPaddingTop();
58 | int previewHeight = frameHeight - verticalPadding;
59 | int previewWidth = frameWidth - horizontalPadding;
60 |
61 | if (previewWidth > previewHeight * mAspectRatio) {
62 | previewWidth = (int) (previewHeight * mAspectRatio + .5);
63 | } else {
64 | previewHeight = (int) (previewWidth / mAspectRatio + .5);
65 | }
66 |
67 | frameWidth = previewWidth + horizontalPadding;
68 | frameHeight = previewHeight + verticalPadding;
69 |
70 | int hSpace = ((r - l) - frameWidth) / 2;
71 | int vSpace = ((b - t) - frameHeight) / 2;
72 | mFrame.measure(
73 | MeasureSpec.makeMeasureSpec(frameWidth, MeasureSpec.EXACTLY),
74 | MeasureSpec.makeMeasureSpec(frameHeight, MeasureSpec.EXACTLY));
75 | mFrame.layout(l + hSpace, t + vSpace, r - hSpace, b - vSpace);
76 | if (mSizeListener != null) {
77 | mSizeListener.onSizeChanged();
78 | }
79 | }
80 | }
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/gui/RotateImageView.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.gui;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Rect;
6 | import android.graphics.drawable.Drawable;
7 | import android.util.AttributeSet;
8 | import android.view.animation.AnimationUtils;
9 | import android.widget.ImageView;
10 |
11 | public class RotateImageView extends ImageView {
12 |
13 | @SuppressWarnings("unused")
14 | private static final String TAG = "RotateImageView";
15 |
16 | private static final int ANIMATION_SPEED = 180;
17 |
18 | private int mCurrentDegree = 0;
19 | private int mStartDegree = 0;
20 | private int mTargetDegree = 0;
21 |
22 | private boolean mClockwise = false;
23 |
24 | private long mAnimationStartTime = 0;
25 | private long mAnimationEndTime = 0;
26 |
27 | public RotateImageView(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 | }
30 |
31 | public void setDegree(int degree) {
32 | degree = degree >= 0 ? degree % 360 : degree % 360 + 360;
33 | if (degree == mTargetDegree) return;
34 |
35 | mTargetDegree = degree;
36 | mStartDegree = mCurrentDegree;
37 | mAnimationStartTime = AnimationUtils.currentAnimationTimeMillis();
38 |
39 | int diff = mTargetDegree - mCurrentDegree;
40 | diff = diff >= 0 ? diff : 360 + diff; // make it in range [0, 359]
41 |
42 | diff = diff > 180 ? diff - 360 : diff;
43 |
44 | mClockwise = diff >= 0;
45 | mAnimationEndTime = mAnimationStartTime
46 | + Math.abs(diff) * 1000 / ANIMATION_SPEED;
47 |
48 | invalidate();
49 | }
50 |
51 | @Override
52 | protected void onDraw(Canvas canvas) {
53 |
54 | Drawable drawable = getDrawable();
55 | if (drawable == null) return;
56 |
57 | Rect bounds = drawable.getBounds();
58 | int w = bounds.right - bounds.left;
59 | int h = bounds.bottom - bounds.top;
60 |
61 | if (w == 0 || h == 0) return; // nothing to draw
62 |
63 | if (mCurrentDegree != mTargetDegree) {
64 | long time = AnimationUtils.currentAnimationTimeMillis();
65 | if (time < mAnimationEndTime) {
66 | int deltaTime = (int)(time - mAnimationStartTime);
67 | int degree = mStartDegree + ANIMATION_SPEED
68 | * (mClockwise ? deltaTime : -deltaTime) / 1000;
69 | degree = degree >= 0 ? degree % 360 : degree % 360 + 360;
70 | mCurrentDegree = degree;
71 | invalidate();
72 | } else {
73 | mCurrentDegree = mTargetDegree;
74 | }
75 | }
76 |
77 | int left = getPaddingLeft();
78 | int top = getPaddingTop();
79 | int right = getPaddingRight();
80 | int bottom = getPaddingBottom();
81 | int width = getWidth() - left - right;
82 | int height = getHeight() - top - bottom;
83 |
84 | int saveCount = canvas.getSaveCount();
85 | canvas.translate(left + width / 2, top + height / 2);
86 | canvas.rotate(-mCurrentDegree);
87 | canvas.translate(-w / 2, -h / 2);
88 | drawable.draw(canvas);
89 | canvas.restoreToCount(saveCount);
90 | }
91 | }
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/gui/UiTools.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.gui;
2 |
3 | import com.dxyh.fqrtmpplayer.MyApplication;
4 | import com.dxyh.fqrtmpplayer.R;
5 |
6 | import android.app.Activity;
7 | import android.app.AlertDialog;
8 | import android.app.Dialog;
9 | import android.content.DialogInterface;
10 | import android.provider.Settings;
11 | import android.text.TextUtils;
12 | import android.view.Window;
13 | import android.view.WindowManager;
14 | import android.widget.EditText;
15 | import android.widget.Toast;
16 |
17 | public class UiTools {
18 | @SuppressWarnings("unused")
19 | private static final String TAG = "UiTools";
20 |
21 | public interface OnInputDialogClickListener {
22 | public void onClick(DialogInterface dialog, final String input);
23 | }
24 | public static void inputDialog(Activity activity, final String title,
25 | final String hint,
26 | final OnInputDialogClickListener positive_listener,
27 | final OnInputDialogClickListener negative_listener) {
28 | final EditText edit = new EditText(MyApplication.getAppContext());
29 | edit.setFocusable(true);
30 | if (!TextUtils.isEmpty(hint)) {
31 | edit.setHint(hint);
32 | } else {
33 | edit.setHint(R.string.edit_hint);
34 | }
35 | edit.setSingleLine(true);
36 | edit.setSelection(edit.getText().toString().length());
37 |
38 | AlertDialog.Builder builder =
39 | new AlertDialog.Builder(activity);
40 | builder.setTitle(title)
41 | .setIcon(android.R.drawable.ic_dialog_info)
42 | .setView(edit)
43 | .setCancelable(false)
44 | .setPositiveButton(R.string.dialog_positive_btn_label,new Dialog.OnClickListener() {
45 | @Override
46 | public void onClick(DialogInterface dialog, int which) {
47 | if (positive_listener != null)
48 | positive_listener.onClick(dialog, edit.getText().toString());
49 | }})
50 | .setNegativeButton(R.string.dialog_negative_btn_label, new Dialog.OnClickListener() {
51 | @Override
52 | public void onClick(DialogInterface dialog, int which) {
53 | if (negative_listener != null)
54 | negative_listener.onClick(dialog, edit.getText().toString());
55 | }});
56 | builder.show();
57 | }
58 |
59 | public static final int SHORT_TOAST = Toast.LENGTH_SHORT;
60 | public static final int LONG_TOAST = Toast.LENGTH_LONG;
61 |
62 | public static void toast(final Activity activity, final String text, final int duration) {
63 | activity.runOnUiThread(new Runnable() {
64 | @Override
65 | public void run() {
66 | Toast.makeText(activity, text, duration).show();
67 | }
68 | });
69 | }
70 |
71 | public static void adjust_brightness(final Activity activity, final float brightness) {
72 | activity.runOnUiThread(new Runnable() {
73 | @Override
74 | public void run() {
75 | Window win = activity.getWindow();
76 |
77 | int mode = Settings.System.getInt(
78 | activity.getContentResolver(),
79 | Settings.System.SCREEN_BRIGHTNESS_MODE,
80 | Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
81 | if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
82 | WindowManager.LayoutParams winParams = win.getAttributes();
83 | winParams.screenBrightness = brightness;
84 | win.setAttributes(winParams);
85 | }
86 | }
87 | });
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/player/media/MediaWrapper.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.player.media;
2 |
3 | public class MediaWrapper {
4 | public final static int MEDIA_VIDEO = 0x01;
5 | public final static int MEDIA_NO_HWACCEL = 0x02;
6 | public final static int MEDIA_PAUSED = 0x4;
7 | public final static int MEDIA_FORCE_AUDIO = 0x8;
8 | }
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/player/util/VLCInstance.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.player.util;
2 |
3 | import org.videolan.libvlc.LibVLC;
4 | import org.videolan.libvlc.util.VLCUtil;
5 |
6 | import android.content.Context;
7 | import android.util.Log;;
8 |
9 | public class VLCInstance {
10 | public final static String TAG = "VLCInstance";
11 |
12 | private static LibVLC sLibVLC = null;
13 |
14 | /** A set of utility functions for the VLC application */
15 | public synchronized static LibVLC get(final Context context) throws IllegalStateException {
16 | if (sLibVLC == null) {
17 | if (!VLCUtil.hasCompatibleCPU(context)) {
18 | Log.e(TAG, VLCUtil.getErrorMsg());
19 | throw new IllegalStateException("LibVLC initialisation failed: " + VLCUtil.getErrorMsg());
20 | }
21 |
22 | sLibVLC = new LibVLC(VLCOptions.getLibOptions());
23 | LibVLC.setOnNativeCrashListener(new LibVLC.OnNativeCrashListener() {
24 | @Override
25 | public void onNativeCrash() {
26 | Log.e(TAG, "FATAL: LHPlayer crashed");
27 | }
28 | });
29 | }
30 | return sLibVLC;
31 | }
32 |
33 | public static synchronized void restart() throws IllegalStateException {
34 | if (sLibVLC != null) {
35 | sLibVLC.release();
36 | sLibVLC = new LibVLC(VLCOptions.getLibOptions());
37 | }
38 | }
39 |
40 | public static synchronized boolean testCompatibleCPU(Context context) {
41 | if (sLibVLC == null && !VLCUtil.hasCompatibleCPU(context))
42 | return false;
43 | else
44 | return true;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/util/AndroidDevices.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.util;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.FileNotFoundException;
5 | import java.io.FileReader;
6 | import java.io.IOException;
7 | import java.util.ArrayList;
8 | import java.util.Arrays;
9 | import java.util.List;
10 | import java.util.StringTokenizer;
11 |
12 | import android.os.Environment;
13 |
14 | public class AndroidDevices {
15 | public final static String TAG = "AndroidDevices";
16 | public final static String EXTERNAL_PUBLIC_DIRECTORY = Environment.getExternalStorageDirectory().getPath();
17 |
18 | public static boolean hasExternalStorage() {
19 | return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
20 | }
21 |
22 | public static ArrayList getStorageDirectories() {
23 | BufferedReader bufReader = null;
24 | ArrayList list = new ArrayList();
25 | list.add(EXTERNAL_PUBLIC_DIRECTORY);
26 |
27 | List typeWL = Arrays.asList("vfat", "exfat", "sdcardfs", "fuse", "ntfs", "fat32", "ext3", "ext4",
28 | "esdfs");
29 | List typeBL = Arrays.asList("tmpfs");
30 | String[] mountWL = { "/mnt", "/Removable", "/storage" };
31 | String[] mountBL = { "/mnt/secure", "/mnt/shell", "/mnt/asec", "/mnt/obb", "/mnt/media_rw/extSdCard",
32 | "/mnt/media_rw/sdcard", "/storage/emulated" };
33 | String[] deviceWL = { "/dev/block/vold", "/dev/fuse", "/mnt/media_rw" };
34 |
35 | try {
36 | bufReader = new BufferedReader(new FileReader("/proc/mounts"));
37 | String line;
38 | while ((line = bufReader.readLine()) != null) {
39 |
40 | StringTokenizer tokens = new StringTokenizer(line, " ");
41 | String device = tokens.nextToken();
42 | String mountpoint = tokens.nextToken();
43 | String type = tokens.nextToken();
44 |
45 | // skip if already in list or if type/mountpoint is blacklisted
46 | if (list.contains(mountpoint) || typeBL.contains(type) || Strings.startsWith(mountBL, mountpoint))
47 | continue;
48 |
49 | // check that device is in whitelist, and either type or
50 | // mountpoint is in a whitelist
51 | if (Strings.startsWith(deviceWL, device)
52 | && (typeWL.contains(type) || Strings.startsWith(mountWL, mountpoint))) {
53 | int position = Strings.containsName(list, FileUtils.getFileNameFromPath(mountpoint));
54 | if (position > -1)
55 | list.remove(position);
56 | list.add(mountpoint);
57 | }
58 | }
59 | } catch (FileNotFoundException e) {
60 | } catch (IOException e) {
61 | } finally {
62 | Util.close(bufReader);
63 | }
64 | return list;
65 | }
66 | }
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/util/FileUtils.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.util;
2 |
3 | import java.io.File;
4 |
5 | import android.annotation.TargetApi;
6 | import android.net.Uri;
7 | import android.os.Build;
8 | import android.text.TextUtils;
9 |
10 | public class FileUtils {
11 |
12 | public interface Callback {
13 | void onResult(boolean success);
14 | }
15 |
16 | public static String getFileNameFromPath(String path) {
17 | if (path == null)
18 | return "";
19 | int index = path.lastIndexOf('/');
20 | if (index > -1)
21 | return path.substring(index + 1);
22 | else
23 | return path;
24 | }
25 |
26 | public static String getParent(String path) {
27 | if (TextUtils.equals("/", path))
28 | return path;
29 | String parentPath = path;
30 | if (parentPath.endsWith("/"))
31 | parentPath = parentPath.substring(0, parentPath.length() - 1);
32 | int index = parentPath.lastIndexOf('/');
33 | if (index > 0) {
34 | parentPath = parentPath.substring(0, index);
35 | } else if (index == 0)
36 | parentPath = "/";
37 | return parentPath;
38 | }
39 |
40 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
41 | public static boolean deleteFile(String path) {
42 | boolean deleted = false;
43 | path = Uri.decode(Strings.removeFileProtocole(path));
44 | File file = new File(path);
45 | if (file.exists())
46 | deleted |= file.delete();
47 | return deleted;
48 | }
49 |
50 | public static void recursiveDelete(String path, Callback callback) {
51 | recursiveDelete(new File(path), callback);
52 | }
53 |
54 | public static void recursiveDelete(String path) {
55 | recursiveDelete(path, null);
56 | }
57 |
58 | private static void recursiveDelete(final File fileOrDirectory, final Callback callback) {
59 | if (!fileOrDirectory.exists() || !fileOrDirectory.canWrite())
60 | return;
61 | boolean success = true;
62 | if (fileOrDirectory.isDirectory()) {
63 | for (File child : fileOrDirectory.listFiles())
64 | recursiveDelete(child, null);
65 | success = fileOrDirectory.delete();
66 | } else {
67 | success = deleteFile(fileOrDirectory.getPath());
68 | }
69 | if (callback != null)
70 | callback.onResult(success);
71 | }
72 |
73 | public static boolean canWrite(String path) {
74 | if (path == null)
75 | return false;
76 | if (path.startsWith("file://"))
77 | path = path.substring(7);
78 | if (!path.startsWith("/"))
79 | return false;
80 | if (path.startsWith(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY))
81 | return true;
82 | File file = new File(path);
83 | return (file.exists() && file.canWrite());
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/util/Logcat.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.util;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.BufferedWriter;
5 | import java.io.FileNotFoundException;
6 | import java.io.FileOutputStream;
7 | import java.io.IOException;
8 | import java.io.InputStreamReader;
9 | import java.io.OutputStreamWriter;
10 |
11 | public class Logcat {
12 | public final static String TAG = "Logcat";
13 |
14 | public static void writeLogcat(String filename) throws IOException {
15 | String[] args = { "logcat", "-v", "time", "-d" };
16 |
17 | Process process = Runtime.getRuntime().exec(args);
18 |
19 | InputStreamReader input = new InputStreamReader(process.getInputStream());
20 |
21 | FileOutputStream fileStream;
22 | try {
23 | fileStream = new FileOutputStream(filename);
24 | } catch (FileNotFoundException e) {
25 | return;
26 | }
27 |
28 | OutputStreamWriter output = new OutputStreamWriter(fileStream);
29 | BufferedReader br = new BufferedReader(input);
30 | BufferedWriter bw = new BufferedWriter(output);
31 |
32 | try {
33 | String line;
34 | while ((line = br.readLine()) != null) {
35 | bw.write(line);
36 | bw.newLine();
37 | }
38 | } catch (Exception e) {
39 | } finally {
40 | Util.close(bw);
41 | Util.close(output);
42 | Util.close(br);
43 | Util.close(input);
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/util/Strings.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.util;
2 |
3 | import java.text.DecimalFormat;
4 | import java.text.NumberFormat;
5 | import java.util.List;
6 | import java.util.Locale;
7 |
8 | public class Strings {
9 | public final static String TAG = "Strings";
10 |
11 | public static String stripTrailingSlash(String s) {
12 | if (s.endsWith("/") && s.length() > 1)
13 | return s.substring(0, s.length() - 1);
14 | return s;
15 | }
16 |
17 | static boolean startsWith(String[] array, String text) {
18 | for (String item : array)
19 | if (text.startsWith(item))
20 | return true;
21 | return false;
22 | }
23 |
24 | static int containsName(List array, String text) {
25 | for (int i = array.size() - 1; i >= 0; --i)
26 | if (array.get(i).endsWith(text))
27 | return i;
28 | return -1;
29 | }
30 |
31 | /**
32 | * Convert time to a string
33 | *
34 | * @param millis
35 | * e.g.time/length from file
36 | * @return formated string (hh:)mm:ss
37 | */
38 | public static String millisToString(long millis) {
39 | return Strings.millisToString(millis, false);
40 | }
41 |
42 | /**
43 | * Convert time to a string
44 | *
45 | * @param millis
46 | * e.g.time/length from file
47 | * @return formated string "[hh]h[mm]min" / "[mm]min[s]s"
48 | */
49 | public static String millisToText(long millis) {
50 | return Strings.millisToString(millis, true);
51 | }
52 |
53 | static String millisToString(long millis, boolean text) {
54 | boolean negative = millis < 0;
55 | millis = java.lang.Math.abs(millis);
56 |
57 | millis /= 1000;
58 | int sec = (int) (millis % 60);
59 | millis /= 60;
60 | int min = (int) (millis % 60);
61 | millis /= 60;
62 | int hours = (int) millis;
63 |
64 | String time;
65 | DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(Locale.US);
66 | format.applyPattern("00");
67 | if (text) {
68 | if (millis > 0)
69 | time = (negative ? "-" : "") + hours + "h" + format.format(min) + "min";
70 | else if (min > 0)
71 | time = (negative ? "-" : "") + min + "min";
72 | else
73 | time = (negative ? "-" : "") + sec + "s";
74 | } else {
75 | if (millis > 0)
76 | time = (negative ? "-" : "") + hours + ":" + format.format(min) + ":" + format.format(sec);
77 | else
78 | time = (negative ? "-" : "") + min + ":" + format.format(sec);
79 | }
80 | return time;
81 | }
82 |
83 | /**
84 | * equals() with two strings where either could be null
85 | */
86 | public static boolean nullEquals(String s1, String s2) {
87 | return (s1 == null ? s2 == null : s1.equals(s2));
88 | }
89 |
90 | /**
91 | * Get the formatted current playback speed in the form of 1.00x
92 | */
93 | public static String formatRateString(float rate) {
94 | return String.format(java.util.Locale.US, "%.2fx", rate);
95 | }
96 |
97 | public static String readableFileSize(long size) {
98 | if (size <= 0)
99 | return "0";
100 | final String[] units = new String[] { "B", "KiB", "MiB", "GiB", "TiB" };
101 | int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
102 | return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups];
103 | }
104 |
105 | public static String removeFileProtocole(String path) {
106 | if (path == null)
107 | return null;
108 | if (path.startsWith("file://"))
109 | return path.substring(7);
110 | else
111 | return path;
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/fqrtmpplayer/util/Util.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.fqrtmpplayer.util;
2 |
3 | import java.io.Closeable;
4 | import java.io.IOException;
5 |
6 | import android.app.Activity;
7 | import android.hardware.Camera;
8 | import android.util.Log;
9 | import android.view.Surface;
10 |
11 | @SuppressWarnings("deprecation")
12 | public class Util {
13 | private static final String TAG = "Util";
14 |
15 | public static void Assert(boolean cond) {
16 | if (!cond) {
17 | throw new AssertionError();
18 | }
19 | }
20 |
21 | public static boolean close(Closeable closeable) {
22 | if (closeable != null) {
23 | try {
24 | closeable.close();
25 | return true;
26 | } catch (IOException e) {
27 | return false;
28 | }
29 | } else {
30 | return false;
31 | }
32 | }
33 |
34 | public static int getDisplayRotation(Activity activity) {
35 | int rotation = activity.getWindowManager().getDefaultDisplay()
36 | .getRotation();
37 | switch (rotation) {
38 | case Surface.ROTATION_0: return 0;
39 | case Surface.ROTATION_90: return 90;
40 | case Surface.ROTATION_180: return 180;
41 | case Surface.ROTATION_270: return 270;
42 | }
43 | return 0;
44 | }
45 |
46 | public static void setCameraDisplayOrientation(Activity activity,
47 | int cameraId, Camera camera) {
48 | Camera.CameraInfo info = new Camera.CameraInfo();
49 | Camera.getCameraInfo(cameraId, info);
50 | int degrees = getDisplayRotation(activity);
51 | int result;
52 | if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
53 | result = (info.orientation + degrees) % 360;
54 | result = (360 - result) % 360;
55 | } else {
56 | result = (info.orientation - degrees + 360) % 360;
57 | }
58 | Log.d(TAG, "setCameraDisplayOrientation(" + result + ")");
59 | camera.setDisplayOrientation(result);
60 | }
61 | }
--------------------------------------------------------------------------------
/player-android/src/com/dxyh/libfqrtmp/Event.java:
--------------------------------------------------------------------------------
1 | package com.dxyh.libfqrtmp;
2 |
3 | public class Event {
4 | public static final int OPENING = 0;
5 | public static final int CONNECTED = 1;
6 | public static final int ENCOUNTERED_ERROR = 2;
7 |
8 | public final int type;
9 | public final long arg1;
10 | public final String arg2;
11 |
12 | protected Event(int type, long arg1, String arg2) {
13 | this.type = type;
14 | this.arg1 = arg1;
15 | this.arg2 = arg2;
16 | }
17 |
18 | public interface Listener {
19 | void onEvent(Event event);
20 | }
21 | }
--------------------------------------------------------------------------------
/player-android/src/org/videolan/libvlc/IAWindowNativeHandler.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | * public class IAWindowNativeHandler.java
3 | *****************************************************************************
4 | * Copyright © 2015 VLC authors, VideoLAN and VideoLabs
5 | *
6 | * This program is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation; either version 2.1 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with this program; if not, write to the Free Software Foundation,
18 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 | *****************************************************************************/
20 |
21 | package org.videolan.libvlc;
22 |
23 | import android.view.Surface;
24 |
25 | public interface IAWindowNativeHandler {
26 | /**
27 | * Callback called from {@link IVLCVout#sendMouseEvent}.
28 | *
29 | * @param nativeHandle handle passed by {@link #setCallback}.
30 | * @param action see ACTION_* in {@link android.view.MotionEvent}.
31 | * @param button see BUTTON_* in {@link android.view.MotionEvent}.
32 | * @param x x coordinate.
33 | * @param y y coordinate.
34 | */
35 | void nativeOnMouseEvent(long nativeHandle, int action, int button, int x, int y);
36 |
37 | /**
38 | * Callback called from {@link IVLCVout#setWindowSize}.
39 | *
40 | * @param nativeHandle handle passed by {@link #setCallback}.
41 | * @param width width of the window.
42 | * @param height height of the window.
43 | */
44 | void nativeOnWindowSize(long nativeHandle, int width, int height);
45 |
46 | /**
47 | * Get the valid Video surface.
48 | *
49 | * @return can be null if the surface was destroyed.
50 | */
51 | Surface getVideoSurface();
52 |
53 | /**
54 | * Get the valid Subtitles surface.
55 | *
56 | * @return can be null if the surface was destroyed.
57 | */
58 | Surface getSubtitlesSurface();
59 |
60 | /**
61 | * Set a callback in order to receive {@link #nativeOnMouseEvent} and {@link #nativeOnWindowSize} events.
62 | *
63 | * @param nativeHandle native Handle passed by {@link #nativeOnMouseEvent} and {@link #nativeOnWindowSize}
64 | * @return true if callback was successfully registered
65 | */
66 | boolean setCallback(long nativeHandle);
67 |
68 | /**
69 | * This method is only used for ICS and before since ANativeWindow_setBuffersGeometry doesn't work before.
70 | * It is synchronous.
71 | *
72 | * @param surface surface returned by getVideoSurface or getSubtitlesSurface
73 | * @param width surface width
74 | * @param height surface height
75 | * @param format color format (or PixelFormat)
76 | * @return true if buffersGeometry were set (only before ICS)
77 | */
78 | boolean setBuffersGeometry(Surface surface, int width, int height, int format);
79 |
80 | /**
81 | * Set the window Layout.
82 | * This call will result of {@link IVLCVout.Callback#onNewLayout} being called from the main thread.
83 | *
84 | * @param width Frame width
85 | * @param height Frame height
86 | * @param visibleWidth Visible frame width
87 | * @param visibleHeight Visible frame height
88 | * @param sarNum Surface aspect ratio numerator
89 | * @param sarDen Surface aspect ratio denominator
90 | */
91 | void setWindowLayout(int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen);
92 | }
--------------------------------------------------------------------------------
/player-android/src/org/videolan/libvlc/MediaDiscoverer.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | * MediaDiscoverer.java
3 | *****************************************************************************
4 | * Copyright © 2015 VLC authors, VideoLAN and VideoLabs
5 | *
6 | * This program is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation; either version 2.1 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with this program; if not, write to the Free Software Foundation,
18 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 | *****************************************************************************/
20 |
21 | package org.videolan.libvlc;
22 |
23 | public class MediaDiscoverer extends VLCObject {
24 | private final static String TAG = "LibVLC/MediaDiscoverer";
25 |
26 | public static class Event extends VLCEvent {
27 |
28 | public static final int Started = 0x500;
29 | public static final int Ended = 0x501;
30 |
31 | protected Event(int type) {
32 | super(type);
33 | }
34 | }
35 |
36 | public interface EventListener extends VLCEvent.Listener {}
37 |
38 | private MediaList mMediaList = null;
39 |
40 | /**
41 | * Create a MediaDiscover.
42 | *
43 | * @param libVLC a valid LibVLC
44 | * @param name Name of the vlc service discovery ("dsm", "upnp", "bonjour"...).
45 | */
46 | public MediaDiscoverer(LibVLC libVLC, String name) {
47 | nativeNew(libVLC, name);
48 | }
49 |
50 | /**
51 | * Starts the discovery. This MediaDiscoverer should be alive (not released).
52 | *
53 | * @return true the service is started
54 | */
55 | public boolean start() {
56 | if (isReleased())
57 | throw new IllegalStateException("MediaDiscoverer is released");
58 | return nativeStart();
59 | }
60 |
61 | /**
62 | * Stops the discovery. This MediaDiscoverer should be alive (not released).
63 | * (You can also call {@link #release() to stop the discovery directly}.
64 | */
65 | public void stop() {
66 | if (isReleased())
67 | throw new IllegalStateException("MediaDiscoverer is released");
68 | nativeStop();
69 | }
70 |
71 | public void setEventListener(EventListener listener) {
72 | super.setEventListener(listener);
73 | }
74 |
75 | @Override
76 | protected Event onEventNative(int eventType, long arg1, float arg2) {
77 | switch (eventType) {
78 | case Event.Started:
79 | case Event.Ended:
80 | return new Event(eventType);
81 | }
82 | return null;
83 | }
84 |
85 | /**
86 | * Get the MediaList associated with the MediaDiscoverer.
87 | * This MediaDiscoverer should be alive (not released).
88 | *
89 | * @return MediaList. This MediaList should be released with {@link #release()}.
90 | */
91 | public MediaList getMediaList() {
92 | synchronized (this) {
93 | if (mMediaList != null) {
94 | mMediaList.retain();
95 | return mMediaList;
96 | }
97 | }
98 | final MediaList mediaList = new MediaList(this);
99 | synchronized (this) {
100 | mMediaList = mediaList;
101 | mMediaList.retain();
102 | return mMediaList;
103 | }
104 | }
105 |
106 | @Override
107 | protected void onReleaseNative() {
108 | if (mMediaList != null)
109 | mMediaList.release();
110 | nativeRelease();
111 | }
112 |
113 | /* JNI */
114 | private native void nativeNew(LibVLC libVLC, String name);
115 | private native void nativeRelease();
116 | private native boolean nativeStart();
117 | private native void nativeStop();
118 | }
119 |
--------------------------------------------------------------------------------
/player-android/src/org/videolan/libvlc/VLCEvent.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | * VLCEvent.java
3 | *****************************************************************************
4 | * Copyright © 2015 VLC authors, VideoLAN and VideoLabs
5 | *
6 | * This program is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation; either version 2.1 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with this program; if not, write to the Free Software Foundation,
18 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 | *****************************************************************************/
20 |
21 | package org.videolan.libvlc;
22 |
23 | abstract class VLCEvent {
24 | public final int type;
25 | protected final long arg1;
26 | protected final float arg2;
27 |
28 | protected VLCEvent(int type) {
29 | this.type = type;
30 | this.arg1 = 0;
31 | this.arg2 = 0;
32 | }
33 | protected VLCEvent(int type, long arg1) {
34 | this.type = type;
35 | this.arg1 = arg1;
36 | this.arg2 = 0;
37 | }
38 | protected VLCEvent(int type, float arg2) {
39 | this.type = type;
40 | this.arg1 = 0;
41 | this.arg2 = arg2;
42 | }
43 |
44 | /**
45 | * Listener for libvlc events
46 | *
47 | * @see VLCEvent
48 | */
49 | public interface Listener {
50 | void onEvent(T event);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/player-android/src/org/videolan/libvlc/util/AndroidUtil.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | * AndroidUtil.java
3 | *****************************************************************************
4 | * Copyright © 2015 VLC authors, VideoLAN and VideoLabs
5 | *
6 | * This program is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation; either version 2.1 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with this program; if not, write to the Free Software Foundation,
18 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 | *****************************************************************************/
20 |
21 | package org.videolan.libvlc.util;
22 |
23 | import java.io.File;
24 |
25 | import android.net.Uri;
26 | import android.os.Build;
27 |
28 | public class AndroidUtil {
29 | public static boolean isFroyoOrLater() {
30 | return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO;
31 | }
32 |
33 | public static boolean isGingerbreadOrLater() {
34 | return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD;
35 | }
36 |
37 | public static boolean isHoneycombOrLater() {
38 | return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB;
39 | }
40 |
41 | public static boolean isHoneycombMr1OrLater() {
42 | return android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1;
43 | }
44 |
45 | public static boolean isICSOrLater() {
46 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
47 | }
48 |
49 | public static boolean isJellyBeanOrLater() {
50 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
51 | }
52 |
53 | public static boolean isJellyBeanMR1OrLater() {
54 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
55 | }
56 |
57 | public static boolean isJellyBeanMR2OrLater() {
58 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2;
59 | }
60 |
61 | public static File UriToFile(Uri uri) {
62 | return new File(uri.getPath().replaceFirst("file://", ""));
63 | }
64 |
65 | /**
66 | * Quickly converts path to URIs, which are mandatory in libVLC.
67 | *
68 | * @param path The path to be converted.
69 | * @return A URI representation of path
70 | */
71 | public static Uri PathToUri(String path) {
72 | return Uri.fromFile(new File(path));
73 | }
74 |
75 | public static Uri LocationToUri(String location) {
76 | Uri uri = Uri.parse(location);
77 | if (uri.getScheme() == null)
78 | throw new IllegalArgumentException("location has no scheme");
79 | return uri;
80 | }
81 |
82 | public static Uri FileToUri(File file) {
83 | return Uri.fromFile(file);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/player-android/src/org/videolan/libvlc/util/Extensions.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | * Extensions.java
3 | *****************************************************************************
4 | * Copyright © 2015 VLC authors, VideoLAN and VideoLabs
5 | *
6 | * This program is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation; either version 2.1 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with this program; if not, write to the Free Software Foundation,
18 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 | *****************************************************************************/
20 |
21 | package org.videolan.libvlc.util;
22 |
23 | import java.util.Arrays;
24 | import java.util.HashSet;
25 |
26 | public class Extensions {
27 |
28 | public final static HashSet VIDEO = new HashSet();
29 | public final static HashSet AUDIO = new HashSet();
30 | public final static HashSet SUBTITLES = new HashSet();
31 | public final static HashSet PLAYLIST = new HashSet();
32 |
33 |
34 | static {
35 | final String[] videoExtensions = {
36 | ".3g2", ".3gp", ".3gp2", ".3gpp", ".amv", ".asf", ".avi", ".divx", ".drc", ".dv",
37 | ".f4v", ".flv", ".gvi", ".gxf", ".ismv", ".iso", ".m1v", ".m2v", ".m2t", ".m2ts",
38 | ".m4v", ".mkv", ".mov", ".mp2", ".mp2v", ".mp4", ".mp4v", ".mpe", ".mpeg",
39 | ".mpeg1", ".mpeg2", ".mpeg4", ".mpg", ".mpv2", ".mts", ".mtv", ".mxf", ".mxg",
40 | ".nsv", ".nut", ".nuv", ".ogm", ".ogv", ".ogx", ".ps", ".rec", ".rm", ".rmvb",
41 | ".tod", ".ts", ".tts", ".vob", ".vro", ".webm", ".wm", ".wmv", ".wtv", ".xesc" };
42 |
43 | final String[] audioExtensions = {
44 | ".3ga", ".a52", ".aac", ".ac3", ".adt", ".adts", ".aif", ".aifc", ".aiff", ".amr",
45 | ".aob", ".ape", ".awb", ".caf", ".dts", ".flac", ".it", ".m4a", ".m4b", ".m4p",
46 | ".mid", ".mka", ".mlp", ".mod", ".mpa", ".mp1", ".mp2", ".mp3", ".mpc", ".mpga",
47 | ".oga", ".ogg", ".oma", ".opus", ".ra", ".ram", ".rmi", ".s3m", ".spx", ".tta",
48 | ".voc", ".vqf", ".w64", ".wav", ".wma", ".wv", ".xa", ".xm" };
49 |
50 | final String[] subtitlesExtensions = {
51 | ".idx", ".sub", ".srt", ".ssa", ".ass", ".smi", ".utf", ".utf8", ".utf-8",
52 | ".rt", ".aqt", ".txt", ".usf", ".jss", ".cdg", ".psb", ".mpsub",".mpl2",
53 | ".pjs", ".dks", ".stl", ".vtt" };
54 |
55 | final String[] playlistExtensions = {".m3u", ".asx", ".b4s", ".pls", ".xspf"/*, ".zip"*/};
56 |
57 | VIDEO.addAll(Arrays.asList(videoExtensions));
58 | AUDIO.addAll(Arrays.asList(audioExtensions));
59 | SUBTITLES.addAll(Arrays.asList(subtitlesExtensions));
60 | PLAYLIST.addAll(Arrays.asList(playlistExtensions));
61 | }
62 | }
--------------------------------------------------------------------------------