├── .gitattributes
├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── gradle.xml
├── jarRepositories.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── ffmpegvideorange2
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── ffmpegvideorange2
│ │ │ ├── App.kt
│ │ │ ├── DisplayUtils.java
│ │ │ ├── FileListActivity.kt
│ │ │ ├── FileListAdapter.java
│ │ │ ├── ImageViewBitmapBean.kt
│ │ │ ├── MainActivity.java
│ │ │ ├── PreviewFrameActivity.java
│ │ │ ├── PreviewImageAdapter.java
│ │ │ ├── RangeTimeLineActivity.kt
│ │ │ ├── ShowFrameQueue.java
│ │ │ ├── TimeLineActivity.kt
│ │ │ ├── Utils.java
│ │ │ ├── VideoRangeActivity.java
│ │ │ ├── VideoUtils.java
│ │ │ ├── VideoUtils2.java
│ │ │ ├── YUVDataBean.kt
│ │ │ ├── YuvQueue.java
│ │ │ ├── cache
│ │ │ └── DiskCackeHelper.kt
│ │ │ ├── helper
│ │ │ ├── IFFmpegCodecFrameHelper.kt
│ │ │ └── IMediaCodecFrameHelper.kt
│ │ │ └── scrollVelocity
│ │ │ ├── ListVelocityHandler.java
│ │ │ ├── RecyclerVelocityHandler.java
│ │ │ ├── ScrollVelocityTracker.java
│ │ │ ├── VelocityHandler.java
│ │ │ ├── VelocityTrackListener.java
│ │ │ ├── ViewVelocityHandler.java
│ │ │ └── WeakRefWrapper.java
│ └── res
│ │ ├── drawable-v24
│ │ ├── ic_launcher_foreground.xml
│ │ ├── play_ico.png
│ │ └── stop_ico.png
│ │ ├── drawable
│ │ ├── drag_btn.png
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_file_list.xml
│ │ ├── activity_main.xml
│ │ ├── activity_preview_frame.xml
│ │ ├── activity_range_time_line.xml
│ │ ├── activity_time_line.xml
│ │ ├── activity_video_range.xml
│ │ ├── item_file_list_name.xml
│ │ └── item_preview_img.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
│ └── test
│ └── java
│ └── com
│ └── example
│ └── ffmpegvideorange2
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── myplayer
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── myplayer
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ │ ├── AVFrameQueue.cpp
│ │ ├── AVFrameQueue.h
│ │ ├── CMakeLists.txt
│ │ ├── FAvFrameHelper.cpp
│ │ ├── FAvFrameHelper.h
│ │ ├── JavaCallHelper.cpp
│ │ ├── JavaCallHelper.h
│ │ ├── KzgAudio.cpp
│ │ ├── KzgAudio.h
│ │ ├── KzgFFmpeg.cpp
│ │ ├── KzgFFmpeg.h
│ │ ├── KzgPlayerStatus.cpp
│ │ ├── KzgPlayerStatus.h
│ │ ├── KzgVideo.cpp
│ │ ├── KzgVideo.h
│ │ ├── SafeQueue.cpp
│ │ ├── SafeQueue.h
│ │ ├── include
│ │ │ ├── libavcodec
│ │ │ │ ├── avcodec.h
│ │ │ │ ├── avdct.h
│ │ │ │ ├── avfft.h
│ │ │ │ ├── d3d11va.h
│ │ │ │ ├── dirac.h
│ │ │ │ ├── dv_profile.h
│ │ │ │ ├── dxva2.h
│ │ │ │ ├── jni.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
│ │ │ │ └── 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_d3d11va.h
│ │ │ │ ├── hwcontext_drm.h
│ │ │ │ ├── hwcontext_dxva2.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
│ │ │ │ ├── version.h
│ │ │ │ └── xtea.h
│ │ │ ├── libpostproc
│ │ │ │ ├── postprocess.h
│ │ │ │ └── version.h
│ │ │ ├── libswresample
│ │ │ │ ├── swresample.h
│ │ │ │ └── version.h
│ │ │ └── libswscale
│ │ │ │ ├── swscale.h
│ │ │ │ └── version.h
│ │ ├── log.h
│ │ ├── mediametadataretriever
│ │ │ ├── Errors.h
│ │ │ ├── Mutex.h
│ │ │ ├── ffmpeg_mediametadataretriever.c
│ │ │ ├── ffmpeg_mediametadataretriever.h
│ │ │ ├── ffmpeg_utils.c
│ │ │ ├── ffmpeg_utils.h
│ │ │ ├── mediametadataretriever.cpp
│ │ │ ├── mediametadataretriever.h
│ │ │ └── wseemann_media_MediaMetadataRetriever.cpp
│ │ ├── native-lib.cpp
│ │ └── soundtouch
│ │ │ ├── SoundTouch
│ │ │ ├── AAFilter.cpp
│ │ │ ├── AAFilter.h
│ │ │ ├── FIFOSampleBuffer.cpp
│ │ │ ├── FIRFilter.cpp
│ │ │ ├── FIRFilter.h
│ │ │ ├── InterpolateCubic.cpp
│ │ │ ├── InterpolateCubic.h
│ │ │ ├── InterpolateLinear.cpp
│ │ │ ├── InterpolateLinear.h
│ │ │ ├── InterpolateShannon.cpp
│ │ │ ├── InterpolateShannon.h
│ │ │ ├── PeakFinder.cpp
│ │ │ ├── PeakFinder.h
│ │ │ ├── RateTransposer.cpp
│ │ │ ├── RateTransposer.h
│ │ │ ├── SoundTouch.cpp
│ │ │ ├── TDStretch.cpp
│ │ │ ├── TDStretch.h
│ │ │ ├── cpu_detect.h
│ │ │ ├── cpu_detect_x86.cpp
│ │ │ └── sse_optimized.cpp
│ │ │ └── include
│ │ │ ├── BPMDetect.h
│ │ │ ├── FIFOSampleBuffer.h
│ │ │ ├── FIFOSamplePipe.h
│ │ │ ├── Makefile.am
│ │ │ ├── STTypes.h
│ │ │ ├── SoundTouch.h
│ │ │ └── soundtouch_config.h.in
│ ├── java
│ │ ├── com
│ │ │ └── example
│ │ │ │ └── myplayer
│ │ │ │ ├── KzgPlayer.java
│ │ │ │ ├── MyQueue.java
│ │ │ │ ├── PacketBean.java
│ │ │ │ ├── PacketQueue.java
│ │ │ │ ├── TimeInfoBean.java
│ │ │ │ ├── VideoRange
│ │ │ │ ├── DividingView.java
│ │ │ │ ├── MediaPlayerView.java
│ │ │ │ ├── MyLinearLayoutManager.java
│ │ │ │ ├── SpacesItemDecoration2.java
│ │ │ │ ├── VideoPreViewAdapter.java
│ │ │ │ ├── VideoRangeHorizontalScrollView.java
│ │ │ │ ├── VideoRangeRecyclerView.java
│ │ │ │ ├── VideoRangeView.java
│ │ │ │ ├── VideoRangeViewBehavior.java
│ │ │ │ └── VideoTrackView.java
│ │ │ │ ├── bean
│ │ │ │ ├── VideoBitmapBean.java
│ │ │ │ └── YUVBean.java
│ │ │ │ ├── mediacodec
│ │ │ │ └── KzglVideoSupportUtil.java
│ │ │ │ ├── mediacodecframes
│ │ │ │ ├── OutputImageFormat.java
│ │ │ │ └── VideoToFrames.java
│ │ │ │ ├── opengl
│ │ │ │ ├── KzgGLSurfaceView.java
│ │ │ │ ├── KzgGlRender.java
│ │ │ │ └── KzgShaderUtil.java
│ │ │ │ ├── timebar
│ │ │ │ ├── Course.java
│ │ │ │ ├── ScaleModel.java
│ │ │ │ ├── ScaleTimeBar.java
│ │ │ │ ├── Scaler.java
│ │ │ │ └── SizeParam.java
│ │ │ │ └── utils
│ │ │ │ └── Utils.java
│ │ └── wseemann
│ │ │ └── media
│ │ │ └── FFmpegMediaMetadataRetriever.java
│ ├── jniLibs
│ │ └── armeabi-v7a
│ │ │ ├── libavcodec.so
│ │ │ ├── libavdevice.so
│ │ │ ├── libavfilter.so
│ │ │ ├── libavformat.so
│ │ │ ├── libavutil.so
│ │ │ ├── libpostproc.so
│ │ │ ├── libswresample.so
│ │ │ └── libswscale.so
│ └── res
│ │ ├── drawable
│ │ ├── bright_progress.xml
│ │ ├── bright_thumb.xml
│ │ ├── btn_vidoe_pause.png
│ │ ├── btn_vidoe_play.png
│ │ └── selector_play_details.xml
│ │ ├── layout
│ │ ├── layout_video_range.xml
│ │ ├── layout_view_pre_item.xml
│ │ ├── video_track_layout.xml
│ │ └── view_media_player.xml
│ │ ├── raw
│ │ ├── fragment_mediacodec.glsl
│ │ ├── fragment_shader.glsl
│ │ └── vertex_shader.glsl
│ │ └── values
│ │ └── colors.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── myplayer
│ └── ExampleUnitTest.java
├── settings.gradle
└── timeLine
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
├── androidTest
└── java
│ └── com
│ └── sam
│ └── video
│ └── ExampleInstrumentedTest.kt
├── main
├── AndroidManifest.xml
├── java
│ └── com
│ │ └── sam
│ │ └── video
│ │ ├── TimeLineApp.kt
│ │ ├── timeline
│ │ ├── adapter
│ │ │ ├── TagAdapter.kt
│ │ │ └── VideoFrameAdapter.kt
│ │ ├── bean
│ │ │ ├── TagLineViewData.kt
│ │ │ ├── TargetBean.java
│ │ │ ├── TimeLineAreaData.kt
│ │ │ ├── VideoClip.kt
│ │ │ └── VideoFrameData.kt
│ │ ├── cache
│ │ │ ├── DiskLruCache.java
│ │ │ ├── DiskLrucacheExt.kt
│ │ │ ├── IoUtils.java
│ │ │ └── StrictLineReader.java
│ │ ├── common
│ │ │ ├── OutputImageFormat.java
│ │ │ └── TargetBeanQueue.java
│ │ ├── helper
│ │ │ ├── DiskCacheAssist.kt
│ │ │ ├── FrameCache.kt
│ │ │ ├── IAvFrameHelper.kt
│ │ │ ├── IFrameSearch.java
│ │ │ ├── OnGetFrameBitmapCallback.kt
│ │ │ ├── VideoAnalyze.kt
│ │ │ └── VideoDecoder2.kt
│ │ ├── listener
│ │ │ ├── Click.java
│ │ │ ├── OnFrameClickListener.kt
│ │ │ ├── SelectAreaMagnetOnChangeListener.kt
│ │ │ ├── TagSelectAreaMagnetOnChangeListener.kt
│ │ │ └── VideoPlayerOperate.kt
│ │ └── widget
│ │ │ ├── ActiveFullTextTagLineView.kt
│ │ │ ├── ActiveWideTextTagLineView.kt
│ │ │ ├── MaxHeightRecyclerView.kt
│ │ │ ├── RoundImageView.java
│ │ │ ├── RoundRectMask.java
│ │ │ ├── RoundTextView.java
│ │ │ ├── RulerView.kt
│ │ │ ├── SelectAreaView.kt
│ │ │ ├── TagItemDecoration.kt
│ │ │ ├── TagLineView.kt
│ │ │ ├── TagPopWindow.kt
│ │ │ ├── TimeChangeListener.kt
│ │ │ ├── TimeLineBaseValue.kt
│ │ │ ├── TransImageView.java
│ │ │ ├── VideoFrameItemDecoration.kt
│ │ │ ├── VideoFrameRecyclerView.kt
│ │ │ ├── WideTextTagLineView.kt
│ │ │ └── ZoomFrameLayout.kt
│ │ └── util
│ │ ├── AppExecutors.java
│ │ ├── CodeCFunction.kt
│ │ ├── Collections.kt
│ │ ├── CommonFunction.kt
│ │ ├── ContextExt.kt
│ │ ├── FUtils.java
│ │ ├── MediaFunction.kt
│ │ ├── MediaStoreUtil.java
│ │ ├── ScreenUtil.java
│ │ ├── SelectAreaEventHandle.kt
│ │ └── VideoUtils.kt
└── res
│ ├── drawable-v24
│ └── ic_launcher_foreground.xml
│ ├── drawable-xxhdpi
│ ├── video_cover_duration_default.webp
│ ├── video_cover_duration_disable.webp
│ ├── video_edit_frame_pic_icon.webp
│ ├── video_frame_cursor.webp
│ ├── video_select_left.webp
│ └── video_select_right.webp
│ ├── drawable
│ ├── ic_launcher_background.xml
│ ├── shape_video_edit_filter_place_bg.xml
│ ├── tag_select_white_border_corners.xml
│ ├── video_edit__tip_circle_bg.xml
│ ├── video_edit__tip_circle_bg_16dp.xml
│ ├── video_edit__tip_line_bg_gradient.xml
│ ├── video_item_index_bg.xml
│ └── video_item_placeholder.xml
│ ├── layout
│ ├── activity_start.xml
│ ├── item_tag_img.xml
│ ├── item_tag_text.xml
│ └── item_video_frame.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
│ ├── attrs.xml
│ ├── colors.xml
│ ├── strings.xml
│ ├── styles.xml
│ └── video_edit_tag_color_res.xml
└── test
└── java
└── com
└── sam
└── video
└── ExampleUnitTest.kt
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.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
16 |
17 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FFmpegVideoRange2
2 |
3 | ## 此项目是android 仿照剪映一些功能,暂时只有预览条的精准快速抽帧显示,以及滑动过程中与播放逐帧显示,我观察了下,基本只有大厂的剪辑软件中会有这样的功能。
4 | ## 网上的一些开源项目中,都仅仅是非精准抽帧或者只是关键帧,有些速度很慢。
5 |
6 | ## 本项目抽帧速度已经和快手的快影差不多了,但是比剪映还是要慢一些,大家可以实际对比一下。
7 |
8 | ### demo 需要在内部存储根目录创建一个testVideo目录,将测试视频放到这里
9 |
10 | ### 开局一张效果图
11 | 
12 | ### 这是剪映的预览条加载显示的速度效果
13 | 
14 |
15 | ### 这是本项目的效果展示
16 | 
17 |
18 | .gif)
19 |
20 |
21 |
22 | ### 其中预览条的UI 用的是https://github.com/meitu/VideoTimeLine
23 |
24 | ### 项目本身是自己学习音视频的demo,从基本的解码播放器开始一边学习一边写出来的,只支持h264的视频,此项目一点不能直接用于实际项目开发中
25 | ### 仅作为类似功能的参考,欢迎star
26 |
27 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 28
7 | buildToolsVersion "29.0.2"
8 | defaultConfig {
9 | applicationId "com.example.ffmpegvideorange2"
10 | minSdkVersion 23
11 | targetSdkVersion 28
12 | versionCode 1
13 | versionName "1.0"
14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15 | ndk {
16 | abiFilters "armeabi-v7a"
17 | }
18 |
19 | }
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24 | }
25 | debug {
26 | debuggable true
27 | buildConfigField "Boolean", "DEBUG_MODE", "true"
28 | }
29 | }
30 | compileOptions {
31 | sourceCompatibility JavaVersion.VERSION_1_8
32 | targetCompatibility JavaVersion.VERSION_1_8
33 | }
34 | kotlinOptions {
35 | jvmTarget = '1.8'
36 | }
37 |
38 | }
39 |
40 | dependencies {
41 | implementation fileTree(dir: 'libs', include: ['*.jar'])
42 | implementation 'androidx.appcompat:appcompat:1.1.0'
43 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
44 | implementation 'com.google.android.material:material:1.2.1'
45 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
46 | implementation project(path: ':timeLine')
47 | testImplementation 'junit:junit:4.12'
48 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
49 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
50 | implementation 'androidx.recyclerview:recyclerview:1.1.0'
51 | implementation project(path: ':myplayer')
52 | implementation 'com.wang.avi:library:2.1.3'
53 | }
54 |
--------------------------------------------------------------------------------
/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/androidTest/java/com/example/ffmpegvideorange2/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 |
25 | assertEquals("com.example.ffmpegvideorange2", appContext.getPackageName());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/App.kt:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2
2 |
3 | import android.app.Application
4 | import android.content.Context
5 | import android.util.Log
6 | import com.sam.video.TimeLineApp
7 | import java.lang.reflect.Method
8 |
9 |
10 | class App : Application() {
11 |
12 | private var moduleApplication: TimeLineApp? = null
13 |
14 | override fun onCreate() {
15 | instance = this
16 | super.onCreate()
17 | }
18 |
19 | companion object {
20 | lateinit var instance: App
21 | private set
22 |
23 | }
24 |
25 | override fun attachBaseContext(base: Context?) {
26 | super.attachBaseContext(base)
27 | moduleApplication = getModuleApplicationInstance(this)
28 | try {
29 | //通过反射调用moduleApplication的attach方法
30 | val method: Method? =
31 | Application::class.java.getDeclaredMethod("attach", Context::class.java)
32 | Log.e("kzg","******************attachBaseContext")
33 | if (method != null) {
34 | method.setAccessible(true)
35 | method.invoke(moduleApplication, baseContext)
36 | Log.e("kzg","******************通过反射调用moduleApplication的attach方法")
37 | }
38 | } catch (e: Exception) {
39 | e.printStackTrace()
40 | }
41 | }
42 |
43 | //映射获取ModuleApplication
44 | private fun getModuleApplicationInstance(paramContext: Context): TimeLineApp? {
45 | try {
46 | if (moduleApplication == null) {
47 | val classLoader: ClassLoader = paramContext.getClassLoader()
48 | if (classLoader != null) {
49 | val mClass = classLoader.loadClass(TimeLineApp::class.java.getName())
50 | if (mClass != null) moduleApplication =
51 | mClass.newInstance() as TimeLineApp
52 | }
53 | }
54 | } catch (e: Exception) {
55 | e.printStackTrace()
56 | }
57 | return moduleApplication
58 | }
59 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/DisplayUtils.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2;
2 |
3 | import android.content.Context;
4 |
5 | /*
6 | * Copyright (c) 2020, jzj
7 | * Author: jzj
8 | * Website: www.paincker.com
9 | */
10 |
11 | public class DisplayUtils {
12 |
13 | public static int dp2px(Context context, float dpValue) {
14 | final float scale = context.getResources().getDisplayMetrics().density;
15 | return (int) (dpValue * scale + 0.5f);
16 | }
17 |
18 | public static int px2dp(Context context, float pxValue) {
19 | final float scale = context.getResources().getDisplayMetrics().density;
20 | return (int) (pxValue / scale + 0.5f);
21 | }
22 |
23 | public static int dip2px(Context context, float dpValue) {
24 | return dp2px(context, dpValue);
25 | }
26 |
27 | public static int px2dip(Context context, float pxValue) {
28 | return px2dp(context, pxValue);
29 | }
30 |
31 | public static int getScreenWidth(Context c) {
32 | return c.getResources().getDisplayMetrics().widthPixels;
33 | }
34 |
35 | public static int getScreenHeight(Context c) {
36 | return c.getResources().getDisplayMetrics().heightPixels;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/FileListActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2
2 |
3 | import android.content.Intent
4 | import android.os.Bundle
5 | import android.os.Environment
6 | import android.util.Log
7 | import android.view.View
8 | import androidx.appcompat.app.AppCompatActivity
9 | import androidx.recyclerview.widget.LinearLayoutManager
10 | import androidx.recyclerview.widget.RecyclerView
11 | import java.io.File
12 | import java.util.*
13 |
14 | class FileListActivity : AppCompatActivity() {
15 | var inputPath = Environment.getExternalStorageDirectory().toString() + "/testVideo"
16 |
17 | private var recyclerView: RecyclerView? = null
18 | private var adapter: FileListAdapter? = null
19 | private var dataList: List? = null
20 |
21 | override fun onCreate(savedInstanceState: Bundle?) {
22 | super.onCreate(savedInstanceState)
23 | setContentView(R.layout.activity_file_list)
24 |
25 | recyclerView = findViewById(R.id.recycler_view) as RecyclerView?
26 | adapter = FileListAdapter(this)
27 | recyclerView?.setLayoutManager(LinearLayoutManager(this))
28 | recyclerView?.setAdapter(adapter)
29 |
30 | dataList = getFileListData()
31 | adapter?.setData(dataList)
32 | adapter?.setOnItemClickListener(FileListAdapter.OnItemClickListener { position ->
33 | val intent = Intent(
34 | this@FileListActivity,
35 | RangeTimeLineActivity::class.java
36 | )
37 | intent.putExtra("filePath", dataList!![position])
38 | startActivity(intent)
39 | })
40 | }
41 |
42 |
43 | private fun getFileListData(): List? {
44 | val file = File(inputPath)
45 | val files = file.listFiles()
46 | if (files == null) {
47 | Log.e("error", "空目录")
48 | return null
49 | }
50 | val s: MutableList = ArrayList()
51 | for (i in files.indices) {
52 | s.add(files[i].absolutePath)
53 | }
54 | return s
55 | }
56 |
57 |
58 | fun goToVideoRange(view: View?) {
59 | val intent = Intent(
60 | this@FileListActivity,
61 | PreviewFrameActivity::class.java
62 | )
63 | startActivity(intent)
64 | }
65 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/FileListAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.TextView;
8 |
9 | import androidx.annotation.NonNull;
10 | import androidx.recyclerview.widget.RecyclerView;
11 |
12 | import java.util.ArrayList;
13 | import java.util.List;
14 |
15 | /**
16 | * Created By Ele
17 | * on 2020/6/25
18 | **/
19 | public class FileListAdapter extends RecyclerView.Adapter{
20 |
21 | private List dataList = new ArrayList<>();
22 | private Context context;
23 | private OnItemClickListener onItemClickListener;
24 |
25 | public FileListAdapter(Context context) {
26 | this.context = context;
27 | }
28 |
29 | public void setData(List data){
30 | if (data == null){
31 | data = new ArrayList<>();
32 | }
33 | dataList = data;
34 | notifyDataSetChanged();
35 | }
36 |
37 | @NonNull
38 | @Override
39 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
40 | View inflate = LayoutInflater.from(context).inflate(R.layout.item_file_list_name, parent, false);
41 | return new ViewHolder(inflate);
42 | }
43 |
44 | @Override
45 | public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
46 | String name = dataList.get(position);
47 | holder.fileName.setText(name);
48 | holder.fileName.setOnClickListener(new View.OnClickListener() {
49 | @Override
50 | public void onClick(View v) {
51 | if (onItemClickListener != null){
52 | onItemClickListener.onItemClick(position);
53 | }
54 | }
55 | });
56 | }
57 |
58 | @Override
59 | public int getItemCount() {
60 | return dataList.size();
61 | }
62 |
63 | class ViewHolder extends RecyclerView.ViewHolder{
64 |
65 | TextView fileName;
66 |
67 | public ViewHolder(@NonNull View itemView) {
68 | super(itemView);
69 | fileName = itemView.findViewById(R.id.tv_file_name);
70 | }
71 | }
72 |
73 |
74 | public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
75 | this.onItemClickListener = onItemClickListener;
76 | }
77 |
78 | public interface OnItemClickListener{
79 | void onItemClick(int position);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/ImageViewBitmapBean.kt:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2
2 |
3 | import android.graphics.Bitmap
4 | import android.graphics.Rect
5 | import android.graphics.YuvImage
6 | import android.media.Image
7 | import android.widget.ImageView
8 | import com.sam.video.timeline.bean.TargetBean
9 |
10 | class ImageViewBitmapBean(var mapEntry: Map.Entry? = null
11 | , var image: YuvImage? = null,var rect: Rect? = null,val time:Long) {
12 |
13 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 | import androidx.recyclerview.widget.LinearLayoutManager;
5 | import androidx.recyclerview.widget.RecyclerView;
6 |
7 | import android.content.Intent;
8 | import android.graphics.Bitmap;
9 | import android.graphics.BitmapFactory;
10 | import android.graphics.Canvas;
11 | import android.graphics.Paint;
12 | import android.media.MediaCodecInfo;
13 | import android.media.MediaCodecList;
14 | import android.os.Bundle;
15 | import android.os.Environment;
16 | import android.util.Log;
17 | import android.view.SurfaceHolder;
18 | import android.view.SurfaceView;
19 | import android.view.View;
20 | import android.widget.ImageView;
21 | import android.widget.SeekBar;
22 | import android.widget.TextView;
23 |
24 | import java.io.File;
25 | import java.util.ArrayList;
26 | import java.util.List;
27 |
28 | import wseemann.media.FFmpegMediaMetadataRetriever;
29 |
30 |
31 | public class MainActivity extends AppCompatActivity {
32 |
33 |
34 |
35 | @Override
36 | protected void onCreate(Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | setContentView(R.layout.activity_main);
39 |
40 | findViewById(R.id.tv_video_list).setOnClickListener(new View.OnClickListener() {
41 | @Override
42 | public void onClick(View v) {
43 | startActivity(new Intent(MainActivity.this,FileListActivity.class));
44 | }
45 | });
46 |
47 |
48 | findViewById(R.id.tv_meitu_time_line).setOnClickListener(new View.OnClickListener() {
49 | @Override
50 | public void onClick(View v) {
51 | startActivity(new Intent(MainActivity.this,TimeLineActivity.class));
52 | }
53 | });
54 | }
55 |
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/PreviewImageAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import androidx.annotation.NonNull;
12 | import androidx.recyclerview.widget.RecyclerView;
13 |
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | /**
18 | * Created By Ele
19 | * on 2020/6/25
20 | **/
21 | public class PreviewImageAdapter extends RecyclerView.Adapter{
22 |
23 | private List dataList = new ArrayList<>();
24 | private Context context;
25 | private OnItemClickListener onItemClickListener;
26 |
27 | public PreviewImageAdapter(Context context) {
28 | this.context = context;
29 | }
30 |
31 | public void setData(List data){
32 | if (data == null){
33 | data = new ArrayList<>();
34 | }
35 | dataList = data;
36 | notifyDataSetChanged();
37 | }
38 |
39 | @NonNull
40 | @Override
41 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
42 | View inflate = LayoutInflater.from(context).inflate(R.layout.item_preview_img, parent, false);
43 | return new ViewHolder(inflate);
44 | }
45 |
46 | @Override
47 | public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
48 | Bitmap bitmap = dataList.get(position);
49 | holder.img.setImageBitmap(bitmap);
50 | }
51 |
52 | @Override
53 | public int getItemCount() {
54 | return dataList.size();
55 | }
56 |
57 | class ViewHolder extends RecyclerView.ViewHolder{
58 |
59 | ImageView img;
60 |
61 | public ViewHolder(@NonNull View itemView) {
62 | super(itemView);
63 | img = itemView.findViewById(R.id.iv_img);
64 | }
65 | }
66 |
67 |
68 | public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
69 | this.onItemClickListener = onItemClickListener;
70 | }
71 |
72 | public interface OnItemClickListener{
73 | void onItemClick(int position);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/ShowFrameQueue.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2;
2 |
3 | import com.example.myplayer.PacketBean;
4 | import com.sam.video.timeline.bean.TargetBean;
5 |
6 | import java.util.concurrent.LinkedBlockingQueue;
7 |
8 | /**
9 | * Created By Ele
10 | * on 2020/6/4
11 | **/
12 | public class ShowFrameQueue {
13 |
14 | private LinkedBlockingQueue list = new LinkedBlockingQueue();
15 |
16 | public boolean enQueue(ImageViewBitmapBean packetBean){
17 | if (list != null){
18 | return list.offer(packetBean);
19 | }
20 | return false;
21 | }
22 |
23 | public ImageViewBitmapBean deQueue(){
24 | if (list == null){
25 | return null;
26 | }
27 | return list.poll();
28 | }
29 |
30 | public ImageViewBitmapBean getFirst(){
31 | if (list == null){
32 | return null;
33 | }
34 | return list.peek();
35 | }
36 |
37 | public int getQueueSize(){
38 | if (list == null){
39 | return 0;
40 | }
41 | return list.size();
42 | }
43 |
44 | public synchronized void clear(){
45 |
46 | if (list == null || list.isEmpty()){
47 | return;
48 | }
49 | list.clear();
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/YUVDataBean.kt:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2
2 |
3 | class YUVDataBean {
4 | var y:ByteArray? = null
5 | var u:ByteArray? = null
6 | var v:ByteArray? = null
7 | var yuv:ByteArray? = null
8 | var timeUs: Long = 0
9 | var width = 0
10 | var height = 0
11 | var practicalWidth = 0
12 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/YuvQueue.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2;
2 |
3 | import java.util.concurrent.LinkedBlockingQueue;
4 |
5 | /**
6 | * Created By Ele
7 | * on 2020/6/4
8 | **/
9 | public class YuvQueue {
10 |
11 | private LinkedBlockingQueue list = new LinkedBlockingQueue();
12 |
13 | public boolean enQueue(YUVDataBean packetBean){
14 | if (list != null){
15 | return list.offer(packetBean);
16 | }
17 | return false;
18 | }
19 |
20 | public YUVDataBean deQueue(){
21 | if (list == null){
22 | return null;
23 | }
24 | return list.poll();
25 | }
26 |
27 | public YUVDataBean getFirst(){
28 | if (list == null){
29 | return null;
30 | }
31 | return list.peek();
32 | }
33 |
34 | public int getQueueSize(){
35 | if (list == null){
36 | return 0;
37 | }
38 | return list.size();
39 | }
40 |
41 | public synchronized void clear(){
42 |
43 | if (list == null || list.isEmpty()){
44 | return;
45 | }
46 | list.clear();
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/cache/DiskCackeHelper.kt:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2.cache
2 |
3 | class DiskCackeHelper {
4 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/scrollVelocity/RecyclerVelocityHandler.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2.scrollVelocity;
2 |
3 | import android.content.Context;
4 | import android.util.Log;
5 |
6 | import androidx.annotation.CallSuper;
7 | import androidx.annotation.NonNull;
8 | import androidx.recyclerview.widget.RecyclerView;
9 |
10 | /*
11 | * Copyright (c) 2020, jzj
12 | * Author: jzj
13 | * Website: www.paincker.com
14 | */
15 |
16 | /**
17 | * RecyclerView滚动速度监听
18 | */
19 | public class RecyclerVelocityHandler extends RecyclerView.OnScrollListener implements VelocityHandler {
20 |
21 | private final ScrollVelocityTracker mTracker;
22 |
23 | public RecyclerVelocityHandler(Context context) {
24 | mTracker = new ScrollVelocityTracker(context);
25 | }
26 |
27 | @Override
28 | public void setThreshold(int upThreshold, int downThreshold) {
29 | mTracker.setThreshold(upThreshold, downThreshold);
30 | }
31 |
32 | @Override
33 | public void setVelocityTrackerListener(VelocityTrackListener listener) {
34 | mTracker.setVelocityTrackerListener(listener);
35 | }
36 |
37 | @Override
38 | public void setThresholdInDp(Context context, int upThreshold, int downThreshold) {
39 | mTracker.setThresholdInDp(context, upThreshold, downThreshold);
40 | }
41 |
42 | @CallSuper
43 | @Override
44 | public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
45 | mTracker.onScrollBy(dx);
46 | }
47 |
48 | @CallSuper
49 | @Override
50 | public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
51 | if (newState == RecyclerView.SCROLL_STATE_IDLE) {
52 | mTracker.reset();
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/scrollVelocity/VelocityHandler.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2.scrollVelocity;
2 |
3 | import android.content.Context;
4 |
5 | /*
6 | * Copyright (c) 2020, jzj
7 | * Author: jzj
8 | * Website: www.paincker.com
9 | */
10 |
11 | public interface VelocityHandler {
12 |
13 | int DEFAULT_UP_THRESHOLD = 600;
14 | int DEFAULT_DOWN_THRESHOLD = 400;
15 |
16 | /**
17 | * 设置速度阈值。应该确保upThreshold >= downThreshold > 0
18 | *
19 | * @param upThreshold 速度增加超过此值时reach->true
20 | * @param downThreshold 速度减小小于此值时reach->false
21 | */
22 | void setThresholdInDp(Context context, int upThreshold, int downThreshold);
23 |
24 | /**
25 | * 设置速度阈值。应该确保upThreshold >= downThreshold > 0
26 | *
27 | * @param upThreshold 速度增加超过此值时reach->true
28 | * @param downThreshold 速度减小小于此值时reach->false
29 | */
30 | void setThreshold(int upThreshold, int downThreshold);
31 |
32 | /**
33 | * 设置速度监听器
34 | *
35 | * @param listener
36 | */
37 | void setVelocityTrackerListener(VelocityTrackListener listener);
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/scrollVelocity/VelocityTrackListener.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2.scrollVelocity;/*
2 | * Copyright (c) 2020, jzj
3 | * Author: jzj
4 | * Website: www.paincker.com
5 | */
6 |
7 | /*
8 | * Copyright (c) 2020, jzj
9 | * Author: jzj
10 | * Website: www.paincker.com
11 | */
12 |
13 | /**
14 | * 滚动速度监听器
15 | */
16 | public interface VelocityTrackListener {
17 |
18 | VelocityTrackListener EMPTY_LISTENER = new VelocityTrackListener() {
19 | @Override
20 | public void onVelocityChanged(int velocity) {
21 |
22 | }
23 |
24 | @Override
25 | public void onScrollFast(int velocity) {
26 |
27 | }
28 |
29 | @Override
30 | public void onScrollSlow(int velocity) {
31 |
32 | }
33 | };
34 |
35 | /**
36 | * 速度发生变化
37 | */
38 | void onVelocityChanged(int velocity);
39 |
40 | /**
41 | * 快速滚动
42 | */
43 | void onScrollFast(int velocity);
44 |
45 | /**
46 | * 慢速滚动或停止滚动
47 | */
48 | void onScrollSlow(int velocity);
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ffmpegvideorange2/scrollVelocity/WeakRefWrapper.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2.scrollVelocity;
2 |
3 | import java.lang.ref.WeakReference;
4 |
5 | /*
6 | * Copyright (c) 2020, jzj
7 | * Author: jzj
8 | * Website: www.paincker.com
9 | */
10 |
11 | /**
12 | * 弱引用辅助类
13 | */
14 | public class WeakRefWrapper {
15 |
16 | private WeakReference mRef;
17 |
18 | public T get() {
19 | return mRef != null ? mRef.get() : null;
20 | }
21 |
22 | public void set(T target) {
23 | mRef = target == null ? null : new WeakReference(target);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/play_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/drawable-v24/play_ico.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/stop_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/drawable-v24/stop_ico.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drag_btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/drawable/drag_btn.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_file_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
21 |
22 |
23 |
35 |
36 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_preview_frame.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_file_list_name.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_preview_img.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/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/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/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 | FFmpegVideoRange2
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/ffmpegvideorange2/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.ffmpegvideorange2;
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() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = "1.5.10"
5 | repositories {
6 | google()
7 | mavenCentral()
8 |
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:3.5.1'
12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | maven { url "https://jitpack.io" }
22 | mavenCentral()
23 | jcenter()
24 | }
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 | ext {
31 | quickAdapterVersion = "2.9.49-androidx"
32 | glideVersion = "4.11.0"
33 |
34 | }
--------------------------------------------------------------------------------
/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=-Xmx1536m
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
20 | android.injected.testOnly=false
21 |
22 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Jan 19 14:09:58 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.7.1-bin.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/myplayer/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/myplayer/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 | buildToolsVersion "29.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 21
9 | targetSdkVersion 28
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14 | consumerProguardFiles 'consumer-rules.pro'
15 | externalNativeBuild {
16 | cmake {
17 | cppFlags "-frtti -fexceptions"
18 | abiFilters 'armeabi-v7a'
19 | }
20 | }
21 | ndk {
22 | abiFilters "armeabi-v7a"
23 | }
24 | }
25 |
26 | buildTypes {
27 | release {
28 | minifyEnabled false
29 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
30 | }
31 | }
32 |
33 | externalNativeBuild {
34 | cmake {
35 | path "src/main/cpp/CMakeLists.txt"
36 | version "3.10.2"
37 | }
38 | }
39 | ndkVersion '21.4.7075529'
40 |
41 | }
42 |
43 | dependencies {
44 | implementation fileTree(dir: 'libs', include: ['*.jar'])
45 |
46 | implementation 'androidx.appcompat:appcompat:1.1.0'
47 | testImplementation 'junit:junit:4.12'
48 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
49 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
50 | implementation 'com.android.support:recyclerview-v7:29.0.0'
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/myplayer/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/consumer-rules.pro
--------------------------------------------------------------------------------
/myplayer/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 |
--------------------------------------------------------------------------------
/myplayer/src/androidTest/java/com/example/myplayer/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 |
25 | assertEquals("com.example.myplayer.test", appContext.getPackageName());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/myplayer/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/AVFrameQueue.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Administrator on 2020/6/7.
3 | //
4 |
5 | #ifndef MYCSDNVIDEOPLAYER_AVFRAMEQUEUE_H
6 | #define MYCSDNVIDEOPLAYER_AVFRAMEQUEUE_H
7 |
8 |
9 | #include "KzgPlayerStatus.h"
10 | #include "queue"
11 | #include "pthread.h"
12 | #include "log.h"
13 | extern "C"{
14 | #include "include/libavcodec/avcodec.h"
15 | };
16 |
17 |
18 | typedef struct frameStruct{
19 | uint8_t *yData;
20 | uint8_t *uData;
21 | uint8_t *vData;
22 | double pts;
23 | };
24 |
25 |
26 | class AVFrameQueue {
27 | public:
28 | AVFrameQueue(KzgPlayerStatus *playerStatus1);
29 | ~AVFrameQueue();
30 |
31 | int putAvFrame(AVFrame *avFrame);
32 | int putStructAvFrame(frameStruct *structFrame);
33 | int getAvFrameByTime(AVFrame *avFrame,double timestamp,AVRational bastTime);
34 | int getAvFrame(AVFrame *avFrame);
35 | int getStructAvFrame(frameStruct **structFrame,double timestamp,AVRational bastTime);
36 | int getQueueSize();
37 | void clearAvPacket();
38 | void noticeQueue();
39 |
40 | public:
41 | std::queue queuePacket;
42 | std::queue structQueuePacket;
43 | pthread_cond_t condPacket;
44 | pthread_mutex_t mutexPacket;
45 | KzgPlayerStatus *playerStatus = NULL;
46 | };
47 |
48 |
49 | #endif //MYCSDNVIDEOPLAYER_AVFRAMEQUEUE_H
50 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/FAvFrameHelper.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by destroyer on 2022/4/5.
3 | //
4 |
5 |
6 |
7 | #include "log.h"
8 | #include "JavaCallHelper.h"
9 | #include "KzgPlayerStatus.h"
10 | #include "pthread.h"
11 | #include "SafeQueue.h"
12 |
13 | extern "C"{
14 | #include "include/libavutil/time.h"
15 | #include "include/libavformat/avformat.h"
16 | #include "include/libavutil/imgutils.h"
17 | };
18 |
19 | class FAvFrameHelper {
20 |
21 | public:
22 | FAvFrameHelper(JavaCallHelper *_helper,const char *_url,KzgPlayerStatus *kzgPlayerStatus);
23 | ~FAvFrameHelper();
24 |
25 | void init();
26 | void decodeAVPackate();
27 | void seekTo(int64_t sec,bool isCurrentGop);
28 | void starDecode();
29 | void releas();
30 | int getAvCodecContent(AVCodecParameters *avCodecParameters,AVCodecContext **avCodecContext);
31 | void decodeAvPacket();
32 | void pauseOrStar(bool isPause);
33 | void decodeFrame();
34 | void decodeFrameFromQueue();
35 | double getAvpacketQueueMaxPts();
36 |
37 | public:
38 | KzgPlayerStatus *playerStatus;
39 | bool isExit = false;
40 | bool isPause = true;
41 | int64_t seekTime = 0;
42 | AVBitStreamFilterContext* mimType = NULL;
43 |
44 | private:
45 | JavaCallHelper *helper;
46 | const char *url;
47 |
48 | pthread_mutex_t init_mutex;
49 | pthread_mutex_t frame_mutex;
50 | pthread_t decodeAvPacketThread;
51 | AVFormatContext *avFormatContext;
52 | int avStreamIndex = -1;
53 | AVRational time_base;
54 | AVCodecContext *avCodecContext = NULL;
55 | int64_t duration = 0;
56 | SafeQueue *queue = NULL;
57 | pthread_mutex_t codecMutex;
58 |
59 |
60 | };
61 |
62 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/KzgFFmpeg.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Administrator on 2020/5/9.
3 | //
4 |
5 | #ifndef MYCSDNMUSICPLAYER_KZGFFMPEG_H
6 | #define MYCSDNMUSICPLAYER_KZGFFMPEG_H
7 |
8 | #include "log.h"
9 | #include "JavaCallHelper.h"
10 | #include "pthread.h"
11 | #include "KzgAudio.h"
12 | #include "KzgPlayerStatus.h"
13 | #include "KzgVideo.h"
14 |
15 | extern "C"{
16 | #include "include/libavutil/time.h"
17 | #include "include/libavformat/avformat.h"
18 | };
19 |
20 |
21 |
22 | class KzgFFmpeg {
23 |
24 | public:
25 | KzgFFmpeg(JavaCallHelper *_helper,const char *_url,KzgPlayerStatus *kzgPlayerStatus);
26 | ~KzgFFmpeg();
27 |
28 | void parpared();
29 | void start();
30 | void decodeFFmpegThread();
31 | void pause();
32 | void resume();
33 | void stop();
34 | void seek(int64_t sec);
35 | int getDuration();
36 | void setVolume(int volume);
37 | void setPitch(float pi);
38 | void setSpeed(float sp);
39 | void setAmplifyVol(float vol);
40 | int getSampleRate();
41 | int getAVCodecContext(AVCodecParameters *avCodecParameters,AVCodecContext **avCodecContext);
42 | void setIsFramePreview(bool isFramePreview);
43 | void showFrame(double timestamp);
44 | void showFrameFromSeek(double timestamp);
45 | void setSeekType(int type,int forAdvance);
46 |
47 | public:
48 | pthread_t decodeThread;
49 | pthread_t showFrameThread;
50 | KzgPlayerStatus *kzgPlayerStatus;
51 | KzgVideo *kzgVideo = NULL;
52 |
53 | private:
54 | JavaCallHelper *helper = NULL;
55 | const char *url = NULL;
56 | AVFormatContext *avFormatContext = NULL;
57 | KzgAudio *kzgAudio = NULL;
58 |
59 | pthread_mutex_t init_mutex;
60 | pthread_mutex_t seek_mutex;
61 | bool exit = false;
62 | int64_t duration = 0;
63 | bool supportMediacodec = false;
64 | const AVBitStreamFilter *bsFilter = NULL;
65 | int tempIndex = 0;
66 |
67 | };
68 |
69 |
70 | #endif //MYCSDNMUSICPLAYER_KZGFFMPEG_H
71 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/KzgPlayerStatus.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Administrator on 2020/5/10.
3 | //
4 |
5 | #include "KzgPlayerStatus.h"
6 |
7 | KzgPlayerStatus::KzgPlayerStatus() {
8 | exit = false;
9 |
10 | }
11 |
12 | KzgPlayerStatus::~KzgPlayerStatus() {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/KzgPlayerStatus.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Administrator on 2020/5/10.
3 | //
4 |
5 | #ifndef MYCSDNMUSICPLAYER_KZGPLAYERSTATUS_H
6 | #define MYCSDNMUSICPLAYER_KZGPLAYERSTATUS_H
7 |
8 |
9 | class KzgPlayerStatus {
10 |
11 | public:
12 | KzgPlayerStatus();
13 | ~KzgPlayerStatus();
14 |
15 | public:
16 | bool exit;
17 | bool loading = true;
18 | bool seeking = false;
19 | //是否初始化了
20 | bool isInited = false;
21 | bool frameSeeking = true;
22 | bool isPause = false;
23 | //是否是预览模式
24 | bool isFramePreview = false;
25 | //视频帧的linesize[0] 是否大于 视频帧的width,大于的话就需要裁剪
26 | bool isCrop = false;
27 | //是否是通过seek的方式来逐帧预览
28 | bool isBackSeekFramePreview = false;
29 | //这个状态是配合isBackSeekFramePreview 当快速前进时,应该另外弄一个状态,但是之前没有考虑好,所以直接用回退的状态,然后再配合这个来判断是否时快速前进
30 | bool isBackSeekForAdvance = false;
31 | //是否处于seek预览下的暂停状态,也就是即没有正常播放,也没有在seek,并且已经显示了目标帧图像
32 | bool isSeekPause = true;
33 | //是否显示了seek的那一帧图片,主要是为了控制能一边后退seek,一边解码,加快显示的速度
34 | bool isShowSeekFrame = true;
35 |
36 |
37 | };
38 |
39 |
40 | #endif //MYCSDNMUSICPLAYER_KZGPLAYERSTATUS_H
41 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/KzgVideo.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Administrator on 2020/5/29.
3 | //
4 |
5 | #ifndef MYCSDNVIDEOPLAYER_KZGVIDEO_H
6 | #define MYCSDNVIDEOPLAYER_KZGVIDEO_H
7 |
8 | #include "KzgPlayerStatus.h"
9 | #include "JavaCallHelper.h"
10 | #include "SafeQueue.h"
11 | #include "KzgAudio.h"
12 | #include "AVFrameQueue.h"
13 |
14 | extern "C"{
15 | #include "include/libavutil/time.h"
16 | #include "include/libavcodec/avcodec.h"
17 | #include "include/libavutil/imgutils.h"
18 | #include "include/libswscale/swscale.h"
19 | };
20 |
21 | #define CODEC_YUV 0
22 | #define CODEC_MEDIACODEC 1
23 |
24 | class KzgVideo {
25 |
26 | public:
27 | int streamIndex = -1;
28 | AVCodecContext *avCodecContext = NULL;
29 | AVCodecParameters *avCodecParameters = NULL;
30 | KzgPlayerStatus *kzgPlayerStatus = NULL;
31 | JavaCallHelper *helper = NULL;
32 | SafeQueue *queue = NULL;
33 | SafeQueue *tempqueue = NULL;
34 | AVFrameQueue *frameQueue = NULL;
35 | AVRational time_base;
36 | KzgAudio *kzgAudio = NULL;
37 |
38 | pthread_t play_thread = NULL;
39 | double lock = 0;
40 | double delayTime = 0;
41 | double defaultDelayTime = 0.04;
42 | int fps;
43 | pthread_mutex_t codecMutex;
44 | pthread_mutex_t showFrameMutex;
45 | int codectype = CODEC_YUV;
46 | AVBSFContext *avbsfContext = NULL;
47 | int64_t duration = 0;
48 | int64_t seekTime = 0;
49 | int64_t lastPFramePTS = 0;
50 |
51 | long startSeekTime = 0;
52 | double showFrameTimestamp = 0;//拖动预览条后当前显示的帧的时间
53 | //队列中缓存的帧的数量
54 | int cacheFrameNum = 60;
55 |
56 |
57 | public:
58 | KzgVideo(KzgPlayerStatus *kzgPlayerStatus,JavaCallHelper *helper);
59 | ~KzgVideo();
60 | void play();
61 | void release();
62 | //计算音频当前播放的帧的时间与当前视频播放的帧的时间差,如果返回正数就是视频比音频慢,如果返回负数就是视频比音频快
63 | double getFrameDiffTime(AVFrame *avFrame,AVPacket *avPacket);
64 | //获取视频因该延迟的时间
65 | double getDelayTime(double diff);
66 |
67 | double myGetDelayTime(AVFrame *avFrame);
68 | void setIsFramePreview(bool isFramePreview);
69 | void showFrame(double timestamp);
70 |
71 | };
72 |
73 |
74 | #endif //MYCSDNVIDEOPLAYER_KZGVIDEO_H
75 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/SafeQueue.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Administrator on 2020/5/10.
3 | //
4 |
5 | #ifndef MYCSDNMUSICPLAYER_SAFEQUEUE_H
6 | #define MYCSDNMUSICPLAYER_SAFEQUEUE_H
7 |
8 | #include "queue"
9 | #include "pthread.h"
10 | #include "KzgPlayerStatus.h"
11 | #include "log.h"
12 |
13 | extern "C"{
14 | #include "include/libavcodec/avcodec.h"
15 | };
16 |
17 |
18 | class SafeQueue {
19 |
20 | public:
21 | SafeQueue(KzgPlayerStatus *playerStatus1);
22 | ~SafeQueue();
23 |
24 | int putAvPacket(AVPacket *avPacket);
25 | int getAvPacket(AVPacket *avPacket);
26 | int getQueueSize();
27 | void clearAvPacket();
28 | void noticeQueue();
29 | void clearByBeforeTime(int64_t time,AVRational time_base);
30 | double getMaxPts();
31 |
32 | public:
33 | std::queue queuePacket;
34 | pthread_cond_t condPacket;
35 | pthread_mutex_t mutexPacket;
36 | KzgPlayerStatus *playerStatus = NULL;
37 |
38 |
39 | };
40 |
41 |
42 | #endif //MYCSDNMUSICPLAYER_SAFEQUEUE_H
43 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 57
31 | #define LIBAVDEVICE_VERSION_MINOR 10
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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/include/libavfilter/avfiltergraph.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Filter graphs
3 | * copyright (c) 2007 Bobby Bingham
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 AVFILTER_AVFILTERGRAPH_H
23 | #define AVFILTER_AVFILTERGRAPH_H
24 |
25 | #include "avfilter.h"
26 | #include "libavutil/log.h"
27 |
28 | #endif /* AVFILTER_AVFILTERGRAPH_H */
29 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/include/libavutil/aes_ctr.h:
--------------------------------------------------------------------------------
1 | /*
2 | * AES-CTR cipher
3 | * Copyright (c) 2015 Eran Kornblau
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_AES_CTR_H
23 | #define AVUTIL_AES_CTR_H
24 |
25 | #include
26 |
27 | #include "attributes.h"
28 | #include "version.h"
29 |
30 | #define AES_CTR_KEY_SIZE (16)
31 | #define AES_CTR_IV_SIZE (8)
32 |
33 | struct AVAESCTR;
34 |
35 | /**
36 | * Allocate an AVAESCTR context.
37 | */
38 | struct AVAESCTR *av_aes_ctr_alloc(void);
39 |
40 | /**
41 | * Initialize an AVAESCTR context.
42 | * @param key encryption key, must have a length of AES_CTR_KEY_SIZE
43 | */
44 | int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key);
45 |
46 | /**
47 | * Release an AVAESCTR context.
48 | */
49 | void av_aes_ctr_free(struct AVAESCTR *a);
50 |
51 | /**
52 | * Process a buffer using a previously initialized context.
53 | * @param dst destination array, can be equal to src
54 | * @param src source array, can be equal to dst
55 | * @param size the size of src and dst
56 | */
57 | void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int size);
58 |
59 | /**
60 | * Get the current iv
61 | */
62 | const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a);
63 |
64 | /**
65 | * Generate a random iv
66 | */
67 | void av_aes_ctr_set_random_iv(struct AVAESCTR *a);
68 |
69 | /**
70 | * Forcefully change the iv
71 | */
72 | void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv);
73 |
74 | /**
75 | * Increment the top 64 bit of the iv (performed after each frame)
76 | */
77 | void av_aes_ctr_increment_iv(struct AVAESCTR *a);
78 |
79 | /**
80 | * @}
81 | */
82 |
83 | #endif /* AVUTIL_AES_CTR_H */
84 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/include/libavutil/avconfig.h:
--------------------------------------------------------------------------------
1 | /* Generated by ffconf */
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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/include/libavutil/base64.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com)
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_BASE64_H
22 | #define AVUTIL_BASE64_H
23 |
24 | #include
25 |
26 | /**
27 | * @defgroup lavu_base64 Base64
28 | * @ingroup lavu_crypto
29 | * @{
30 | */
31 |
32 | /**
33 | * Decode a base64-encoded string.
34 | *
35 | * @param out buffer for decoded data
36 | * @param in null-terminated input string
37 | * @param out_size size in bytes of the out buffer, must be at
38 | * least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in))
39 | * @return number of bytes written, or a negative value in case of
40 | * invalid input
41 | */
42 | int av_base64_decode(uint8_t *out, const char *in, int out_size);
43 |
44 | /**
45 | * Calculate the output size in bytes needed to decode a base64 string
46 | * with length x to a data buffer.
47 | */
48 | #define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4)
49 |
50 | /**
51 | * Encode data to base64 and null-terminate.
52 | *
53 | * @param out buffer for encoded data
54 | * @param out_size size in bytes of the out buffer (including the
55 | * null terminator), must be at least AV_BASE64_SIZE(in_size)
56 | * @param in input buffer containing the data to encode
57 | * @param in_size size in bytes of the in buffer
58 | * @return out or NULL in case of error
59 | */
60 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
61 |
62 | /**
63 | * Calculate the output size needed to base64-encode x bytes to a
64 | * null-terminated string.
65 | */
66 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1)
67 |
68 | /**
69 | * @}
70 | */
71 |
72 | #endif /* AVUTIL_BASE64_H */
73 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/include/libavutil/camellia.h:
--------------------------------------------------------------------------------
1 | /*
2 | * An implementation of the CAMELLIA algorithm as mentioned in RFC3713
3 | * Copyright (c) 2014 Supraja Meedinti
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_CAMELLIA_H
23 | #define AVUTIL_CAMELLIA_H
24 |
25 | #include
26 |
27 |
28 | /**
29 | * @file
30 | * @brief Public header for libavutil CAMELLIA algorithm
31 | * @defgroup lavu_camellia CAMELLIA
32 | * @ingroup lavu_crypto
33 | * @{
34 | */
35 |
36 | extern const int av_camellia_size;
37 |
38 | struct AVCAMELLIA;
39 |
40 | /**
41 | * Allocate an AVCAMELLIA context
42 | * To free the struct: av_free(ptr)
43 | */
44 | struct AVCAMELLIA *av_camellia_alloc(void);
45 |
46 | /**
47 | * Initialize an AVCAMELLIA context.
48 | *
49 | * @param ctx an AVCAMELLIA context
50 | * @param key a key of 16, 24, 32 bytes used for encryption/decryption
51 | * @param key_bits number of keybits: possible are 128, 192, 256
52 | */
53 | int av_camellia_init(struct AVCAMELLIA *ctx, const uint8_t *key, int key_bits);
54 |
55 | /**
56 | * Encrypt or decrypt a buffer using a previously initialized context
57 | *
58 | * @param ctx an AVCAMELLIA context
59 | * @param dst destination array, can be equal to src
60 | * @param src source array, can be equal to dst
61 | * @param count number of 16 byte blocks
62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode
63 | * @param decrypt 0 for encryption, 1 for decryption
64 | */
65 | void av_camellia_crypt(struct AVCAMELLIA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt);
66 |
67 | /**
68 | * @}
69 | */
70 | #endif /* AVUTIL_CAMELLIA_H */
71 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 "3.4"
5 | #endif /* AVUTIL_FFVERSION_H */
6 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 | AVCUDADeviceContextInternal *internal;
45 | } AVCUDADeviceContext;
46 |
47 | /**
48 | * AVHWFramesContext.hwctx is currently not used
49 | */
50 |
51 | #endif /* AVUTIL_HWCONTEXT_CUDA_H */
52 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/include/libavutil/lfg.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Lagged Fibonacci PRNG
3 | * Copyright (c) 2008 Michael Niedermayer
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_LFG_H
23 | #define AVUTIL_LFG_H
24 |
25 | #include
26 |
27 | typedef struct AVLFG {
28 | unsigned int state[64];
29 | int index;
30 | } AVLFG;
31 |
32 | void av_lfg_init(AVLFG *c, unsigned int seed);
33 |
34 | /**
35 | * Seed the state of the ALFG using binary data.
36 | *
37 | * Return value: 0 on success, negative value (AVERROR) on failure.
38 | */
39 | int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length);
40 |
41 | /**
42 | * Get the next random unsigned 32-bit number using an ALFG.
43 | *
44 | * Please also consider a simple LCG like state= state*1664525+1013904223,
45 | * it may be good enough and faster for your specific use case.
46 | */
47 | static inline unsigned int av_lfg_get(AVLFG *c){
48 | c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
49 | return c->state[c->index++ & 63];
50 | }
51 |
52 | /**
53 | * Get the next random unsigned 32-bit number using a MLFG.
54 | *
55 | * Please also consider av_lfg_get() above, it is faster.
56 | */
57 | static inline unsigned int av_mlfg_get(AVLFG *c){
58 | unsigned int a= c->state[(c->index-55) & 63];
59 | unsigned int b= c->state[(c->index-24) & 63];
60 | return c->state[c->index++ & 63] = 2*a*b+a+b;
61 | }
62 |
63 | /**
64 | * Get the next two numbers generated by a Box-Muller Gaussian
65 | * generator using the random numbers issued by lfg.
66 | *
67 | * @param out array where the two generated numbers are placed
68 | */
69 | void av_bmg_get(AVLFG *lfg, double out[2]);
70 |
71 | #endif /* AVUTIL_LFG_H */
72 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/include/libavutil/ripemd.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 Michael Niedermayer
3 | * Copyright (C) 2013 James Almer
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 | /**
23 | * @file
24 | * @ingroup lavu_ripemd
25 | * Public header for RIPEMD hash function implementation.
26 | */
27 |
28 | #ifndef AVUTIL_RIPEMD_H
29 | #define AVUTIL_RIPEMD_H
30 |
31 | #include
32 |
33 | #include "attributes.h"
34 | #include "version.h"
35 |
36 | /**
37 | * @defgroup lavu_ripemd RIPEMD
38 | * @ingroup lavu_hash
39 | * RIPEMD hash function implementation.
40 | *
41 | * @{
42 | */
43 |
44 | extern const int av_ripemd_size;
45 |
46 | struct AVRIPEMD;
47 |
48 | /**
49 | * Allocate an AVRIPEMD context.
50 | */
51 | struct AVRIPEMD *av_ripemd_alloc(void);
52 |
53 | /**
54 | * Initialize RIPEMD hashing.
55 | *
56 | * @param context pointer to the function context (of size av_ripemd_size)
57 | * @param bits number of bits in digest (128, 160, 256 or 320 bits)
58 | * @return zero if initialization succeeded, -1 otherwise
59 | */
60 | int av_ripemd_init(struct AVRIPEMD* context, int bits);
61 |
62 | /**
63 | * Update hash value.
64 | *
65 | * @param context hash function context
66 | * @param data input data to update hash with
67 | * @param len input data length
68 | */
69 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len);
70 |
71 | /**
72 | * Finish hashing and output digest value.
73 | *
74 | * @param context hash function context
75 | * @param digest buffer where output digest value is stored
76 | */
77 | void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest);
78 |
79 | /**
80 | * @}
81 | */
82 |
83 | #endif /* AVUTIL_RIPEMD_H */
84 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/include/libavutil/twofish.h:
--------------------------------------------------------------------------------
1 | /*
2 | * An implementation of the TwoFish algorithm
3 | * Copyright (c) 2015 Supraja Meedinti
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_TWOFISH_H
23 | #define AVUTIL_TWOFISH_H
24 |
25 | #include
26 |
27 |
28 | /**
29 | * @file
30 | * @brief Public header for libavutil TWOFISH algorithm
31 | * @defgroup lavu_twofish TWOFISH
32 | * @ingroup lavu_crypto
33 | * @{
34 | */
35 |
36 | extern const int av_twofish_size;
37 |
38 | struct AVTWOFISH;
39 |
40 | /**
41 | * Allocate an AVTWOFISH context
42 | * To free the struct: av_free(ptr)
43 | */
44 | struct AVTWOFISH *av_twofish_alloc(void);
45 |
46 | /**
47 | * Initialize an AVTWOFISH context.
48 | *
49 | * @param ctx an AVTWOFISH context
50 | * @param key a key of size ranging from 1 to 32 bytes used for encryption/decryption
51 | * @param key_bits number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise
52 | */
53 | int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits);
54 |
55 | /**
56 | * Encrypt or decrypt a buffer using a previously initialized context
57 | *
58 | * @param ctx an AVTWOFISH context
59 | * @param dst destination array, can be equal to src
60 | * @param src source array, can be equal to dst
61 | * @param count number of 16 byte blocks
62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode
63 | * @param decrypt 0 for encryption, 1 for decryption
64 | */
65 | void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt);
66 |
67 | /**
68 | * @}
69 | */
70 | #endif /* AVUTIL_TWOFISH_H */
71 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 54
32 | #define LIBPOSTPROC_VERSION_MINOR 7
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 | #ifndef FF_API_QP_TYPE
46 | #define FF_API_QP_TYPE (LIBPOSTPROC_VERSION_MAJOR < 55)
47 | #endif
48 |
49 | #endif /* POSTPROC_VERSION_H */
50 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 2
32 | #define LIBSWRESAMPLE_VERSION_MINOR 9
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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/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 4
30 | #define LIBSWSCALE_VERSION_MINOR 8
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 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/log.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Administrator on 2020/4/20.
3 | //
4 |
5 | #ifndef MYFFMPEGPLAYERTEST1_LOG_H
6 | #define MYFFMPEGPLAYERTEST1_LOG_H
7 |
8 | #include
9 |
10 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,"FFmpeg:",__VA_ARGS__)
11 |
12 | #endif //MYFFMPEGPLAYERTEST1_LOG_H
13 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/mediametadataretriever/mediametadataretriever.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FFmpegMediaMetadataRetriever: A unified interface for retrieving frame
3 | * and meta data from an input media file.
4 | *
5 | * Copyright 2016 William Seemann
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | #ifndef MEDIAMETADATARETRIEVER_H
21 | #define MEDIAMETADATARETRIEVER_H
22 |
23 | #include
24 | #include "Mutex.h"
25 |
26 | extern "C" {
27 | #include "ffmpeg_mediametadataretriever.h"
28 | }
29 |
30 | class MediaMetadataRetriever
31 | {
32 | State* state;
33 | public:
34 | MediaMetadataRetriever();
35 | ~MediaMetadataRetriever();
36 | void disconnect();
37 | int setDataSource(const char* dataSourceUrl, const char* headers);
38 | int setDataSource(int fd, int64_t offset, int64_t length);
39 | int getFrameAtTime(int64_t timeUs, int option, AVPacket *pkt);
40 | int getScaledFrameAtTime(int64_t timeUs, int option, AVPacket *pkt, int width, int height);
41 | int extractAlbumArt(AVPacket *pkt);
42 | const char* extractMetadata(const char* key);
43 | const char* extractMetadataFromChapter(const char* key, int chapter);
44 | int getMetadata(bool update_only, bool apply_filter, AVDictionary **metadata);
45 | int setNativeWindow(ANativeWindow* native_window);
46 |
47 | private:
48 | Mutex mLock;
49 | };
50 |
51 | #endif // MEDIAMETADATARETRIEVER_H
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/mediametadataretriever/wseemann_media_MediaMetadataRetriever.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * FFmpegMediaMetadataRetriever: A unified interface for retrieving frame
3 | * and meta data from an input media file.
4 | *
5 | * Copyright 2016 William Seemann
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | //#define LOG_NDEBUG 0
21 | #define LOG_TAG "MediaMetadataRetrieverJNI"
22 | /*
23 | #include
24 | #include
25 | #include "mediametadataretriever.h"
26 | #include "jni.h"
27 |
28 | // for native window JNI
29 | #include
30 | #include
31 | #include */
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/soundtouch/SoundTouch/InterpolateCubic.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | ///
3 | /// Cubic interpolation routine.
4 | ///
5 | /// Author : Copyright (c) Olli Parviainen
6 | /// Author e-mail : oparviai 'at' iki.fi
7 | /// SoundTouch WWW: http://www.surina.net/soundtouch
8 | ///
9 | ////////////////////////////////////////////////////////////////////////////////
10 | //
11 | // $Id: InterpolateCubic.h 225 2015-07-26 14:45:48Z oparviai $
12 | //
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // License :
16 | //
17 | // SoundTouch audio processing library
18 | // Copyright (c) Olli Parviainen
19 | //
20 | // This library is free software; you can redistribute it and/or
21 | // modify it under the terms of the GNU Lesser General Public
22 | // License as published by the Free Software Foundation; either
23 | // version 2.1 of the License, or (at your option) any later version.
24 | //
25 | // This library is distributed in the hope that it will be useful,
26 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
27 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 | // Lesser General Public License for more details.
29 | //
30 | // You should have received a copy of the GNU Lesser General Public
31 | // License along with this library; if not, write to the Free Software
32 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 | //
34 | ////////////////////////////////////////////////////////////////////////////////
35 |
36 | #ifndef _InterpolateCubic_H_
37 | #define _InterpolateCubic_H_
38 |
39 | #include "RateTransposer.h"
40 | #include "../include/STTypes.h"
41 |
42 | namespace soundtouch
43 | {
44 |
45 | class InterpolateCubic : public TransposerBase
46 | {
47 | protected:
48 | virtual void resetRegisters();
49 | virtual int transposeMono(SAMPLETYPE *dest,
50 | const SAMPLETYPE *src,
51 | int &srcSamples);
52 | virtual int transposeStereo(SAMPLETYPE *dest,
53 | const SAMPLETYPE *src,
54 | int &srcSamples);
55 | virtual int transposeMulti(SAMPLETYPE *dest,
56 | const SAMPLETYPE *src,
57 | int &srcSamples);
58 |
59 | double fract;
60 |
61 | public:
62 | InterpolateCubic();
63 | };
64 |
65 | }
66 |
67 | #endif
68 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/soundtouch/SoundTouch/PeakFinder.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/src/main/cpp/soundtouch/SoundTouch/PeakFinder.cpp
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/soundtouch/SoundTouch/cpu_detect.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | ///
3 | /// A header file for detecting the Intel MMX instructions set extension.
4 | ///
5 | /// Please see 'mmx_win.cpp', 'mmx_cpp.cpp' and 'mmx_non_x86.cpp' for the
6 | /// routine implementations for x86 Windows, x86 gnu version and non-x86
7 | /// platforms, respectively.
8 | ///
9 | /// Author : Copyright (c) Olli Parviainen
10 | /// Author e-mail : oparviai 'at' iki.fi
11 | /// SoundTouch WWW: http://www.surina.net/soundtouch
12 | ///
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // Last changed : $Date: 2008-02-10 18:26:55 +0200 (su, 10 helmi 2008) $
16 | // File revision : $Revision: 4 $
17 | //
18 | // $Id: cpu_detect.h 11 2008-02-10 16:26:55Z oparviai $
19 | //
20 | ////////////////////////////////////////////////////////////////////////////////
21 | //
22 | // License :
23 | //
24 | // SoundTouch audio processing library
25 | // Copyright (c) Olli Parviainen
26 | //
27 | // This library is free software; you can redistribute it and/or
28 | // modify it under the terms of the GNU Lesser General Public
29 | // License as published by the Free Software Foundation; either
30 | // version 2.1 of the License, or (at your option) any later version.
31 | //
32 | // This library is distributed in the hope that it will be useful,
33 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
34 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 | // Lesser General Public License for more details.
36 | //
37 | // You should have received a copy of the GNU Lesser General Public
38 | // License along with this library; if not, write to the Free Software
39 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
40 | //
41 | ////////////////////////////////////////////////////////////////////////////////
42 |
43 | #ifndef _CPU_DETECT_H_
44 | #define _CPU_DETECT_H_
45 |
46 | #include "../include/STTypes.h"
47 |
48 | #define SUPPORT_MMX 0x0001
49 | #define SUPPORT_3DNOW 0x0002
50 | #define SUPPORT_ALTIVEC 0x0004
51 | #define SUPPORT_SSE 0x0008
52 | #define SUPPORT_SSE2 0x0010
53 |
54 | /// Checks which instruction set extensions are supported by the CPU.
55 | ///
56 | /// \return A bitmask of supported extensions, see SUPPORT_... defines.
57 | uint detectCPUextensions(void);
58 |
59 | /// Disables given set of instruction extensions. See SUPPORT_... defines.
60 | void disableExtensions(uint wDisableMask);
61 |
62 | #endif // _CPU_DETECT_H_
63 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/soundtouch/include/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | ##
3 | ## $Id: Makefile.am 11 2008-02-10 16:26:55Z oparviai $
4 | ##
5 | ## Copyright (C) 2003 - David W. Durham
6 | ##
7 | ## This file is part of SoundTouch, an audio processing library for pitch/time adjustments
8 | ##
9 | ## SoundTouch is free software; you can redistribute it and/or modify it under the
10 | ## terms of the GNU General Public License as published by the Free Software
11 | ## Foundation; either version 2 of the License, or (at your option) any later
12 | ## version.
13 | ##
14 | ## SoundTouch is distributed in the hope that it will be useful, but WITHOUT ANY
15 | ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 | ## A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 | ##
18 | ## You should have received a copy of the GNU General Public License along with
19 | ## this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20 | ## Place - Suite 330, Boston, MA 02111-1307, USA
21 |
22 | ## I used config/am_include.mk for common definitions
23 | include $(top_srcdir)/config/am_include.mk
24 |
25 | pkginclude_HEADERS=FIFOSampleBuffer.h FIFOSamplePipe.h SoundTouch.h STTypes.h BPMDetect.h soundtouch_config.h
26 |
27 |
--------------------------------------------------------------------------------
/myplayer/src/main/cpp/soundtouch/include/soundtouch_config.h.in:
--------------------------------------------------------------------------------
1 | /* Use Float as Sample type */
2 | #undef SOUNDTOUCH_FLOAT_SAMPLES
3 |
4 | /* Use Integer as Sample type */
5 | #undef SOUNDTOUCH_INTEGER_SAMPLES
6 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/MyQueue.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer;
2 |
3 | import com.example.myplayer.bean.YUVBean;
4 |
5 | import java.util.concurrent.LinkedBlockingQueue;
6 |
7 | /**
8 | * Created By Ele
9 | * on 2020/6/4
10 | **/
11 | public class MyQueue {
12 |
13 | private LinkedBlockingQueue list = new LinkedBlockingQueue();
14 |
15 | public boolean enQueue(YUVBean yuvBean){
16 | if (list != null){
17 | return list.offer(yuvBean);
18 | }
19 | return false;
20 | }
21 |
22 | public YUVBean deQueue(){
23 | if (list == null){
24 | return null;
25 | }
26 | return list.poll();
27 | }
28 |
29 | public YUVBean getFirst(){
30 | if (list == null){
31 | return null;
32 | }
33 | return list.peek();
34 | }
35 |
36 | public int getQueueSize(){
37 | if (list == null){
38 | return 0;
39 | }
40 | return list.size();
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/PacketBean.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer;
2 |
3 | import java.util.Arrays;
4 |
5 | /**
6 | * Created By Ele
7 | * on 2020/6/14
8 | **/
9 | public class PacketBean {
10 |
11 | private double pts;
12 | private int dataSize;
13 | private byte[] data;
14 | private int width;
15 | private int height;
16 |
17 |
18 | public int getWidth() {
19 | return width;
20 | }
21 |
22 | public void setWidth(int width) {
23 | this.width = width;
24 | }
25 |
26 | public int getHeight() {
27 | return height;
28 | }
29 |
30 | public void setHeight(int height) {
31 | this.height = height;
32 | }
33 |
34 | public double getPts() {
35 | return pts;
36 | }
37 |
38 | public void setPts(double pts) {
39 | this.pts = pts;
40 | }
41 |
42 | public int getDataSize() {
43 | return dataSize;
44 | }
45 |
46 | public void setDataSize(int dataSize) {
47 | this.dataSize = dataSize;
48 | }
49 |
50 | public byte[] getData() {
51 | return data;
52 | }
53 |
54 | public void setData(byte[] data) {
55 | this.data = data;
56 | }
57 |
58 |
59 | @Override
60 | public String toString() {
61 | return "PacketBean{" +
62 | "pts=" + pts +
63 | ", dataSize=" + dataSize +
64 | ", data=" + Arrays.toString(data) +
65 | ", width=" + width +
66 | ", height=" + height +
67 | '}';
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/PacketQueue.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer;
2 |
3 | import android.util.Log;
4 |
5 | import java.util.Iterator;
6 | import java.util.concurrent.LinkedBlockingQueue;
7 |
8 | /**
9 | * Created By Ele
10 | * on 2020/6/4
11 | **/
12 | public class PacketQueue {
13 |
14 | private LinkedBlockingQueue list = new LinkedBlockingQueue();
15 |
16 | public boolean enQueue(PacketBean packetBean){
17 | if (list != null){
18 | return list.offer(packetBean);
19 | }
20 | return false;
21 | }
22 |
23 | public PacketBean deQueue(){
24 | if (list == null){
25 | return null;
26 | }
27 | return list.poll();
28 | }
29 |
30 | public PacketBean getFirst(){
31 | if (list == null){
32 | return null;
33 | }
34 | return list.peek();
35 | }
36 |
37 | public int getQueueSize(){
38 | if (list == null){
39 | return 0;
40 | }
41 | return list.size();
42 | }
43 |
44 | public synchronized void clear(){
45 |
46 | if (list == null || list.isEmpty()){
47 | return;
48 | }
49 | list.clear();
50 | }
51 |
52 | public double getMaxPts(){
53 | if (list == null || list.isEmpty()){
54 | return 0;
55 | }
56 | double max = -1;
57 | PacketBean bean;
58 | Iterator iterator = list.iterator();
59 | while (iterator.hasNext()){
60 | bean = iterator.next();
61 | max = bean.getPts() > max ? bean.getPts() : max;
62 | }
63 | Log.e("kzg","******************queue max pts:"+max);
64 | return max;
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/TimeInfoBean.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer;
2 |
3 | /**
4 | * Created By Ele
5 | * on 2020/5/11
6 | **/
7 | public class TimeInfoBean {
8 | private int currentTime;
9 | private int totalTime;
10 |
11 | public int getCurrentTime() {
12 | return currentTime;
13 | }
14 |
15 | public void setCurrentTime(int currentTime) {
16 | this.currentTime = currentTime;
17 | }
18 |
19 | public int getTotalTime() {
20 | return totalTime;
21 | }
22 |
23 | public void setTotalTime(int totalTime) {
24 | this.totalTime = totalTime;
25 | }
26 |
27 | @Override
28 | public String toString() {
29 | return "TimeInfoBean{" +
30 | "currentTime=" + currentTime +
31 | ", totalTime=" + totalTime +
32 | '}';
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/VideoRange/MyLinearLayoutManager.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.VideoRange;
2 |
3 | import android.content.Context;
4 | import android.graphics.Rect;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 |
8 | import androidx.recyclerview.widget.LinearLayoutManager;
9 |
10 | /**
11 | * Created By Ele
12 | * on 2020/8/23
13 | **/
14 | public class MyLinearLayoutManager extends LinearLayoutManager {
15 |
16 | private int maxWidth = 0;
17 |
18 | public MyLinearLayoutManager(Context context) {
19 | super(context);
20 | }
21 |
22 | public MyLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
23 | super(context, orientation, reverseLayout);
24 | }
25 |
26 | public MyLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
27 | super(context, attrs, defStyleAttr, defStyleRes);
28 | }
29 |
30 |
31 | @Override
32 | public void setMeasuredDimension(Rect childrenBounds, int wSpec, int hSpec) {
33 | if (maxWidth > 0){
34 | super.setMeasuredDimension(childrenBounds, View.MeasureSpec.makeMeasureSpec(maxWidth, View.MeasureSpec.AT_MOST), hSpec);
35 | }else {
36 | super.setMeasuredDimension(childrenBounds, wSpec, hSpec);
37 | }
38 | }
39 |
40 | public int getMaxWidth() {
41 | return maxWidth;
42 | }
43 |
44 | public void setMaxWidth(int maxWidth) {
45 | this.maxWidth = maxWidth;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/VideoRange/SpacesItemDecoration2.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.VideoRange;
2 |
3 | import android.graphics.Rect;
4 | import android.util.Log;
5 | import android.view.View;
6 |
7 | import androidx.recyclerview.widget.RecyclerView;
8 |
9 | public class SpacesItemDecoration2 extends RecyclerView.ItemDecoration{
10 |
11 | private int space;
12 | private int thumbnailsCount;
13 |
14 | public SpacesItemDecoration2(int space, int thumbnailsCount) {
15 | this.space = space;
16 | this.thumbnailsCount = thumbnailsCount;
17 | }
18 |
19 | @Override
20 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
21 | int position = parent.getChildAdapterPosition(view);
22 | if (position == 0) {
23 | outRect.left = space;
24 | outRect.right = 0;
25 | } else if (thumbnailsCount > 1 && position == thumbnailsCount - 1) {
26 | outRect.left = 0;
27 | outRect.right = 0;
28 | } else {
29 | outRect.left = 0;
30 | outRect.right = 0;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/VideoRange/VideoRangeViewBehavior.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.VideoRange;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 |
7 | import androidx.annotation.NonNull;
8 | import androidx.coordinatorlayout.widget.CoordinatorLayout;
9 | import androidx.recyclerview.widget.RecyclerView;
10 |
11 |
12 | /**
13 | * Created By Ele
14 | * on 2020/1/15
15 | **/
16 | public class VideoRangeViewBehavior extends CoordinatorLayout.Behavior {
17 | public VideoRangeViewBehavior() {
18 | }
19 |
20 | public VideoRangeViewBehavior(Context context, AttributeSet attrs) {
21 | super(context, attrs);
22 | }
23 |
24 | @Override
25 | public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull DividingView child, @NonNull View directTargetChild, @NonNull View target, int axes, int type) {
26 | return target instanceof RecyclerView;
27 | }
28 |
29 | @Override
30 | public void onNestedPreScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull DividingView child, @NonNull View target, int dx, int dy, @NonNull int[] consumed, int type) {
31 | super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
32 | if (target instanceof RecyclerView){
33 | //Log.e("kzg","***********************dx:"+dx);
34 | //child.scrollTo(dx,0);
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/bean/VideoBitmapBean.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.bean;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * Created By Ele
7 | * on 2020/8/22
8 | **/
9 | public class VideoBitmapBean {
10 | //视频帧图片
11 | private Bitmap bitmap;
12 | //此帧图片对应的事件戳
13 | private long presentationTimeUs;
14 |
15 | public VideoBitmapBean(Bitmap bitmap, long presentationTimeUs) {
16 | this.bitmap = bitmap;
17 | this.presentationTimeUs = presentationTimeUs;
18 | }
19 |
20 | public Bitmap getBitmap() {
21 | return bitmap;
22 | }
23 |
24 | public void setBitmap(Bitmap bitmap) {
25 | this.bitmap = bitmap;
26 | }
27 |
28 | public long getPresentationTimeUs() {
29 | return presentationTimeUs;
30 | }
31 |
32 | public void setPresentationTimeUs(long presentationTimeUs) {
33 | this.presentationTimeUs = presentationTimeUs;
34 | }
35 |
36 | @Override
37 | public String toString() {
38 | return "VideoBitmapBean{" +
39 | "bitmap=" + bitmap +
40 | ", presentationTimeUs=" + presentationTimeUs +
41 | '}';
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/bean/YUVBean.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.bean;
2 |
3 | /**
4 | * Created By Ele
5 | * on 2020/6/9
6 | **/
7 | public class YUVBean {
8 | private byte[] yData;
9 | private byte[] uData;
10 | private byte[] vData;
11 | private double timestamp;
12 | private int width;
13 | private int height;
14 |
15 | public int getWidth() {
16 | return width;
17 | }
18 |
19 | public void setWidth(int width) {
20 | this.width = width;
21 | }
22 |
23 | public int getHeight() {
24 | return height;
25 | }
26 |
27 | public void setHeight(int height) {
28 | this.height = height;
29 | }
30 |
31 | public byte[] getyData() {
32 | return yData;
33 | }
34 |
35 | public void setyData(byte[] yData) {
36 | this.yData = yData;
37 | }
38 |
39 | public byte[] getuData() {
40 | return uData;
41 | }
42 |
43 | public void setuData(byte[] uData) {
44 | this.uData = uData;
45 | }
46 |
47 | public byte[] getvData() {
48 | return vData;
49 | }
50 |
51 | public void setvData(byte[] vData) {
52 | this.vData = vData;
53 | }
54 |
55 | public double getTimestamp() {
56 | return timestamp;
57 | }
58 |
59 | public void setTimestamp(double timestamp) {
60 | this.timestamp = timestamp;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/mediacodec/KzglVideoSupportUtil.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.mediacodec;
2 |
3 | import android.media.MediaCodecList;
4 | import android.util.Log;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | /**
10 | * Created By Ele
11 | * on 2020/5/31
12 | **/
13 | public class KzglVideoSupportUtil {
14 |
15 | private static Map codecMap = new HashMap<>();
16 | //ffmpeg中的编码格式与mediaCodec 中解码器名称的一一对应关系
17 | static {
18 | codecMap.put("h264", "video/avc");
19 | codecMap.put("mpeg4", "video/mp4v-es");
20 | }
21 |
22 | public static String findVideoCodecName(String ffcodename)
23 | {
24 | if(codecMap.containsKey(ffcodename))
25 | {
26 | return codecMap.get(ffcodename);
27 | }
28 | return "";
29 | }
30 |
31 | public static boolean isSupportCodec(String ffcodecname)
32 | {
33 | boolean supportvideo = false;
34 | int count = MediaCodecList.getCodecCount();
35 | for(int i = 0; i < count; i++)
36 | {
37 | String[] tyeps = MediaCodecList.getCodecInfoAt(i).getSupportedTypes();
38 | for(int j = 0; j < tyeps.length; j++)
39 | {
40 | Log.e("kzg","********************:"+tyeps[j] + " , "+ffcodecname);
41 | if(tyeps[j].equals(findVideoCodecName(ffcodecname)))
42 | {
43 | supportvideo = true;
44 | break;
45 | }
46 | }
47 | if(supportvideo)
48 | {
49 | break;
50 | }
51 | }
52 | return supportvideo;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/mediacodecframes/OutputImageFormat.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.mediacodecframes;
2 |
3 | /**
4 | * Created by zhantong on 16/9/8.
5 | */
6 | public enum OutputImageFormat {
7 | I420("I420"),
8 | NV21("NV21"),
9 | JPEG("JPEG");
10 | private String friendlyName;
11 |
12 | private OutputImageFormat(String friendlyName) {
13 | this.friendlyName = friendlyName;
14 | }
15 |
16 | public String toString() {
17 | return friendlyName;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/opengl/KzgGLSurfaceView.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.opengl;
2 |
3 | import android.content.Context;
4 | import android.opengl.GLSurfaceView;
5 | import android.util.AttributeSet;
6 | import android.util.Log;
7 |
8 | /**
9 | * Created By Ele
10 | * on 2020/5/30
11 | **/
12 | public class KzgGLSurfaceView extends GLSurfaceView {
13 |
14 | private KzgGlRender kzgGlRender;
15 |
16 | public KzgGLSurfaceView(Context context) {
17 | this(context,null);
18 | }
19 |
20 | public KzgGLSurfaceView(Context context, AttributeSet attrs) {
21 | super(context, attrs);
22 | setEGLContextClientVersion(2);
23 | kzgGlRender = new KzgGlRender(context);
24 | setRenderer(kzgGlRender);
25 | setRenderMode(RENDERMODE_WHEN_DIRTY);
26 | kzgGlRender.setOnRenderListener(new KzgGlRender.OnRenderListener() {
27 | @Override
28 | public void onRender() {
29 | //主动调用请求刷新数据
30 | requestRender();
31 | }
32 | });
33 | }
34 |
35 |
36 | public void setYUV(int width,int height,byte[] y,byte[] u,byte[] v,int practicalWidth){
37 | if (kzgGlRender != null){
38 | kzgGlRender.setYUVRenderData(width,height,y,u,v,practicalWidth);
39 | //主动调用请求刷新数据
40 | requestRender();
41 | }
42 | }
43 |
44 | public KzgGlRender getKzgGlRender() {
45 | return kzgGlRender;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/timebar/Course.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.timebar;
2 |
3 | /**
4 | * 刻度尺游标
5 | */
6 | public class Course {
7 | //游标在刻度尺的位置
8 | private float position;
9 |
10 | public void setPosition(float position) {
11 | this.position = position;
12 | }
13 |
14 | public float getPosition() {
15 | return position;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/timebar/Scaler.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.timebar;
2 |
3 |
4 | public class Scaler {
5 | private int position;
6 | /*是否为关键刻度*/
7 | private boolean isKeyScaler;
8 |
9 | public void setPosition(int value) {
10 | this.position = value;
11 | }
12 |
13 | public int getPosition() {
14 | return position;
15 | }
16 |
17 | public boolean isKeyScaler() {
18 | return isKeyScaler;
19 | }
20 |
21 | public void setKeyScaler(boolean keyScaler) {
22 | isKeyScaler = keyScaler;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/timebar/SizeParam.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.timebar;
2 |
3 | public class SizeParam {
4 | //一个大刻度代表的度量
5 | private final int largeValue;
6 | // 一个小刻度代表的度量
7 | private final int unitValue;
8 | //当前最小刻度与最小单位的进制 如:当前最小刻度表示1分钟,则1分钟有 1*60*1000毫秒,此时 decimal 为60*1000
9 | private final int decimal;
10 | /*显示区域最多显示大刻度的个数*/
11 | private final int disPlayLargeCount;
12 |
13 | public SizeParam(int largeValue, int unitValue, int decimal, int disPlayLargeCount) {
14 | this.largeValue = largeValue;
15 | this.unitValue = unitValue;
16 | this.decimal = decimal;
17 | this.disPlayLargeCount = disPlayLargeCount;
18 | }
19 |
20 | public int getDecimal() {
21 | return decimal;
22 | }
23 |
24 | public int getUnitValue() {
25 | return unitValue;
26 | }
27 |
28 | public int getLargeValue() {
29 | return largeValue;
30 | }
31 |
32 | public int getDisPlayLargeCount() {
33 | return disPlayLargeCount;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/myplayer/src/main/java/com/example/myplayer/utils/Utils.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer.utils;
2 |
3 | import android.graphics.BitmapFactory;
4 |
5 | /**
6 | * Created By Ele
7 | * on 2020/1/15
8 | **/
9 | public class Utils {
10 |
11 | /**
12 | * 将毫秒数转成00:00 格式
13 | * @param duration
14 | * @return
15 | */
16 | public static String MilliToMinuteTime(long duration){
17 | String time = "" ;
18 | long minute = duration / 60000 ;
19 | long seconds = duration % 60000 ;
20 | long second = Math.round((float)seconds/1000) ;
21 | if( minute < 10 ){
22 | time += "0" ;
23 | }
24 | time += minute+":" ;
25 | if( second < 10 ){
26 | time += "0" ;
27 | }
28 | time += second ;
29 | return time ;
30 | }
31 |
32 |
33 | /**
34 | * 比较两个数与目标数差距较小的那个
35 | * @param a
36 | * @param b
37 | * @param c 对比目标数
38 | * @return
39 | */
40 | public static long minDifferenceValue(long a,long b,long c) {
41 | if (a == b) {
42 | return Math.min(a, c);
43 | }
44 | long f_a = Math.abs(a - c);
45 | long f_b = Math.abs(b - c);
46 | if (f_a == f_b) {
47 | return Math.min(a, b);
48 | }
49 | return f_a < f_b?a:b;
50 | }
51 |
52 |
53 | /**
54 | * 计算Bitmap最大的压缩比
55 | * @param options
56 | * @param reqWidth
57 | * @param reqHeight
58 | * @return
59 | */
60 | public static int calculateInSampleSize(
61 | BitmapFactory.Options options, int reqWidth, int reqHeight) {
62 | // Raw height and width of image
63 | final int height = options.outHeight;
64 | final int width = options.outWidth;
65 | int inSampleSize = 1;
66 | if (height > reqHeight || width > reqWidth) {
67 | final int halfHeight = height / 2;
68 | final int halfWidth = width / 2;
69 | // 宽和高比需要的宽高大的前提下最大的inSampleSize
70 | while ((halfHeight / inSampleSize) >= reqHeight
71 | && (halfWidth / inSampleSize) >= reqWidth) {
72 | inSampleSize *= 2;
73 | }
74 | }
75 | return inSampleSize;
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/myplayer/src/main/jniLibs/armeabi-v7a/libavcodec.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/src/main/jniLibs/armeabi-v7a/libavcodec.so
--------------------------------------------------------------------------------
/myplayer/src/main/jniLibs/armeabi-v7a/libavdevice.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/src/main/jniLibs/armeabi-v7a/libavdevice.so
--------------------------------------------------------------------------------
/myplayer/src/main/jniLibs/armeabi-v7a/libavfilter.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/src/main/jniLibs/armeabi-v7a/libavfilter.so
--------------------------------------------------------------------------------
/myplayer/src/main/jniLibs/armeabi-v7a/libavformat.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/src/main/jniLibs/armeabi-v7a/libavformat.so
--------------------------------------------------------------------------------
/myplayer/src/main/jniLibs/armeabi-v7a/libavutil.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/src/main/jniLibs/armeabi-v7a/libavutil.so
--------------------------------------------------------------------------------
/myplayer/src/main/jniLibs/armeabi-v7a/libpostproc.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/src/main/jniLibs/armeabi-v7a/libpostproc.so
--------------------------------------------------------------------------------
/myplayer/src/main/jniLibs/armeabi-v7a/libswresample.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/src/main/jniLibs/armeabi-v7a/libswresample.so
--------------------------------------------------------------------------------
/myplayer/src/main/jniLibs/armeabi-v7a/libswscale.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/src/main/jniLibs/armeabi-v7a/libswscale.so
--------------------------------------------------------------------------------
/myplayer/src/main/res/drawable/bright_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/myplayer/src/main/res/drawable/bright_thumb.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/myplayer/src/main/res/drawable/btn_vidoe_pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/src/main/res/drawable/btn_vidoe_pause.png
--------------------------------------------------------------------------------
/myplayer/src/main/res/drawable/btn_vidoe_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/myplayer/src/main/res/drawable/btn_vidoe_play.png
--------------------------------------------------------------------------------
/myplayer/src/main/res/drawable/selector_play_details.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/myplayer/src/main/res/layout/layout_video_range.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
18 |
19 |
23 |
24 |
28 |
29 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/myplayer/src/main/res/layout/layout_view_pre_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/myplayer/src/main/res/layout/video_track_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/myplayer/src/main/res/raw/fragment_mediacodec.glsl:
--------------------------------------------------------------------------------
1 | #extension GL_OES_EGL_image_external : require
2 | precision mediump float;
3 | varying vec2 v_texPosition;
4 | uniform samplerExternalOES sTexture;
5 |
6 | void main() {
7 | gl_FragColor=texture2D(sTexture, v_texPosition);
8 | }
9 |
--------------------------------------------------------------------------------
/myplayer/src/main/res/raw/fragment_shader.glsl:
--------------------------------------------------------------------------------
1 | precision mediump float;
2 | varying vec2 v_texPosition;
3 | uniform sampler2D sampler_y;
4 | uniform sampler2D sampler_u;
5 | uniform sampler2D sampler_v;
6 | void main() {
7 |
8 | mediump vec3 yuv;
9 | lowp vec3 rgb;
10 | yuv.x = texture2D(sampler_y, v_texPosition).r - 0.0625;
11 | yuv.y = texture2D(sampler_u, v_texPosition).r - 0.5;
12 | yuv.z = texture2D(sampler_v, v_texPosition).r - 0.5;
13 |
14 | rgb = mat3( 1,1,1,
15 | 0,-0.39465,2.03211,
16 | 1.13983,-0.58060,0) * yuv;
17 |
18 |
19 | //float y,u,v;
20 | //y = texture2D(sampler_y,v_texPosition).r - 0.0625;
21 | //u = texture2D(sampler_u,v_texPosition).r- 0.5;
22 | //v = texture2D(sampler_v,v_texPosition).r- 0.5;
23 |
24 |
25 | //vec3 rgb;
26 | //rgb.r = y + 1.403 * v;
27 | //rgb.g = y - 0.344 * u - 0.714 * v;
28 | //rgb.b = y + 1.770 * u;
29 |
30 | gl_FragColor = vec4(rgb,1);
31 | }
32 |
--------------------------------------------------------------------------------
/myplayer/src/main/res/raw/vertex_shader.glsl:
--------------------------------------------------------------------------------
1 | attribute vec4 av_Position;
2 | attribute vec2 af_Position;
3 | varying vec2 v_texPosition;
4 | void main() {
5 | v_texPosition = af_Position;
6 | gl_Position = av_Position;
7 | }
8 |
--------------------------------------------------------------------------------
/myplayer/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/myplayer/src/test/java/com/example/myplayer/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.myplayer;
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() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':myplayer'
2 | rootProject.name='FFmpegVideoRange2'
3 | include ':timeLine'
4 |
--------------------------------------------------------------------------------
/timeLine/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/timeLine/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | id 'kotlin-android'
4 | id 'kotlin-android-extensions'
5 | }
6 |
7 | android {
8 | compileSdkVersion 28
9 |
10 | defaultConfig {
11 | minSdkVersion 21
12 | targetSdkVersion 28
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | consumerProguardFiles "consumer-rules.pro"
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | compileOptions {
27 | sourceCompatibility JavaVersion.VERSION_1_8
28 | targetCompatibility JavaVersion.VERSION_1_8
29 | }
30 | kotlinOptions {
31 | jvmTarget = '1.8'
32 | }
33 | }
34 |
35 | dependencies {
36 | //implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
37 | api fileTree(dir: 'libs', include: ['*.jar'])
38 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
39 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
40 | implementation 'androidx.core:core-ktx:1.3.1'
41 | implementation 'androidx.appcompat:appcompat:1.2.0'
42 | implementation 'com.google.android.material:material:1.2.1'
43 |
44 | api 'androidx.recyclerview:recyclerview:1.1.0'
45 | api 'com.github.bumptech.glide:glide:4.8.0'
46 |
47 | api 'androidx.dynamicanimation:dynamicanimation:1.0.0'
48 | api "com.github.CymChad:BaseRecyclerViewAdapterHelper:$quickAdapterVersion"
49 |
50 | api 'androidx.lifecycle:lifecycle-livedata-core:2.0.0'
51 | api 'androidx.lifecycle:lifecycle-viewmodel:2.0.0'
52 | api 'androidx.lifecycle:lifecycle-extensions:2.0.0'
53 |
54 | api "com.github.bumptech.glide:glide:$glideVersion"
55 | annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
56 | api 'androidx.annotation:annotation:1.1.0@jar'
57 | implementation 'com.google.android:flexbox:2.0.0'
58 |
59 | api "io.reactivex.rxjava2:rxjava:2.1.12"
60 | api "io.reactivex.rxjava2:rxandroid:2.0.2"
61 | }
--------------------------------------------------------------------------------
/timeLine/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/consumer-rules.pro
--------------------------------------------------------------------------------
/timeLine/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
--------------------------------------------------------------------------------
/timeLine/src/androidTest/java/com/sam/video/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.sam.video.test", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/timeLine/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/TimeLineApp.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video
2 |
3 | import android.app.Application
4 | import android.content.Context
5 | import android.util.Log
6 |
7 |
8 | class TimeLineApp : Application() {
9 |
10 | override fun onCreate() {
11 | Log.e("kzg","******************TimeLineApp")
12 | instance = this
13 | super.onCreate()
14 | }
15 |
16 | override fun attachBaseContext(base: Context?) {
17 | Log.e("kzg","******************attachBaseContext")
18 | super.attachBaseContext(base)
19 | instance = this
20 | }
21 |
22 | companion object {
23 | lateinit var instance: TimeLineApp
24 | private set
25 |
26 | }
27 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/bean/TagLineViewData.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.bean
2 |
3 | import androidx.annotation.ColorInt
4 | import androidx.annotation.IntDef
5 |
6 | /**
7 | * 标签线 需要的数据
8 | *
9 | * 具体的绘制内容由文字标签给出
10 | * @author SamWang(33691286@qq.com)
11 | * @date 2019-08-03
12 | */
13 | class TagLineViewData(
14 | @ColorInt var color: Int,
15 | var startTime: Long,
16 | var endTime: Long,
17 | @TagType val itemType: Int,
18 | var content: String, //内容。img->path, text->text
19 | var originData: Any? = null, // 原始数据
20 | var tagDrawStartTime: Long = 0L, //标签开始绘制的时间,用于左边缘停留
21 | var index: Int = 0, //所属层级
22 | var groupHead: TagLineViewData?= null //所属分组的第一个,null时未分组,在屏幕外
23 | )
24 |
25 |
26 | @IntDef(TagType.ITEM_TYPE_TEXT, TagType.ITEM_TYPE_IMG)
27 | annotation class TagType {
28 | companion object {
29 | const val ITEM_TYPE_TEXT = 1
30 | const val ITEM_TYPE_IMG = 2
31 | }
32 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/bean/TargetBean.java:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.bean;
2 |
3 | public class TargetBean {
4 | private long timeUs;
5 | private boolean isAddFrame = false;
6 | private boolean removeTag = false;
7 |
8 | public long getTimeUs() {
9 | return timeUs;
10 | }
11 |
12 | public void setTimeUs(long timeUs) {
13 | this.timeUs = timeUs;
14 | }
15 |
16 | public boolean isAddFrame() {
17 | return isAddFrame;
18 | }
19 |
20 | public void setAddFrame(boolean addFrame) {
21 | isAddFrame = addFrame;
22 | }
23 |
24 | public boolean isRemoveTag() {
25 | return removeTag;
26 | }
27 |
28 | public void setRemoveTag(boolean removeTag) {
29 | this.removeTag = removeTag;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return "TargetBean{" +
35 | "timeUs=" + timeUs +
36 | ", isAddFrame=" + isAddFrame +
37 | ", removeTag=" + removeTag +
38 | '}';
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/bean/TimeLineAreaData.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.bean
2 |
3 | /**
4 | * 时间轴区域数据
5 | * 实现该接口以指定时间轴上的一段区域,并在开始和结束位置与相应的视频片断绑定
6 | * @author SamWang(33691286@qq.com)
7 | * @date 2019-12-04
8 | */
9 | interface TimeLineAreaData {
10 | var start: Long //区域开始位置
11 | var duration: Long //区域持续时间
12 | //-----------
13 | var startVideoClipId: String //起始点所属片段,编辑完贴纸后需记录
14 | var startVideoClipOffsetMs: Long //起始点位于所属片段位置的时间(未处理变速、绝对时长),仅在贴纸调整时会有影响
15 | var endVideoClipId: String //结束位置
16 | var endVideoClipOffsetMs: Long //起始点位于所属片段位置的时间(未处理变速、绝对时长)
17 |
18 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/bean/VideoClip.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.bean
2 |
3 |
4 | /**
5 | * 视频美化视频片段
6 | * @author WangYingHao
7 | * @since 2019-08-03
8 | */
9 | data class VideoClip(
10 | var id: String, //唯一标识
11 | var originalFilePath: String,//文件路径
12 | var originalDurationMs: Long = 0,//原始文件时长
13 | var startAtMs: Long = 0, //视频有效起始时刻
14 | var endAtMs: Long = 0//视频有效结束时刻
15 | ){
16 | val durationMs: Long //视频有效播放时长,受节选、速度、转场吃掉时间影响
17 | get() {
18 | return endAtMs - startAtMs
19 | }
20 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/bean/VideoFrameData.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.bean
2 |
3 | data class VideoFrameData(
4 | var videoData: VideoClip,
5 | var time: Long, //这个帧片断 开始时间; 与整个视频的开始时间为-“相对时间”;例:任何视频片断的第一帧为时间为0
6 | var frameClipTime: Long, //这个片断 第一个合适的最小时间轴精度时间(避免片断开始时间一直变,图片一直刷),这边是考虑裁剪后的时间-“本视频文件的绝对时间”;例:不同视频的第一帧时间为截断开始的时间附近
7 | var frameWidth: Int, //这一帧的宽度
8 | var isFirstItem: Boolean = false,
9 | var isLastItem: Boolean = false,
10 | var offsetX: Int = 0 //左边偏移,用于第一帧不是从起始位置开始时的开始位置
11 | )
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/cache/DiskLrucacheExt.kt:
--------------------------------------------------------------------------------
1 | package com.jadyn.mediakit.cache
2 |
3 | import com.sam.video.timeline.cache.DiskLruCache
4 | import java.io.IOException
5 |
6 | /**
7 | *@version:
8 | *@FileDescription:
9 | *@Author:Jing
10 | *@Since:2019/3/1
11 | *@ChangeList:
12 | */
13 | fun DiskLruCache.takeSnap(key: String): DiskLruCache.Snapshot? {
14 | return try {
15 | get(key)
16 | } catch (e: IOException) {
17 | null
18 | }
19 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/cache/IoUtils.java:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.cache;
2 |
3 | import java.io.Closeable;
4 | import java.io.File;
5 | import java.io.IOException;
6 | import java.io.Reader;
7 | import java.io.StringWriter;
8 | import java.nio.charset.Charset;
9 |
10 | /**
11 | * @version:
12 | * @FileDescription:
13 | * @Author:AiLo
14 | * @Since:2019/2/28
15 | * @ChangeList:
16 | */
17 | final class IoUtils {
18 | static final Charset US_ASCII = Charset.forName("US-ASCII");
19 | static final Charset UTF_8 = Charset.forName("UTF-8");
20 |
21 | private IoUtils() {
22 | }
23 |
24 | static String readFully(Reader reader) throws IOException {
25 | try {
26 | StringWriter writer = new StringWriter();
27 | char[] buffer = new char[1024];
28 | int count;
29 | while ((count = reader.read(buffer)) != -1) {
30 | writer.write(buffer, 0, count);
31 | }
32 | return writer.toString();
33 | } finally {
34 | reader.close();
35 | }
36 | }
37 |
38 | /**
39 | * Deletes the contents of {@code dir}. Throws an IOException if any file
40 | * could not be deleted, or if {@code dir} is not a readable directory.
41 | */
42 | static void deleteContents(File dir) throws IOException {
43 | File[] files = dir.listFiles();
44 | if (files == null) {
45 | throw new IOException("not a readable directory: " + dir);
46 | }
47 | for (File file : files) {
48 | if (file.isDirectory()) {
49 | deleteContents(file);
50 | }
51 | if (!file.delete()) {
52 | throw new IOException("failed to delete file: " + file);
53 | }
54 | }
55 | }
56 |
57 | static void closeQuietly(/*Auto*/Closeable closeable) {
58 | if (closeable != null) {
59 | try {
60 | closeable.close();
61 | } catch (RuntimeException rethrown) {
62 | throw rethrown;
63 | } catch (Exception ignored) {
64 | }
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/common/OutputImageFormat.java:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.common;
2 |
3 | /**
4 | * Created by zhantong on 16/9/8.
5 | */
6 | public enum OutputImageFormat {
7 | I420("I420"),
8 | NV21("NV21"),
9 | JPEG("JPEG");
10 | private String friendlyName;
11 |
12 | private OutputImageFormat(String friendlyName) {
13 | this.friendlyName = friendlyName;
14 | }
15 |
16 | public String toString() {
17 | return friendlyName;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/common/TargetBeanQueue.java:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.common;
2 |
3 | import com.sam.video.timeline.bean.TargetBean;
4 |
5 | import java.util.concurrent.LinkedBlockingQueue;
6 |
7 | /**
8 | * Created By Ele
9 | * on 2020/6/4
10 | **/
11 | public class TargetBeanQueue {
12 |
13 | private LinkedBlockingQueue list = new LinkedBlockingQueue();
14 |
15 | public boolean enQueue(TargetBean packetBean){
16 | if (list != null){
17 | return list.offer(packetBean);
18 | }
19 | return false;
20 | }
21 |
22 | public TargetBean deQueue(){
23 | if (list == null){
24 | return null;
25 | }
26 | return list.poll();
27 | }
28 |
29 | public TargetBean getFirst(){
30 | if (list == null){
31 | return null;
32 | }
33 | return list.peek();
34 | }
35 |
36 | public int getQueueSize(){
37 | if (list == null){
38 | return 0;
39 | }
40 | return list.size();
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/helper/IAvFrameHelper.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.helper
2 |
3 | import android.graphics.Bitmap
4 | import android.widget.ImageView
5 | import androidx.recyclerview.widget.RecyclerView
6 |
7 | /**
8 | * 视频抽帧接口
9 | */
10 | interface IAvFrameHelper {
11 | var filePath:String
12 | var onGetFrameBitmapCallback:OnGetFrameBitmapCallback?
13 |
14 | var lastBitMap : Bitmap?
15 | var decodeFrameListener:DecodeFrameListener?
16 | var isSeekBack:Boolean
17 | var isScrolling:Boolean
18 | var isPause:Boolean
19 | //每一帧的间隔时间 单位:毫秒
20 | var itemFrameForTime:Long
21 |
22 | fun init()
23 | /**
24 | * 获取指定时间的帧数据,并显示到指定的view中
25 | *
26 | */
27 | fun loadAvFrame(view: RecyclerView.ViewHolder, timeMs:Long)
28 |
29 | fun addAvFrame(view:ImageView)
30 |
31 | fun loadAvFrame(view: ImageView, timeMs:Long)
32 |
33 | fun removeAvFrameTag(view:ImageView)
34 |
35 | fun removeAvFrame()
36 |
37 | fun release()
38 |
39 | fun seek()
40 |
41 | fun pause()
42 |
43 | interface DecodeFrameListener{
44 | fun onGetOneFrame()
45 | }
46 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/helper/OnGetFrameBitmapCallback.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.helper
2 |
3 | import android.graphics.Bitmap
4 |
5 | interface OnGetFrameBitmapCallback {
6 |
7 | fun onGetBitmap(bitmap: Bitmap?, usTime: Long)
8 | fun onCodecStart()
9 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/listener/Click.java:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.listener;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * Created by wyh3 on 2018/7/21.
7 | * 一些通用的、与交互相关的、与业务无关的点击事件监听器
8 | * 抽离出来公用,避免每次用的时候都要重新写一个
9 | */
10 | public class Click {
11 |
12 | /**
13 | * 天真无暇的click
14 | */
15 | public interface OnClickListener {
16 | void onClick();
17 | }
18 |
19 | /**
20 | * 监听控件点击时还想多传一个参数
21 | */
22 | public interface OnViewClickListener {
23 | void onClick(View view, T t);
24 | }
25 |
26 | public interface OnViewLongClickListener {
27 | void onLongClick(View view, T t);
28 | }
29 |
30 | /**
31 | * 监听对象可能是任意一个抽象的实体
32 | */
33 | public interface OnObjectClickListener {
34 | void onObjectClick(T t);
35 | }
36 |
37 | /**
38 | * 需要回调位置的监听
39 | */
40 | public interface OnPositionClickListener {
41 | void onPositionClick(int position);
42 | }
43 |
44 | /**
45 | * 需要回调位置的监听
46 | */
47 | public interface OnItemClickListener {
48 | void onItemClick(T t, int position);
49 | }
50 |
51 | /**
52 | * 需要回调位置的监听
53 | */
54 | public interface OnItemViewClickListener {
55 | void onItemClick(View view, T t, int position);
56 | }
57 |
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/listener/VideoPlayerOperate.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.listener
2 |
3 | import com.sam.video.timeline.widget.TimeChangeListener
4 |
5 | /**
6 | * 视频美化首页 视频播放控件的操作接口
7 | * @author SamWang(33691286@qq.com)
8 | * @date 2019-07-24
9 | */
10 | interface VideoPlayerOperate : TimeChangeListener {
11 | /** 增删、排序后 更新视频信息 */
12 | fun updateVideoInfo()
13 |
14 | fun startTrackingTouch()
15 |
16 | fun stopTrackingTouch(ms: Long)
17 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/widget/ActiveFullTextTagLineView.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.widget
2 |
3 | import android.content.Context
4 | import android.graphics.Canvas
5 | import android.graphics.RectF
6 | import android.util.AttributeSet
7 | import com.sam.video.timeline.bean.TagLineViewData
8 | import com.sam.video.timeline.bean.TagType
9 |
10 |
11 | /**
12 | *
13 | * 文字 激活时全部显示,非激活时限制长度
14 | *
15 | * @author SamWang(33691286@qq.com)
16 | * @date 2019-07-31
17 | */
18 | class ActiveFullTextTagLineView @JvmOverloads constructor(
19 | context: Context, paramAttributeSet: AttributeSet? = null,
20 | paramInt: Int = 0
21 | ) : WideTextTagLineView(context, paramAttributeSet, paramInt),
22 | TimeLineBaseValue.TimeLineBaseView {
23 |
24 | override fun updatePathBeforeDraw(
25 | item: TagLineViewData,
26 | canvas: Canvas,
27 | zIndex: Int,
28 | isActive: Boolean
29 | ) {
30 | //UPDATE PATH
31 | if (item.itemType == TagType.ITEM_TYPE_TEXT) {
32 | if (zIndex == 0 && isActive) {
33 | updateActivePath(getItemWidth(item))
34 | } else {
35 | updateNormalPath(getItemWidth(item))
36 | }
37 | } else {
38 | super.updatePathBeforeDraw(item, canvas, zIndex, isActive)
39 | }
40 | }
41 |
42 | override fun drawContentText(content: String, canvas: Canvas, rect: RectF, isActive: Boolean) {
43 | val paddingLeft = if (isActive) activeTextPadding else normalTextPadding
44 | val text = if(isActive) content else ellipsizeText(content)
45 | canvas.drawText(text, paddingLeft, rect.centerY() + textBaseY, textPaint)
46 | }
47 |
48 |
49 | override fun getItemWidth(item: TagLineViewData): Float {
50 | return if (item == activeItem && item.itemType == TagType.ITEM_TYPE_TEXT) {
51 | val width = textPaint.measureText(item.content)
52 | width + activeTextPadding * 2
53 | } else if (item.itemType == TagType.ITEM_TYPE_TEXT) {
54 | val width = textPaint.measureText(ellipsizeText(item.content))
55 | width + activeTextPadding * 2
56 | } else {
57 | normalWidth
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/widget/ActiveWideTextTagLineView.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.widget
2 |
3 | import android.content.Context
4 | import android.graphics.Canvas
5 | import android.graphics.Color
6 | import android.graphics.RectF
7 | import android.util.AttributeSet
8 | import com.sam.video.timeline.bean.TagLineViewData
9 | import com.sam.video.timeline.bean.TagType
10 | import com.sam.video.util.getScreenWidth
11 |
12 |
13 | /**
14 | *
15 | * 文字 激活时最多半屏,非激活时一字
16 | *
17 | * @author SamWang(33691286@qq.com)
18 | * @date 2019-07-31
19 | */
20 | class ActiveWideTextTagLineView @JvmOverloads constructor(
21 | context: Context, paramAttributeSet: AttributeSet? = null,
22 | paramInt: Int = 0
23 | ) : WideTextTagLineView(context, paramAttributeSet, paramInt),
24 | TimeLineBaseValue.TimeLineBaseView {
25 |
26 | override fun initMaxTextWidth(): Float {
27 | return (context.getScreenWidth() / 2).toFloat()
28 | }
29 | override fun updatePathBeforeDraw(
30 | item: TagLineViewData,
31 | canvas: Canvas,
32 | zIndex: Int,
33 | isActive: Boolean
34 | ) {
35 | //UPDATE PATH
36 | if (isActive && zIndex == 0) {
37 | if (item.itemType == TagType.ITEM_TYPE_TEXT) {
38 | val text = ellipsizeText(item.content)
39 | val width = textPaint.measureText(text)
40 | updateActivePath(width + activeTextPadding * 2)
41 | } else {
42 | updateActivePath()
43 | }
44 | }
45 | //这里的场景,未激活的都是同样的尺寸
46 | }
47 |
48 | override fun drawContentText(content: String, canvas: Canvas, rect: RectF, isActive: Boolean) {
49 | if (isActive) {
50 | super.drawContentText(content, canvas, rect, isActive)
51 | } else {
52 | paint.color = Color.WHITE
53 | canvas.drawText(content, 0, 1, rect.centerX(), rect.centerY() + textBaseY, paint)
54 |
55 | }
56 |
57 | }
58 |
59 |
60 | override fun getItemWidth(item: TagLineViewData): Float {
61 | return if (item == activeItem && item.itemType == TagType.ITEM_TYPE_TEXT) {
62 | val width = textPaint.measureText(ellipsizeText(item.content))
63 | width + activeTextPadding * 2
64 | } else {
65 | normalWidth
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/widget/MaxHeightRecyclerView.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.widget
2 |
3 | import android.content.Context
4 | import android.util.AttributeSet
5 |
6 | /**
7 | * 限制最大高度的rv
8 | * @author SamWang(33691286@qq.com)
9 | * @date 2019-08-07
10 | */
11 | class MaxHeightRecyclerView @JvmOverloads constructor(
12 | context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
13 | ) : androidx.recyclerview.widget.RecyclerView(context, attrs, defStyleAttr) {
14 |
15 | var maxHeight = 0
16 | override fun onMeasure(widthSpec: Int, heightSpec: Int) {
17 | val newHeightSpec = if (maxHeight > 0) {
18 | MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.AT_MOST)
19 | } else {
20 | heightSpec
21 | }
22 | super.onMeasure(widthSpec, newHeightSpec)
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/widget/RoundTextView.java:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.widget;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Path;
7 | import android.graphics.Rect;
8 | import android.graphics.RectF;
9 | import android.util.AttributeSet;
10 |
11 | import androidx.appcompat.widget.AppCompatTextView;
12 |
13 | import com.sam.video.R;
14 |
15 |
16 | /**
17 | * 只需要设置背景色就能得到圆角的背景 TextView
18 | *
19 | * @author SamWang(33691286@qq.com)
20 | * @date 2019/5/7
21 | */
22 | public class RoundTextView extends AppCompatTextView {
23 |
24 | private int radius = 0;
25 | private RectF rect;
26 | private Path path;
27 |
28 | public RoundTextView(Context context) {
29 | this(context, null);
30 | init();
31 | }
32 |
33 | public RoundTextView(Context context, AttributeSet attrs) {
34 | this(context, attrs, -1);
35 |
36 | }
37 |
38 | public RoundTextView(Context context, AttributeSet attrs, int defStyleAttr) {
39 | super(context, attrs, defStyleAttr);
40 | if (attrs != null) {
41 | final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RoundTextView);
42 | radius = typedArray.getDimensionPixelOffset(R.styleable.RoundTextView_tv_radius, 0);
43 | typedArray.recycle();
44 | }
45 | init();
46 | }
47 |
48 | private void init() {
49 | rect = new RectF();
50 | path = new Path();
51 | }
52 |
53 | public void setRadius(int radius) {
54 | this.radius = radius;
55 | updatePath();
56 | invalidate();
57 | }
58 |
59 | @Override
60 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
61 | super.onSizeChanged(w, h, oldw, oldh);
62 | rect.set(0, 0, w, h);
63 | updatePath();
64 | }
65 |
66 | private void updatePath() {
67 | if (path == null) {
68 | init();
69 | }
70 | path.reset();
71 | path.addRoundRect(rect, radius, radius, Path.Direction.CW);
72 | }
73 |
74 | private Rect canvasRect = new Rect();
75 | @Override
76 | public void draw(Canvas canvas) {
77 | if (radius > 0) {
78 | canvas.getClipBounds(canvasRect);
79 | rect.set(canvasRect);
80 | path.reset();
81 | path.addRoundRect(rect, radius, radius, Path.Direction.CW);
82 | canvas.clipPath(path);
83 | }
84 | super.draw(canvas);
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/widget/TagItemDecoration.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.widget
2 |
3 | import android.content.Context
4 | import android.graphics.*
5 | import androidx.recyclerview.widget.RecyclerView
6 | import com.sam.video.util.dp2px
7 |
8 |
9 | /**
10 | * 标签弹窗的item间隔
11 | *
12 | * 间隔的数据 为间隔前的item position
13 | * @author SamWang(33691286@qq.com)
14 | * @date 2019-07-22
15 | */
16 | class TagItemDecoration(context: Context) : RecyclerView.ItemDecoration() {
17 | private val colorBg = Color.parseColor("#202020")
18 |
19 | private val triangleWidth = context.dp2px(7f) //小三角规格
20 | val triangleHeight = context.dp2px(9f)
21 | private val cornerRadius = context.dp2px(2f)
22 |
23 | var triangleXOffset = 0
24 | private var trianglePath = Path()
25 | private var coverPath = Path()
26 |
27 | val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
28 | color = Color.WHITE
29 | style = Paint.Style.FILL
30 | }
31 |
32 | private val rectF = RectF()
33 | override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
34 | super.onDraw(c, parent, state)
35 | paint.color = colorBg
36 | rectF.set(0f, 0f, parent.width.toFloat(), parent.height - triangleHeight)
37 | val startX = parent.width / 2 - triangleWidth + triangleXOffset
38 |
39 | trianglePath.reset()
40 | trianglePath.moveTo(startX, parent.height - triangleHeight)
41 | trianglePath.rLineTo(triangleWidth, triangleHeight)
42 | trianglePath.rLineTo(triangleWidth, -triangleHeight)
43 | trianglePath.close()
44 |
45 | c.drawRoundRect(rectF, cornerRadius, cornerRadius, paint)
46 | c.drawPath(trianglePath, paint)
47 | }
48 |
49 | override fun onDrawOver(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
50 | super.onDrawOver(c, parent, state)
51 | coverPath.reset()
52 | coverPath.addRect(0f, parent.height - triangleHeight, parent.width.toFloat(), parent.height.toFloat(), Path.Direction.CCW)
53 | coverPath.op(trianglePath, Path.Op.DIFFERENCE)
54 | paint.color = Color.BLACK
55 | c.drawPath(coverPath, paint)
56 | }
57 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/widget/TimeChangeListener.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.widget
2 |
3 | interface TimeChangeListener {
4 | /** 因滑动 更新时间 单位时毫秒*/
5 | fun updateTimeByScroll(time: Long)
6 |
7 | }
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/timeline/widget/TransImageView.java:
--------------------------------------------------------------------------------
1 | package com.sam.video.timeline.widget;
2 |
3 |
4 | import android.annotation.SuppressLint;
5 | import android.content.Context;
6 | import android.graphics.drawable.Drawable;
7 | import android.util.AttributeSet;
8 | import android.widget.ImageView;
9 |
10 | import androidx.annotation.Nullable;
11 |
12 | @SuppressLint("AppCompatCustomView")
13 | public class TransImageView extends ImageView {
14 | public TransImageView(Context context) {
15 | this(context,null);
16 | }
17 |
18 | public TransImageView(Context context, @Nullable AttributeSet attrs) {
19 | this(context, attrs,0);
20 | }
21 |
22 | public TransImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
23 | super(context, attrs, defStyleAttr);
24 | }
25 |
26 |
27 | @Override
28 | public void setImageDrawable(@Nullable Drawable drawable) {
29 | if(drawable!=null){
30 | super.setImageDrawable(drawable);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/util/Collections.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.util
2 |
3 | public inline fun MutableList.removeObj(item: T): Collection {
4 | val index = this.indexOfFirst { it === item }
5 | if (index in 0 until size) {
6 | this.removeAt(index)
7 | }
8 | return this
9 | }
10 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/util/FUtils.java:
--------------------------------------------------------------------------------
1 | package com.sam.video.util;
2 |
3 | import android.graphics.BitmapFactory;
4 |
5 | /**
6 | * Created By Ele
7 | * on 2020/1/15
8 | **/
9 | public class FUtils {
10 |
11 | /**
12 | * 将毫秒数转成00:00 格式
13 | * @param duration
14 | * @return
15 | */
16 | public static String MilliToMinuteTime(long duration){
17 | String time = "" ;
18 | long minute = duration / 60000 ;
19 | long seconds = duration % 60000 ;
20 | long second = Math.round((float)seconds/1000) ;
21 | if( minute < 10 ){
22 | time += "0" ;
23 | }
24 | time += minute+":" ;
25 | if( second < 10 ){
26 | time += "0" ;
27 | }
28 | time += second ;
29 | return time ;
30 | }
31 |
32 |
33 | /**
34 | * 比较两个数与目标数差距较小的那个
35 | * @param a
36 | * @param b
37 | * @param c 对比目标数
38 | * @return
39 | */
40 | public static long minDifferenceValue(long a,long b,long c) {
41 | if (a == b) {
42 | return Math.min(a, c);
43 | }
44 | long f_a = Math.abs(a - c);
45 | long f_b = Math.abs(b - c);
46 | if (f_a == f_b) {
47 | return Math.min(a, b);
48 | }
49 | return f_a < f_b?a:b;
50 | }
51 |
52 |
53 | /**
54 | * 计算Bitmap最大的压缩比
55 | * @param options
56 | * @param reqWidth
57 | * @param reqHeight
58 | * @return
59 | */
60 | public static int calculateInSampleSize(
61 | BitmapFactory.Options options, int reqWidth, int reqHeight) {
62 | // Raw height and width of image
63 | final int height = options.outHeight;
64 | final int width = options.outWidth;
65 | int inSampleSize = 1;
66 | if (height > reqHeight || width > reqWidth) {
67 | final int halfHeight = height / 2;
68 | final int halfWidth = width / 2;
69 | // 宽和高比需要的宽高大的前提下最大的inSampleSize
70 | while ((halfHeight / inSampleSize) >= reqHeight
71 | && (halfWidth / inSampleSize) >= reqWidth) {
72 | inSampleSize *= 2;
73 | }
74 | }
75 | return inSampleSize;
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/util/ScreenUtil.java:
--------------------------------------------------------------------------------
1 | package com.sam.video.util;
2 |
3 |
4 | import android.content.Context;
5 | import android.graphics.Point;
6 | import android.os.Build;
7 | import android.view.Display;
8 | import android.view.WindowManager;
9 |
10 | import com.sam.video.TimeLineApp;
11 |
12 |
13 | public class ScreenUtil {
14 |
15 | public static final String TAG = ScreenUtil.class.getSimpleName();
16 |
17 | private int mRealSizeWidth;
18 | private int mRealSizeHeight;
19 |
20 | private ScreenUtil() {
21 | initRealSize();
22 | }
23 |
24 | private static final class InstanceHolder {
25 | private static final ScreenUtil INSTANCE = new ScreenUtil();
26 | }
27 |
28 | /**
29 | * 获取实例
30 | *
31 | * @return ScreenUtils
32 | */
33 | public static ScreenUtil getInstance() {
34 | return InstanceHolder.INSTANCE;
35 | }
36 |
37 | private void initRealSize() {
38 | final WindowManager windowManager =
39 | (WindowManager) TimeLineApp.Companion.getInstance().getSystemService(Context.WINDOW_SERVICE);
40 | final Display display = windowManager.getDefaultDisplay();
41 | Point outPoint = new Point();
42 | if (Build.VERSION.SDK_INT >= 19) {
43 | // 包含虚拟按键
44 | display.getRealSize(outPoint);
45 | } else {
46 | // 不含虚拟按键
47 | display.getSize(outPoint);
48 | }
49 | if (outPoint.y > outPoint.x) {
50 | mRealSizeHeight = outPoint.y;
51 | mRealSizeWidth = outPoint.x;
52 | } else {
53 | mRealSizeHeight = outPoint.x;
54 | mRealSizeWidth = outPoint.y;
55 | }
56 | }
57 |
58 | public int getRealSizeWidth() {
59 | return mRealSizeWidth;
60 | }
61 |
62 | public int getRealSizeHeight() {
63 | return mRealSizeHeight;
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/timeLine/src/main/java/com/sam/video/util/VideoUtils.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video.util
2 |
3 | import android.content.Context
4 | import android.media.MediaMetadataRetriever
5 | import android.net.Uri
6 | import java.io.File
7 |
8 | object VideoUtils {
9 | /**
10 | * 获取视频时长
11 | *
12 | * @param videoPath 视频地址
13 | * @return 视频时长 单位毫秒
14 | */
15 | fun getVideoDuration(context: Context, videoPath: String?): Long {
16 | val retriever = MediaMetadataRetriever()
17 | retriever.setDataSource(context, Uri.fromFile(File(videoPath)))
18 | val duration =
19 | retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)
20 | .toLong()
21 | retriever.release()
22 | return duration
23 | }
24 | }
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable-xxhdpi/video_cover_duration_default.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/drawable-xxhdpi/video_cover_duration_default.webp
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable-xxhdpi/video_cover_duration_disable.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/drawable-xxhdpi/video_cover_duration_disable.webp
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable-xxhdpi/video_edit_frame_pic_icon.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/drawable-xxhdpi/video_edit_frame_pic_icon.webp
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable-xxhdpi/video_frame_cursor.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/drawable-xxhdpi/video_frame_cursor.webp
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable-xxhdpi/video_select_left.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/drawable-xxhdpi/video_select_left.webp
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable-xxhdpi/video_select_right.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/drawable-xxhdpi/video_select_right.webp
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable/shape_video_edit_filter_place_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable/tag_select_white_border_corners.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable/video_edit__tip_circle_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable/video_edit__tip_circle_bg_16dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable/video_edit__tip_line_bg_gradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/drawable/video_item_index_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/layout/activity_start.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/layout/item_tag_img.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
15 |
16 |
22 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/layout/item_tag_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
22 |
23 |
31 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/layout/item_video_frame.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/timeLine/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Destroyer716/FFmpegVideoRange2/3308d11fe1fe3b3a620d1b7904e54e4c9237cd2b/timeLine/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/timeLine/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | VideoTimeLine
3 |
4 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/timeLine/src/main/res/values/video_edit_tag_color_res.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | - #6b93d1
6 | - #4da9e8
7 | - #7eb7de
8 | - #777de5
9 | - #5d65b2
10 | - #8c79d3
11 | - #ae85c3
12 | - #6c8baf
13 | - #6a7482
14 | - #6ba9b6
15 |
16 |
17 |
18 | - #00c1a4
19 | - #32d886
20 | - #55d542
21 | - #b3d65c
22 | - #e3d156
23 | - #edc112
24 | - #ff9a57
25 | - #ff819e
26 | - #ff2b6e
27 | - #e9241b
28 |
29 |
--------------------------------------------------------------------------------
/timeLine/src/test/java/com/sam/video/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.sam.video
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------