├── .gitignore ├── .idea ├── .name ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── gradle.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── yingke │ │ └── simple │ │ └── codec │ │ └── MainActivity1.java │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ ├── bg_debug_btn.xml │ └── ic_launcher_background.xml │ ├── layout │ └── activity_main.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 │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── audio_faac_encoder ├── .gitignore ├── CMakeLists.txt ├── README.md ├── build.gradle ├── consumer-rules.pro ├── libs │ └── armeabi-v7a │ │ └── libfaac.a ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── com_yingke_audio_faac_encoder_encoder_FaacUtil.h │ ├── faac_util.cpp │ └── include │ │ ├── faac.h │ │ └── faaccfg.h │ ├── java │ └── com │ │ └── yingke │ │ └── audio │ │ └── faac │ │ └── encoder │ │ ├── A.java │ │ ├── encoder │ │ └── FaacUtil.java │ │ ├── recorder │ │ ├── AACRecorder.kt │ │ ├── Recorder.kt │ │ └── RecorderListener.kt │ │ ├── util │ │ └── DateUtils.java │ │ └── view │ │ ├── RecorderProgressView.java │ │ ├── RecorderView.java │ │ └── SpectrumView.java │ ├── output │ └── armeabi-v7a │ │ └── libyingke-faac.so │ └── res │ ├── mipmap-xhdpi │ └── ic_mic_white.png │ └── values │ ├── strings.xml │ └── styles.xml ├── audio_mp3lame_encoder ├── .gitignore ├── CMakeLists.txt ├── README.md ├── abi │ ├── arm64-v8a │ │ └── libmp3lame.so │ ├── x86 │ │ └── libmp3lame.so │ └── x86_64 │ │ └── libmp3lame.so ├── build.gradle ├── consumer-rules.pro ├── libs │ ├── armeabi-v7a │ │ └── libmp3lame.so │ └── include │ │ └── libmp3lame │ │ ├── VbrTag.h │ │ ├── bitstream.h │ │ ├── encoder.h │ │ ├── fft.h │ │ ├── gain_analysis.h │ │ ├── i386 │ │ └── nasm.h │ │ ├── id3tag.h │ │ ├── l3side.h │ │ ├── lame-analysis.h │ │ ├── lame.h │ │ ├── lame_global_flags.h │ │ ├── lameerror.h │ │ ├── machine.h │ │ ├── newmdct.h │ │ ├── psymodel.h │ │ ├── quantize.h │ │ ├── quantize_pvt.h │ │ ├── reservoir.h │ │ ├── set_get.h │ │ ├── tables.h │ │ ├── util.h │ │ ├── vbrquantize.h │ │ ├── vector │ │ └── lame_intrin.h │ │ └── version.h ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── com_yingke_audio_mp3lame_encoder_encoder_LameUtil.h │ ├── com_yingke_audio_mp3lame_encoder_encoder_LameUtil_Companion.h │ └── lame_util.cpp │ ├── java │ └── com │ │ └── yingke │ │ └── audio │ │ └── mp3lame │ │ └── encoder │ │ ├── LameEncoderActivity.kt │ │ ├── Recorder.kt │ │ ├── RecorderListener.kt │ │ ├── encoder │ │ └── LameUtil.kt │ │ ├── recorder │ │ ├── Mp3Recorder.kt │ │ └── PCMFormat.java │ │ ├── util │ │ └── DateUtils.java │ │ └── view │ │ ├── RecorderProgressView.java │ │ ├── RecorderView.java │ │ └── SpectrumView.java │ └── res │ ├── layout │ └── activity_mp3_lame.xml │ ├── mipmap-xhdpi │ └── ic_mic_white.png │ └── values │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── config.gradle ├── core ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── yingke │ │ └── core │ │ ├── base │ │ ├── BaseActivity.java │ │ ├── BaseApplication.java │ │ └── BasePermissionActivity.java │ │ ├── core │ │ └── CoreContext.java │ │ └── util │ │ └── FileUtil.java │ └── res │ └── values │ └── strings.xml ├── ffmpeg-decode-mp4-native-player ├── .gitignore ├── CMakeLists.txt ├── REDAME.md ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── ffmpeg_player.cpp │ ├── ffmpeg_player.h │ ├── logger.h │ ├── native_player.cpp │ └── native_player.h │ ├── java │ └── com │ │ └── yingke │ │ └── ffmpeg │ │ └── decode │ │ ├── Mp4NativePlayer.java │ │ └── Mp4NativePlayerActivity.java │ └── res │ ├── layout │ └── main_mp4_player.xml │ └── values │ └── strings.xml ├── ffmpeg-decode-mp4-to-yuv ├── .gitignore ├── CMakeLists.txt ├── README.md ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── decode_mp4.cpp │ ├── decode_mp4.h │ ├── logger.h │ ├── mp4_decoder.cpp │ └── video_decode.h │ ├── java │ └── com │ │ └── yingke │ │ └── decode │ │ └── mp4 │ │ ├── Mp4Decoder.java │ │ └── Mp4DecoderActivity.java │ └── res │ ├── layout │ └── main_mp4_decoder.xml │ └── values │ └── strings.xml ├── ffmpeg-demuxer-mp4-to-h264-aac ├── .gitignore ├── CMakeLists.txt ├── README.md ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── Mp4DemuxerUtil.cpp │ ├── Mp4DemuxerUtil.h │ ├── ffmpeg_demuxer.cpp │ ├── ffmpeg_demuxer.h │ └── logger.h │ ├── java │ └── com │ │ └── yingke │ │ └── ffmpeg │ │ └── demuxer │ │ ├── Mp4DemuxerActivity.java │ │ └── Mp4DemuxerUtil.java │ └── res │ ├── layout │ └── main_mp4_demuxer.xml │ └── values │ └── strings.xml ├── ffmpeg-encode-camera-h264-mp4-jpeg ├── .gitignore ├── CMakeLists.txt ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── camera_encoder.cpp │ ├── camera_encoder.h │ ├── encode_h264.cpp │ ├── encode_h264.h │ ├── encode_jpeg.cpp │ ├── encode_jpeg.h │ ├── encode_mp4.cpp │ ├── encode_mp4.h │ └── logger.h │ ├── java │ └── com │ │ └── yingke │ │ └── encode │ │ └── camera │ │ ├── CameraEncoder.java │ │ ├── EncodeMp4JpegActivity.java │ │ └── camera │ │ ├── CameraV1.java │ │ └── IEncoder.java │ └── res │ ├── layout │ └── activity_encode_mp4_jpeg.xml │ └── values │ └── strings.xml ├── ffmpeg-muxer-h264-aac-to-mp4 ├── .gitignore ├── CMakeLists.txt ├── REDAME.md ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── Mp4MuxerUtil.cpp │ ├── Mp4MuxerUtil.h │ ├── ffmpeg_muxer.cpp │ ├── ffmpeg_muxer.h │ └── logger.h │ ├── java │ └── com │ │ └── yingke │ │ └── ffmpeg │ │ └── muxer │ │ ├── Mp4MuxerActivity.java │ │ └── Mp4MuxerUtil.java │ └── res │ ├── layout │ └── main_mp4_muxer.xml │ └── values │ └── strings.xml ├── ffmpeg_assets ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ ├── aac_for_mp4.aac │ ├── h264_for_mp4.h264 │ ├── input.mp4 │ ├── mp4_for_h264_aac.mp4 │ ├── mp4_for_native_player.mp4 │ └── yuv_jpeg_png.yuv │ ├── java │ └── com │ │ └── yingke │ │ └── ffmpeg │ │ └── assets │ │ └── AssetsTask.java │ └── res │ └── values │ └── strings.xml ├── ffmpeg_single ├── .gitignore ├── README.md ├── build.gradle ├── consumer-rules.pro ├── libs │ └── armeabi-v7a │ │ ├── include │ │ ├── compat │ │ │ └── va_copy.h │ │ ├── libavcodec │ │ │ ├── avcodec.h │ │ │ ├── avdct.h │ │ │ ├── avfft.h │ │ │ ├── d3d11va.h │ │ │ ├── dirac.h │ │ │ ├── dv_profile.h │ │ │ ├── dxva2.h │ │ │ ├── jni.h │ │ │ ├── mathops.h │ │ │ ├── mediacodec.h │ │ │ ├── qsv.h │ │ │ ├── vaapi.h │ │ │ ├── vda.h │ │ │ ├── vdpau.h │ │ │ ├── version.h │ │ │ ├── videotoolbox.h │ │ │ ├── vorbis_parser.h │ │ │ └── xvmc.h │ │ ├── libavdevice │ │ │ ├── avdevice.h │ │ │ └── version.h │ │ ├── libavfilter │ │ │ ├── avfilter.h │ │ │ ├── avfiltergraph.h │ │ │ ├── buffersink.h │ │ │ ├── buffersrc.h │ │ │ └── version.h │ │ ├── libavformat │ │ │ ├── avformat.h │ │ │ ├── avio.h │ │ │ ├── ffm.h │ │ │ ├── network.h │ │ │ ├── os_support.h │ │ │ ├── url.h │ │ │ └── version.h │ │ ├── libavresample │ │ │ ├── avresample.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 │ │ │ ├── error.h │ │ │ ├── eval.h │ │ │ ├── ffversion.h │ │ │ ├── fifo.h │ │ │ ├── file.h │ │ │ ├── frame.h │ │ │ ├── hash.h │ │ │ ├── hmac.h │ │ │ ├── hwcontext.h │ │ │ ├── hwcontext_cuda.h │ │ │ ├── hwcontext_dxva2.h │ │ │ ├── hwcontext_qsv.h │ │ │ ├── hwcontext_vaapi.h │ │ │ ├── hwcontext_vdpau.h │ │ │ ├── imgutils.h │ │ │ ├── internal.h │ │ │ ├── intfloat.h │ │ │ ├── intreadwrite.h │ │ │ ├── lfg.h │ │ │ ├── libm.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 │ │ │ ├── reverse.h │ │ │ ├── ripemd.h │ │ │ ├── samplefmt.h │ │ │ ├── sha.h │ │ │ ├── sha512.h │ │ │ ├── spherical.h │ │ │ ├── stereo3d.h │ │ │ ├── tea.h │ │ │ ├── threadmessage.h │ │ │ ├── time.h │ │ │ ├── timecode.h │ │ │ ├── timer.h │ │ │ ├── timestamp.h │ │ │ ├── tree.h │ │ │ ├── twofish.h │ │ │ ├── version.h │ │ │ └── xtea.h │ │ ├── libpostproc │ │ │ ├── postprocess.h │ │ │ └── version.h │ │ ├── libswresample │ │ │ ├── swresample.h │ │ │ └── version.h │ │ └── libswscale │ │ │ ├── swscale.h │ │ │ └── version.h │ │ └── libffmpeg.so ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── res │ └── values │ └── strings.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── h264tool ├── H.264 示例 │ ├── ElecardStreamEyeTools_2.9.2.70710.exe │ └── slamtv60.264 ├── H264码流分析工具集.rar └── H264码流分析工具集 │ ├── CTI-TS.rar │ ├── EasyICE_2.6.0.5.zip │ ├── README.txt │ ├── VideoEye_0.2.7z │ ├── elecardstreameyetools.zip │ └── yuvplayer.exe ├── image-decode-jpeg-libjpeg-turbo ├── .gitignore ├── CMakeLists.txt ├── build.gradle ├── build_scripts │ ├── build_jpeg.sh │ ├── build_jpeg_all.sh │ └── config.sh ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── input.jpeg │ ├── cpp │ ├── libjpegturbo_util.cpp │ ├── libjpegturbo_util.h │ └── logger.h │ ├── java │ └── com │ │ └── yingke │ │ └── libjpeg │ │ └── turbo │ │ ├── LibJpegTurboActivity.java │ │ └── LibJpegTurboUtil.java │ └── res │ ├── layout │ └── activity_libjpegturbo.xml │ └── values │ └── strings.xml ├── image-decode-png-libpng ├── .gitignore ├── CMakeLists.txt ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── input.png │ ├── cpp │ ├── libpng_util.cpp │ ├── libpng_util.h │ └── logger.h │ ├── java │ └── com │ │ └── yingke │ │ └── libpng │ │ ├── LibPngActivity.java │ │ └── LibPngUtil.java │ └── res │ ├── layout │ └── activity_libpng.xml │ └── values │ └── strings.xml ├── image-encode-yuv-to-jpeg-png ├── .gitignore ├── CMakeLists.txt ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── logger.h │ ├── yuv_to_jpeg_png_util.cpp │ ├── yuv_to_jpeg_png_util.h │ ├── yuv_to_jpeg_util.cpp │ ├── yuv_to_jpeg_util.h │ ├── yuv_to_png_util.cpp │ ├── yuv_to_png_util.h │ ├── yuv_to_rgb_util.cpp │ └── yuv_to_rgb_util.h │ ├── java │ └── com │ │ └── yingke │ │ └── yuvtojpegpng │ │ ├── YuvJpegPngActivity.java │ │ └── YuvToJpegPngUtil.java │ └── res │ ├── layout │ └── activity_yuv_jpeg_png.xml │ └── values │ └── strings.xml ├── image-transform-yuv-to-rgb ├── .gitignore ├── CMakeLists.txt ├── README.md ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ ├── input.jpg │ ├── nv12.yuv │ ├── nv21.yuv │ ├── rgb24.rgb │ └── yuv420p.yuv │ ├── cpp │ ├── logger.h │ ├── native_yuv2rgb.cpp │ └── native_yuv2rgb.h │ ├── java │ └── com │ │ └── yingke │ │ └── yuv2rgb │ │ ├── NativeYUV2RGB.java │ │ └── NativeYUV2RGBActivity.java │ └── res │ ├── layout │ └── activity_native_yuv2rgb.xml │ └── values │ └── strings.xml ├── image-transfrom-libyuv-to-rgb ├── .gitignore ├── CMakeLists.txt ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── logger.h │ ├── native_libyuv2rgb.cpp │ └── native_libyuv2rgb.h │ ├── java │ └── com │ │ └── yingke │ │ └── libyuv2rgb │ │ ├── LibYUV2RGB.java │ │ └── LibYUV2RGBActivity.java │ └── res │ ├── layout │ └── activity_native_libyuv2rgb.xml │ └── values │ └── strings.xml ├── module.gradle ├── settings.gradle ├── snapshot ├── 1607310537048.jpg ├── 1607311037550.jpg └── device-2020-12-07-104125.png ├── third-libjpeg-turbo ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── libs │ └── armeabi-v7a │ │ ├── include_jpeg │ │ ├── jconfig.h │ │ ├── jerror.h │ │ ├── jmorecfg.h │ │ ├── jpeglib.h │ │ └── turbojpeg.h │ │ ├── libjpeg.a │ │ ├── libjpeg.so │ │ ├── libturbojpeg.a │ │ └── libturbojpeg.so ├── other │ ├── arm64-v8a │ │ ├── include │ │ │ ├── jconfig.h │ │ │ ├── jerror.h │ │ │ ├── jmorecfg.h │ │ │ ├── jpeglib.h │ │ │ └── turbojpeg.h │ │ ├── libjpeg.a │ │ ├── libjpeg.so │ │ ├── libturbojpeg.a │ │ └── libturbojpeg.so │ ├── armeabi │ │ ├── include │ │ │ ├── jconfig.h │ │ │ ├── jerror.h │ │ │ ├── jmorecfg.h │ │ │ ├── jpeglib.h │ │ │ └── turbojpeg.h │ │ ├── libjpeg.a │ │ ├── libjpeg.so │ │ ├── libturbojpeg.a │ │ └── libturbojpeg.so │ ├── x86 │ │ ├── include │ │ │ ├── jconfig.h │ │ │ ├── jerror.h │ │ │ ├── jmorecfg.h │ │ │ ├── jpeglib.h │ │ │ └── turbojpeg.h │ │ ├── libjpeg.a │ │ ├── libjpeg.so │ │ ├── libturbojpeg.a │ │ └── libturbojpeg.so │ └── x86_64 │ │ ├── include │ │ ├── jconfig.h │ │ ├── jerror.h │ │ ├── jmorecfg.h │ │ ├── jpeglib.h │ │ └── turbojpeg.h │ │ ├── libjpeg.a │ │ ├── libjpeg.so │ │ ├── libturbojpeg.a │ │ └── libturbojpeg.so ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── res │ └── values │ └── strings.xml ├── third-libpng ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── libs │ └── armeabi-v7a │ │ ├── include_png │ │ ├── PngFile.h │ │ ├── cexcept.h │ │ ├── png.h │ │ ├── pngconf.h │ │ ├── pngdebug.h │ │ ├── pnginfo.h │ │ ├── pnglibconf.h │ │ ├── pngpriv.h │ │ ├── pngstest-errors.h │ │ ├── pngstruct.h │ │ ├── pngusr.h │ │ ├── readpng.h │ │ ├── readpng2.h │ │ ├── resource.h │ │ ├── sRGB.h │ │ └── writepng.h │ │ ├── include_zlib │ │ ├── blast.h │ │ ├── crc32.h │ │ ├── crypt.h │ │ ├── deflate.h │ │ ├── gzguts.h │ │ ├── gzlog.h │ │ ├── infback9.h │ │ ├── inffast.h │ │ ├── inffix9.h │ │ ├── inffixed.h │ │ ├── inflate.h │ │ ├── inflate9.h │ │ ├── inftree9.h │ │ ├── inftrees.h │ │ ├── ioapi.h │ │ ├── iowin32.h │ │ ├── mztools.h │ │ ├── puff.h │ │ ├── trees.h │ │ ├── unzip.h │ │ ├── zconf.h │ │ ├── zfstream.h │ │ ├── zip.h │ │ ├── zlib.h │ │ ├── zstream.h │ │ └── zutil.h │ │ ├── libpng.so │ │ └── libz.so ├── other │ ├── arm64-v8a │ │ ├── libpng.so │ │ └── libz.so │ ├── armeabi │ │ ├── libpng.so │ │ └── libz.so │ ├── mips │ │ ├── libpng.so │ │ └── libz.so │ ├── mips64 │ │ ├── libpng.so │ │ └── libz.so │ ├── x86 │ │ ├── libpng.so │ │ └── libz.so │ └── x86_64 │ │ ├── libpng.so │ │ └── libz.so ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── res │ └── values │ └── strings.xml └── third-libyuv ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── libs └── armeabi-v7a │ ├── 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 │ └── libyuv.so ├── other ├── arm64-v8a │ └── libyuv.so ├── x86 │ └── libyuv.so └── x86_64 │ └── libyuv.so ├── proguard-rules.pro └── src └── main ├── AndroidManifest.xml └── res └── values └── strings.xml /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | YingKe-SimpleCodeC -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YingKe-SimpleCodeC 2 | FFmpeg音视频库学习实践,包括 3 | 1. 音频使用mp3lame库实时编码pcm成mp3文件,faac库编码pcm成aac音频文件, 4 | 2. 使用ffmpeg解码mp4视频使用ANativeWindow简易播放器, 5 | 3. ffmpeg解码mp4视频成yuv格式裸流数据, 6 | 4. ffmpeg合成封装h264视频编码文件和aac音频编码文件成mp4视频, 7 | 5. 和逆过程 ffmpeg解封装mp4视频成h264和aac 编码文件, 8 | 6. 以及常见的yuv图像格式操作,yuv转换rgb(使用libyuv和纯代码),libjpeg-turbo库读取解码jpeg图像,libpng库读取解码png图像并使用ANativeWindow在Android显示, 9 | 7. 最后使用libjpeg-turbo和libpng库对原始yuv图像编码成jpeg和png图像 10 | 11 | 12 | ## 项目截图 13 | ||| 14 | |:---:|:---:| 15 | |![](https://github.com/tuke0919/YingKe-SimpleCodeC/blob/master/snapshot/1607311037550.jpg)|![](https://github.com/tuke0919/YingKe-SimpleCodeC/blob/master/snapshot/1607310537048.jpg)| 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /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 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_debug_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | YingKe-SimpleCodeC 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /audio_faac_encoder/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /audio_faac_encoder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 3.4.1) 3 | 4 | 5 | # 导入第三方静态库 6 | set(LIB_FAAC_DIR ${CMAKE_SOURCE_DIR}/libs) 7 | 8 | add_library(faac 9 | STATIC 10 | IMPORTED) 11 | 12 | set_target_properties(faac 13 | PROPERTIES 14 | IMPORTED_LOCATION ${LIB_FAAC_DIR}/${ANDROID_ABI}/libfaac.a) 15 | 16 | # 包含头文件 17 | include_directories(src/main/cpp/include) 18 | # 设置so动态库输出目录 19 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/src/main/output/${ANDROID_ABI}) 20 | # 添加库 21 | add_library(yingke-faac 22 | SHARED 23 | src/main/cpp/faac_util.cpp) 24 | # 搜索库 25 | find_library( # 设置path变量的名称 26 | log-lib 27 | # 在CMake定位前指定的NDK库名称 28 | log ) 29 | # 链接库 30 | target_link_libraries(yingke-faac 31 | faac 32 | ${log-lib}) -------------------------------------------------------------------------------- /audio_faac_encoder/README.md: -------------------------------------------------------------------------------- 1 | ### 参考的博客 2 | > 参考链接: 3 | https://blog.csdn.net/qq_40834030/article/details/104070708 4 | https://blog.csdn.net/arbboter/article/details/43152967 5 | https://blog.csdn.net/weiyuefei/article/details/70882504 6 | https://blog.csdn.net/Guofengpu/article/details/51981259 7 | 编译faac: 8 | https://github.com/han1202012/RTMP_Pusher 9 | https://blog.csdn.net/shulianghan/article/details/106795757 -------------------------------------------------------------------------------- /audio_faac_encoder/build.gradle: -------------------------------------------------------------------------------- 1 | apply from: "../module.gradle" 2 | -------------------------------------------------------------------------------- /audio_faac_encoder/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/audio_faac_encoder/consumer-rules.pro -------------------------------------------------------------------------------- /audio_faac_encoder/libs/armeabi-v7a/libfaac.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/audio_faac_encoder/libs/armeabi-v7a/libfaac.a -------------------------------------------------------------------------------- /audio_faac_encoder/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 | -------------------------------------------------------------------------------- /audio_faac_encoder/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /audio_faac_encoder/src/main/cpp/com_yingke_audio_faac_encoder_encoder_FaacUtil.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_yingke_audio_faac_encoder_encoder_FaacUtil */ 4 | 5 | //#ifndef _Included_com_yingke_audio_faac_encoder_encoder_FaacUtil 6 | //#define _Included_com_yingke_audio_faac_encoder_encoder_FaacUtil 7 | 8 | extern "C" 9 | JNIEXPORT jlongArray JNICALL 10 | Java_com_yingke_audio_faac_encoder_encoder_FaacUtil_faacOpen(JNIEnv *env, jclass thiz, 11 | jint sample_rate, jint channels); 12 | extern "C" 13 | JNIEXPORT jint JNICALL 14 | Java_com_yingke_audio_faac_encoder_encoder_FaacUtil_faacEncode(JNIEnv *env, jclass thiz, 15 | jshortArray pcm_buffer, jint samples, 16 | jbyteArray aac_buffer); 17 | extern "C" 18 | JNIEXPORT void JNICALL 19 | Java_com_yingke_audio_faac_encoder_encoder_FaacUtil_faacClose(JNIEnv *env, jclass thiz) ; -------------------------------------------------------------------------------- /audio_faac_encoder/src/main/java/com/yingke/audio/faac/encoder/A.java: -------------------------------------------------------------------------------- 1 | package com.yingke.audio.faac.encoder; 2 | 3 | /** 4 | * 功能: 5 | *

6 | *

Copyright xxx.xxx.com 2020 All right reserved

7 | * 8 | * @author tuke 时间 2020-06-29 9 | * @email

10 | * 最后修改人:无 11 | *

12 | */ 13 | public class A { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /audio_faac_encoder/src/main/java/com/yingke/audio/faac/encoder/encoder/FaacUtil.java: -------------------------------------------------------------------------------- 1 | package com.yingke.audio.faac.encoder.encoder; 2 | 3 | /** 4 | * 功能: 5 | *

6 | *

Copyright xxx.xxx.com 2020 All right reserved

7 | * 8 | * @author tuke 时间 2020-06-30 9 | * @email

10 | * 最后修改人:无 11 | *

12 | */ 13 | public class FaacUtil { 14 | 15 | static { 16 | System.loadLibrary("yingke-faac"); 17 | } 18 | 19 | public native static long[] faacOpen(int sampleRate, int channels); 20 | 21 | public native static int faacEncode(short[] pcmBuffer, int samples, byte[] aacBuffer); 22 | 23 | public native static void faacClose(); 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /audio_faac_encoder/src/main/java/com/yingke/audio/faac/encoder/recorder/Recorder.kt: -------------------------------------------------------------------------------- 1 | package com.yingke.audio.mp3lame.encoder 2 | 3 | /** 4 | * 功能: 5 | *

6 | *

Copyright xxx.xxx.com 2019 All right reserved

7 | * 8 | * @author tuke 时间 2020-06-18 9 | * @email 10 | *

11 | * 最后修改人:无 12 | *

13 | */ 14 | interface Recorder { 15 | 16 | /** 17 | * @param listener 18 | */ 19 | fun setAudioListener(listener: RecorderListener) 20 | 21 | /** 22 | * @param path 23 | */ 24 | fun startRecord(path: String) 25 | 26 | /** 27 | * 暂停 录制 28 | */ 29 | fun pauseRecord() 30 | 31 | /** 32 | * 继续录制 33 | */ 34 | fun resumeRecord() 35 | 36 | /** 37 | * 停止录制 38 | * @return 录制时长 ms 39 | */ 40 | fun stopRecord(): Long 41 | 42 | } -------------------------------------------------------------------------------- /audio_faac_encoder/src/main/java/com/yingke/audio/faac/encoder/recorder/RecorderListener.kt: -------------------------------------------------------------------------------- 1 | package com.yingke.audio.mp3lame.encoder 2 | 3 | /** 4 | * 功能: 5 | *

6 | *

Copyright corp.netease.com 2019 All right reserved

7 | * 8 | * @author tuke 时间 2020-06-18 9 | * @email tuke@corp.netease.com 10 | *

11 | * 最后修改人:无 12 | *

13 | */ 14 | interface RecorderListener { 15 | 16 | /** 17 | * 获取录制音量的大小 18 | * 19 | * @param volume 20 | */ 21 | fun onGetVolume(volume: Int) 22 | 23 | } -------------------------------------------------------------------------------- /audio_faac_encoder/src/main/java/com/yingke/audio/faac/encoder/util/DateUtils.java: -------------------------------------------------------------------------------- 1 | package com.yingke.audio.faac.encoder.util; 2 | 3 | import android.annotation.SuppressLint; 4 | 5 | /** 6 | * @author :chezi008 on 2018/4/17 22:24 7 | * @description : 8 | * @email :chezi008@163.com 9 | */ 10 | public class DateUtils { 11 | @SuppressLint({"DefaultLocale"}) 12 | public static String toTime(int var0) { 13 | var0 /= 1000; 14 | int var1 = var0 / 60; 15 | boolean var2 = false; 16 | if (var1 >= 60) { 17 | int var4 = var1 / 60; 18 | var1 %= 60; 19 | } 20 | int var3 = var0 % 60; 21 | if (var1>0){ 22 | return String.format("%d′%d\"", new Object[]{Integer.valueOf(var1), Integer.valueOf(var3)}); 23 | } 24 | return String.format("%d\"", Integer.valueOf(var3)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /audio_faac_encoder/src/main/output/armeabi-v7a/libyingke-faac.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/audio_faac_encoder/src/main/output/armeabi-v7a/libyingke-faac.so -------------------------------------------------------------------------------- /audio_faac_encoder/src/main/res/mipmap-xhdpi/ic_mic_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/audio_faac_encoder/src/main/res/mipmap-xhdpi/ic_mic_white.png -------------------------------------------------------------------------------- /audio_faac_encoder/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | audio_faac_encoder 3 | 4 | -------------------------------------------------------------------------------- /audio_faac_encoder/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 有关使用CMake在Android Studio的更多信息,请阅读文档:https://d.android.com/studio/projects/add-native-code.html 2 | 3 | # 设置CMake的最低版本构建本机所需库 4 | cmake_minimum_required(VERSION 3.4.1) 5 | 6 | 7 | # 导入 三方库,构建 8 | set(LIBMP3_DIR ${CMAKE_SOURCE_DIR}/libs) 9 | add_library(mp3lame 10 | SHARED 11 | IMPORTED) 12 | 13 | set_target_properties(mp3lame 14 | PROPERTIES 15 | IMPORTED_LOCATION ${LIBMP3_DIR}/${ANDROID_ABI}/libmp3lame.so) 16 | 17 | include_directories(libs/include) 18 | 19 | # 创建并命名库,将其设置为静态的 20 | # 或共享,并提供其源代码的相对路径。 21 | # 你可以定义多个library库,并使用CMake来构建。 22 | # Gradle会自动将包共享库关联到你的apk程序。 23 | 24 | add_library( # 设置库的名称 25 | yingke-mp3lame 26 | # 将库设置为共享库。 27 | SHARED 28 | # 为源文件提供一个相对路径。 29 | src/main/cpp/lame_util.cpp ) 30 | 31 | # 搜索指定预先构建的库和存储路径变量。因为CMake包括系统库搜索路径中默认情况下,只需要指定想添加公共NDK库的名称,在CMake验证库之前存在完成构建 32 | find_library( # 设置path变量的名称 33 | log-lib 34 | # 在CMake定位前指定的NDK库名称 35 | log ) 36 | # 指定库CMake应该链接到目标库中,可以链接多个库,比如定义库,构建脚本,预先构建的第三方库或者系统库 37 | target_link_libraries( # 指定目标库 38 | yingke-mp3lame 39 | 40 | # 是预先构建的三方库 41 | mp3lame 42 | # 目标库到日志库的链接 包含在NDK 43 | ${log-lib} ) -------------------------------------------------------------------------------- /audio_mp3lame_encoder/README.md: -------------------------------------------------------------------------------- 1 | ### 参考的博客 2 | https://www.jianshu.com/p/dce4e2e9ed75 3 | https://blog.csdn.net/AndrExpert/article/details/77683776 -------------------------------------------------------------------------------- /audio_mp3lame_encoder/abi/arm64-v8a/libmp3lame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/audio_mp3lame_encoder/abi/arm64-v8a/libmp3lame.so -------------------------------------------------------------------------------- /audio_mp3lame_encoder/abi/x86/libmp3lame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/audio_mp3lame_encoder/abi/x86/libmp3lame.so -------------------------------------------------------------------------------- /audio_mp3lame_encoder/abi/x86_64/libmp3lame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/audio_mp3lame_encoder/abi/x86_64/libmp3lame.so -------------------------------------------------------------------------------- /audio_mp3lame_encoder/build.gradle: -------------------------------------------------------------------------------- 1 | apply from: "../module.gradle" 2 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/audio_mp3lame_encoder/consumer-rules.pro -------------------------------------------------------------------------------- /audio_mp3lame_encoder/libs/armeabi-v7a/libmp3lame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/audio_mp3lame_encoder/libs/armeabi-v7a/libmp3lame.so -------------------------------------------------------------------------------- /audio_mp3lame_encoder/libs/include/libmp3lame/bitstream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MP3 bitstream Output interface for LAME 3 | * 4 | * Copyright (c) 1999 Takehiro TOMINAGA 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library 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 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 | * Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef LAME_BITSTREAM_H 23 | #define LAME_BITSTREAM_H 24 | 25 | int getframebits(const lame_internal_flags * gfc); 26 | 27 | int format_bitstream(lame_internal_flags * gfc); 28 | 29 | void flush_bitstream(lame_internal_flags * gfc); 30 | void add_dummy_byte(lame_internal_flags * gfc, unsigned char val, unsigned int n); 31 | 32 | int copy_buffer(lame_internal_flags * gfc, unsigned char *buffer, int buffer_size, 33 | int update_crc); 34 | void init_bit_stream_w(lame_internal_flags * gfc); 35 | void CRC_writeheader(lame_internal_flags const *gfc, char *buffer); 36 | int compute_flushbits(const lame_internal_flags * gfp, int *nbytes); 37 | 38 | int get_max_frame_buffer_size_by_constraint(SessionConfig_t const * cfg, int constraint); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/libs/include/libmp3lame/fft.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Fast Fourier Transform include file 3 | * 4 | * Copyright (c) 2000 Mark Taylor 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library 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 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 | * Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef LAME_FFT_H 23 | #define LAME_FFT_H 24 | 25 | void fft_long(lame_internal_flags const *const gfc, FLOAT x_real[BLKSIZE], 26 | int chn, const sample_t *const data[2]); 27 | 28 | void fft_short(lame_internal_flags const *const gfc, FLOAT x_real[3][BLKSIZE_s], 29 | int chn, const sample_t *const data[2]); 30 | 31 | void init_fft(lame_internal_flags * const gfc); 32 | 33 | #endif 34 | 35 | /* End of fft.h */ 36 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/libs/include/libmp3lame/lameerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A collection of LAME Error Codes 3 | * 4 | * Please use the constants defined here instead of some arbitrary 5 | * values. Currently the values starting at -10 to avoid intersection 6 | * with the -1, -2, -3 and -4 used in the current code. 7 | * 8 | * May be this should be a part of the include/lame.h. 9 | */ 10 | 11 | typedef enum { 12 | LAME_OKAY = 0, 13 | LAME_NOERROR = 0, 14 | LAME_GENERICERROR = -1, 15 | LAME_NOMEM = -10, 16 | LAME_BADBITRATE = -11, 17 | LAME_BADSAMPFREQ = -12, 18 | LAME_INTERNALERROR = -13, 19 | 20 | FRONTEND_READERROR = -80, 21 | FRONTEND_WRITEERROR = -81, 22 | FRONTEND_FILETOOLARGE = -82, 23 | 24 | } lame_errorcodes_t; 25 | 26 | /* end of lameerror.h */ 27 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/libs/include/libmp3lame/newmdct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * New Modified DCT include file 3 | * 4 | * Copyright (c) 1999 Takehiro TOMINAGA 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library 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 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 | * Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef LAME_NEWMDCT_H 23 | #define LAME_NEWMDCT_H 24 | 25 | void mdct_sub48(lame_internal_flags * gfc, const sample_t * w0, const sample_t * w1); 26 | 27 | #endif /* LAME_NEWMDCT_H */ 28 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/libs/include/libmp3lame/quantize.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MP3 quantization 3 | * 4 | * Copyright (c) 1999 Mark Taylor 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library 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 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 | * Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef LAME_QUANTIZE_H 23 | #define LAME_QUANTIZE_H 24 | 25 | void CBR_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], 26 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]); 27 | 28 | void VBR_old_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], 29 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]); 30 | 31 | void VBR_new_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], 32 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]); 33 | 34 | void ABR_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], 35 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]); 36 | 37 | 38 | #endif /* LAME_QUANTIZE_H */ 39 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/libs/include/libmp3lame/reservoir.h: -------------------------------------------------------------------------------- 1 | /* 2 | * bit reservoir include file 3 | * 4 | * Copyright (c) 1999 Mark Taylor 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library 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 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 | * Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef LAME_RESERVOIR_H 23 | #define LAME_RESERVOIR_H 24 | 25 | int ResvFrameBegin(lame_internal_flags * gfc, int *mean_bits); 26 | void ResvMaxBits(lame_internal_flags * gfc, int mean_bits, int *targ_bits, int *max_bits, 27 | int cbr); 28 | void ResvAdjust(lame_internal_flags * gfc, gr_info const *gi); 29 | void ResvFrameEnd(lame_internal_flags * gfc, int mean_bits); 30 | 31 | #endif /* LAME_RESERVOIR_H */ 32 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/libs/include/libmp3lame/vbrquantize.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MP3 VBR quantization 3 | * 4 | * Copyright (c) 1999 Mark Taylor 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library 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 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 | * Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef LAME_VBRQUANTIZE_H 23 | #define LAME_VBRQUANTIZE_H 24 | 25 | int VBR_encode_frame(lame_internal_flags * gfc, const FLOAT xr34orig[2][2][576], 26 | const FLOAT l3_xmin[2][2][SFBMAX], const int maxbits[2][2]); 27 | 28 | #endif /* LAME_VBRQUANTIZE_H */ 29 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/libs/include/libmp3lame/vector/lame_intrin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lame_intrin.h include file 3 | * 4 | * Copyright (c) 2006 Gabriel Bouvigne 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library 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 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 | * Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | 23 | #ifndef LAME_INTRIN_H 24 | #define LAME_INTRIN_H 25 | 26 | 27 | void 28 | init_xrpow_core_sse(gr_info * const cod_info, FLOAT xrpow[576], int upper, FLOAT * sum); 29 | 30 | void 31 | fht_SSE2(FLOAT* , int); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/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 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/src/main/cpp/com_yingke_audio_mp3lame_encoder_encoder_LameUtil.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_yingke_audio_mp3lame_encoder_encoder_LameUtil */ 4 | 5 | #ifndef _Included_com_yingke_audio_mp3lame_encoder_encoder_LameUtil 6 | #define _Included_com_yingke_audio_mp3lame_encoder_encoder_LameUtil 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/src/main/cpp/com_yingke_audio_mp3lame_encoder_encoder_LameUtil_Companion.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_yingke_audio_mp3lame_encoder_encoder_LameUtil_Companion */ 4 | 5 | #ifndef _Included_com_yingke_audio_mp3lame_encoder_encoder_LameUtil_Companion 6 | #define _Included_com_yingke_audio_mp3lame_encoder_encoder_LameUtil_Companion 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: com_yingke_audio_mp3lame_encoder_encoder_LameUtil_Companion 12 | * Method: init 13 | * Signature: (IIIII)V 14 | */ 15 | JNIEXPORT void JNICALL Java_com_yingke_audio_mp3lame_encoder_encoder_LameUtil_00024Companion_init 16 | (JNIEnv *, jobject, jint, jint, jint, jint, jint); 17 | 18 | /* 19 | * Class: com_yingke_audio_mp3lame_encoder_encoder_LameUtil_Companion 20 | * Method: encode 21 | * Signature: ([S[SI[B)I 22 | */ 23 | JNIEXPORT jint JNICALL Java_com_yingke_audio_mp3lame_encoder_encoder_LameUtil_00024Companion_encode 24 | (JNIEnv *, jobject, jshortArray, jshortArray, jint, jbyteArray); 25 | 26 | /* 27 | * Class: com_yingke_audio_mp3lame_encoder_encoder_LameUtil_Companion 28 | * Method: flush 29 | * Signature: ([B)I 30 | */ 31 | JNIEXPORT jint JNICALL Java_com_yingke_audio_mp3lame_encoder_encoder_LameUtil_00024Companion_flush 32 | (JNIEnv *, jobject, jbyteArray); 33 | 34 | /* 35 | * Class: com_yingke_audio_mp3lame_encoder_encoder_LameUtil_Companion 36 | * Method: close 37 | * Signature: ()V 38 | */ 39 | JNIEXPORT void JNICALL Java_com_yingke_audio_mp3lame_encoder_encoder_LameUtil_00024Companion_close 40 | (JNIEnv *, jobject); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif 46 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/src/main/java/com/yingke/audio/mp3lame/encoder/Recorder.kt: -------------------------------------------------------------------------------- 1 | package com.yingke.audio.mp3lame.encoder 2 | 3 | /** 4 | * 功能: 5 | *

6 | *

Copyright xxx.xxx.com 2019 All right reserved

7 | * 8 | * @author tuke 时间 2020-06-18 9 | * @email 10 | *

11 | * 最后修改人:无 12 | *

13 | */ 14 | interface Recorder { 15 | 16 | /** 17 | * @param listener 18 | */ 19 | fun setAudioListener(listener: RecorderListener) 20 | 21 | /** 22 | * @param path 23 | */ 24 | fun startRecord(path: String) 25 | 26 | /** 27 | * 暂停 录制 28 | */ 29 | fun pauseRecord() 30 | 31 | /** 32 | * 继续录制 33 | */ 34 | fun resumeRecord() 35 | 36 | /** 37 | * 停止录制 38 | * @return 录制时长 ms 39 | */ 40 | fun stopRecord(): Long 41 | 42 | } -------------------------------------------------------------------------------- /audio_mp3lame_encoder/src/main/java/com/yingke/audio/mp3lame/encoder/RecorderListener.kt: -------------------------------------------------------------------------------- 1 | package com.yingke.audio.mp3lame.encoder 2 | 3 | /** 4 | * 功能: 5 | *

6 | *

Copyright corp.netease.com 2019 All right reserved

7 | * 8 | * @author tuke 时间 2020-06-18 9 | * @email tuke@corp.netease.com 10 | *

11 | * 最后修改人:无 12 | *

13 | */ 14 | interface RecorderListener { 15 | 16 | /** 17 | * 获取录制音量的大小 18 | * 19 | * @param volume 20 | */ 21 | fun onGetVolume(volume: Int) 22 | 23 | } -------------------------------------------------------------------------------- /audio_mp3lame_encoder/src/main/java/com/yingke/audio/mp3lame/encoder/recorder/PCMFormat.java: -------------------------------------------------------------------------------- 1 | package com.yingke.audio.mp3lame.encoder.recorder; 2 | 3 | import android.media.AudioFormat; 4 | 5 | public enum PCMFormat { 6 | PCM_8BIT(1, AudioFormat.ENCODING_PCM_8BIT), 7 | PCM_16BIT(2, AudioFormat.ENCODING_PCM_16BIT); 8 | 9 | private int bytesPerFrame; 10 | private int audioFormat; 11 | 12 | PCMFormat(int bytesPerFrame, int audioFormat) { 13 | this.bytesPerFrame = bytesPerFrame; 14 | this.audioFormat = audioFormat; 15 | } 16 | 17 | public int getBytesPerFrame() { 18 | return bytesPerFrame; 19 | } 20 | 21 | public int getAudioFormat() { 22 | return audioFormat; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/src/main/java/com/yingke/audio/mp3lame/encoder/util/DateUtils.java: -------------------------------------------------------------------------------- 1 | package com.yingke.audio.mp3lame.encoder.util; 2 | 3 | import android.annotation.SuppressLint; 4 | 5 | /** 6 | * @author :chezi008 on 2018/4/17 22:24 7 | * @description : 8 | * @email :chezi008@163.com 9 | */ 10 | public class DateUtils { 11 | @SuppressLint({"DefaultLocale"}) 12 | public static String toTime(int var0) { 13 | var0 /= 1000; 14 | int var1 = var0 / 60; 15 | boolean var2 = false; 16 | if (var1 >= 60) { 17 | int var4 = var1 / 60; 18 | var1 %= 60; 19 | } 20 | int var3 = var0 % 60; 21 | if (var1>0){ 22 | return String.format("%d′%d\"", new Object[]{Integer.valueOf(var1), Integer.valueOf(var3)}); 23 | } 24 | return String.format("%d\"", Integer.valueOf(var3)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/src/main/res/mipmap-xhdpi/ic_mic_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/audio_mp3lame_encoder/src/main/res/mipmap-xhdpi/ic_mic_white.png -------------------------------------------------------------------------------- /audio_mp3lame_encoder/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | audio_mp3lame_encoder 3 | 4 | -------------------------------------------------------------------------------- /audio_mp3lame_encoder/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | 2 | 3 | buildscript { 4 | apply from: "config.gradle" 5 | def versions = rootProject.ext.android 6 | repositories { 7 | google() 8 | jcenter() 9 | 10 | } 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:3.5.0' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin_version}" 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 | 24 | } 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /config.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | android = [ 3 | compileSdkVersion: 28, 4 | buildToolsVersion: "28.0.3", 5 | applicationId : "com.yingke.simple.codec", 6 | minSdkVersion : 21, 7 | targetSdkVersion : 28, 8 | versionCode : 1, 9 | versionName : "1.0.0", 10 | kotlin_version : '1.3.41' 11 | ] 12 | 13 | libraries = [ 14 | androidx_appcompat : 'androidx.appcompat:appcompat:1.0.2', 15 | androidx_core : 'androidx.core:core:1.0.0', 16 | androidx_fragment : 'androidx.fragment:fragment:1.0.0', 17 | androidx_media : 'androidx.media:media:1.0.0', 18 | androidx_list : 'androidx.recyclerview:recyclerview:1.0.0', 19 | androidx_multidex : 'androidx.multidex:multidex:2.0.0', 20 | android_bolts : 'com.parse.bolts:bolts-tasks:1.4.0', 21 | 22 | androidx_core_ktx : 'androidx.core:core-ktx:1.3.0', 23 | androidx_constraint : 'androidx.constraintlayout:constraintlayout:1.1.3', 24 | rxjava : 'io.reactivex.rxjava2:rxjava:2.2.0', 25 | rxandroid : 'io.reactivex.rxjava2:rxandroid:2.1.0', 26 | kotlin_lib : 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.41', 27 | permision_lib : 'pub.devrel:easypermissions:0.2.1' 28 | ] 29 | 30 | } -------------------------------------------------------------------------------- /core/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /core/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | minSdkVersion 21 7 | targetSdkVersion 28 8 | versionCode 1 9 | versionName "1.0" 10 | } 11 | 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | 19 | sourceSets { 20 | main { 21 | // so库地址 22 | jniLibs.srcDirs = ['libs'] 23 | } 24 | } 25 | 26 | } 27 | 28 | dependencies { 29 | implementation fileTree(dir: 'libs', include: ['*.jar']) 30 | implementation rootProject.ext.libraries.androidx_appcompat 31 | implementation rootProject.ext.libraries.androidx_core 32 | 33 | compileOnly rootProject.ext.libraries.permision_lib 34 | } 35 | -------------------------------------------------------------------------------- /core/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/core/consumer-rules.pro -------------------------------------------------------------------------------- /core/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 | -------------------------------------------------------------------------------- /core/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /core/src/main/java/com/yingke/core/base/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.yingke.core.base; 2 | 3 | import android.os.Bundle; 4 | 5 | import androidx.annotation.Nullable; 6 | import androidx.appcompat.app.AppCompatActivity; 7 | 8 | /** 9 | * 功能: 10 | *

11 | *

Copyright xxx.xxx.com 2020 All right reserved

12 | * 13 | * @author tuke 时间 2020-07-03 14 | * @email

15 | * 最后修改人:无 16 | *

17 | */ 18 | public class BaseActivity extends AppCompatActivity { 19 | 20 | @Override 21 | protected void onCreate(@Nullable Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/yingke/core/base/BaseApplication.java: -------------------------------------------------------------------------------- 1 | package com.yingke.core.base; 2 | 3 | import android.app.Application; 4 | 5 | import com.yingke.core.core.CoreContext; 6 | 7 | /** 8 | * 功能: 9 | *

10 | *

Copyright xxx.xxx.com 2020 All right reserved

11 | * 12 | * @author tuke 时间 2020-07-03 13 | * @email

14 | * 最后修改人:无 15 | *

16 | */ 17 | public class BaseApplication extends Application { 18 | 19 | @Override 20 | public void onCreate() { 21 | super.onCreate(); 22 | CoreContext.get().init(this); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/yingke/core/core/CoreContext.java: -------------------------------------------------------------------------------- 1 | package com.yingke.core.core; 2 | 3 | import android.app.Application; 4 | 5 | /** 6 | * 功能: 7 | *

8 | *

Copyright xxx.xxx.com 2020 All right reserved

9 | * 10 | * @author tuke 时间 2020-07-03 11 | * @email

12 | * 最后修改人:无 13 | *

14 | */ 15 | public class CoreContext { 16 | 17 | private final static class SingletonHolder { 18 | public final static CoreContext INSTANCE = new CoreContext(); 19 | } 20 | 21 | public static CoreContext get(){ 22 | return SingletonHolder.INSTANCE; 23 | } 24 | 25 | public void init(Application application){ 26 | sApplication = application; 27 | } 28 | 29 | private static Application sApplication; 30 | public static Application context() { 31 | return sApplication; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | core 3 | 4 | -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 3.4.1) 3 | 4 | # 包含头文件 5 | include_directories(src/main/cpp) 6 | add_library(yingke-mp4-native-player 7 | SHARED 8 | src/main/cpp/native_player.cpp 9 | src/main/cpp/ffmpeg_player.cpp 10 | ) 11 | 12 | # 获取上级 目录 13 | get_filename_component(PARENT_DIR ${CMAKE_SOURCE_DIR} PATH) 14 | set(LIBRARY_DIR ${PARENT_DIR}/ffmpeg_single) 15 | 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") 17 | set(CMAKE_VERBOSE_MAKEFILE on) 18 | 19 | # 设置so动态库输出目录 20 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/src/main/output/${ANDROID_ABI}) 21 | 22 | # 引入三方库 ffmpeg 23 | add_library(ffmpeg_single 24 | SHARED 25 | IMPORTED 26 | ) 27 | set_target_properties( 28 | ffmpeg_single 29 | PROPERTIES IMPORTED_LOCATION 30 | ${LIBRARY_DIR}/libs/${ANDROID_ABI}/libffmpeg.so) 31 | 32 | # ffmpeg头文件 33 | include_directories(${LIBRARY_DIR}/libs/${ANDROID_ABI}/include) 34 | 35 | find_library( 36 | log-lib 37 | log) 38 | 39 | # 链接 40 | target_link_libraries( 41 | yingke-mp4-native-player 42 | ffmpeg_single 43 | ${log-lib} 44 | android) -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/REDAME.md: -------------------------------------------------------------------------------- 1 | ### 参考代码和博客 2 | 1. 代码:https://github.com/byhook/ffmpeg4android 3 | 2. 博客:https://blog.csdn.net/byhook/article/details/84648755 4 | -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/build.gradle: -------------------------------------------------------------------------------- 1 | apply from: '../module.gradle' 2 | dependencies { 3 | compileOnly project(path: ':ffmpeg_assets') 4 | compileOnly project(path: ':ffmpeg_single') 5 | 6 | } -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuke0919/YingKe-SimpleCodeC/0c89a0c3d23fa15201cd77121146a5aeb6c508b9/ffmpeg-decode-mp4-native-player/consumer-rules.pro -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/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 | -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/src/main/cpp/ffmpeg_player.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by KE TU on 2020-07-14. 3 | // 4 | #include 5 | #include 6 | 7 | #ifndef YINGKE_SIMPLECODEC_FFMPEG_PLAYER_H 8 | #define YINGKE_SIMPLECODEC_FFMPEG_PLAYER_H 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #include "libavcodec/avcodec.h" 14 | #include "libavformat/avformat.h" 15 | #include "libavfilter/avfilter.h" 16 | #include "libavutil/log.h" 17 | #include 18 | #include 19 | 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | class NativePlayer{ 26 | 27 | private: 28 | int width = 0; 29 | int height = 0; 30 | 31 | int bufferSize = 0; 32 | int videoIndex = -1; 33 | 34 | AVFormatContext *avFormatContext = NULL; 35 | AVCodec *avCodec = NULL; 36 | AVCodecContext *avCodecContext = NULL; 37 | 38 | AVPacket *avPacket = NULL; 39 | AVFrame *avFrame = NULL; 40 | AVFrame *avFrameRGB = NULL; 41 | 42 | SwsContext *swsContext = NULL; 43 | uint8_t *out_buffer = NULL; 44 | ANativeWindow_Buffer windowBuffer; 45 | 46 | public: 47 | /** 48 | * native 播放 49 | * @param video_path 50 | * @param aNativeWindow 51 | * @return 52 | */ 53 | int native_play(const char *video_path, ANativeWindow *aNativeWindow); 54 | }; 55 | 56 | 57 | 58 | #endif //YINGKE_SIMPLECODEC_FFMPEG_PLAYER_H 59 | -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/src/main/cpp/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 | 13 | #define LOG_TAG "Mp4ToYuvDecoder" 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 | #endif //FFMPEG4ANDROID_LOGGER_H 22 | -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/src/main/cpp/native_player.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by KE TU on 2020-07-14. 3 | // 4 | 5 | #include "jni.h" 6 | #ifndef YINGKE_SIMPLECODEC_NATIVE_PLAYER_H 7 | #define YINGKE_SIMPLECODEC_NATIVE_PLAYER_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | JNIEXPORT jint JNICALL startNativePlayer(JNIEnv *env, jclass clz, jstring videoPath, jobject surface); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif //YINGKE_SIMPLECODEC_NATIVE_PLAYER_H 20 | -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/src/main/java/com/yingke/ffmpeg/decode/Mp4NativePlayer.java: -------------------------------------------------------------------------------- 1 | package com.yingke.ffmpeg.decode; 2 | 3 | /** 4 | * 功能:使用ffmpeg 解码播放mp4 5 | *

6 | *

Copyright xxx.xxx.com 2020 All right reserved

7 | * 8 | * @author tuke 时间 2020-07-14 9 | * @email

10 | * 最后修改人:无 11 | *

12 | */ 13 | public class Mp4NativePlayer { 14 | 15 | static { 16 | System.loadLibrary("yingke-mp4-native-player"); 17 | } 18 | 19 | /** 20 | * 播放mp4 21 | * @param videoPath 22 | * @param surface 23 | * @return 24 | */ 25 | public static native int startMp4Player(String videoPath, Object surface); 26 | } 27 | -------------------------------------------------------------------------------- /ffmpeg-decode-mp4-native-player/src/main/res/layout/main_mp4_player.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 |