├── .gitignore
├── app
├── .gitignore
├── CMakeLists.txt
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ ├── drawer
│ │ ├── base_drawer.cpp
│ │ ├── base_drawer.h
│ │ ├── triangle_drawer.cpp
│ │ └── triangle_drawer.h
│ ├── egl
│ │ ├── egl_core.cpp
│ │ ├── egl_core.h
│ │ ├── egl_surface.cpp
│ │ ├── egl_surface.h
│ │ ├── gl_render.cpp
│ │ └── gl_render.h
│ ├── filter
│ │ ├── adjust
│ │ │ ├── brightness_filter.cpp
│ │ │ ├── brightness_filter.h
│ │ │ ├── color_invert_filter.cpp
│ │ │ ├── color_invert_filter.h
│ │ │ ├── contrast_image_filter.cpp
│ │ │ ├── contrast_image_filter.h
│ │ │ ├── exposure_filter.cpp
│ │ │ ├── exposure_filter.h
│ │ │ ├── hue_filter.cpp
│ │ │ ├── hue_filter.h
│ │ │ ├── saturation_filter.cpp
│ │ │ ├── saturation_filter.h
│ │ │ ├── sharpen_filter.cpp
│ │ │ └── sharpen_filter.h
│ │ └── base
│ │ │ ├── image_filter.cpp
│ │ │ └── image_filter.h
│ ├── opengl_demo.cpp
│ ├── render
│ │ ├── image_render.cpp
│ │ └── image_render.h
│ └── utils
│ │ ├── logger.h
│ │ ├── opengl_utils.h
│ │ └── stb_image.h
│ ├── java
│ └── com
│ │ └── poney
│ │ ├── blogdemo
│ │ ├── MainActivity.java
│ │ ├── base
│ │ │ └── camera
│ │ │ │ ├── Camera1Loader.kt
│ │ │ │ ├── Camera2Loader.kt
│ │ │ │ ├── CameraLoader.kt
│ │ │ │ ├── CameraPreview.java
│ │ │ │ ├── ImageExt.kt
│ │ │ │ └── ViewExt.kt
│ │ ├── demo1
│ │ │ ├── DemoActivity.java
│ │ │ ├── EGLDemoActivity.java
│ │ │ ├── drawer
│ │ │ │ ├── BitmapDrawer.kt
│ │ │ │ ├── IDrawer.kt
│ │ │ │ └── TriangleDrawer.kt
│ │ │ └── filter
│ │ │ │ └── base
│ │ │ │ └── GPUImageFilterType.java
│ │ ├── demo2
│ │ │ ├── H264AACFFMpegActivity.kt
│ │ │ ├── H264AACMediaCodecActivity.kt
│ │ │ ├── H264AsyncMediaCodecActivity.kt
│ │ │ └── Mp4MediaCodecActivity.kt
│ │ ├── ffplaydemo
│ │ │ ├── FFAVPlayerActivity.java
│ │ │ └── FFPlayActivity.java
│ │ └── mediacodecdemo
│ │ │ ├── lib
│ │ │ ├── AudioDecoder.java
│ │ │ ├── AudioExtractor.java
│ │ │ ├── BaseDecoder.java
│ │ │ ├── DecodeState.java
│ │ │ ├── DecodeType.java
│ │ │ ├── IDecoder.java
│ │ │ ├── IExtractor.java
│ │ │ ├── IStateListener.java
│ │ │ ├── MMExtractor.java
│ │ │ ├── VideoDecoder.java
│ │ │ └── VideoExtractor.java
│ │ │ └── play
│ │ │ ├── MediaCodecAVActivity.java
│ │ │ ├── MediaCodecAVSyncActivity.java
│ │ │ └── advance
│ │ │ ├── CodecState.java
│ │ │ ├── MediaCodecPlayer.java
│ │ │ ├── MediaTimeProvider.java
│ │ │ ├── NonBlockingAudioTrack.java
│ │ │ └── VideoFrameReleaseTimeHelper.java
│ │ └── utils
│ │ └── AutoFitSurfaceView.kt
│ └── res
│ ├── color
│ ├── selector_image_back.xml
│ ├── selector_image_edit.xml
│ └── selector_image_edit_yellow.xml
│ ├── drawable-v24
│ └── ic_launcher_foreground.xml
│ ├── drawable-xxhdpi
│ ├── edit_bg_adjust_contrast.png
│ ├── edit_bg_adjust_contrast_press.png
│ ├── edit_bg_adjust_exposure.png
│ ├── edit_bg_adjust_exposure_press.png
│ ├── edit_bg_adjust_hdr.png
│ ├── edit_bg_adjust_hdr_press.png
│ ├── edit_bg_adjust_saturation.png
│ ├── edit_bg_adjust_saturation_press.png
│ ├── edit_bg_adjust_sharpness.png
│ ├── edit_bg_adjust_sharpness_press.png
│ ├── edit_bg_adjust_vibrance.png
│ ├── edit_bg_adjust_vibrance_press.png
│ ├── edit_color_hue.png
│ └── edit_color_hue_press.png
│ ├── drawable
│ ├── ic_default.xml
│ ├── ic_default_select.xml
│ ├── ic_launcher_background.xml
│ ├── ic_switch_camera.xml
│ ├── selector_image_edit_adjust_bright.xml
│ ├── selector_image_edit_adjust_contrast.xml
│ ├── selector_image_edit_adjust_default.xml
│ ├── selector_image_edit_adjust_exposure.xml
│ ├── selector_image_edit_adjust_hue.xml
│ ├── selector_image_edit_adjust_saturation.xml
│ ├── selector_image_edit_adjust_sharpness.xml
│ └── selector_image_edit_adjust_vibrance.xml
│ ├── layout
│ ├── activity_codec_h_a.xml
│ ├── activity_codec_mp4.xml
│ ├── activity_demo.xml
│ ├── activity_egl_demo.xml
│ ├── activity_f_f_a_v_player.xml
│ ├── activity_ff_play.xml
│ ├── activity_ffmpeg_h_a.xml
│ ├── activity_main.xml
│ └── activity_media_codec_a_v.xml
│ ├── mipmap-anydpi-v26
│ ├── ic_launcher.xml
│ └── ic_launcher_round.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-mdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xhdpi
│ ├── ic_launcher.png
│ ├── ic_launcher_round.png
│ └── icon_default.jpg
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.png
│ ├── ic_launcher_round.png
│ ├── ic_qxx.png
│ └── wall.jpg
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── buildv21.gradle
├── common
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── poney
│ │ └── ffmpeg
│ │ ├── base
│ │ ├── AbsBaseActivity.java
│ │ └── BaseApplication.java
│ │ ├── core
│ │ └── AppCore.java
│ │ ├── task
│ │ └── AssertReleaseTask.java
│ │ └── utils
│ │ ├── ResReadUtils.java
│ │ ├── ShaderUtils.java
│ │ └── TextureUtils.java
│ └── res
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── libyuv-single
├── .gitignore
├── build.gradle
├── libs
│ └── armeabi-v7a
│ │ └── libyuv.so
├── proguard-rules.pro
└── src
│ ├── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ │ └── 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
│ │ │ ├── macros_msa.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
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── poney
│ └── libyuv
│ └── single
│ └── ExampleUnitTest.java
├── media
├── .gitignore
├── CMakeLists.txt
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ ├── encode
│ │ ├── encode_jpeg.cpp
│ │ ├── encode_jpeg.h
│ │ ├── encode_mp4.cpp
│ │ ├── encode_mp4.h
│ │ ├── encode_video.cpp
│ │ ├── encode_video.h
│ │ ├── logger.h
│ │ ├── native_code.cpp
│ │ └── native_code.h
│ ├── ffmpeg
│ │ ├── ffplay_demo.cpp
│ │ └── include
│ │ │ ├── libavcodec
│ │ │ ├── ac3_parser.h
│ │ │ ├── adts_parser.h
│ │ │ ├── avcodec.h
│ │ │ ├── avdct.h
│ │ │ ├── avfft.h
│ │ │ ├── d3d11va.h
│ │ │ ├── dirac.h
│ │ │ ├── dv_profile.h
│ │ │ ├── dxva2.h
│ │ │ ├── jni.h
│ │ │ ├── mediacodec.h
│ │ │ ├── qsv.h
│ │ │ ├── vaapi.h
│ │ │ ├── vdpau.h
│ │ │ ├── version.h
│ │ │ ├── videotoolbox.h
│ │ │ ├── vorbis_parser.h
│ │ │ └── xvmc.h
│ │ │ ├── libavdevice
│ │ │ ├── avdevice.h
│ │ │ └── version.h
│ │ │ ├── libavfilter
│ │ │ ├── avfilter.h
│ │ │ ├── buffersink.h
│ │ │ ├── buffersrc.h
│ │ │ └── version.h
│ │ │ ├── libavformat
│ │ │ ├── avformat.h
│ │ │ ├── avio.h
│ │ │ └── version.h
│ │ │ ├── libavutil
│ │ │ ├── adler32.h
│ │ │ ├── aes.h
│ │ │ ├── aes_ctr.h
│ │ │ ├── attributes.h
│ │ │ ├── audio_fifo.h
│ │ │ ├── avassert.h
│ │ │ ├── avconfig.h
│ │ │ ├── avstring.h
│ │ │ ├── avutil.h
│ │ │ ├── base64.h
│ │ │ ├── blowfish.h
│ │ │ ├── bprint.h
│ │ │ ├── bswap.h
│ │ │ ├── buffer.h
│ │ │ ├── camellia.h
│ │ │ ├── cast5.h
│ │ │ ├── channel_layout.h
│ │ │ ├── common.h
│ │ │ ├── cpu.h
│ │ │ ├── crc.h
│ │ │ ├── des.h
│ │ │ ├── dict.h
│ │ │ ├── display.h
│ │ │ ├── downmix_info.h
│ │ │ ├── encryption_info.h
│ │ │ ├── error.h
│ │ │ ├── eval.h
│ │ │ ├── ffversion.h
│ │ │ ├── fifo.h
│ │ │ ├── file.h
│ │ │ ├── frame.h
│ │ │ ├── hash.h
│ │ │ ├── hdr_dynamic_metadata.h
│ │ │ ├── hmac.h
│ │ │ ├── hwcontext.h
│ │ │ ├── hwcontext_cuda.h
│ │ │ ├── hwcontext_d3d11va.h
│ │ │ ├── hwcontext_drm.h
│ │ │ ├── hwcontext_dxva2.h
│ │ │ ├── hwcontext_mediacodec.h
│ │ │ ├── hwcontext_qsv.h
│ │ │ ├── hwcontext_vaapi.h
│ │ │ ├── hwcontext_vdpau.h
│ │ │ ├── hwcontext_videotoolbox.h
│ │ │ ├── imgutils.h
│ │ │ ├── intfloat.h
│ │ │ ├── intreadwrite.h
│ │ │ ├── lfg.h
│ │ │ ├── log.h
│ │ │ ├── lzo.h
│ │ │ ├── macros.h
│ │ │ ├── mastering_display_metadata.h
│ │ │ ├── mathematics.h
│ │ │ ├── md5.h
│ │ │ ├── mem.h
│ │ │ ├── motion_vector.h
│ │ │ ├── murmur3.h
│ │ │ ├── opt.h
│ │ │ ├── parseutils.h
│ │ │ ├── pixdesc.h
│ │ │ ├── pixelutils.h
│ │ │ ├── pixfmt.h
│ │ │ ├── random_seed.h
│ │ │ ├── rational.h
│ │ │ ├── rc4.h
│ │ │ ├── replaygain.h
│ │ │ ├── ripemd.h
│ │ │ ├── samplefmt.h
│ │ │ ├── sha.h
│ │ │ ├── sha512.h
│ │ │ ├── spherical.h
│ │ │ ├── stereo3d.h
│ │ │ ├── tea.h
│ │ │ ├── threadmessage.h
│ │ │ ├── time.h
│ │ │ ├── timecode.h
│ │ │ ├── timestamp.h
│ │ │ ├── tree.h
│ │ │ ├── twofish.h
│ │ │ ├── tx.h
│ │ │ ├── version.h
│ │ │ └── xtea.h
│ │ │ ├── libpostproc
│ │ │ ├── postprocess.h
│ │ │ └── version.h
│ │ │ ├── libswresample
│ │ │ ├── swresample.h
│ │ │ └── version.h
│ │ │ └── libswscale
│ │ │ ├── swscale.h
│ │ │ └── version.h
│ ├── sdl2
│ │ └── include
│ │ │ ├── SDL.h
│ │ │ ├── SDL_assert.h
│ │ │ ├── SDL_atomic.h
│ │ │ ├── SDL_audio.h
│ │ │ ├── SDL_bits.h
│ │ │ ├── SDL_blendmode.h
│ │ │ ├── SDL_clipboard.h
│ │ │ ├── SDL_config.h
│ │ │ ├── SDL_config.h.cmake
│ │ │ ├── SDL_config.h.in
│ │ │ ├── SDL_config_android.h
│ │ │ ├── SDL_config_iphoneos.h
│ │ │ ├── SDL_config_macosx.h
│ │ │ ├── SDL_config_minimal.h
│ │ │ ├── SDL_config_pandora.h
│ │ │ ├── SDL_config_psp.h
│ │ │ ├── SDL_config_windows.h
│ │ │ ├── SDL_config_winrt.h
│ │ │ ├── SDL_config_wiz.h
│ │ │ ├── SDL_copying.h
│ │ │ ├── SDL_cpuinfo.h
│ │ │ ├── SDL_egl.h
│ │ │ ├── SDL_endian.h
│ │ │ ├── SDL_error.h
│ │ │ ├── SDL_events.h
│ │ │ ├── SDL_filesystem.h
│ │ │ ├── SDL_gamecontroller.h
│ │ │ ├── SDL_gesture.h
│ │ │ ├── SDL_haptic.h
│ │ │ ├── SDL_hints.h
│ │ │ ├── SDL_joystick.h
│ │ │ ├── SDL_keyboard.h
│ │ │ ├── SDL_keycode.h
│ │ │ ├── SDL_loadso.h
│ │ │ ├── SDL_log.h
│ │ │ ├── SDL_main.h
│ │ │ ├── SDL_messagebox.h
│ │ │ ├── SDL_mouse.h
│ │ │ ├── SDL_mutex.h
│ │ │ ├── SDL_name.h
│ │ │ ├── SDL_opengl.h
│ │ │ ├── SDL_opengl_glext.h
│ │ │ ├── SDL_opengles.h
│ │ │ ├── SDL_opengles2.h
│ │ │ ├── SDL_opengles2_gl2.h
│ │ │ ├── SDL_opengles2_gl2ext.h
│ │ │ ├── SDL_opengles2_gl2platform.h
│ │ │ ├── SDL_opengles2_khrplatform.h
│ │ │ ├── SDL_pixels.h
│ │ │ ├── SDL_platform.h
│ │ │ ├── SDL_power.h
│ │ │ ├── SDL_quit.h
│ │ │ ├── SDL_rect.h
│ │ │ ├── SDL_render.h
│ │ │ ├── SDL_revision.h
│ │ │ ├── SDL_rwops.h
│ │ │ ├── SDL_scancode.h
│ │ │ ├── SDL_shape.h
│ │ │ ├── SDL_stdinc.h
│ │ │ ├── SDL_surface.h
│ │ │ ├── SDL_system.h
│ │ │ ├── SDL_syswm.h
│ │ │ ├── SDL_test.h
│ │ │ ├── SDL_test_assert.h
│ │ │ ├── SDL_test_common.h
│ │ │ ├── SDL_test_compare.h
│ │ │ ├── SDL_test_crc32.h
│ │ │ ├── SDL_test_font.h
│ │ │ ├── SDL_test_fuzzer.h
│ │ │ ├── SDL_test_harness.h
│ │ │ ├── SDL_test_images.h
│ │ │ ├── SDL_test_log.h
│ │ │ ├── SDL_test_md5.h
│ │ │ ├── SDL_test_memory.h
│ │ │ ├── SDL_test_random.h
│ │ │ ├── SDL_thread.h
│ │ │ ├── SDL_timer.h
│ │ │ ├── SDL_touch.h
│ │ │ ├── SDL_types.h
│ │ │ ├── SDL_version.h
│ │ │ ├── SDL_video.h
│ │ │ ├── SDL_vulkan.h
│ │ │ ├── begin_code.h
│ │ │ └── close_code.h
│ └── utils
│ │ ├── const.h
│ │ ├── logger.h
│ │ └── timer.c
│ ├── java
│ └── com
│ │ └── poney
│ │ └── ffmpeg
│ │ ├── audio
│ │ └── AudioRecordLoader.java
│ │ ├── encoder
│ │ ├── AACMediaCodecEncoder.java
│ │ ├── EncoderCallback.java
│ │ ├── H264FFMPEGEncoder.java
│ │ ├── H264MediaCodecAsyncEncoder.java
│ │ ├── H264MediaCodecEncoder.java
│ │ ├── MediaEncoder.java
│ │ └── Mp4MediaCodecRecord.java
│ │ └── play
│ │ ├── FFUtils.java
│ │ └── FFVideoView.java
│ ├── jniLibs
│ └── armeabi-v7a
│ │ ├── libavcodec.so
│ │ ├── libavdevice.so
│ │ ├── libavfilter.so
│ │ ├── libavformat.so
│ │ ├── libavutil.so
│ │ ├── libpostproc.so
│ │ ├── libswresample.so
│ │ └── libswscale.so
│ └── res
│ └── values
│ └── strings.xml
├── pdf
└── opengles20-reference-card.pdf
├── sdl2-hello
├── .gitignore
├── CMakeLists.txt
├── build.gradle
├── libs
│ └── armeabi-v7a
│ │ └── libSDL2.so
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ └── input.bmp
│ ├── cpp
│ ├── include
│ │ ├── SDL.h
│ │ ├── SDL_assert.h
│ │ ├── SDL_atomic.h
│ │ ├── SDL_audio.h
│ │ ├── SDL_bits.h
│ │ ├── SDL_blendmode.h
│ │ ├── SDL_clipboard.h
│ │ ├── SDL_config.h
│ │ ├── SDL_config.h.cmake
│ │ ├── SDL_config.h.in
│ │ ├── SDL_config_android.h
│ │ ├── SDL_config_iphoneos.h
│ │ ├── SDL_config_macosx.h
│ │ ├── SDL_config_minimal.h
│ │ ├── SDL_config_pandora.h
│ │ ├── SDL_config_psp.h
│ │ ├── SDL_config_windows.h
│ │ ├── SDL_config_winrt.h
│ │ ├── SDL_config_wiz.h
│ │ ├── SDL_copying.h
│ │ ├── SDL_cpuinfo.h
│ │ ├── SDL_egl.h
│ │ ├── SDL_endian.h
│ │ ├── SDL_error.h
│ │ ├── SDL_events.h
│ │ ├── SDL_filesystem.h
│ │ ├── SDL_gamecontroller.h
│ │ ├── SDL_gesture.h
│ │ ├── SDL_haptic.h
│ │ ├── SDL_hints.h
│ │ ├── SDL_joystick.h
│ │ ├── SDL_keyboard.h
│ │ ├── SDL_keycode.h
│ │ ├── SDL_loadso.h
│ │ ├── SDL_log.h
│ │ ├── SDL_main.h
│ │ ├── SDL_messagebox.h
│ │ ├── SDL_mouse.h
│ │ ├── SDL_mutex.h
│ │ ├── SDL_name.h
│ │ ├── SDL_opengl.h
│ │ ├── SDL_opengl_glext.h
│ │ ├── SDL_opengles.h
│ │ ├── SDL_opengles2.h
│ │ ├── SDL_opengles2_gl2.h
│ │ ├── SDL_opengles2_gl2ext.h
│ │ ├── SDL_opengles2_gl2platform.h
│ │ ├── SDL_opengles2_khrplatform.h
│ │ ├── SDL_pixels.h
│ │ ├── SDL_platform.h
│ │ ├── SDL_power.h
│ │ ├── SDL_quit.h
│ │ ├── SDL_rect.h
│ │ ├── SDL_render.h
│ │ ├── SDL_revision.h
│ │ ├── SDL_rwops.h
│ │ ├── SDL_scancode.h
│ │ ├── SDL_shape.h
│ │ ├── SDL_stdinc.h
│ │ ├── SDL_surface.h
│ │ ├── SDL_system.h
│ │ ├── SDL_syswm.h
│ │ ├── SDL_test.h
│ │ ├── SDL_test_assert.h
│ │ ├── SDL_test_common.h
│ │ ├── SDL_test_compare.h
│ │ ├── SDL_test_crc32.h
│ │ ├── SDL_test_font.h
│ │ ├── SDL_test_fuzzer.h
│ │ ├── SDL_test_harness.h
│ │ ├── SDL_test_images.h
│ │ ├── SDL_test_log.h
│ │ ├── SDL_test_md5.h
│ │ ├── SDL_test_memory.h
│ │ ├── SDL_test_random.h
│ │ ├── SDL_thread.h
│ │ ├── SDL_timer.h
│ │ ├── SDL_touch.h
│ │ ├── SDL_types.h
│ │ ├── SDL_version.h
│ │ ├── SDL_video.h
│ │ ├── SDL_vulkan.h
│ │ ├── begin_code.h
│ │ └── close_code.h
│ └── sdl2_hello.c
│ ├── java
│ ├── com
│ │ └── poney
│ │ │ └── sdl2
│ │ │ └── hello
│ │ │ └── SDLHelloActivity.java
│ └── org
│ │ └── libsdl
│ │ └── app
│ │ ├── SDL.java
│ │ ├── SDLActivity.java
│ │ ├── SDLAudioManager.java
│ │ └── SDLControllerManager.java
│ └── res
│ ├── layout
│ └── activity_sdl_hello.xml
│ └── values
│ └── strings.xml
├── settings.gradle
└── source
├── cuc_ieschool.mp4
└── mvtest.mp4
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 | .cxx
10 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | android {
5 | compileSdkVersion 29
6 | buildToolsVersion "30.0.2"
7 |
8 | defaultConfig {
9 | applicationId "com.poney.blogdemo"
10 | minSdkVersion 21
11 | targetSdkVersion 29
12 | versionCode 1
13 | versionName "1.0"
14 | externalNativeBuild {
15 | cmake {
16 | cppFlags ""
17 | }
18 | ndk {
19 | abiFilters "armeabi-v7a"
20 | }
21 | }
22 | }
23 |
24 | buildTypes {
25 | release {
26 | minifyEnabled false
27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
28 | }
29 | }
30 | externalNativeBuild {
31 | cmake {
32 | path "CMakeLists.txt"
33 | version "3.10.2"
34 | }
35 | }
36 |
37 |
38 | compileOptions {
39 | sourceCompatibility JavaVersion.VERSION_1_8
40 | targetCompatibility JavaVersion.VERSION_1_8
41 | }
42 | }
43 |
44 | dependencies {
45 | implementation fileTree(dir: "libs", include: ["*.jar"])
46 | implementation 'androidx.appcompat:appcompat:1.2.0'
47 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
48 | implementation dependenciesConfig.butterknife
49 | implementation dependenciesConfig.rxpermissions
50 | implementation dependenciesConfig.rxjava
51 | implementation dependenciesConfig.rxandroid
52 |
53 |
54 | annotationProcessor dependenciesConfig.butterknifeannotation
55 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
56 | implementation project(path: ':media')
57 |
58 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
20 |
21 |
22 |
23 |
24 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/cpp/drawer/base_drawer.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/16.
3 | //
4 |
5 | #include "base_drawer.h"
6 | #include "../utils/logger.h"
7 | #include
8 |
9 | BaseDrawer::BaseDrawer() {
10 |
11 | }
12 |
13 | BaseDrawer::~BaseDrawer() {
14 |
15 | }
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/cpp/drawer/base_drawer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/12.
3 | //
4 |
5 | #ifndef BLOGDEMO_BASE_DRAWER_H
6 | #define BLOGDEMO_BASE_DRAWER_H
7 |
8 | #include
9 | #include "../utils/opengl_utils.h"
10 |
11 | class BaseDrawer {
12 | protected:
13 | const char *TAG = "BaseDrawer";
14 | GLuint m_program_id = 0;
15 |
16 | //顶点坐标接收者
17 | GLint m_vertex_pos_handler = -1;
18 |
19 | //纹理坐标接收者
20 | GLint m_texture_pos_handler = -1;
21 |
22 | //纹理接收者
23 | GLint m_texture_handler = -1;
24 |
25 |
26 | public:
27 |
28 | BaseDrawer();
29 |
30 | ~BaseDrawer();
31 |
32 | virtual void OnInit() = 0;
33 |
34 | virtual void Release() = 0;
35 |
36 | virtual void DoDraw(int textureId, void *vertexPos, void *texturePos) = 0;
37 |
38 | virtual const GLchar *GetVertexShader() = 0;
39 |
40 | virtual const GLchar *GetFragmentShader() = 0;
41 |
42 | };
43 |
44 |
45 | #endif //BLOGDEMO_BASE_DRAWER_H
46 |
--------------------------------------------------------------------------------
/app/src/main/cpp/drawer/triangle_drawer.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/12.
3 | //
4 |
5 | #include "triangle_drawer.h"
6 | #include "../utils/logger.h"
7 |
8 | TriangleDrawer::TriangleDrawer() {
9 |
10 | }
11 |
12 | TriangleDrawer::~TriangleDrawer() {
13 |
14 | }
15 |
16 | void TriangleDrawer::OnInit() {
17 | //创建程序
18 | m_program_id = OpenGLUtils::CreateProgram(GetVertexShader(), GetFragmentShader());
19 | m_vertex_pos_handler = glGetAttribLocation(m_program_id, "aPosition");
20 | }
21 |
22 |
23 | void TriangleDrawer::Release() {
24 | glDisableVertexAttribArray(m_vertex_pos_handler);
25 | glBindTexture(GL_TEXTURE_2D, 0);
26 | glDeleteProgram(m_program_id);
27 | }
28 |
29 | void TriangleDrawer::DoDraw(int textureId, void *vertexPos, void *texturePos) {
30 | //启用顶点的句柄
31 | glEnableVertexAttribArray(m_vertex_pos_handler);
32 | glVertexAttribPointer(m_vertex_pos_handler, 3, GL_FLOAT, GL_FALSE, 0, m_vertex_coors);
33 | //开始绘制
34 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
35 |
36 | }
37 |
38 | const char *TriangleDrawer::GetVertexShader() {
39 | return "attribute vec4 aPosition; \n"
40 | "void main() \n"
41 | "{ \n"
42 | " gl_Position = aPosition; \n"
43 | "} \n";;
44 | }
45 |
46 | const char *TriangleDrawer::GetFragmentShader() {
47 | return "precision mediump float; \n"
48 | "void main() \n"
49 | "{ \n"
50 | " gl_FragColor = vec4 ( 1.0, 0.0, 0.0, 1.0 ); \n"
51 | "} \n";
52 | }
--------------------------------------------------------------------------------
/app/src/main/cpp/drawer/triangle_drawer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/12.
3 | //
4 |
5 | #ifndef BLOGDEMO_TRIANGLE_DRAWER_H
6 | #define BLOGDEMO_TRIANGLE_DRAWER_H
7 |
8 |
9 | #include "base_drawer.h"
10 | #include
11 |
12 | class TriangleDrawer : public BaseDrawer {
13 | private:
14 | const char *TAG = "TriangleDrawer";
15 |
16 | const GLfloat m_vertex_coors[9] = {
17 | -0.5f, -0.5f, 0.0f,//左下
18 | 0.5f, -0.5f, 0.0f,//右下
19 | 0.0f, 0.5f, 0.0f//上
20 | };
21 |
22 |
23 | public:
24 | TriangleDrawer();
25 |
26 | ~TriangleDrawer();
27 |
28 |
29 | void Release() override;
30 |
31 | void DoDraw(int textureId, void *vertexPos, void *texturePos) override;
32 |
33 | void OnInit() override;
34 |
35 | const GLchar *GetVertexShader() override;
36 |
37 | const GLchar *GetFragmentShader() override;
38 | };
39 |
40 |
41 | #endif //BLOGDEMO_TRIANGLE_DRAWER_H
42 |
--------------------------------------------------------------------------------
/app/src/main/cpp/egl/egl_core.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/9/16.
3 | //
4 |
5 | #ifndef WHEAT_EGL_CORE_H
6 | #define WHEAT_EGL_CORE_H
7 |
8 | extern "C" {
9 | #include
10 | #include
11 | };
12 |
13 | class EglCore {
14 | private:
15 | const char *TAG = "EglCore";
16 | //EGL显示窗口
17 | EGLDisplay m_egl_dsp = EGL_NO_DISPLAY;
18 | //EGL上下文
19 | EGLContext m_egl_context = EGL_NO_CONTEXT;
20 | //EGL配置
21 | EGLConfig m_egl_config;
22 |
23 | EGLConfig GetEGLConfig();
24 |
25 | public:
26 | EglCore();
27 |
28 | ~EglCore();
29 |
30 | bool Init(EGLContext share_ctx);
31 |
32 | //根据比例窗口创建显示表面
33 | EGLSurface CreateWindSurface(ANativeWindow *window);
34 |
35 | EGLSurface CreateOffScreenSurface(int width, int height);
36 |
37 | //将OpenGL上下文与当前线程绑定
38 | void MakeCurrent(EGLSurface egl_surface);
39 |
40 | //将缓存数据交换至前台显示
41 | void SwapBuffer(EGLSurface egl_surface);
42 |
43 | //释放显示
44 | void DestroySurface(EGLSurface egl_surface);
45 |
46 | //释放EGL
47 | void Release();
48 | };
49 |
50 |
51 | #endif //WHEAT_EGL_CORE_H
52 |
--------------------------------------------------------------------------------
/app/src/main/cpp/egl/egl_surface.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/9/16.
3 | //
4 |
5 | #include "egl_surface.h"
6 | #include "../utils/logger.h"
7 |
8 | EglSurface::EglSurface() {
9 | m_core = new EglCore();
10 | }
11 |
12 | EglSurface::~EglSurface() {
13 | delete m_core;
14 | }
15 |
16 | bool EglSurface::Init() {
17 | return m_core->Init(NULL);
18 | }
19 | /**
20 | *
21 | * @param native_window 传入上一步创建的ANativeWindow
22 | * @param width
23 | * @param height
24 | */
25 | void EglSurface::CreateEglSurface(ANativeWindow *native_window, int width, int height) {
26 | if (native_window != NULL) {
27 | this->m_native_window = native_window;
28 | m_surface = m_core->CreateWindSurface(m_native_window);
29 | } else {
30 | m_surface = m_core->CreateOffScreenSurface(width, height);
31 | }
32 | if (m_surface == NULL) {
33 | LOGE(TAG, "EGL create window surface fail")
34 | Release();
35 | }
36 | MakeCurrent();
37 | }
38 |
39 | void EglSurface::MakeCurrent() {
40 | m_core->MakeCurrent(m_surface);
41 | }
42 |
43 | void EglSurface::SwapBuffers() {
44 | m_core->SwapBuffer(m_surface);
45 | }
46 |
47 | void EglSurface::DestroyEglSurface() {
48 | if (m_surface != NULL) {
49 | if (m_core != NULL) {
50 | m_core->DestroySurface(m_surface);
51 | }
52 | m_surface = NULL;
53 | }
54 | }
55 |
56 | void EglSurface::Release() {
57 | DestroyEglSurface();
58 | if (m_core != NULL) {
59 | m_core->Release();
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/cpp/egl/egl_surface.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/9/16.
3 | //
4 | #include
5 | #include "egl_core.h"
6 |
7 | #ifndef WHEAT_EGL_SURFACE_H
8 | #define WHEAT_EGL_SURFACE_H
9 |
10 |
11 | class EglSurface {
12 | private:
13 | const char *TAG = "EglSurface";
14 |
15 | ANativeWindow *m_native_window = NULL;
16 |
17 | EglCore *m_core;
18 |
19 | EGLSurface m_surface;
20 | public:
21 | EglSurface();
22 | ~EglSurface();
23 |
24 | bool Init();
25 | void CreateEglSurface(ANativeWindow *native_window, int width, int height);
26 | void MakeCurrent();
27 | void SwapBuffers();
28 | void DestroyEglSurface();
29 | void Release();
30 | };
31 |
32 |
33 | #endif //WHEAT_EGL_SURFACE_H
34 |
--------------------------------------------------------------------------------
/app/src/main/cpp/egl/gl_render.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/9/16.
3 | //
4 |
5 | #ifndef WHEAT_OPENGL_RENDER_H
6 | #define WHEAT_OPENGL_RENDER_H
7 |
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include "egl_surface.h"
15 | #include "../render/image_render.h"
16 |
17 | class GLRender {
18 | private:
19 |
20 | const char *TAG = "GLRender";
21 |
22 | //OpenGL渲染状态
23 | enum STATE {
24 | NO_SURFACE, //没有有效的surface
25 | FRESH_SURFACE, //持有一个为初始化的新的surface
26 | RENDERING, //初始化完毕,可以开始渲染
27 | SURFACE_DESTROY, //surface销毁
28 | STOP //停止绘制
29 | };
30 |
31 | JNIEnv *m_env = NULL;
32 |
33 | //线程依附的jvm环境
34 | JavaVM *m_jvm_for_thread = NULL;
35 |
36 | //Surface引用,必须要使用引用,否则无法在线程中操作
37 | jobject m_surface_ref = NULL;
38 |
39 | //本地屏幕
40 | ANativeWindow *m_native_window = NULL;
41 |
42 | //EGL显示表面
43 | EglSurface *m_egl_surface = NULL;
44 |
45 | int m_window_width = 0;
46 | int m_window_height = 0;
47 | // 绘制代理器
48 | ImageRender *pImageRender = NULL;
49 |
50 | STATE m_state = NO_SURFACE;
51 |
52 | // 初始化相关的方法
53 | void InitRenderThread();
54 |
55 | bool InitEGL();
56 |
57 | void InitDspWindow(JNIEnv *env);
58 |
59 | // 创建/销毁 Surface
60 | void CreateSurface();
61 |
62 |
63 | void DestroySurface();
64 |
65 | // 渲染方法
66 | void Render();
67 |
68 | void ReleaseSurface();
69 |
70 | void ReleaseWindow();
71 |
72 | // 渲染线程回调方法
73 | static void sRenderThread(std::shared_ptr that);
74 |
75 | public:
76 | GLRender(JNIEnv *env);
77 |
78 | ~GLRender();
79 |
80 | void SetSurface(jobject surface);
81 |
82 | void SetOffScreenSize(int width, int height);
83 |
84 | void Stop();
85 |
86 | void SetBitmapRender(ImageRender *bitmapRender);
87 |
88 |
89 | // 释放资源相关方法
90 | void ReleaseRender();
91 |
92 | ImageRender *GetImageRender();
93 | };
94 |
95 |
96 | #endif //WHEAT_OPENGL_RENDER_H
97 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/brightness_filter.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/29.
3 | //
4 |
5 | #include "brightness_filter.h"
6 |
7 | void BrightnessFilter::OnInit() {
8 | ImageFilter::OnInit();
9 | m_brightnessLocation = glGetUniformLocation(m_program_id, "brightness");
10 | setValue(m_brightness);
11 | }
12 |
13 | const GLchar *BrightnessFilter::GetFragmentShader() {
14 | return ""
15 | "varying highp vec2 textureCoordinate;\n"
16 | " \n"
17 | " uniform sampler2D inputImageTexture;\n"
18 | " uniform lowp float brightness;\n"
19 | " \n"
20 | " void main()\n"
21 | " {\n"
22 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n"
23 | " \n"
24 | " gl_FragColor = vec4((textureColor.rgb + vec3(brightness)), textureColor.w);\n"
25 | " }";
26 |
27 | }
28 |
29 | void BrightnessFilter::setValue(float value) {
30 | m_brightness = value;
31 | setFloat(m_brightnessLocation, m_brightness);
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/brightness_filter.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/29.
3 | //
4 |
5 | #ifndef BLOGDEMO_BRIGHTNESS_FILTER_H
6 | #define BLOGDEMO_BRIGHTNESS_FILTER_H
7 |
8 |
9 | #include "../base/image_filter.h"
10 |
11 | class BrightnessFilter : public ImageFilter {
12 | private:
13 | int m_brightnessLocation;
14 | float m_brightness = 0.0f;
15 | public:
16 | virtual void OnInit();
17 |
18 | virtual const GLchar *GetFragmentShader();
19 |
20 | void setValue(float value);
21 | };
22 |
23 |
24 | #endif //BLOGDEMO_BRIGHTNESS_FILTER_H
25 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/color_invert_filter.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/28.
3 | //
4 |
5 | #include "color_invert_filter.h"
6 |
7 |
8 | const GLchar *ColorInvertImageFilter::GetVertexShader() {
9 | return ImageFilter::GetVertexShader();
10 | }
11 |
12 | const GLchar *ColorInvertImageFilter::GetFragmentShader() {
13 | return ""
14 | "varying highp vec2 textureCoordinate;\n"
15 | "\n"
16 | "uniform sampler2D inputImageTexture;\n"
17 | "\n"
18 | "void main()\n"
19 | "{\n"
20 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n"
21 | " \n"
22 | " gl_FragColor = vec4((1.0 - textureColor.rgb), textureColor.w);\n"
23 | "}";;
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/color_invert_filter.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/28.
3 | //
4 |
5 | #ifndef BLOGDEMO_COLOR_INVERT_FILTER_H
6 | #define BLOGDEMO_COLOR_INVERT_FILTER_H
7 |
8 |
9 | #include "../base/image_filter.h"
10 |
11 | class ColorInvertImageFilter : public ImageFilter {
12 | public:
13 |
14 | virtual const GLchar *GetVertexShader();
15 |
16 | virtual const GLchar *GetFragmentShader();
17 | };
18 |
19 |
20 | #endif //BLOGDEMO_COLOR_INVERT_FILTER_H
21 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/contrast_image_filter.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/28.
3 | //
4 |
5 | #include "contrast_image_filter.h"
6 |
7 |
8 | void ContrastImageFilter::OnInit() {
9 | ImageFilter::OnInit();
10 | m_contrastLocation = glGetUniformLocation(m_program_id, "m_contrast");
11 | setValue(m_contrast);
12 | }
13 |
14 | const GLchar *ContrastImageFilter::GetFragmentShader() {
15 | return ""
16 | "varying highp vec2 textureCoordinate;\n"
17 | " \n"
18 | " uniform sampler2D inputImageTexture;\n"
19 | " uniform lowp float m_contrast;\n"
20 | " \n"
21 | " void main()\n"
22 | " {\n"
23 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n"
24 | " \n"
25 | " gl_FragColor = vec4(((textureColor.rgb - vec3(0.5)) * m_contrast + vec3(0.5)), textureColor.w);\n"
26 | " }";
27 |
28 | }
29 |
30 | void ContrastImageFilter::setValue(float contrast) {
31 | m_contrast = contrast;
32 | setFloat(m_contrastLocation, contrast);
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/contrast_image_filter.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/28.
3 | //
4 |
5 | #ifndef BLOGDEMO_CONTRAST_IMAGE_FILTER_H
6 | #define BLOGDEMO_CONTRAST_IMAGE_FILTER_H
7 |
8 |
9 | #include "../base/image_filter.h"
10 |
11 | class ContrastImageFilter : public ImageFilter {
12 | private:
13 | int m_contrastLocation;
14 | float m_contrast = 1.2f;
15 | public:
16 |
17 | virtual void OnInit();
18 |
19 | virtual const GLchar *GetFragmentShader();
20 |
21 | void setValue(float contrast);
22 | };
23 |
24 |
25 | #endif //BLOGDEMO_CONTRAST_IMAGE_FILTER_H
26 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/exposure_filter.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/28.
3 | //
4 |
5 | #include "exposure_filter.h"
6 |
7 | void ExposureFilter::OnInit() {
8 | ImageFilter::OnInit();
9 | m_exposureLocation = glGetUniformLocation(m_program_id, "exposure");
10 | setValue(m_exposure);
11 | }
12 |
13 | const GLchar *ExposureFilter::GetFragmentShader() {
14 | return ""
15 | " varying highp vec2 textureCoordinate;\n"
16 | " \n"
17 | " uniform sampler2D inputImageTexture;\n"
18 | " uniform highp float exposure;\n"
19 | " \n"
20 | " void main()\n"
21 | " {\n"
22 | " highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n"
23 | " \n"
24 | " gl_FragColor = vec4(textureColor.rgb * pow(2.0, exposure), textureColor.w);\n"
25 | " } ";
26 | }
27 |
28 | void ExposureFilter::setValue(float exposure) {
29 | m_exposure = exposure;
30 | setFloat(m_exposureLocation, m_exposure);
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/exposure_filter.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/28.
3 | //
4 |
5 | #ifndef BLOGDEMO_EXPOSURE_FILTER_H
6 | #define BLOGDEMO_EXPOSURE_FILTER_H
7 |
8 |
9 | #include "../base/image_filter.h"
10 |
11 | class ExposureFilter : public ImageFilter {
12 | private:
13 | int m_exposureLocation;
14 | float m_exposure = 1.0f;
15 |
16 | public:
17 |
18 | virtual void OnInit();
19 |
20 | virtual const GLchar *GetFragmentShader();
21 |
22 | void setValue(float exposure);
23 | };
24 |
25 |
26 | #endif //BLOGDEMO_EXPOSURE_FILTER_H
27 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/hue_filter.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/30.
3 | //
4 |
5 | #ifndef BLOGDEMO_HUE_FILTER_H
6 | #define BLOGDEMO_HUE_FILTER_H
7 |
8 |
9 | #include "../base/image_filter.h"
10 |
11 | class HueFilter : public ImageFilter {
12 | private:
13 | int m_hue_location;
14 | float m_hue = 90.0f;
15 |
16 | public:
17 |
18 | virtual void OnInit();
19 |
20 | virtual const GLchar *GetFragmentShader();
21 |
22 | void setValue(float hue);
23 | };
24 |
25 |
26 | #endif //BLOGDEMO_HUE_FILTER_H
27 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/saturation_filter.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/29.
3 | //
4 |
5 | #include "saturation_filter.h"
6 |
7 | void SaturationFilter::OnInit() {
8 | ImageFilter::OnInit();
9 | m_saturationLocation = glGetUniformLocation(m_program_id, "saturation");
10 | setValue(m_saturation);
11 | }
12 |
13 | const GLchar *SaturationFilter::GetFragmentShader() {
14 | return ""
15 | " varying highp vec2 textureCoordinate;\n"
16 | " \n"
17 | " uniform sampler2D inputImageTexture;\n"
18 | " uniform lowp float saturation;\n"
19 | " \n"
20 | " // Values from \"Graphics Shaders: Theory and Practice\" by Bailey and Cunningham\n"
21 | " const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);\n"
22 | " \n"
23 | " void main()\n"
24 | " {\n"
25 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n"
26 | " lowp float luminance = dot(textureColor.rgb, luminanceWeighting);\n"
27 | " lowp vec3 greyScaleColor = vec3(luminance);\n"
28 | " \n"
29 | " gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, saturation), textureColor.w);\n"
30 | " \n"
31 | " }";;
32 | }
33 |
34 | void SaturationFilter::setValue(float saturation) {
35 | m_saturation = saturation;
36 | setFloat(m_saturationLocation, m_saturation);
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/saturation_filter.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/29.
3 | //
4 |
5 | #ifndef BLOGDEMO_SATURATION_FILTER_H
6 | #define BLOGDEMO_SATURATION_FILTER_H
7 |
8 |
9 | #include "../base/image_filter.h"
10 |
11 | class SaturationFilter : public ImageFilter {
12 | private:
13 | int m_saturationLocation;
14 | float m_saturation = 1.0f;
15 |
16 | public:
17 | virtual void OnInit();
18 |
19 | virtual const GLchar *GetFragmentShader();
20 |
21 | void setValue(float saturation);
22 | };
23 |
24 |
25 | #endif //BLOGDEMO_SATURATION_FILTER_H
26 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/adjust/sharpen_filter.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/11/3.
3 | //
4 |
5 | #ifndef BLOGDEMO_SHARPEN_FILTER_H
6 | #define BLOGDEMO_SHARPEN_FILTER_H
7 |
8 |
9 | #include "../base/image_filter.h"
10 |
11 | class SharpenFilter : public ImageFilter {
12 | private:
13 | int m_sharpnessLocation;
14 | float m_sharpness = 0.0f;
15 | int imageWidthFactorLocation;
16 | int imageHeightFactorLocation;
17 |
18 | public:
19 | virtual void OnInit();
20 |
21 | virtual const GLchar *GetFragmentShader();
22 |
23 | void setValue(float saturation);
24 |
25 | virtual const GLchar *GetVertexShader();
26 |
27 | virtual void onOutputSizeChanged(int width, int height);
28 |
29 |
30 | };
31 |
32 |
33 | #endif //BLOGDEMO_SHARPEN_FILTER_H
34 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/base/image_filter.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/28.
3 | //
4 |
5 | #include "image_filter.h"
6 |
7 | void ImageFilter::setFloat(int location, float floatValue) {
8 | glUniform1f(location, floatValue);
9 | }
10 |
11 | void ImageFilter::OnInit() {
12 | if (!isInitialized) {
13 | m_program_id = OpenGLUtils::CreateProgram(GetVertexShader(), GetFragmentShader());
14 | m_vertex_pos_handler = glGetAttribLocation(m_program_id, "position");
15 | m_texture_pos_handler = glGetAttribLocation(m_program_id, "inputTextureCoordinate");
16 | m_texture_handler = glGetUniformLocation(m_program_id, "inputImageTexture");
17 | isInitialized = true;
18 | }
19 |
20 | }
21 |
22 | void ImageFilter::Release() {
23 | isInitialized = false;
24 | glDeleteProgram(m_program_id);
25 | }
26 |
27 | void ImageFilter::DoDraw(int textureId, void *vertexPos, void *texturePos) {
28 | //启用顶点的句柄
29 | glEnableVertexAttribArray(m_vertex_pos_handler);
30 | glEnableVertexAttribArray(m_texture_pos_handler);
31 | //设置着色器参数
32 | // glUniformMatrix4fv(m_vertex_matrix_handler, 1, false, m_matrix, 0);
33 | glVertexAttribPointer(m_vertex_pos_handler, 3, GL_FLOAT, GL_FALSE, 0, vertexPos);
34 | glVertexAttribPointer(m_texture_pos_handler, 2, GL_FLOAT, GL_FALSE, 0, texturePos);
35 | //开始绘制
36 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
37 | }
38 |
39 | const GLchar *ImageFilter::GetVertexShader() {
40 | return
41 | "attribute vec4 position;\n"
42 | "attribute vec4 inputTextureCoordinate;\n"
43 | " \n"
44 | "varying vec2 textureCoordinate;\n"
45 | " \n"
46 | "void main()\n"
47 | "{\n"
48 | " gl_Position = position;\n"
49 | " textureCoordinate = inputTextureCoordinate.xy;\n"
50 | "}";
51 | }
52 |
53 | const GLchar *ImageFilter::GetFragmentShader() {
54 |
55 | return "precision mediump float;\n"
56 | "varying highp vec2 textureCoordinate;\n"
57 | " \n"
58 | "uniform sampler2D inputImageTexture;\n"
59 | " \n"
60 | "void main()\n"
61 | "{\n"
62 | " gl_FragColor = texture2D(inputImageTexture, textureCoordinate);\n"
63 | "}";
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/cpp/filter/base/image_filter.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/28.
3 | //
4 |
5 | #ifndef BLOGDEMO_IMAGE_FILTER_H
6 | #define BLOGDEMO_IMAGE_FILTER_H
7 |
8 |
9 | #include "../../drawer/base_drawer.h"
10 |
11 | class ImageFilter : public BaseDrawer {
12 | private :
13 | bool isInitialized;
14 | protected:
15 | void setFloat(int location, float floatValue);
16 |
17 | public:
18 | virtual void OnInit();
19 |
20 | virtual void Release();
21 |
22 | virtual void DoDraw(int textureId, void *vertexPos, void *texturePos);
23 |
24 | virtual const GLchar *GetVertexShader();
25 |
26 | virtual const GLchar *GetFragmentShader();
27 | };
28 |
29 |
30 | #endif //BLOGDEMO_IMAGE_FILTER_H
31 |
--------------------------------------------------------------------------------
/app/src/main/cpp/render/image_render.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by poney.ma on 2020/10/16.
3 | //
4 |
5 | #ifndef BLOGDEMO_IMAGE_RENDER_H
6 | #define BLOGDEMO_IMAGE_RENDER_H
7 |
8 |
9 | #include "../drawer/base_drawer.h"
10 | #include "../filter/base/image_filter.h"
11 |
12 | class ImageRender {
13 | private:
14 | const char *TAG = "ImageRender";
15 | int m_origin_width = 0;
16 |
17 | int m_origin_height = 0;
18 |
19 |
20 | int m_output_width = 0;
21 |
22 | int m_output_height = 0;
23 |
24 |
25 | //顶点坐标
26 | GLfloat m_vertex_coors[12] = {
27 | -1.0f, -1.0f, 0.0f,//左下
28 | 1.0f, -1.0f, 0.0f,//右下
29 | -1.0f, 1.0f, 0.0f,//左上
30 | 1.0f, 1.0f, 0.0f//右上
31 | };
32 |
33 | //纹理坐标
34 | GLfloat m_texture_coors[8] = {
35 | 0.0f, 1.0f,
36 | 1.0f, 1.0f,
37 | 0.0f, 0.0f,
38 | 1.0f, 0.0f
39 | };
40 |
41 | // 自定义用户数据,可用于存放画面数据
42 | void *cst_data = NULL;
43 |
44 | ImageFilter *m_filter;
45 |
46 |
47 | GLuint m_texture_id = 0;
48 |
49 | public:
50 | ImageRender(int origin_width, int origin_height, void *p);
51 |
52 | ~ImageRender();
53 |
54 |
55 | void AdjustImageScale();
56 |
57 | void OnOutputSizeChanged(int outputWidth, int outputHeight);
58 |
59 | float addDistance(const GLfloat d, float horizontal);
60 |
61 | void ResetTextureCoors();
62 |
63 | void DoDraw();
64 |
65 | void Release();
66 |
67 | ImageFilter *getFilter() const;
68 |
69 | void setFilter(ImageFilter *mFilter);
70 |
71 | bool isReadyToDraw();
72 |
73 | bool texture_loaded;
74 | };
75 |
76 |
77 | #endif //BLOGDEMO_IMAGE_RENDER_H
78 |
--------------------------------------------------------------------------------
/app/src/main/cpp/utils/logger.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by cxp on 2019-07-31.
3 | //
4 |
5 | #ifndef LEARNVIDEO_LOGGER_H
6 | #define LEARNVIDEO_LOGGER_H
7 |
8 | #include
9 |
10 | #define LOG
11 |
12 | #ifdef LOG
13 | #define LOGD(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_DEBUG,TAG,FORMAT,##__VA_ARGS__);
14 | #define LOGI(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_INFO,TAG,FORMAT,##__VA_ARGS__);
15 | #define LOGW(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_WARN,TAG,FORMAT,##__VA_ARGS__);
16 | #define LOGE(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_ERROR,TAG,FORMAT,##__VA_ARGS__);
17 |
18 | #define LOG_INFO(TAG, SPEC, FMT, ...) LOGI(TAG, "[%s] " FMT, SPEC, ##__VA_ARGS__)
19 | #define LOG_ERROR(TAG, SPEC, FMT, ...) LOGE(TAG, "[%s] " FMT, SPEC, ##__VA_ARGS__)
20 | #else
21 | #define LOGD(TAG, FORMAT,...);
22 | #define LOGI(TAG, FORMAT,...);
23 | #define LOGW(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_WARN,TAG,FORMAT,##__VA_ARGS__);
24 | #define LOGE(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_ERROR,TAG,FORMAT,##__VA_ARGS__);
25 | #endif
26 |
27 | #endif //LEARNVIDEO_LOGGER_H
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/base/camera/CameraLoader.kt:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.base.camera
2 |
3 | import android.view.SurfaceHolder
4 |
5 |
6 | abstract class CameraLoader {
7 |
8 | protected var onPreviewFrame: ((data: ByteArray, width: Int, height: Int) -> Unit)? = null
9 |
10 | abstract fun onResume(width: Int, height: Int)
11 |
12 | abstract fun setPreview(holder: SurfaceHolder)
13 |
14 | abstract fun onPause()
15 |
16 | abstract fun switchCamera()
17 |
18 | abstract fun getCameraOrientation(): Int
19 |
20 | abstract fun hasMultipleCamera(): Boolean
21 |
22 | fun setOnPreviewFrameListener(onPreviewFrame: (data: ByteArray, width: Int, height: Int) -> Unit) {
23 | this.onPreviewFrame = onPreviewFrame
24 | }
25 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/base/camera/CameraPreview.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.base.camera;
2 |
3 | import android.content.Context;
4 | import android.view.SurfaceHolder;
5 | import android.view.SurfaceView;
6 |
7 | /**
8 | * camera预览视图
9 | */
10 | public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
11 | private SurfaceHolder mHolder;
12 |
13 | public CameraPreview(Context context) {
14 | super(context);
15 | mHolder = getHolder();
16 | mHolder.addCallback(this);
17 | mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
18 | }
19 |
20 | @Override
21 | public void surfaceCreated(SurfaceHolder holder) {
22 | }
23 |
24 |
25 | @Override
26 | public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
27 |
28 | }
29 |
30 | @Override
31 | public void surfaceDestroyed(SurfaceHolder holder) {
32 | }
33 |
34 |
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/base/camera/ImageExt.kt:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.base.camera
2 |
3 | import android.graphics.ImageFormat
4 | import android.media.Image
5 | import android.os.Build
6 | import androidx.annotation.RequiresApi
7 |
8 | @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
9 | fun Image.generateNV21Data(): ByteArray {
10 | val crop = cropRect
11 | val format = format
12 | val width = crop.width()
13 | val height = crop.height()
14 | val planes = planes
15 | val data = ByteArray(width * height * ImageFormat.getBitsPerPixel(format) / 8)
16 | val rowData = ByteArray(planes[0].rowStride)
17 | var channelOffset = 0
18 | var outputStride = 1
19 | for (i in planes.indices) {
20 | when (i) {
21 | 0 -> {
22 | channelOffset = 0
23 | outputStride = 1
24 | }
25 | 1 -> {
26 | channelOffset = width * height + 1
27 | outputStride = 2
28 | }
29 | 2 -> {
30 | channelOffset = width * height
31 | outputStride = 2
32 | }
33 | }
34 | val buffer = planes[i].buffer
35 | val rowStride = planes[i].rowStride
36 | val pixelStride = planes[i].pixelStride
37 | val shift = if (i == 0) 0 else 1
38 | val w = width shr shift
39 | val h = height shr shift
40 | buffer.position(rowStride * (crop.top shr shift) + pixelStride * (crop.left shr shift))
41 | for (row in 0 until h) {
42 | val length: Int
43 | if (pixelStride == 1 && outputStride == 1) {
44 | length = w
45 | buffer.get(data, channelOffset, length)
46 | channelOffset += length
47 | } else {
48 | length = (w - 1) * pixelStride + 1
49 | buffer.get(rowData, 0, length)
50 | for (col in 0 until w) {
51 | data[channelOffset] = rowData[col * pixelStride]
52 | channelOffset += outputStride
53 | }
54 | }
55 | if (row < h - 1) {
56 | buffer.position(buffer.position() + rowStride - length)
57 | }
58 | }
59 | }
60 | return data
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/base/camera/ViewExt.kt:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.base.camera
2 |
3 | import android.view.View
4 | import androidx.core.view.ViewCompat
5 |
6 | inline fun View.doOnLayout(crossinline action: (view: View) -> Unit) {
7 | if (ViewCompat.isLaidOut(this) && !isLayoutRequested) {
8 | action(this)
9 | } else {
10 | doOnNextLayout { action(it) }
11 | }
12 | }
13 |
14 | inline fun View.doOnNextLayout(crossinline action: (view: View) -> Unit) {
15 | addOnLayoutChangeListener(object : View.OnLayoutChangeListener {
16 | override fun onLayoutChange(
17 | view: View,
18 | left: Int,
19 | top: Int,
20 | right: Int,
21 | bottom: Int,
22 | oldLeft: Int,
23 | oldTop: Int,
24 | oldRight: Int,
25 | oldBottom: Int
26 | ) {
27 | view.removeOnLayoutChangeListener(this)
28 | action(view)
29 | }
30 | })
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/demo1/drawer/IDrawer.kt:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.demo1.drawer
2 |
3 | interface IDrawer {
4 | fun draw()
5 | fun release()
6 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/demo1/filter/base/GPUImageFilterType.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.demo1.filter.base;
2 |
3 | /**
4 | * Created by why8222 on 2016/2/25.
5 | */
6 | public enum GPUImageFilterType {
7 | NONE,
8 | //image adjust
9 | INVERT,
10 | CONTRAST,
11 | BRIGHTNESS,
12 | EXPOSURE,
13 | HUE,
14 | SATURATION,
15 | SHARPEN
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/ffplaydemo/FFAVPlayerActivity.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.ffplaydemo;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 |
5 | import android.os.Bundle;
6 |
7 | import com.poney.blogdemo.R;
8 |
9 | /**
10 | * FFMpeg音视频同步播放
11 | */
12 | public class FFAVPlayerActivity extends AppCompatActivity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_f_f_a_v_player);
18 | }
19 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/ffplaydemo/FFPlayActivity.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.ffplaydemo;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 |
5 | import android.os.Bundle;
6 | import android.os.Environment;
7 | import android.view.View;
8 | import android.widget.TextView;
9 |
10 | import com.poney.blogdemo.R;
11 | import com.poney.ffmpeg.play.FFUtils;
12 | import com.poney.ffmpeg.play.FFVideoView;
13 |
14 | /**
15 | * FFMpeg 仅视频播放
16 | */
17 | public class FFPlayActivity extends AppCompatActivity {
18 | private TextView mTextView;
19 | private FFVideoView mVideoView;
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_ff_play);
25 |
26 | mTextView = findViewById(R.id.sample_text);
27 | mVideoView = findViewById(R.id.videoView);
28 | }
29 |
30 | public void onButtonClick(View view) {
31 | int id = view.getId();
32 |
33 | switch (id) {
34 | case R.id.button_protocol:
35 | setInfoText(FFUtils.urlProtocolInfo());
36 | break;
37 | case R.id.button_codec:
38 | setInfoText(FFUtils.avCodecInfo());
39 | break;
40 | case R.id.button_filter:
41 | setInfoText(FFUtils.avFilterInfo());
42 | break;
43 | case R.id.button_format:
44 | setInfoText(FFUtils.avFormatInfo());
45 | break;
46 | case R.id.button_play:
47 | String videoPath = Environment.getExternalStorageDirectory() + "/killer.mp4";
48 |
49 | mVideoView.playVideo(videoPath);
50 | break;
51 | }
52 | }
53 |
54 | private void setInfoText(String content) {
55 | if (mTextView != null) {
56 | mTextView.setText(content);
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/mediacodecdemo/lib/AudioExtractor.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.mediacodecdemo.lib;
2 |
3 | import android.media.MediaFormat;
4 |
5 | import java.nio.ByteBuffer;
6 |
7 | /**
8 | * @author poney.ma
9 | * @project BlogDemo
10 | * @package_name com.poney.blogdemo.mediacodecdemo.lib
11 | * @date 2021/1/5
12 | */
13 | public class AudioExtractor implements IExtractor {
14 | private MMExtractor mmExtractor;
15 |
16 | public AudioExtractor(String path) {
17 | this.mmExtractor = new MMExtractor(path);
18 | }
19 |
20 |
21 | @Override
22 | public MediaFormat getFormat() {
23 | return mmExtractor.getAudioFormat();
24 | }
25 |
26 | @Override
27 | public int readBuffer(ByteBuffer byteBuffer) {
28 | return mmExtractor.readBuffer(byteBuffer);
29 | }
30 |
31 | @Override
32 | public long getCurrentTimeStamp() {
33 | return mmExtractor.getCurSampleTime();
34 | }
35 |
36 | @Override
37 | public long seek(long pos) {
38 | return mmExtractor.seek(pos);
39 | }
40 |
41 | @Override
42 | public void setStartPos(long pos) {
43 | mmExtractor.setStartPos(pos);
44 | }
45 |
46 | @Override
47 | public void stop() {
48 | mmExtractor.stop();
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/mediacodecdemo/lib/DecodeState.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.mediacodecdemo.lib;
2 |
3 | /**
4 | * @author poney.ma
5 | * @project BlogDemo
6 | * @package_name com.poney.blogdemo.mediacodecdemo.lib
7 | * @date 2021/1/4
8 | */
9 | public enum DecodeState {
10 | /**开始状态*/
11 | START,
12 | /**解码中*/
13 | DECODING,
14 | /**解码暂停*/
15 | PAUSE,
16 | /**正在快进*/
17 | SEEKING,
18 | /**解码完成*/
19 | FINISH,
20 | /**解码器释放*/
21 | STOP
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/mediacodecdemo/lib/DecodeType.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.mediacodecdemo.lib;
2 |
3 | /**
4 | * @author poney.ma
5 | * @project BlogDemo
6 | * @package_name com.poney.blogdemo.mediacodecdemo.lib
7 | * @date 2021/1/4
8 | */
9 | public enum DecodeType {
10 | /**
11 | * 未知
12 | */
13 | UNKNOWN,
14 | /**
15 | * 音频
16 | */
17 | AUDIO,
18 | /**
19 | * 视频
20 | */
21 | VIDEO
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/mediacodecdemo/lib/IDecoder.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.mediacodecdemo.lib;
2 |
3 | /**
4 | * @author poney.ma
5 | * @project BlogDemo
6 | * @package_name com.poney.blogdemo.mediacodecdemo.lib
7 | * @date 2021/1/4
8 | */
9 | public interface IDecoder extends Runnable {
10 | //继续解码
11 | void resume();
12 |
13 | //暂停解码
14 | void pause();
15 |
16 | //停止解码
17 | void stop();
18 |
19 | //是否正在解码
20 | boolean isDecoding();
21 |
22 | //是否正在快进
23 | boolean isSeeking();
24 |
25 | //是否停止解码
26 | boolean isStop();
27 |
28 | void setStateListener(IStateListener stateListener);
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/mediacodecdemo/lib/IExtractor.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.mediacodecdemo.lib;
2 |
3 | import android.media.MediaFormat;
4 |
5 | import java.nio.ByteBuffer;
6 |
7 | /**
8 | * @author poney.ma
9 | * @project BlogDemo
10 | * @package_name com.poney.blogdemo.mediacodecdemo.lib
11 | * @date 2021/1/4
12 | */
13 | public interface IExtractor {
14 | //获取音视频格式参数
15 | MediaFormat getFormat();
16 |
17 | //读取音视频数据
18 | int readBuffer(ByteBuffer byteBuffer);
19 |
20 | //获取当前帧时间
21 | long getCurrentTimeStamp();
22 |
23 | //Seek到指定位置,并返回实际帧的时间戳
24 | long seek(long pos);
25 |
26 | void setStartPos(long pos);
27 |
28 | //停止读取数据
29 | void stop();
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/mediacodecdemo/lib/IStateListener.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.mediacodecdemo.lib;
2 |
3 | /**
4 | * @author poney.ma
5 | * @project BlogDemo
6 | * @package_name com.poney.blogdemo.mediacodecdemo.lib
7 | * @date 2021/1/4
8 | */
9 | public interface IStateListener {
10 | void decoderPrepare(BaseDecoder baseDecoder);
11 | void decoderReady(BaseDecoder baseDecoder);
12 | void decoderRunning(BaseDecoder baseDecoder);
13 | void decoderPause(BaseDecoder baseDecoder);
14 | void decoderFinish(BaseDecoder baseDecoder);
15 | void decoderDestroy(BaseDecoder baseDecoder);
16 | void decoderError(BaseDecoder baseDecoder, String reason);
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/mediacodecdemo/lib/VideoExtractor.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.mediacodecdemo.lib;
2 |
3 | import android.media.MediaFormat;
4 |
5 | import java.nio.ByteBuffer;
6 |
7 | /**
8 | * @author poney.ma
9 | * @project BlogDemo
10 | * @package_name com.poney.blogdemo.mediacodecdemo.lib
11 | * @date 2021/1/5
12 | */
13 | public class VideoExtractor implements IExtractor {
14 | private MMExtractor mmExtractor;
15 |
16 | public VideoExtractor(String path) {
17 | this.mmExtractor = new MMExtractor(path);
18 | }
19 |
20 |
21 | @Override
22 | public MediaFormat getFormat() {
23 | return mmExtractor.getVideoFormat();
24 | }
25 |
26 | @Override
27 | public int readBuffer(ByteBuffer byteBuffer) {
28 | return mmExtractor.readBuffer(byteBuffer);
29 | }
30 |
31 | @Override
32 | public long getCurrentTimeStamp() {
33 | return mmExtractor.getCurSampleTime();
34 | }
35 |
36 | @Override
37 | public long seek(long pos) {
38 | return mmExtractor.seek(pos);
39 | }
40 |
41 | @Override
42 | public void setStartPos(long pos) {
43 | mmExtractor.setStartPos(pos);
44 | }
45 |
46 | @Override
47 | public void stop() {
48 | mmExtractor.stop();
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/poney/blogdemo/mediacodecdemo/play/advance/MediaTimeProvider.java:
--------------------------------------------------------------------------------
1 | package com.poney.blogdemo.mediacodecdemo.play.advance;
2 |
3 | /*
4 | * Interface used by CodecState to retrieve Media timing info from parent Player
5 | */
6 | public interface MediaTimeProvider {
7 | public long getNowUs();
8 | public long getRealTimeUsForMediaTime(long mediaTimeUs);
9 | public long getVsyncDurationNs();
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/res/color/selector_image_back.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/color/selector_image_edit.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/color/selector_image_edit_yellow.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_contrast.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_contrast.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_contrast_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_contrast_press.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_exposure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_exposure.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_exposure_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_exposure_press.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_hdr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_hdr.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_hdr_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_hdr_press.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_saturation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_saturation.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_saturation_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_saturation_press.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_sharpness.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_sharpness.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_sharpness_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_sharpness_press.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_vibrance.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_vibrance.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_vibrance_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_bg_adjust_vibrance_press.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_color_hue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_color_hue.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/edit_color_hue_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/drawable-xxhdpi/edit_color_hue_press.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_default.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_default_select.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_switch_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_image_edit_adjust_bright.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_image_edit_adjust_contrast.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_image_edit_adjust_default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_image_edit_adjust_exposure.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_image_edit_adjust_hue.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_image_edit_adjust_saturation.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_image_edit_adjust_sharpness.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_image_edit_adjust_vibrance.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_codec_h_a.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
21 |
22 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_codec_mp4.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
21 |
22 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_f_f_a_v_player.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_ffmpeg_h_a.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
21 |
22 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_media_codec_a_v.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/icon_default.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-xhdpi/icon_default.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_qxx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-xxhdpi/ic_qxx.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/wall.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-xxhdpi/wall.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 | #ff5cbadc
7 |
8 | #3d5afe
9 |
10 | #1e3250
11 |
12 | #ff6666
13 |
14 | #b93221
15 |
16 | #fe9833
17 |
18 | #cc99cc
19 |
20 | #c4c4c4
21 |
22 | #c8ca34
23 |
24 | #568f35
25 |
26 | #e69138
27 |
28 | #c8ca34
29 |
30 | #ff9933
31 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BlogDemo
3 | 对比度
4 |
5 | 曝光
6 |
7 | 自然饱和度
8 |
9 | 饱和度
10 |
11 | 锐化
12 |
13 | 亮度
14 |
15 | 色调
16 | 反相
17 | 原图
18 |
19 |
20 |
21 | Protocol
22 | Codec
23 | Filter
24 | Format
25 | Play
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
32 |
33 |
34 | -
35 |
36 |
53 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | apply from: "buildv21.gradle"
3 | buildscript {
4 | ext.kotlin_version = '1.4.10'
5 | repositories {
6 | google()
7 | jcenter()
8 | maven { url 'https://jitpack.io' }
9 | }
10 | dependencies {
11 | classpath "com.android.tools.build:gradle:4.0.2"
12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
13 | classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.1'
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | google()
22 | jcenter()
23 | maven { url 'https://jitpack.io' }
24 | }
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
--------------------------------------------------------------------------------
/common/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/common/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | //构建版本
5 | compileSdkVersion rootProject.ext.androidConfig.compileSdkVersion
6 | buildToolsVersion rootProject.ext.androidConfig.buildToolsVersion
7 | //默认的配置
8 | defaultConfig {
9 | minSdkVersion rootProject.ext.androidConfig.minSdkVersion
10 | targetSdkVersion rootProject.ext.androidConfig.targetSdkVersion
11 | versionCode rootProject.ext.androidConfig.versionCode
12 | versionName rootProject.ext.androidConfig.versionName
13 |
14 | ndk {
15 | abiFilters 'armeabi-v7a'
16 | }
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: 'libs', include: ['*.jar'])
30 | implementation rootProject.ext.dependenciesConfig["appcompatV7"]
31 | implementation rootProject.ext.dependenciesConfig["design"]
32 |
33 | implementation rootProject.ext.dependenciesConfig["rxjava"]
34 | implementation rootProject.ext.dependenciesConfig["rxandroid"]
35 | }
36 |
--------------------------------------------------------------------------------
/common/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/common/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/common/src/main/java/com/poney/ffmpeg/base/AbsBaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.poney.ffmpeg.base;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | import androidx.annotation.Nullable;
7 |
8 | /**
9 | * @anchor: poney
10 | * @date: 2018-10-29
11 | * @description:
12 | */
13 | public abstract class AbsBaseActivity extends Activity {
14 |
15 | @Override
16 | protected void onCreate(@Nullable Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/common/src/main/java/com/poney/ffmpeg/base/BaseApplication.java:
--------------------------------------------------------------------------------
1 | package com.poney.ffmpeg.base;
2 |
3 | import android.app.Application;
4 |
5 | import com.poney.ffmpeg.core.AppCore;
6 |
7 | /**
8 | * @anchor: poney
9 | * @date: 2018-11-07
10 | * @description:
11 | */
12 | public class BaseApplication extends Application {
13 |
14 | @Override
15 | public void onCreate() {
16 | super.onCreate();
17 | AppCore.getInstance().init(this);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/common/src/main/java/com/poney/ffmpeg/core/AppCore.java:
--------------------------------------------------------------------------------
1 | package com.poney.ffmpeg.core;
2 |
3 | import android.app.Application;
4 | import android.content.res.Resources;
5 |
6 | /**
7 | * @anchor: poney
8 | * @date: 2018-11-07
9 | * @description:
10 | */
11 | public class AppCore {
12 |
13 | private static AppCore sInstance;
14 |
15 | private Application application;
16 |
17 | public static AppCore getInstance() {
18 | if (sInstance == null) {
19 | sInstance = new AppCore();
20 | }
21 | return sInstance;
22 | }
23 |
24 | public void init(Application application) {
25 | this.application = application;
26 | }
27 |
28 | public Application getContext() {
29 | return application;
30 | }
31 |
32 | public Resources getResources() {
33 | return application.getResources();
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/common/src/main/java/com/poney/ffmpeg/utils/ResReadUtils.java:
--------------------------------------------------------------------------------
1 | package com.poney.ffmpeg.utils;
2 |
3 | import android.content.res.Resources;
4 |
5 | import com.poney.ffmpeg.core.AppCore;
6 |
7 | import java.io.BufferedReader;
8 | import java.io.IOException;
9 | import java.io.InputStream;
10 | import java.io.InputStreamReader;
11 |
12 | /**
13 | * @anchor: poney
14 | * @date: 2018-09-13
15 | * @description:
16 | */
17 | public class ResReadUtils {
18 |
19 | /**
20 | * 读取资源
21 | *
22 | * @param resourceId
23 | * @return
24 | */
25 | public static String readResource(int resourceId) {
26 | StringBuilder builder = new StringBuilder();
27 | try {
28 | InputStream inputStream = AppCore.getInstance().getResources().openRawResource(resourceId);
29 | InputStreamReader streamReader = new InputStreamReader(inputStream);
30 |
31 | BufferedReader bufferedReader = new BufferedReader(streamReader);
32 | String textLine;
33 | while ((textLine = bufferedReader.readLine()) != null) {
34 | builder.append(textLine);
35 | builder.append("\n");
36 | }
37 | } catch (IOException e) {
38 | e.printStackTrace();
39 | } catch (Resources.NotFoundException e) {
40 | e.printStackTrace();
41 | }
42 | return builder.toString();
43 | }
44 |
45 | }
--------------------------------------------------------------------------------
/common/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/common/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/common/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/common/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/common/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/common/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/common/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/common/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/common/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/common/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/common/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/common/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | common
3 |
4 |
--------------------------------------------------------------------------------
/common/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Oct 10 15:25:31 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/libyuv-single/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/libyuv-single/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | //构建版本
5 | compileSdkVersion rootProject.ext.androidConfig.compileSdkVersion
6 | buildToolsVersion rootProject.ext.androidConfig.buildToolsVersion
7 | //默认的配置
8 | defaultConfig {
9 | minSdkVersion rootProject.ext.androidConfig.minSdkVersion
10 | targetSdkVersion rootProject.ext.androidConfig.targetSdkVersion
11 | versionCode rootProject.ext.androidConfig.versionCode
12 | versionName rootProject.ext.androidConfig.versionName
13 |
14 | ndk {
15 | abiFilters "armeabi-v7a"
16 | }
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | sourceSets {
25 | main {
26 | //库地址
27 | jniLibs.srcDirs = ['libs']
28 | }
29 | }
30 | packagingOptions {
31 | pickFirst 'lib/armeabi-v7a/libyuv.so'
32 | }
33 | }
34 |
35 | dependencies {
36 | implementation fileTree(dir: 'libs', include: ['*.jar'])
37 |
38 | implementation rootProject.ext.dependenciesConfig["appcompatV7"]
39 | implementation rootProject.ext.dependenciesConfig["design"]
40 | }
41 |
--------------------------------------------------------------------------------
/libyuv-single/libs/armeabi-v7a/libyuv.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/libyuv-single/libs/armeabi-v7a/libyuv.so
--------------------------------------------------------------------------------
/libyuv-single/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/libyuv-single/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/libyuv-single/src/main/cpp/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_
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_
33 |
--------------------------------------------------------------------------------
/libyuv-single/src/main/cpp/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_
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_t* src_argb,
25 | int src_stride_argb,
26 | uint8_t* dst_argb,
27 | int dst_stride_argb,
28 | int src_width,
29 | int src_height,
30 | enum RotationMode mode);
31 |
32 | #ifdef __cplusplus
33 | } // extern "C"
34 | } // namespace libyuv
35 | #endif
36 |
37 | #endif // INCLUDE_LIBYUV_ROTATE_ARGB_H_
38 |
--------------------------------------------------------------------------------
/libyuv-single/src/main/cpp/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_
12 | #define INCLUDE_LIBYUV_VERSION_H_
13 |
14 | #define LIBYUV_VERSION 1717
15 |
16 | #endif // INCLUDE_LIBYUV_VERSION_H_
17 |
--------------------------------------------------------------------------------
/libyuv-single/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | libyuv-single
3 |
4 |
--------------------------------------------------------------------------------
/libyuv-single/src/test/java/com/poney/libyuv/single/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.poney.libyuv.single;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/media/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/media/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.androidConfig.compileSdkVersion
5 | buildToolsVersion rootProject.ext.androidConfig.buildToolsVersion
6 |
7 | defaultConfig {
8 | minSdkVersion rootProject.ext.androidConfig.minSdkVersion
9 | targetSdkVersion rootProject.ext.androidConfig.targetSdkVersion
10 |
11 | versionCode rootProject.ext.androidConfig.versionCode
12 | versionName rootProject.ext.androidConfig.versionName
13 |
14 | consumerProguardFiles "consumer-rules.pro"
15 | externalNativeBuild {
16 | cmake {
17 | cppFlags ""
18 | }
19 | ndk {
20 | abiFilters "armeabi-v7a"
21 | }
22 | }
23 | }
24 |
25 | buildTypes {
26 | release {
27 | minifyEnabled false
28 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29 | }
30 | }
31 |
32 | externalNativeBuild {
33 | cmake {
34 | path "CMakeLists.txt"
35 | version "3.10.2"
36 | }
37 | }
38 | packagingOptions {
39 | pickFirst 'lib/armeabi-v7a/libavutil.so'
40 | pickFirst 'lib/armeabi-v7a/libavcodec.so'
41 | pickFirst 'lib/armeabi-v7a/libavformat.so'
42 | pickFirst 'lib/armeabi-v7a/libavfilter.so'
43 | pickFirst 'lib/armeabi-v7a/libswresample.so'
44 | pickFirst 'lib/armeabi-v7a/libswscale.so'
45 | pickFirst 'lib/armeabi-v7a/libavdevice.so'
46 | pickFirst 'lib/armeabi-v7a/libpostproc.so'
47 | pickFirst 'lib/armeabi-v7a/libyuv.so'
48 | }
49 | compileOptions {
50 | sourceCompatibility JavaVersion.VERSION_1_8
51 | targetCompatibility JavaVersion.VERSION_1_8
52 | }
53 | }
54 |
55 | dependencies {
56 | implementation fileTree(dir: "libs", include: ["*.jar"])
57 | implementation 'androidx.appcompat:appcompat:1.2.0'
58 | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
59 | implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0'
60 | implementation 'com.google.android.exoplayer:exoplayer-core:2.11.5'
61 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
62 | }
--------------------------------------------------------------------------------
/media/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/media/consumer-rules.pro
--------------------------------------------------------------------------------
/media/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/media/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/media/src/main/cpp/encode/encode_jpeg.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef FFMPEG4ANDROID_JPEG_ENCODE_H
3 | #define FFMPEG4ANDROID_JPEG_ENCODE_H
4 |
5 | #ifdef __cplusplus
6 | extern "C" {
7 | #endif
8 |
9 | #include "libavcodec/avcodec.h"
10 | #include "libavformat/avformat.h"
11 | #include
12 | #include
13 |
14 | #ifdef __cplusplus
15 | }
16 | #endif
17 |
18 |
19 | class JPEGEncoder {
20 |
21 | private:
22 |
23 | int width = 0;
24 | int height = 0;
25 |
26 | int bufferSize = 0;
27 |
28 | char jpegPath[256] = {0};
29 |
30 | AVFormatContext *pFormatCtx = NULL;
31 | AVStream *pStream = NULL;
32 | AVCodecContext *pCodecCtx = NULL;
33 | AVCodec *pCodec = NULL;
34 | SwsContext *sws_ctx = NULL;
35 | uint8_t *out_buffer = NULL;
36 | AVFrame *pFrame = NULL;
37 | AVPacket avPacket;
38 |
39 | bool transform = false;
40 |
41 | public:
42 |
43 | JPEGEncoder(const char *jpegPath, int width, int height);
44 | ~JPEGEncoder();
45 |
46 | int EncodeJPEG(unsigned char *nv21Buffer);
47 |
48 |
49 | bool isTransform();
50 |
51 | };
52 |
53 |
54 | #endif //FFMPEG4ANDROID_JPEG_ENCODE_H
55 |
--------------------------------------------------------------------------------
/media/src/main/cpp/encode/encode_mp4.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef MP4_ENCODER_H
3 | #define MP4_ENCODER_H
4 |
5 | #include "encode_video.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | #ifdef __cplusplus
18 | }
19 | #endif
20 |
21 | class MP4Encoder : public VideoEncoder {
22 |
23 | private:
24 |
25 | const char *mp4Path;
26 |
27 | int width;
28 |
29 | int height;
30 |
31 | AVPacket avPacket;
32 | AVFormatContext *pFormatCtx = NULL;
33 | AVStream *pStream = NULL;
34 | AVCodecContext *pCodecCtx = NULL;
35 | AVCodec *pCodec = NULL;
36 | uint8_t *pFrameBuffer = NULL;
37 | AVFrame *pFrame = NULL;
38 |
39 | //AVFrame PTS
40 | int index = 0;
41 |
42 | int EncodeFrame(AVCodecContext *pCodecCtx, AVFrame *pFrame, AVPacket *pPkt);
43 |
44 | public:
45 |
46 | void InitEncoder(const char *mp4Path, int width, int height);
47 |
48 | void EncodeStart();
49 |
50 | void EncodeBuffer(unsigned char *nv21Buffer);
51 |
52 | void EncodeStop();
53 |
54 | };
55 |
56 | #endif //FFMPEG4ANDROID_ENCODE_MP4_H
57 |
--------------------------------------------------------------------------------
/media/src/main/cpp/encode/encode_video.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "encode_video.h"
3 |
4 |
5 | bool VideoEncoder::isTransform() {
6 | return transform;
7 | }
--------------------------------------------------------------------------------
/media/src/main/cpp/encode/encode_video.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef ANDROID_VIDEO_ENCODER_H
3 | #define ANDROID_VIDEO_ENCODER_H
4 |
5 |
6 | class VideoEncoder {
7 |
8 | protected:
9 |
10 | bool transform = false;
11 |
12 | public:
13 |
14 | virtual void InitEncoder(const char *mp4Path, int width, int height) = 0;
15 |
16 | virtual void EncodeStart() = 0;
17 |
18 | virtual void EncodeBuffer(unsigned char *nv21Buffer) = 0;
19 |
20 | virtual void EncodeStop() = 0;
21 |
22 | bool isTransform();
23 |
24 | };
25 |
26 | #endif //ANDROID_VIDEO_ENCODER_H
27 |
--------------------------------------------------------------------------------
/media/src/main/cpp/encode/logger.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by byhook on 18-11-26.
3 | //
4 |
5 | #ifndef FFMPEG4ANDROID_LOGGER_H
6 | #define FFMPEG4ANDROID_LOGGER_H
7 |
8 |
9 | #ifdef ANDROID
10 |
11 | #include
12 | #include
13 |
14 | #define LOG_TAG "NativeEncode"
15 | #define LOGE(format, ...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, format, ##__VA_ARGS__)
16 | #define LOGI(format, ...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, format, ##__VA_ARGS__)
17 | #else
18 | #define LOGE(format, ...) printf(LOG_TAG format "\n", ##__VA_ARGS__)
19 | #define LOGI(format, ...) printf(LOG_TAG format "\n", ##__VA_ARGS__)
20 | #endif
21 |
22 | #endif //FFMPEG4ANDROID_LOGGER_H
23 |
--------------------------------------------------------------------------------
/media/src/main/cpp/encode/native_code.h:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #ifndef NATIVE_ENCODE_H
4 | #define NATIVE_ENCODE_H
5 | #ifdef __cplusplus
6 | extern "C" {
7 | #endif
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 |
15 | JNIEXPORT void JNICALL onPreviewFrame(JNIEnv *, jobject, jbyteArray, jint, jint);
16 |
17 | JNIEXPORT void JNICALL encodeMP4Start(JNIEnv *, jobject, jstring, jint, jint);
18 |
19 | JNIEXPORT void JNICALL encodeMP4Stop(JNIEnv *, jobject);
20 |
21 | JNIEXPORT void JNICALL encodeJPEG(JNIEnv *, jobject, jstring, jint, jint);
22 |
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 | #endif
27 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavcodec/ac3_parser.h:
--------------------------------------------------------------------------------
1 | /*
2 | * AC-3 parser prototypes
3 | * Copyright (c) 2003 Fabrice Bellard
4 | * Copyright (c) 2003 Michael Niedermayer
5 | *
6 | * This file is part of FFmpeg.
7 | *
8 | * FFmpeg is free software; you can redistribute it and/or
9 | * modify it under the terms of the GNU Lesser General Public
10 | * License as published by the Free Software Foundation; either
11 | * version 2.1 of the License, or (at your option) any later version.
12 | *
13 | * FFmpeg is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | * Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public
19 | * License along with FFmpeg; if not, write to the Free Software
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 | */
22 |
23 | #ifndef AVCODEC_AC3_PARSER_H
24 | #define AVCODEC_AC3_PARSER_H
25 |
26 | #include
27 | #include
28 |
29 | /**
30 | * Extract the bitstream ID and the frame size from AC-3 data.
31 | */
32 | int av_ac3_parse_header(const uint8_t *buf, size_t size,
33 | uint8_t *bitstream_id, uint16_t *frame_size);
34 |
35 |
36 | #endif /* AVCODEC_AC3_PARSER_H */
37 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavcodec/adts_parser.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVCODEC_ADTS_PARSER_H
20 | #define AVCODEC_ADTS_PARSER_H
21 |
22 | #include
23 | #include
24 |
25 | #define AV_AAC_ADTS_HEADER_SIZE 7
26 |
27 | /**
28 | * Extract the number of samples and frames from AAC data.
29 | * @param[in] buf pointer to AAC data buffer
30 | * @param[out] samples Pointer to where number of samples is written
31 | * @param[out] frames Pointer to where number of frames is written
32 | * @return Returns 0 on success, error code on failure.
33 | */
34 | int av_adts_header_parse(const uint8_t *buf, uint32_t *samples,
35 | uint8_t *frames);
36 |
37 | #endif /* AVCODEC_ADTS_PARSER_H */
38 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavcodec/jni.h:
--------------------------------------------------------------------------------
1 | /*
2 | * JNI public API functions
3 | *
4 | * Copyright (c) 2015-2016 Matthieu Bouron
5 | *
6 | * This file is part of FFmpeg.
7 | *
8 | * FFmpeg is free software; you can redistribute it and/or
9 | * modify it under the terms of the GNU Lesser General Public
10 | * License as published by the Free Software Foundation; either
11 | * version 2.1 of the License, or (at your option) any later version.
12 | *
13 | * FFmpeg is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | * Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public
19 | * License along with FFmpeg; if not, write to the Free Software
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 | */
22 |
23 | #ifndef AVCODEC_JNI_H
24 | #define AVCODEC_JNI_H
25 |
26 | /*
27 | * Manually set a Java virtual machine which will be used to retrieve the JNI
28 | * environment. Once a Java VM is set it cannot be changed afterwards, meaning
29 | * you can call multiple times av_jni_set_java_vm with the same Java VM pointer
30 | * however it will error out if you try to set a different Java VM.
31 | *
32 | * @param vm Java virtual machine
33 | * @param log_ctx context used for logging, can be NULL
34 | * @return 0 on success, < 0 otherwise
35 | */
36 | int av_jni_set_java_vm(void *vm, void *log_ctx);
37 |
38 | /*
39 | * Get the Java virtual machine which has been set with av_jni_set_java_vm.
40 | *
41 | * @param vm Java virtual machine
42 | * @return a pointer to the Java virtual machine
43 | */
44 | void *av_jni_get_java_vm(void *log_ctx);
45 |
46 | #endif /* AVCODEC_JNI_H */
47 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavdevice/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVDEVICE_VERSION_H
20 | #define AVDEVICE_VERSION_H
21 |
22 | /**
23 | * @file
24 | * @ingroup lavd
25 | * Libavdevice version macros
26 | */
27 |
28 | #include "libavutil/version.h"
29 |
30 | #define LIBAVDEVICE_VERSION_MAJOR 58
31 | #define LIBAVDEVICE_VERSION_MINOR 8
32 | #define LIBAVDEVICE_VERSION_MICRO 100
33 |
34 | #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
35 | LIBAVDEVICE_VERSION_MINOR, \
36 | LIBAVDEVICE_VERSION_MICRO)
37 | #define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \
38 | LIBAVDEVICE_VERSION_MINOR, \
39 | LIBAVDEVICE_VERSION_MICRO)
40 | #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT
41 |
42 | #define LIBAVDEVICE_IDENT "Lavd" AV_STRINGIFY(LIBAVDEVICE_VERSION)
43 |
44 | /**
45 | * FF_API_* defines may be placed below to indicate public API that will be
46 | * dropped at a future version bump. The defines themselves are not part of
47 | * the public API and may change, break or disappear at any time.
48 | */
49 |
50 | #endif /* AVDEVICE_VERSION_H */
51 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/adler32.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2006 Mans Rullgard
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg 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 GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | /**
22 | * @file
23 | * @ingroup lavu_adler32
24 | * Public header for Adler-32 hash function implementation.
25 | */
26 |
27 | #ifndef AVUTIL_ADLER32_H
28 | #define AVUTIL_ADLER32_H
29 |
30 | #include
31 | #include "attributes.h"
32 |
33 | /**
34 | * @defgroup lavu_adler32 Adler-32
35 | * @ingroup lavu_hash
36 | * Adler-32 hash function implementation.
37 | *
38 | * @{
39 | */
40 |
41 | /**
42 | * Calculate the Adler32 checksum of a buffer.
43 | *
44 | * Passing the return value to a subsequent av_adler32_update() call
45 | * allows the checksum of multiple buffers to be calculated as though
46 | * they were concatenated.
47 | *
48 | * @param adler initial checksum value
49 | * @param buf pointer to input buffer
50 | * @param len size of input buffer
51 | * @return updated checksum
52 | */
53 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf,
54 | unsigned int len) av_pure;
55 |
56 | /**
57 | * @}
58 | */
59 |
60 | #endif /* AVUTIL_ADLER32_H */
61 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/aes.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2007 Michael Niedermayer
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg 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 GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_AES_H
22 | #define AVUTIL_AES_H
23 |
24 | #include
25 |
26 | #include "attributes.h"
27 | #include "version.h"
28 |
29 | /**
30 | * @defgroup lavu_aes AES
31 | * @ingroup lavu_crypto
32 | * @{
33 | */
34 |
35 | extern const int av_aes_size;
36 |
37 | struct AVAES;
38 |
39 | /**
40 | * Allocate an AVAES context.
41 | */
42 | struct AVAES *av_aes_alloc(void);
43 |
44 | /**
45 | * Initialize an AVAES context.
46 | * @param key_bits 128, 192 or 256
47 | * @param decrypt 0 for encryption, 1 for decryption
48 | */
49 | int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt);
50 |
51 | /**
52 | * Encrypt or decrypt a buffer using a previously initialized context.
53 | * @param count number of 16 byte blocks
54 | * @param dst destination array, can be equal to src
55 | * @param src source array, can be equal to dst
56 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used
57 | * @param decrypt 0 for encryption, 1 for decryption
58 | */
59 | void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
60 |
61 | /**
62 | * @}
63 | */
64 |
65 | #endif /* AVUTIL_AES_H */
66 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/avconfig.h:
--------------------------------------------------------------------------------
1 | /* Generated by ffmpeg configure */
2 | #ifndef AVUTIL_AVCONFIG_H
3 | #define AVUTIL_AVCONFIG_H
4 | #define AV_HAVE_BIGENDIAN 0
5 | #define AV_HAVE_FAST_UNALIGNED 1
6 | #endif /* AVUTIL_AVCONFIG_H */
7 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/ffversion.h:
--------------------------------------------------------------------------------
1 | /* Automatically generated by version.sh, do not manually edit! */
2 | #ifndef AVUTIL_FFVERSION_H
3 | #define AVUTIL_FFVERSION_H
4 | #define FFMPEG_VERSION "4.2.4"
5 | #endif /* AVUTIL_FFVERSION_H */
6 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/hwcontext_cuda.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 |
20 | #ifndef AVUTIL_HWCONTEXT_CUDA_H
21 | #define AVUTIL_HWCONTEXT_CUDA_H
22 |
23 | #ifndef CUDA_VERSION
24 | #include
25 | #endif
26 |
27 | #include "pixfmt.h"
28 |
29 | /**
30 | * @file
31 | * An API-specific header for AV_HWDEVICE_TYPE_CUDA.
32 | *
33 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return
34 | * AVBufferRefs whose data pointer is a CUdeviceptr.
35 | */
36 |
37 | typedef struct AVCUDADeviceContextInternal AVCUDADeviceContextInternal;
38 |
39 | /**
40 | * This struct is allocated as AVHWDeviceContext.hwctx
41 | */
42 | typedef struct AVCUDADeviceContext {
43 | CUcontext cuda_ctx;
44 | CUstream stream;
45 | AVCUDADeviceContextInternal *internal;
46 | } AVCUDADeviceContext;
47 |
48 | /**
49 | * AVHWFramesContext.hwctx is currently not used
50 | */
51 |
52 | #endif /* AVUTIL_HWCONTEXT_CUDA_H */
53 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/hwcontext_mediacodec.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_HWCONTEXT_MEDIACODEC_H
20 | #define AVUTIL_HWCONTEXT_MEDIACODEC_H
21 |
22 | /**
23 | * MediaCodec details.
24 | *
25 | * Allocated as AVHWDeviceContext.hwctx
26 | */
27 | typedef struct AVMediaCodecDeviceContext {
28 | /**
29 | * android/view/Surface handle, to be filled by the user.
30 | *
31 | * This is the default surface used by decoders on this device.
32 | */
33 | void *surface;
34 | } AVMediaCodecDeviceContext;
35 |
36 | #endif /* AVUTIL_HWCONTEXT_MEDIACODEC_H */
37 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/hwcontext_qsv.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_HWCONTEXT_QSV_H
20 | #define AVUTIL_HWCONTEXT_QSV_H
21 |
22 | #include
23 |
24 | /**
25 | * @file
26 | * An API-specific header for AV_HWDEVICE_TYPE_QSV.
27 | *
28 | * This API does not support dynamic frame pools. AVHWFramesContext.pool must
29 | * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct.
30 | */
31 |
32 | /**
33 | * This struct is allocated as AVHWDeviceContext.hwctx
34 | */
35 | typedef struct AVQSVDeviceContext {
36 | mfxSession session;
37 | } AVQSVDeviceContext;
38 |
39 | /**
40 | * This struct is allocated as AVHWFramesContext.hwctx
41 | */
42 | typedef struct AVQSVFramesContext {
43 | mfxFrameSurface1 *surfaces;
44 | int nb_surfaces;
45 |
46 | /**
47 | * A combination of MFX_MEMTYPE_* describing the frame pool.
48 | */
49 | int frame_type;
50 | } AVQSVFramesContext;
51 |
52 | #endif /* AVUTIL_HWCONTEXT_QSV_H */
53 |
54 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/hwcontext_vdpau.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_HWCONTEXT_VDPAU_H
20 | #define AVUTIL_HWCONTEXT_VDPAU_H
21 |
22 | #include
23 |
24 | /**
25 | * @file
26 | * An API-specific header for AV_HWDEVICE_TYPE_VDPAU.
27 | *
28 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return
29 | * AVBufferRefs whose data pointer is a VdpVideoSurface.
30 | */
31 |
32 | /**
33 | * This struct is allocated as AVHWDeviceContext.hwctx
34 | */
35 | typedef struct AVVDPAUDeviceContext {
36 | VdpDevice device;
37 | VdpGetProcAddress *get_proc_address;
38 | } AVVDPAUDeviceContext;
39 |
40 | /**
41 | * AVHWFramesContext.hwctx is currently not used
42 | */
43 |
44 | #endif /* AVUTIL_HWCONTEXT_VDPAU_H */
45 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/hwcontext_videotoolbox.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H
20 | #define AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H
21 |
22 | #include
23 |
24 | #include
25 |
26 | #include "pixfmt.h"
27 |
28 | /**
29 | * @file
30 | * An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX.
31 | *
32 | * This API currently does not support frame allocation, as the raw VideoToolbox
33 | * API does allocation, and FFmpeg itself never has the need to allocate frames.
34 | *
35 | * If the API user sets a custom pool, AVHWFramesContext.pool must return
36 | * AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef.
37 | *
38 | * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always
39 | * NULL.
40 | */
41 |
42 | /**
43 | * Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat.
44 | * Returns AV_PIX_FMT_NONE if no known equivalent was found.
45 | */
46 | enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt);
47 |
48 | /**
49 | * Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format.
50 | * Returns 0 if no known equivalent was found.
51 | */
52 | uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt);
53 |
54 | #endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */
55 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/intfloat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2011 Mans Rullgard
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg 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 GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_INTFLOAT_H
22 | #define AVUTIL_INTFLOAT_H
23 |
24 | #include
25 | #include "attributes.h"
26 |
27 | union av_intfloat32 {
28 | uint32_t i;
29 | float f;
30 | };
31 |
32 | union av_intfloat64 {
33 | uint64_t i;
34 | double f;
35 | };
36 |
37 | /**
38 | * Reinterpret a 32-bit integer as a float.
39 | */
40 | static av_always_inline float av_int2float(uint32_t i)
41 | {
42 | union av_intfloat32 v;
43 | v.i = i;
44 | return v.f;
45 | }
46 |
47 | /**
48 | * Reinterpret a float as a 32-bit integer.
49 | */
50 | static av_always_inline uint32_t av_float2int(float f)
51 | {
52 | union av_intfloat32 v;
53 | v.f = f;
54 | return v.i;
55 | }
56 |
57 | /**
58 | * Reinterpret a 64-bit integer as a double.
59 | */
60 | static av_always_inline double av_int2double(uint64_t i)
61 | {
62 | union av_intfloat64 v;
63 | v.i = i;
64 | return v.f;
65 | }
66 |
67 | /**
68 | * Reinterpret a double as a 64-bit integer.
69 | */
70 | static av_always_inline uint64_t av_double2int(double f)
71 | {
72 | union av_intfloat64 v;
73 | v.f = f;
74 | return v.i;
75 | }
76 |
77 | #endif /* AVUTIL_INTFLOAT_H */
78 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/lzo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * LZO 1x decompression
3 | * copyright (c) 2006 Reimar Doeffinger
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_LZO_H
23 | #define AVUTIL_LZO_H
24 |
25 | /**
26 | * @defgroup lavu_lzo LZO
27 | * @ingroup lavu_crypto
28 | *
29 | * @{
30 | */
31 |
32 | #include
33 |
34 | /** @name Error flags returned by av_lzo1x_decode
35 | * @{ */
36 | /// end of the input buffer reached before decoding finished
37 | #define AV_LZO_INPUT_DEPLETED 1
38 | /// decoded data did not fit into output buffer
39 | #define AV_LZO_OUTPUT_FULL 2
40 | /// a reference to previously decoded data was wrong
41 | #define AV_LZO_INVALID_BACKPTR 4
42 | /// a non-specific error in the compressed bitstream
43 | #define AV_LZO_ERROR 8
44 | /** @} */
45 |
46 | #define AV_LZO_INPUT_PADDING 8
47 | #define AV_LZO_OUTPUT_PADDING 12
48 |
49 | /**
50 | * @brief Decodes LZO 1x compressed data.
51 | * @param out output buffer
52 | * @param outlen size of output buffer, number of bytes left are returned here
53 | * @param in input buffer
54 | * @param inlen size of input buffer, number of bytes left are returned here
55 | * @return 0 on success, otherwise a combination of the error flags above
56 | *
57 | * Make sure all buffers are appropriately padded, in must provide
58 | * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
59 | */
60 | int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
61 |
62 | /**
63 | * @}
64 | */
65 |
66 | #endif /* AVUTIL_LZO_H */
67 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/macros.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | /**
20 | * @file
21 | * @ingroup lavu
22 | * Utility Preprocessor macros
23 | */
24 |
25 | #ifndef AVUTIL_MACROS_H
26 | #define AVUTIL_MACROS_H
27 |
28 | /**
29 | * @addtogroup preproc_misc Preprocessor String Macros
30 | *
31 | * String manipulation macros
32 | *
33 | * @{
34 | */
35 |
36 | #define AV_STRINGIFY(s) AV_TOSTRING(s)
37 | #define AV_TOSTRING(s) #s
38 |
39 | #define AV_GLUE(a, b) a ## b
40 | #define AV_JOIN(a, b) AV_GLUE(a, b)
41 |
42 | /**
43 | * @}
44 | */
45 |
46 | #define AV_PRAGMA(s) _Pragma(#s)
47 |
48 | #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
49 |
50 | #endif /* AVUTIL_MACROS_H */
51 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/motion_vector.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_MOTION_VECTOR_H
20 | #define AVUTIL_MOTION_VECTOR_H
21 |
22 | #include
23 |
24 | typedef struct AVMotionVector {
25 | /**
26 | * Where the current macroblock comes from; negative value when it comes
27 | * from the past, positive value when it comes from the future.
28 | * XXX: set exact relative ref frame reference instead of a +/- 1 "direction".
29 | */
30 | int32_t source;
31 | /**
32 | * Width and height of the block.
33 | */
34 | uint8_t w, h;
35 | /**
36 | * Absolute source position. Can be outside the frame area.
37 | */
38 | int16_t src_x, src_y;
39 | /**
40 | * Absolute destination position. Can be outside the frame area.
41 | */
42 | int16_t dst_x, dst_y;
43 | /**
44 | * Extra flag information.
45 | * Currently unused.
46 | */
47 | uint64_t flags;
48 | /**
49 | * Motion vector
50 | * src_x = dst_x + motion_x / motion_scale
51 | * src_y = dst_y + motion_y / motion_scale
52 | */
53 | int32_t motion_x, motion_y;
54 | uint16_t motion_scale;
55 | } AVMotionVector;
56 |
57 | #endif /* AVUTIL_MOTION_VECTOR_H */
58 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/pixelutils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_PIXELUTILS_H
20 | #define AVUTIL_PIXELUTILS_H
21 |
22 | #include
23 | #include
24 | #include "common.h"
25 |
26 | /**
27 | * Sum of abs(src1[x] - src2[x])
28 | */
29 | typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1,
30 | const uint8_t *src2, ptrdiff_t stride2);
31 |
32 | /**
33 | * Get a potentially optimized pointer to a Sum-of-absolute-differences
34 | * function (see the av_pixelutils_sad_fn prototype).
35 | *
36 | * @param w_bits 1<
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg 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 GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_RANDOM_SEED_H
22 | #define AVUTIL_RANDOM_SEED_H
23 |
24 | #include
25 | /**
26 | * @addtogroup lavu_crypto
27 | * @{
28 | */
29 |
30 | /**
31 | * Get a seed to use in conjunction with random functions.
32 | * This function tries to provide a good seed at a best effort bases.
33 | * Its possible to call this function multiple times if more bits are needed.
34 | * It can be quite slow, which is why it should only be used as seed for a faster
35 | * PRNG. The quality of the seed depends on the platform.
36 | */
37 | uint32_t av_get_random_seed(void);
38 |
39 | /**
40 | * @}
41 | */
42 |
43 | #endif /* AVUTIL_RANDOM_SEED_H */
44 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/rc4.h:
--------------------------------------------------------------------------------
1 | /*
2 | * RC4 encryption/decryption/pseudo-random number generator
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg 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 GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_RC4_H
22 | #define AVUTIL_RC4_H
23 |
24 | #include
25 |
26 | /**
27 | * @defgroup lavu_rc4 RC4
28 | * @ingroup lavu_crypto
29 | * @{
30 | */
31 |
32 | typedef struct AVRC4 {
33 | uint8_t state[256];
34 | int x, y;
35 | } AVRC4;
36 |
37 | /**
38 | * Allocate an AVRC4 context.
39 | */
40 | AVRC4 *av_rc4_alloc(void);
41 |
42 | /**
43 | * @brief Initializes an AVRC4 context.
44 | *
45 | * @param key_bits must be a multiple of 8
46 | * @param decrypt 0 for encryption, 1 for decryption, currently has no effect
47 | * @return zero on success, negative value otherwise
48 | */
49 | int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt);
50 |
51 | /**
52 | * @brief Encrypts / decrypts using the RC4 algorithm.
53 | *
54 | * @param count number of bytes
55 | * @param dst destination array, can be equal to src
56 | * @param src source array, can be equal to dst, may be NULL
57 | * @param iv not (yet) used for RC4, should be NULL
58 | * @param decrypt 0 for encryption, 1 for decryption, not (yet) used
59 | */
60 | void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
61 |
62 | /**
63 | * @}
64 | */
65 |
66 | #endif /* AVUTIL_RC4_H */
67 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/replaygain.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_REPLAYGAIN_H
20 | #define AVUTIL_REPLAYGAIN_H
21 |
22 | #include
23 |
24 | /**
25 | * ReplayGain information (see
26 | * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification).
27 | * The size of this struct is a part of the public ABI.
28 | */
29 | typedef struct AVReplayGain {
30 | /**
31 | * Track replay gain in microbels (divide by 100000 to get the value in dB).
32 | * Should be set to INT32_MIN when unknown.
33 | */
34 | int32_t track_gain;
35 | /**
36 | * Peak track amplitude, with 100000 representing full scale (but values
37 | * may overflow). 0 when unknown.
38 | */
39 | uint32_t track_peak;
40 | /**
41 | * Same as track_gain, but for the whole album.
42 | */
43 | int32_t album_gain;
44 | /**
45 | * Same as track_peak, but for the whole album,
46 | */
47 | uint32_t album_peak;
48 | } AVReplayGain;
49 |
50 | #endif /* AVUTIL_REPLAYGAIN_H */
51 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/tea.h:
--------------------------------------------------------------------------------
1 | /*
2 | * A 32-bit implementation of the TEA algorithm
3 | * Copyright (c) 2015 Vesselin Bontchev
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_TEA_H
23 | #define AVUTIL_TEA_H
24 |
25 | #include
26 |
27 | /**
28 | * @file
29 | * @brief Public header for libavutil TEA algorithm
30 | * @defgroup lavu_tea TEA
31 | * @ingroup lavu_crypto
32 | * @{
33 | */
34 |
35 | extern const int av_tea_size;
36 |
37 | struct AVTEA;
38 |
39 | /**
40 | * Allocate an AVTEA context
41 | * To free the struct: av_free(ptr)
42 | */
43 | struct AVTEA *av_tea_alloc(void);
44 |
45 | /**
46 | * Initialize an AVTEA context.
47 | *
48 | * @param ctx an AVTEA context
49 | * @param key a key of 16 bytes used for encryption/decryption
50 | * @param rounds the number of rounds in TEA (64 is the "standard")
51 | */
52 | void av_tea_init(struct AVTEA *ctx, const uint8_t key[16], int rounds);
53 |
54 | /**
55 | * Encrypt or decrypt a buffer using a previously initialized context.
56 | *
57 | * @param ctx an AVTEA context
58 | * @param dst destination array, can be equal to src
59 | * @param src source array, can be equal to dst
60 | * @param count number of 8 byte blocks
61 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used
62 | * @param decrypt 0 for encryption, 1 for decryption
63 | */
64 | void av_tea_crypt(struct AVTEA *ctx, uint8_t *dst, const uint8_t *src,
65 | int count, uint8_t *iv, int decrypt);
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | #endif /* AVUTIL_TEA_H */
72 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libavutil/time.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2003 Fabrice Bellard
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg 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 GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_TIME_H
22 | #define AVUTIL_TIME_H
23 |
24 | #include
25 |
26 | /**
27 | * Get the current time in microseconds.
28 | */
29 | int64_t av_gettime(void);
30 |
31 | /**
32 | * Get the current time in microseconds since some unspecified starting point.
33 | * On platforms that support it, the time comes from a monotonic clock
34 | * This property makes this time source ideal for measuring relative time.
35 | * The returned values may not be monotonic on platforms where a monotonic
36 | * clock is not available.
37 | */
38 | int64_t av_gettime_relative(void);
39 |
40 | /**
41 | * Indicates with a boolean result if the av_gettime_relative() time source
42 | * is monotonic.
43 | */
44 | int av_gettime_relative_is_monotonic(void);
45 |
46 | /**
47 | * Sleep for a period of time. Although the duration is expressed in
48 | * microseconds, the actual delay may be rounded to the precision of the
49 | * system timer.
50 | *
51 | * @param usec Number of microseconds to sleep.
52 | * @return zero on success or (negative) error code.
53 | */
54 | int av_usleep(unsigned usec);
55 |
56 | #endif /* AVUTIL_TIME_H */
57 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libpostproc/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Version macros.
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg 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 GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef POSTPROC_VERSION_H
22 | #define POSTPROC_VERSION_H
23 |
24 | /**
25 | * @file
26 | * Libpostproc version macros
27 | */
28 |
29 | #include "libavutil/avutil.h"
30 |
31 | #define LIBPOSTPROC_VERSION_MAJOR 55
32 | #define LIBPOSTPROC_VERSION_MINOR 5
33 | #define LIBPOSTPROC_VERSION_MICRO 100
34 |
35 | #define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
36 | LIBPOSTPROC_VERSION_MINOR, \
37 | LIBPOSTPROC_VERSION_MICRO)
38 | #define LIBPOSTPROC_VERSION AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \
39 | LIBPOSTPROC_VERSION_MINOR, \
40 | LIBPOSTPROC_VERSION_MICRO)
41 | #define LIBPOSTPROC_BUILD LIBPOSTPROC_VERSION_INT
42 |
43 | #define LIBPOSTPROC_IDENT "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION)
44 |
45 | #endif /* POSTPROC_VERSION_H */
46 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libswresample/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Version macros.
3 | *
4 | * This file is part of libswresample
5 | *
6 | * libswresample is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * libswresample 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 GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with libswresample; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef SWRESAMPLE_VERSION_H
22 | #define SWRESAMPLE_VERSION_H
23 |
24 | /**
25 | * @file
26 | * Libswresample version macros
27 | */
28 |
29 | #include "libavutil/avutil.h"
30 |
31 | #define LIBSWRESAMPLE_VERSION_MAJOR 3
32 | #define LIBSWRESAMPLE_VERSION_MINOR 5
33 | #define LIBSWRESAMPLE_VERSION_MICRO 100
34 |
35 | #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
36 | LIBSWRESAMPLE_VERSION_MINOR, \
37 | LIBSWRESAMPLE_VERSION_MICRO)
38 | #define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \
39 | LIBSWRESAMPLE_VERSION_MINOR, \
40 | LIBSWRESAMPLE_VERSION_MICRO)
41 | #define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT
42 |
43 | #define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION)
44 |
45 | #endif /* SWRESAMPLE_VERSION_H */
46 |
--------------------------------------------------------------------------------
/media/src/main/cpp/ffmpeg/include/libswscale/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef SWSCALE_VERSION_H
20 | #define SWSCALE_VERSION_H
21 |
22 | /**
23 | * @file
24 | * swscale version macros
25 | */
26 |
27 | #include "libavutil/version.h"
28 |
29 | #define LIBSWSCALE_VERSION_MAJOR 5
30 | #define LIBSWSCALE_VERSION_MINOR 5
31 | #define LIBSWSCALE_VERSION_MICRO 100
32 |
33 | #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
34 | LIBSWSCALE_VERSION_MINOR, \
35 | LIBSWSCALE_VERSION_MICRO)
36 | #define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \
37 | LIBSWSCALE_VERSION_MINOR, \
38 | LIBSWSCALE_VERSION_MICRO)
39 | #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
40 |
41 | #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
42 |
43 | /**
44 | * FF_API_* defines may be placed below to indicate public API that will be
45 | * dropped at a future version bump. The defines themselves are not part of
46 | * the public API and may change, break or disappear at any time.
47 | */
48 |
49 | #ifndef FF_API_SWS_VECTOR
50 | #define FF_API_SWS_VECTOR (LIBSWSCALE_VERSION_MAJOR < 6)
51 | #endif
52 |
53 | #endif /* SWSCALE_VERSION_H */
54 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_clipboard.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_clipboard.h
24 | *
25 | * Include file for SDL clipboard handling
26 | */
27 |
28 | #ifndef SDL_clipboard_h_
29 | #define SDL_clipboard_h_
30 |
31 | #include "SDL_stdinc.h"
32 |
33 | #include "begin_code.h"
34 | /* Set up for C function definitions, even when using C++ */
35 | #ifdef __cplusplus
36 | extern "C" {
37 | #endif
38 |
39 | /* Function prototypes */
40 |
41 | /**
42 | * \brief Put UTF-8 text into the clipboard
43 | *
44 | * \sa SDL_GetClipboardText()
45 | */
46 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
47 |
48 | /**
49 | * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
50 | *
51 | * \sa SDL_SetClipboardText()
52 | */
53 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
54 |
55 | /**
56 | * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
57 | *
58 | * \sa SDL_GetClipboardText()
59 | */
60 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
61 |
62 |
63 | /* Ends C function definitions when using C++ */
64 | #ifdef __cplusplus
65 | }
66 | #endif
67 | #include "close_code.h"
68 |
69 | #endif /* SDL_clipboard_h_ */
70 |
71 | /* vi: set ts=4 sw=4 expandtab: */
72 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_config.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDL_config_h_
23 | #define SDL_config_h_
24 |
25 | #include "SDL_platform.h"
26 |
27 | /**
28 | * \file SDL_config.h
29 | */
30 |
31 | /* Add any platform that doesn't build using the configure system. */
32 | #if defined(__WIN32__)
33 | #include "SDL_config_windows.h"
34 | #elif defined(__WINRT__)
35 | #include "SDL_config_winrt.h"
36 | #elif defined(__MACOSX__)
37 | #include "SDL_config_macosx.h"
38 | #elif defined(__IPHONEOS__)
39 | #include "SDL_config_iphoneos.h"
40 | #elif defined(__ANDROID__)
41 | #include "SDL_config_android.h"
42 | #elif defined(__PSP__)
43 | #include "SDL_config_psp.h"
44 | #else
45 | /* This is a minimal configuration just to get SDL running on new platforms */
46 | #include "SDL_config_minimal.h"
47 | #endif /* platform config */
48 |
49 | #ifdef USING_GENERATED_CONFIG_H
50 | #error Wrong SDL_config.h, check your include path?
51 | #endif
52 |
53 | #endif /* SDL_config_h_ */
54 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_copying.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_name.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDLname_h_
23 | #define SDLname_h_
24 |
25 | #if defined(__STDC__) || defined(__cplusplus)
26 | #define NeedFunctionPrototypes 1
27 | #endif
28 |
29 | #define SDL_NAME(X) SDL_##X
30 |
31 | #endif /* SDLname_h_ */
32 |
33 | /* vi: set ts=4 sw=4 expandtab: */
34 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_opengles.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_opengles.h
24 | *
25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers.
26 | */
27 | #include "SDL_config.h"
28 |
29 | #ifdef __IPHONEOS__
30 | #include
31 | #include
32 | #else
33 | #include
34 | #include
35 | #endif
36 |
37 | #ifndef APIENTRY
38 | #define APIENTRY
39 | #endif
40 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_opengles2.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_opengles2.h
24 | *
25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
26 | */
27 | #include "SDL_config.h"
28 |
29 | #ifndef _MSC_VER
30 |
31 | #ifdef __IPHONEOS__
32 | #include
33 | #include
34 | #else
35 | #include
36 | #include
37 | #include
38 | #endif
39 |
40 | #else /* _MSC_VER */
41 |
42 | /* OpenGL ES2 headers for Visual Studio */
43 | #include "SDL_opengles2_khrplatform.h"
44 | #include "SDL_opengles2_gl2platform.h"
45 | #include "SDL_opengles2_gl2.h"
46 | #include "SDL_opengles2_gl2ext.h"
47 |
48 | #endif /* _MSC_VER */
49 |
50 | #ifndef APIENTRY
51 | #define APIENTRY GL_APIENTRY
52 | #endif
53 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_opengles2_gl2platform.h:
--------------------------------------------------------------------------------
1 | #ifndef __gl2platform_h_
2 | #define __gl2platform_h_
3 |
4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
5 |
6 | /*
7 | * This document is licensed under the SGI Free Software B License Version
8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
9 | */
10 |
11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
12 | *
13 | * Adopters may modify khrplatform.h and this file to suit their platform.
14 | * You are encouraged to submit all modifications to the Khronos group so that
15 | * they can be included in future versions of this file. Please submit changes
16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
17 | * by filing a bug against product "OpenGL-ES" component "Registry".
18 | */
19 |
20 | /*#include */
21 |
22 | #ifndef GL_APICALL
23 | #define GL_APICALL KHRONOS_APICALL
24 | #endif
25 |
26 | #ifndef GL_APIENTRY
27 | #define GL_APIENTRY KHRONOS_APIENTRY
28 | #endif
29 |
30 | #endif /* __gl2platform_h_ */
31 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_revision.h:
--------------------------------------------------------------------------------
1 | #define SDL_REVISION "hg-11914:f1084c419f33"
2 | #define SDL_REVISION_NUMBER 11914
3 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_test.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_test.h
24 | *
25 | * Include file for SDL test framework.
26 | *
27 | * This code is a part of the SDL2_test library, not the main SDL library.
28 | */
29 |
30 | #ifndef SDL_test_h_
31 | #define SDL_test_h_
32 |
33 | #include "SDL.h"
34 | #include "SDL_test_assert.h"
35 | #include "SDL_test_common.h"
36 | #include "SDL_test_compare.h"
37 | #include "SDL_test_crc32.h"
38 | #include "SDL_test_font.h"
39 | #include "SDL_test_fuzzer.h"
40 | #include "SDL_test_harness.h"
41 | #include "SDL_test_images.h"
42 | #include "SDL_test_log.h"
43 | #include "SDL_test_md5.h"
44 | #include "SDL_test_memory.h"
45 | #include "SDL_test_random.h"
46 |
47 | #include "begin_code.h"
48 | /* Set up for C function definitions, even when using C++ */
49 | #ifdef __cplusplus
50 | extern "C" {
51 | #endif
52 |
53 | /* Global definitions */
54 |
55 | /*
56 | * Note: Maximum size of SDLTest log message is less than SDL's limit
57 | * to ensure we can fit additional information such as the timestamp.
58 | */
59 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584
60 |
61 | /* Ends C function definitions when using C++ */
62 | #ifdef __cplusplus
63 | }
64 | #endif
65 | #include "close_code.h"
66 |
67 | #endif /* SDL_test_h_ */
68 |
69 | /* vi: set ts=4 sw=4 expandtab: */
70 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_test_log.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_test_log.h
24 | *
25 | * Include file for SDL test framework.
26 | *
27 | * This code is a part of the SDL2_test library, not the main SDL library.
28 | */
29 |
30 | /*
31 | *
32 | * Wrapper to log in the TEST category
33 | *
34 | */
35 |
36 | #ifndef SDL_test_log_h_
37 | #define SDL_test_log_h_
38 |
39 | #include "begin_code.h"
40 | /* Set up for C function definitions, even when using C++ */
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 | /**
46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority.
47 | *
48 | * \param fmt Message to be logged
49 | */
50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
51 |
52 | /**
53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority.
54 | *
55 | * \param fmt Message to be logged
56 | */
57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
58 |
59 | /* Ends C function definitions when using C++ */
60 | #ifdef __cplusplus
61 | }
62 | #endif
63 | #include "close_code.h"
64 |
65 | #endif /* SDL_test_log_h_ */
66 |
67 | /* vi: set ts=4 sw=4 expandtab: */
68 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_test_memory.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_test_memory.h
24 | *
25 | * Include file for SDL test framework.
26 | *
27 | * This code is a part of the SDL2_test library, not the main SDL library.
28 | */
29 |
30 | #ifndef SDL_test_memory_h_
31 | #define SDL_test_memory_h_
32 |
33 | #include "begin_code.h"
34 | /* Set up for C function definitions, even when using C++ */
35 | #ifdef __cplusplus
36 | extern "C" {
37 | #endif
38 |
39 |
40 | /**
41 | * \brief Start tracking SDL memory allocations
42 | *
43 | * \note This should be called before any other SDL functions for complete tracking coverage
44 | */
45 | int SDLTest_TrackAllocations();
46 |
47 | /**
48 | * \brief Print a log of any outstanding allocations
49 | *
50 | * \note This can be called after SDL_Quit()
51 | */
52 | void SDLTest_LogAllocations();
53 |
54 |
55 | /* Ends C function definitions when using C++ */
56 | #ifdef __cplusplus
57 | }
58 | #endif
59 | #include "close_code.h"
60 |
61 | #endif /* SDL_test_memory_h_ */
62 |
63 | /* vi: set ts=4 sw=4 expandtab: */
64 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/SDL_types.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_types.h
24 | *
25 | * \deprecated
26 | */
27 |
28 | /* DEPRECATED */
29 | #include "SDL_stdinc.h"
30 |
--------------------------------------------------------------------------------
/media/src/main/cpp/sdl2/include/close_code.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file close_code.h
24 | *
25 | * This file reverses the effects of begin_code.h and should be included
26 | * after you finish any function and structure declarations in your headers
27 | */
28 |
29 | #undef _begin_code_h
30 |
31 | /* Reset structure packing at previous byte alignment */
32 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
33 | #ifdef __BORLANDC__
34 | #pragma nopackwarning
35 | #endif
36 | #pragma pack(pop)
37 | #endif /* Compiler needs structure packing set */
38 |
--------------------------------------------------------------------------------
/media/src/main/cpp/utils/const.h:
--------------------------------------------------------------------------------
1 | //
2 | // 编解码常量定义
3 | // Author: Chen Xiaoping
4 | //
5 |
6 | #ifndef LEARNVIDEO_ENCODE_CONST_H
7 | #define LEARNVIDEO_ENCODE_CONST_H
8 |
9 | extern "C" {
10 | #include
11 | };
12 |
13 | // 音频编码格式:浮点型数据(32位)
14 | static const AVSampleFormat AUDIO_DEST_FORMAT = AV_SAMPLE_FMT_FLTP;
15 | // 音频编码采样率
16 | static const int AUDIO_DEST_SAMPLE_RATE = 44100;
17 | // 音频编码通道数
18 | static const int AUDIO_DEST_CHANNEL_COUNTS = 2;
19 | // 音频编码声道格式
20 | static const uint64_t AUDIO_DEST_CHANNEL_LAYOUT = AV_CH_LAYOUT_STEREO;
21 | // 音频编码比特率
22 | static const int AUDIO_DEST_BIT_RATE = 64000;
23 | // ACC音频一帧采样数
24 | static const int ACC_NB_SAMPLES = 1024;
25 | // 视频编码帧率
26 | static const int ENCODE_VIDEO_FPS = 25;
27 |
28 | #endif //LEARNVIDEO_ENCODE_CONST_H
29 |
--------------------------------------------------------------------------------
/media/src/main/cpp/utils/logger.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by cxp on 2019-07-31.
3 | //
4 |
5 | #ifndef LEARNVIDEO_LOGGER_H
6 | #define LEARNVIDEO_LOGGER_H
7 |
8 | #include
9 |
10 | #define LOG
11 |
12 | #ifdef LOG
13 | #define LOGD(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_DEBUG,TAG,FORMAT,##__VA_ARGS__);
14 | #define LOGI(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_INFO,TAG,FORMAT,##__VA_ARGS__);
15 | #define LOGW(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_WARN,TAG,FORMAT,##__VA_ARGS__);
16 | #define LOGE(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_ERROR,TAG,FORMAT,##__VA_ARGS__);
17 |
18 | #define LOG_INFO(TAG, SPEC, FMT, ...) LOGI(TAG, "[%s] " FMT, SPEC, ##__VA_ARGS__)
19 | #define LOG_ERROR(TAG, SPEC, FMT, ...) LOGE(TAG, "[%s] " FMT, SPEC, ##__VA_ARGS__)
20 | #else
21 | #define LOGD(TAG, FORMAT,...);
22 | #define LOGI(TAG, FORMAT,...);
23 | #define LOGW(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_WARN,TAG,FORMAT,##__VA_ARGS__);
24 | #define LOGE(TAG, FORMAT,...) __android_log_print(ANDROID_LOG_ERROR,TAG,FORMAT,##__VA_ARGS__);
25 | #endif
26 |
27 | #endif //LEARNVIDEO_LOGGER_H
28 |
--------------------------------------------------------------------------------
/media/src/main/cpp/utils/timer.c:
--------------------------------------------------------------------------------
1 | //
2 | // Created by cxp on 2019-08-05.
3 | //
4 |
5 | #include "sys/time.h"
6 |
7 | int64_t GetCurMsTime() {
8 | struct timeval tv;
9 | gettimeofday(&tv, NULL);
10 | int64_t ts = (int64_t)tv.tv_sec * 1000 + tv.tv_usec / 1000;
11 | return ts;
12 | }
--------------------------------------------------------------------------------
/media/src/main/java/com/poney/ffmpeg/encoder/EncoderCallback.java:
--------------------------------------------------------------------------------
1 | package com.poney.ffmpeg.encoder;
2 |
3 | import android.media.MediaCodec;
4 | import android.media.MediaFormat;
5 |
6 | import java.nio.ByteBuffer;
7 |
8 | public interface EncoderCallback {
9 | void outputMediaFormatChanged(int type, MediaFormat mediaFormat);
10 |
11 | void onEncodeOutput(int type, ByteBuffer byteBuffer, MediaCodec.BufferInfo bufferInfo);
12 |
13 | void onStop(int type);
14 | }
--------------------------------------------------------------------------------
/media/src/main/java/com/poney/ffmpeg/encoder/H264FFMPEGEncoder.java:
--------------------------------------------------------------------------------
1 | package com.poney.ffmpeg.encoder;
2 |
3 |
4 | public class H264FFMPEGEncoder {
5 |
6 | static {
7 | System.loadLibrary("ffmpeg-lib");
8 | }
9 |
10 | public native void encodeMP4Start(String mp4Path, int width, int height);
11 |
12 | public native void encodeMP4Stop();
13 |
14 | public native void onPreviewFrame(byte[] yuvData, int width, int height);
15 |
16 | public native void encodeJPEG(String jpegPath, int width, int height);
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/media/src/main/java/com/poney/ffmpeg/encoder/MediaEncoder.java:
--------------------------------------------------------------------------------
1 | package com.poney.ffmpeg.encoder;
2 |
3 | /**
4 | * @author feibiao.ma
5 | * @project BlogDemo
6 | * @package_name com.poney.ffmpeg.encoder
7 | * @date 2021/1/11
8 | */
9 | public abstract class MediaEncoder {
10 | /**
11 | * previous presentationTimeUs for writing
12 | */
13 | protected long prevOutputPTSUs = 0;
14 |
15 | /**
16 | * get next encoding presentationTimeUs
17 | *
18 | * @return
19 | */
20 | protected long getPTSUs() {
21 | long result = System.nanoTime() / 1000L;
22 | // presentationTimeUs should be monotonic
23 | // otherwise muxer fail to write
24 | if (result < prevOutputPTSUs)
25 | result = (prevOutputPTSUs - result) + result;
26 | return result;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/media/src/main/java/com/poney/ffmpeg/play/FFUtils.java:
--------------------------------------------------------------------------------
1 | package com.poney.ffmpeg.play;
2 |
3 | import android.view.Surface;
4 |
5 | /**
6 | *
7 | */
8 |
9 | public class FFUtils {
10 | static {
11 | System.loadLibrary("ffmpeg-lib");
12 | }
13 |
14 | public static native String urlProtocolInfo();
15 |
16 | public static native String avFormatInfo();
17 |
18 | public static native String avCodecInfo();
19 |
20 | public static native String avFilterInfo();
21 |
22 | public static native void playVideo(String videoPath, Surface surface, int viewWidth, int viewHeight);
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/media/src/main/java/com/poney/ffmpeg/play/FFVideoView.java:
--------------------------------------------------------------------------------
1 | package com.poney.ffmpeg.play;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.graphics.PixelFormat;
6 | import android.os.Build;
7 | import android.util.AttributeSet;
8 | import android.util.Log;
9 | import android.view.Surface;
10 | import android.view.SurfaceHolder;
11 | import android.view.SurfaceView;
12 |
13 | /**
14 | * Created by tingkuo.
15 | * Date: 2018-08-24
16 | * Time: 09:35
17 | */
18 | public class FFVideoView extends SurfaceView implements SurfaceHolder.Callback {
19 |
20 | Surface mSurface;
21 | private int viewWidth;
22 | private int viewHeight;
23 |
24 | public FFVideoView(Context context) {
25 | this(context, null);
26 | }
27 |
28 | public FFVideoView(Context context, AttributeSet attrs) {
29 | this(context, attrs, 0);
30 |
31 | }
32 |
33 | public FFVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
34 | this(context, attrs, defStyleAttr, 0);
35 |
36 | }
37 |
38 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
39 | public FFVideoView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
40 | super(context, attrs, defStyleAttr, defStyleRes);
41 | init();
42 | }
43 |
44 | private void init() {
45 | getHolder().addCallback(this);
46 | }
47 |
48 |
49 | public void playVideo(final String videoPath) {
50 | if (mSurface != null && viewWidth != 0 && viewHeight != 0) {
51 | new Thread(new Runnable() {
52 | @Override
53 | public void run() {
54 | FFUtils.playVideo(videoPath, mSurface, viewWidth, viewHeight);
55 | }
56 | }).start();
57 | }
58 |
59 | }
60 |
61 | @Override
62 | public void surfaceCreated(SurfaceHolder holder) {
63 | holder.setFormat(PixelFormat.RGBA_8888);
64 | mSurface = holder.getSurface();
65 | }
66 |
67 | @Override
68 | public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
69 | viewWidth = width;
70 | viewHeight = height;
71 | }
72 |
73 | @Override
74 | public void surfaceDestroyed(SurfaceHolder holder) {
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/media/src/main/jniLibs/armeabi-v7a/libavcodec.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/media/src/main/jniLibs/armeabi-v7a/libavcodec.so
--------------------------------------------------------------------------------
/media/src/main/jniLibs/armeabi-v7a/libavdevice.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/media/src/main/jniLibs/armeabi-v7a/libavdevice.so
--------------------------------------------------------------------------------
/media/src/main/jniLibs/armeabi-v7a/libavfilter.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/media/src/main/jniLibs/armeabi-v7a/libavfilter.so
--------------------------------------------------------------------------------
/media/src/main/jniLibs/armeabi-v7a/libavformat.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/media/src/main/jniLibs/armeabi-v7a/libavformat.so
--------------------------------------------------------------------------------
/media/src/main/jniLibs/armeabi-v7a/libavutil.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/media/src/main/jniLibs/armeabi-v7a/libavutil.so
--------------------------------------------------------------------------------
/media/src/main/jniLibs/armeabi-v7a/libpostproc.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/media/src/main/jniLibs/armeabi-v7a/libpostproc.so
--------------------------------------------------------------------------------
/media/src/main/jniLibs/armeabi-v7a/libswresample.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/media/src/main/jniLibs/armeabi-v7a/libswresample.so
--------------------------------------------------------------------------------
/media/src/main/jniLibs/armeabi-v7a/libswscale.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/media/src/main/jniLibs/armeabi-v7a/libswscale.so
--------------------------------------------------------------------------------
/media/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/pdf/opengles20-reference-card.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/pdf/opengles20-reference-card.pdf
--------------------------------------------------------------------------------
/sdl2-hello/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/sdl2-hello/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | cmake_minimum_required(VERSION 3.4.1)
3 |
4 |
5 | add_library(main
6 | SHARED
7 | src/main/cpp/sdl2_hello.c)
8 |
9 | find_library(log-lib
10 | log)
11 |
12 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
13 | set(CMAKE_VERBOSE_MAKEFILE on)
14 |
15 | add_library(sdl2
16 | SHARED
17 | IMPORTED)
18 |
19 | set_target_properties(sdl2
20 | PROPERTIES IMPORTED_LOCATION
21 | ${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}/libSDL2.so
22 | )
23 |
24 | #头文件
25 | include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include)
26 |
27 | target_link_libraries(main sdl2 ${log-lib})
28 |
--------------------------------------------------------------------------------
/sdl2-hello/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 |
5 | compileSdkVersion rootProject.ext.androidConfig.compileSdkVersion
6 | buildToolsVersion rootProject.ext.androidConfig.buildToolsVersion
7 |
8 | defaultConfig {
9 | minSdkVersion rootProject.ext.androidConfig.minSdkVersion
10 | targetSdkVersion rootProject.ext.androidConfig.targetSdkVersion
11 |
12 | versionCode rootProject.ext.androidConfig.versionCode
13 | versionName rootProject.ext.androidConfig.versionName
14 |
15 | externalNativeBuild {
16 | cmake {
17 | cppFlags ""
18 | }
19 | ndk {
20 | abiFilters "armeabi-v7a"
21 | }
22 | }
23 | sourceSets {
24 | main {
25 | //库地址
26 | jniLibs.srcDirs = ['libs']
27 | }
28 | }
29 | }
30 | buildTypes {
31 | release {
32 | minifyEnabled false
33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
34 | }
35 | }
36 | externalNativeBuild {
37 | cmake {
38 | path "CMakeLists.txt"
39 | }
40 | }
41 |
42 | packagingOptions {
43 | pickFirst 'lib/armeabi-v7a/libSDL2.so'
44 | }
45 | }
46 |
47 | dependencies {
48 | implementation fileTree(dir: 'libs', include: ['*.jar'])
49 | implementation rootProject.ext.dependenciesConfig["appcompatV7"]
50 | implementation rootProject.ext.dependenciesConfig["design"]
51 | implementation project(path: ':common')
52 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
53 | }
54 |
--------------------------------------------------------------------------------
/sdl2-hello/libs/armeabi-v7a/libSDL2.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/sdl2-hello/libs/armeabi-v7a/libSDL2.so
--------------------------------------------------------------------------------
/sdl2-hello/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/assets/input.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/sdl2-hello/src/main/assets/input.bmp
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_clipboard.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_clipboard.h
24 | *
25 | * Include file for SDL clipboard handling
26 | */
27 |
28 | #ifndef SDL_clipboard_h_
29 | #define SDL_clipboard_h_
30 |
31 | #include "SDL_stdinc.h"
32 |
33 | #include "begin_code.h"
34 | /* Set up for C function definitions, even when using C++ */
35 | #ifdef __cplusplus
36 | extern "C" {
37 | #endif
38 |
39 | /* Function prototypes */
40 |
41 | /**
42 | * \brief Put UTF-8 text into the clipboard
43 | *
44 | * \sa SDL_GetClipboardText()
45 | */
46 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
47 |
48 | /**
49 | * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
50 | *
51 | * \sa SDL_SetClipboardText()
52 | */
53 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
54 |
55 | /**
56 | * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
57 | *
58 | * \sa SDL_GetClipboardText()
59 | */
60 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
61 |
62 |
63 | /* Ends C function definitions when using C++ */
64 | #ifdef __cplusplus
65 | }
66 | #endif
67 | #include "close_code.h"
68 |
69 | #endif /* SDL_clipboard_h_ */
70 |
71 | /* vi: set ts=4 sw=4 expandtab: */
72 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_config.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDL_config_h_
23 | #define SDL_config_h_
24 |
25 | #include "SDL_platform.h"
26 |
27 | /**
28 | * \file SDL_config.h
29 | */
30 |
31 | /* Add any platform that doesn't build using the configure system. */
32 | #if defined(__WIN32__)
33 | #include "SDL_config_windows.h"
34 | #elif defined(__WINRT__)
35 | #include "SDL_config_winrt.h"
36 | #elif defined(__MACOSX__)
37 | #include "SDL_config_macosx.h"
38 | #elif defined(__IPHONEOS__)
39 | #include "SDL_config_iphoneos.h"
40 | #elif defined(__ANDROID__)
41 | #include "SDL_config_android.h"
42 | #elif defined(__PSP__)
43 | #include "SDL_config_psp.h"
44 | #else
45 | /* This is a minimal configuration just to get SDL running on new platforms */
46 | #include "SDL_config_minimal.h"
47 | #endif /* platform config */
48 |
49 | #ifdef USING_GENERATED_CONFIG_H
50 | #error Wrong SDL_config.h, check your include path?
51 | #endif
52 |
53 | #endif /* SDL_config_h_ */
54 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_copying.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_name.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDLname_h_
23 | #define SDLname_h_
24 |
25 | #if defined(__STDC__) || defined(__cplusplus)
26 | #define NeedFunctionPrototypes 1
27 | #endif
28 |
29 | #define SDL_NAME(X) SDL_##X
30 |
31 | #endif /* SDLname_h_ */
32 |
33 | /* vi: set ts=4 sw=4 expandtab: */
34 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_opengles.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_opengles.h
24 | *
25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers.
26 | */
27 | #include "SDL_config.h"
28 |
29 | #ifdef __IPHONEOS__
30 | #include
31 | #include
32 | #else
33 | #include
34 | #include
35 | #endif
36 |
37 | #ifndef APIENTRY
38 | #define APIENTRY
39 | #endif
40 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_opengles2.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_opengles2.h
24 | *
25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
26 | */
27 | #include "SDL_config.h"
28 |
29 | #ifndef _MSC_VER
30 |
31 | #ifdef __IPHONEOS__
32 | #include
33 | #include
34 | #else
35 | #include
36 | #include
37 | #include
38 | #endif
39 |
40 | #else /* _MSC_VER */
41 |
42 | /* OpenGL ES2 headers for Visual Studio */
43 | #include "SDL_opengles2_khrplatform.h"
44 | #include "SDL_opengles2_gl2platform.h"
45 | #include "SDL_opengles2_gl2.h"
46 | #include "SDL_opengles2_gl2ext.h"
47 |
48 | #endif /* _MSC_VER */
49 |
50 | #ifndef APIENTRY
51 | #define APIENTRY GL_APIENTRY
52 | #endif
53 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_opengles2_gl2platform.h:
--------------------------------------------------------------------------------
1 | #ifndef __gl2platform_h_
2 | #define __gl2platform_h_
3 |
4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
5 |
6 | /*
7 | * This document is licensed under the SGI Free Software B License Version
8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
9 | */
10 |
11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
12 | *
13 | * Adopters may modify khrplatform.h and this file to suit their platform.
14 | * You are encouraged to submit all modifications to the Khronos group so that
15 | * they can be included in future versions of this file. Please submit changes
16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
17 | * by filing a bug against product "OpenGL-ES" component "Registry".
18 | */
19 |
20 | /*#include */
21 |
22 | #ifndef GL_APICALL
23 | #define GL_APICALL KHRONOS_APICALL
24 | #endif
25 |
26 | #ifndef GL_APIENTRY
27 | #define GL_APIENTRY KHRONOS_APIENTRY
28 | #endif
29 |
30 | #endif /* __gl2platform_h_ */
31 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_revision.h:
--------------------------------------------------------------------------------
1 | #define SDL_REVISION "hg-11914:f1084c419f33"
2 | #define SDL_REVISION_NUMBER 11914
3 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_test.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_test.h
24 | *
25 | * Include file for SDL test framework.
26 | *
27 | * This code is a part of the SDL2_test library, not the main SDL library.
28 | */
29 |
30 | #ifndef SDL_test_h_
31 | #define SDL_test_h_
32 |
33 | #include "SDL.h"
34 | #include "SDL_test_assert.h"
35 | #include "SDL_test_common.h"
36 | #include "SDL_test_compare.h"
37 | #include "SDL_test_crc32.h"
38 | #include "SDL_test_font.h"
39 | #include "SDL_test_fuzzer.h"
40 | #include "SDL_test_harness.h"
41 | #include "SDL_test_images.h"
42 | #include "SDL_test_log.h"
43 | #include "SDL_test_md5.h"
44 | #include "SDL_test_memory.h"
45 | #include "SDL_test_random.h"
46 |
47 | #include "begin_code.h"
48 | /* Set up for C function definitions, even when using C++ */
49 | #ifdef __cplusplus
50 | extern "C" {
51 | #endif
52 |
53 | /* Global definitions */
54 |
55 | /*
56 | * Note: Maximum size of SDLTest log message is less than SDL's limit
57 | * to ensure we can fit additional information such as the timestamp.
58 | */
59 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584
60 |
61 | /* Ends C function definitions when using C++ */
62 | #ifdef __cplusplus
63 | }
64 | #endif
65 | #include "close_code.h"
66 |
67 | #endif /* SDL_test_h_ */
68 |
69 | /* vi: set ts=4 sw=4 expandtab: */
70 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_test_log.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_test_log.h
24 | *
25 | * Include file for SDL test framework.
26 | *
27 | * This code is a part of the SDL2_test library, not the main SDL library.
28 | */
29 |
30 | /*
31 | *
32 | * Wrapper to log in the TEST category
33 | *
34 | */
35 |
36 | #ifndef SDL_test_log_h_
37 | #define SDL_test_log_h_
38 |
39 | #include "begin_code.h"
40 | /* Set up for C function definitions, even when using C++ */
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 | /**
46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority.
47 | *
48 | * \param fmt Message to be logged
49 | */
50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
51 |
52 | /**
53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority.
54 | *
55 | * \param fmt Message to be logged
56 | */
57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
58 |
59 | /* Ends C function definitions when using C++ */
60 | #ifdef __cplusplus
61 | }
62 | #endif
63 | #include "close_code.h"
64 |
65 | #endif /* SDL_test_log_h_ */
66 |
67 | /* vi: set ts=4 sw=4 expandtab: */
68 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_test_memory.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_test_memory.h
24 | *
25 | * Include file for SDL test framework.
26 | *
27 | * This code is a part of the SDL2_test library, not the main SDL library.
28 | */
29 |
30 | #ifndef SDL_test_memory_h_
31 | #define SDL_test_memory_h_
32 |
33 | #include "begin_code.h"
34 | /* Set up for C function definitions, even when using C++ */
35 | #ifdef __cplusplus
36 | extern "C" {
37 | #endif
38 |
39 |
40 | /**
41 | * \brief Start tracking SDL memory allocations
42 | *
43 | * \note This should be called before any other SDL functions for complete tracking coverage
44 | */
45 | int SDLTest_TrackAllocations();
46 |
47 | /**
48 | * \brief Print a log of any outstanding allocations
49 | *
50 | * \note This can be called after SDL_Quit()
51 | */
52 | void SDLTest_LogAllocations();
53 |
54 |
55 | /* Ends C function definitions when using C++ */
56 | #ifdef __cplusplus
57 | }
58 | #endif
59 | #include "close_code.h"
60 |
61 | #endif /* SDL_test_memory_h_ */
62 |
63 | /* vi: set ts=4 sw=4 expandtab: */
64 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/SDL_types.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_types.h
24 | *
25 | * \deprecated
26 | */
27 |
28 | /* DEPRECATED */
29 | #include "SDL_stdinc.h"
30 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/include/close_code.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2018 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file close_code.h
24 | *
25 | * This file reverses the effects of begin_code.h and should be included
26 | * after you finish any function and structure declarations in your headers
27 | */
28 |
29 | #undef _begin_code_h
30 |
31 | /* Reset structure packing at previous byte alignment */
32 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
33 | #ifdef __BORLANDC__
34 | #pragma nopackwarning
35 | #endif
36 | #pragma pack(pop)
37 | #endif /* Compiler needs structure packing set */
38 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/cpp/sdl2_hello.c:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 | #include
5 | #include "SDL.h"
6 | #include "SDL_log.h"
7 | #include "SDL_main.h"
8 |
9 | #ifdef ANDROID
10 |
11 | #include
12 |
13 | #define LOG_TAG "SDL2Hello"
14 | #define LOGE(format, ...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, format, ##__VA_ARGS__)
15 | #define LOGI(format, ...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, format, ##__VA_ARGS__)
16 | #else
17 | #define LOGE(format, ...) printf(LOG_TAG format "\n", ##__VA_ARGS__)
18 | #define LOGI(format, ...) printf(LOG_TAG format "\n", ##__VA_ARGS__)
19 | #endif
20 |
21 |
22 | int main(int argc, char *argv[]) {
23 |
24 | struct SDL_Window *window = NULL;
25 | struct SDL_Renderer *render = NULL;
26 | struct SDL_Surface *bmp = NULL;
27 | struct SDL_Texture *texture = NULL;
28 |
29 | char *filepath = "/sdcard/Android/data/com.poney.sdl2.hello/files/input.bmp";
30 |
31 | if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) == -1) {
32 | LOGE("SDL_Init failed %s", SDL_GetError());
33 | }
34 |
35 | window = SDL_CreateWindow("SDL HelloWorld!", 100, 100, 320, 480,
36 | SDL_WINDOW_SHOWN);
37 | if (window == NULL) {
38 | LOGE("SDL_CreateWindow failed %s", SDL_GetError());
39 | }
40 |
41 | render = SDL_CreateRenderer(window, -1,
42 | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
43 | if (render == NULL) {
44 | LOGE("SDL_CreateRenderer failed %s", SDL_GetError());
45 | }
46 |
47 | bmp = SDL_LoadBMP(filepath);
48 | if (bmp == NULL) {
49 | LOGE("SDL_LoadBMP failed: %s", SDL_GetError());
50 | }
51 |
52 | texture = SDL_CreateTextureFromSurface(render, bmp);
53 | SDL_FreeSurface(bmp);
54 |
55 | SDL_RenderClear(render);
56 | SDL_RenderCopy(render, texture, NULL, NULL);
57 | SDL_RenderPresent(render);
58 |
59 | SDL_Delay(10000);
60 |
61 | SDL_DestroyTexture(texture);
62 | SDL_DestroyRenderer(render);
63 | SDL_DestroyWindow(window);
64 |
65 | //Quit SDL
66 | SDL_Quit();
67 | return 0;
68 | }
--------------------------------------------------------------------------------
/sdl2-hello/src/main/java/com/poney/sdl2/hello/SDLHelloActivity.java:
--------------------------------------------------------------------------------
1 | package com.poney.sdl2.hello;
2 |
3 | import android.content.Intent;
4 | import android.os.AsyncTask;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.TextView;
8 |
9 |
10 | import androidx.annotation.Nullable;
11 |
12 | import com.poney.ffmpeg.base.AbsBaseActivity;
13 | import com.poney.ffmpeg.task.AssertReleaseTask;
14 |
15 | import org.libsdl.app.SDLActivity;
16 |
17 |
18 | /**
19 | * @anchor: poney
20 | * @date: 2018-10-30
21 | * @description:
22 | */
23 | public class SDLHelloActivity extends AbsBaseActivity implements AssertReleaseTask.ReleaseCallback {
24 |
25 | private TextView mBtnSDLShow;
26 |
27 | @Override
28 | protected void onCreate(@Nullable Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_sdl_hello);
31 | }
32 |
33 | @Override
34 | protected void onPostCreate(@Nullable Bundle savedInstanceState) {
35 | super.onPostCreate(savedInstanceState);
36 | mBtnSDLShow = (TextView) findViewById(R.id.btn_sdl_hello);
37 | AssertReleaseTask videoReleaseTask = new AssertReleaseTask(this, "input.bmp", this);
38 | videoReleaseTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
39 | }
40 |
41 | public void onSDLClick(View view) {
42 | Intent intent = new Intent(this, SDLActivity.class);
43 | startActivity(intent);
44 | }
45 |
46 | @Override
47 | public void onReleaseSuccess(String filePath) {
48 | mBtnSDLShow.setEnabled(true);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/java/org/libsdl/app/SDL.java:
--------------------------------------------------------------------------------
1 | package org.libsdl.app;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | SDL library initialization
7 | */
8 | public class SDL {
9 |
10 | // This function should be called first and sets up the native code
11 | // so it can call into the Java classes
12 | public static void setupJNI() {
13 | SDLActivity.nativeSetupJNI();
14 | SDLAudioManager.nativeSetupJNI();
15 | SDLControllerManager.nativeSetupJNI();
16 | }
17 |
18 | // This function should be called each time the activity is started
19 | public static void initialize() {
20 | setContext(null);
21 |
22 | SDLActivity.initialize();
23 | SDLAudioManager.initialize();
24 | SDLControllerManager.initialize();
25 | }
26 |
27 | // This function stores the current activity (SDL or not)
28 | public static void setContext(Context context) {
29 | mContext = context;
30 | }
31 |
32 | public static Context getContext() {
33 | return mContext;
34 | }
35 |
36 | protected static Context mContext;
37 | }
38 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/res/layout/activity_sdl_hello.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
--------------------------------------------------------------------------------
/sdl2-hello/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | sdl2-hello
3 |
4 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':common'
2 | include ':sdl2-hello'
3 | include ':libyuv-single'
4 | include ':media'
5 | include ':app'
6 | rootProject.name = "BlogDemo"
--------------------------------------------------------------------------------
/source/cuc_ieschool.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/source/cuc_ieschool.mp4
--------------------------------------------------------------------------------
/source/mvtest.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LoveWFan/BlogDemo/798df321acb14f7e7aa991f2bafca45164b489ae/source/mvtest.mp4
--------------------------------------------------------------------------------