├── .travis.yml ├── LICENSE.txt ├── NOTICE.txt ├── README.md ├── android ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── org │ └── m4m │ └── android │ ├── AndroidMediaObjectFactory.java │ ├── AudioContentRecognition.java │ ├── AudioFormatAndroid.java │ ├── BufferInfoTranslator.java │ ├── ByteBufferTranslator.java │ ├── CameraSource.java │ ├── EGLContextWrapper.java │ ├── EffectorSurface.java │ ├── EglContextSwitcher.java │ ├── FaceRecognitionPlugin.java │ ├── GameCapturerSource.java │ ├── InputSurface.java │ ├── JNIProgressListener.java │ ├── JNIVideoEffect.java │ ├── MediaCodecAudioDecoderPlugin.java │ ├── MediaCodecDecoderPlugin.java │ ├── MediaCodecEncoderPlugin.java │ ├── MediaCodecVideoDecoderPlugin.java │ ├── MediaExtractorPlugin.java │ ├── MediaFormatTranslator.java │ ├── MediaFormatWrapper.java │ ├── MediaMuxerPlugin.java │ ├── MediaPipeline.java │ ├── MicrophoneSource.java │ ├── OutputSurface.java │ ├── PreviewRender.java │ ├── PreviewTranscode.java │ ├── ResamplerAndroid.java │ ├── SimpleSurface.java │ ├── Surface.java │ ├── SurfaceTextureWrapper.java │ ├── SurfaceWrapper.java │ ├── VideoFormatAndroid.java │ └── graphics │ ├── EglUtil.java │ ├── FrameBuffer.java │ ├── FullFrameTexture.java │ ├── ShaderProgram.java │ └── VideoEffect.java ├── build.gradle ├── domain ├── build.gradle └── src │ ├── main │ └── java │ │ └── org │ │ └── m4m │ │ ├── AudioFormat.java │ │ ├── CameraCapture.java │ │ ├── GLCapture.java │ │ ├── IAudioEffect.java │ │ ├── IBaseVideoEffect.java │ │ ├── IProgressListener.java │ │ ├── IRecognitionPlugin.java │ │ ├── IVideoEffect.java │ │ ├── MediaComposer.java │ │ ├── MediaFile.java │ │ ├── MediaFileInfo.java │ │ ├── MediaStreamer.java │ │ ├── StreamingParameters.java │ │ ├── Uri.java │ │ ├── VideoFormat.java │ │ └── domain │ │ ├── AudioDecoder.java │ │ ├── AudioEffector.java │ │ ├── AudioEncoder.java │ │ ├── AudioRender.java │ │ ├── AudioSample.java │ │ ├── CameraSource.java │ │ ├── CapturePipeline.java │ │ ├── CaptureSource.java │ │ ├── Command.java │ │ ├── CommandHandlerFactory.java │ │ ├── CommandProcessor.java │ │ ├── CommandQueue.java │ │ ├── ConnectedNode.java │ │ ├── Decoder.java │ │ ├── Encoder.java │ │ ├── EofFrame.java │ │ ├── FileSegment.java │ │ ├── Frame.java │ │ ├── FrameBuffer.java │ │ ├── IAndroidMediaObjectFactory.java │ │ ├── IAudioContentRecognition.java │ │ ├── IAudioTrack.java │ │ ├── ICameraSource.java │ │ ├── ICaptureSource.java │ │ ├── ICommandHandler.java │ │ ├── ICommandProcessor.java │ │ ├── IEffectorSurface.java │ │ ├── IEgl.java │ │ ├── IEglContext.java │ │ ├── IFrameAllocator.java │ │ ├── IFrameBuffer.java │ │ ├── IHandlerCreator.java │ │ ├── IInput.java │ │ ├── IInputRaw.java │ │ ├── IMediaCodec.java │ │ ├── IMediaExtractor.java │ │ ├── IMediaFormatWrapper.java │ │ ├── IMediaMuxer.java │ │ ├── IMediaSource.java │ │ ├── IMicrophoneSource.java │ │ ├── IOnFrameAvailableListener.java │ │ ├── IOnSurfaceReady.java │ │ ├── IOutput.java │ │ ├── IOutputRaw.java │ │ ├── IPluginOutput.java │ │ ├── IPreview.java │ │ ├── IPreviewTranscode.java │ │ ├── IReadyFrameProvider.java │ │ ├── IRunnable.java │ │ ├── ISpecification.java │ │ ├── ISurface.java │ │ ├── ISurfaceCreatedListener.java │ │ ├── ISurfaceCreator.java │ │ ├── ISurfaceListener.java │ │ ├── ISurfaceProvider.java │ │ ├── ISurfaceTexture.java │ │ ├── ISurfaceWrapper.java │ │ ├── ITopologyTree.java │ │ ├── ITransform.java │ │ ├── IVideoOutput.java │ │ ├── IWrapper.java │ │ ├── Input.java │ │ ├── IsConnectable.java │ │ ├── MatchingCommands.java │ │ ├── MediaCodecInfo.java │ │ ├── MediaCodecPlugin.java │ │ ├── MediaFormat.java │ │ ├── MediaFormatType.java │ │ ├── MediaSource.java │ │ ├── MicrophoneSource.java │ │ ├── MultipleMediaSource.java │ │ ├── MuxRender.java │ │ ├── OutputInputPair.java │ │ ├── Pair.java │ │ ├── PairCommandSpecification.java │ │ ├── PairQueueSpecification.java │ │ ├── PassThroughPlugin.java │ │ ├── Pipeline.java │ │ ├── Plugin.java │ │ ├── PluginState.java │ │ ├── PreviewContext.java │ │ ├── ProgressTracker.java │ │ ├── RecognitionPipeline.java │ │ ├── Render.java │ │ ├── Resampler.java │ │ ├── Resolution.java │ │ ├── SampleRate.java │ │ ├── Segments.java │ │ ├── SurfaceRender.java │ │ ├── TopologyNet.java │ │ ├── TopologySolver.java │ │ ├── VideoDecoder.java │ │ ├── VideoEffector.java │ │ ├── VideoEncoder.java │ │ ├── VideoTimeScaler.java │ │ ├── Wrapper.java │ │ ├── graphics │ │ ├── IEglUtil.java │ │ ├── IShaderProgram.java │ │ ├── Program.java │ │ ├── TextureRenderer.java │ │ └── TextureType.java │ │ └── pipeline │ │ ├── AudioOutputFormatChangedCommandHadler.java │ │ ├── CaptureSourcePullSurfaceCommandHandler.java │ │ ├── ConfigureVideoDecoderCommandHandler.java │ │ ├── ConfigureVideoEffectorCommandHandler.java │ │ ├── ConfigureVideoTimeScalerVideoEffectorCommand.java │ │ ├── ConnectorFactory.java │ │ ├── CopyDataCommandHandler.java │ │ ├── DrainCommandHandler.java │ │ ├── DrainRenderCommandHandler.java │ │ ├── EncoderMediaFormatChangedCommandHandler.java │ │ ├── EofCommandHandler.java │ │ ├── IConnector.java │ │ ├── IOnStopListener.java │ │ ├── ManyToOneConnectable.java │ │ ├── ManyTypes.java │ │ ├── MicrophoneSourcePullFrameCommandHandler.java │ │ ├── OneToManyConnectable.java │ │ ├── OneToOneConnectable.java │ │ ├── OutputFormatChangedHandler.java │ │ ├── PluginConnector.java │ │ ├── PullDataCommandHandler.java │ │ ├── PullFrameToEffectorFromMicrophoneSourceCommandHandler.java │ │ ├── PushDataCommandHandler.java │ │ ├── PushNewDataCommandHandler.java │ │ ├── PushSurfaceCommandHandler.java │ │ ├── PushSurfaceCommandHandlerForEffector.java │ │ ├── PushSurfaceCommandHandlerForSurfaceRender.java │ │ ├── SkipOutputFormatChangeCommandHandler.java │ │ └── TriangleVerticesCalculator.java │ └── test │ ├── java │ └── org │ │ └── m4m │ │ └── domain │ │ ├── AudioEffectorTest.java │ │ ├── AudioEncoderTest.java │ │ ├── BufferInfoTest.java │ │ ├── CameraCaptureFather.java │ │ ├── CameraCaptureTest.java │ │ ├── CameraSourceTest.java │ │ ├── CaptureSourceTest.java │ │ ├── CommandQueueTest.java │ │ ├── EncoderTest.java │ │ ├── EofFrameTest.java │ │ ├── FrameBufferTest.java │ │ ├── IsPairCommandSpecificationTest.java │ │ ├── IsPairQueueSpecificationTest.java │ │ ├── MediaFileInfoTest.java │ │ ├── MediaFileTest.java │ │ ├── MediaSourceTest.java │ │ ├── MicrophoneSourceTest.java │ │ ├── MultipleMediaSourceTest.java │ │ ├── PairTest.java │ │ ├── PluginTest.java │ │ ├── ProgressListenerStub.java │ │ ├── ProgressTrackerTest.java │ │ ├── RecognitionPipelineTest.java │ │ ├── ResamplerTest.java │ │ ├── SegmentAssert.java │ │ ├── SegmentTest.java │ │ ├── TestBase.java │ │ ├── TopologySolverTest.java │ │ ├── VideoDecoderTest.java │ │ ├── VideoEffectorTest.java │ │ ├── VideoEncoderTest.java │ │ ├── VideoFormatTest.java │ │ ├── WhenDecodeAudio.java │ │ ├── WhenDecoderInitializedTest.java │ │ ├── WhenDrainDecoder.java │ │ ├── WhenGetFileInfo.java │ │ ├── WhenPullFrameFromEncoder.java │ │ ├── WhenPullFrameFromMediaSource.java │ │ ├── WhenPullFrameFromMultipleMediaSource.java │ │ ├── WhenPullFrameFromVideoDecoder.java │ │ ├── WhenPushFrameToDecoder.java │ │ ├── WhenPushFrameToEncoder.java │ │ ├── WhenRenderInitialized.java │ │ ├── WhenSourceInitialized.java │ │ ├── WhenVideoDecoderFillsCommandQueues.java │ │ ├── commandHandler │ │ └── SpyCommandHandler.java │ │ ├── dsl │ │ ├── AudioDecoderFather.java │ │ ├── AudioEffectorFather.java │ │ ├── AudioEncoderFather.java │ │ ├── AudioFormatFake.java │ │ ├── AudioFormatFather.java │ │ ├── BrokenFather.java │ │ ├── CameraSourceFather.java │ │ ├── CommandProcessorAssert.java │ │ ├── CommandProcessorFather.java │ │ ├── CommandProcessorSpy.java │ │ ├── CommandQueueAssert.java │ │ ├── DecoderFather.java │ │ ├── Father.java │ │ ├── FatherOf.java │ │ ├── FrameFather.java │ │ ├── InfiniteCommandQueue.java │ │ ├── MediaCodecFather.java │ │ ├── MediaComposerFather.java │ │ ├── MediaExtractorFather.java │ │ ├── MediaFileFather.java │ │ ├── MediaFileInfoFather.java │ │ ├── MediaMuxerFather.java │ │ ├── MediaSourceAssert.java │ │ ├── MediaSourceFather.java │ │ ├── MediaStreamerFather.java │ │ ├── MicrophoneSourceFather.java │ │ ├── MultipleMediaSourceFather.java │ │ ├── PipelineFather.java │ │ ├── ProgressListenerAssert.java │ │ ├── ProgressListenerFather.java │ │ ├── RecognitionPipelineFather.java │ │ ├── RecognitionPluginAssert.java │ │ ├── RenderFather.java │ │ ├── ResamplerFather.java │ │ ├── ScreenCaptureFather.java │ │ ├── SinkAssert.java │ │ ├── StreamingParametersFather.java │ │ ├── SurfaceContainerFather.java │ │ ├── SurfaceFather.java │ │ ├── SurfaceRenderFather.java │ │ ├── VideoDecoderFather.java │ │ ├── VideoEffectAssert.java │ │ ├── VideoEffectorFather.java │ │ ├── VideoEncoderFather.java │ │ ├── VideoFormatFake.java │ │ └── VideoFormatFather.java │ │ ├── formatSetup │ │ └── WhenResolvePipeline.java │ │ ├── mediaComposer │ │ ├── AndroidMediaObjectFactoryFake.java │ │ ├── MediaComposerTest.java │ │ ├── ProgressListenerFake.java │ │ ├── WhenAddRemoveFiles.java │ │ ├── WhenAddSource.java │ │ ├── WhenApplyVideoEffect.java │ │ ├── WhenErrorOnStart.java │ │ ├── WhenGetDuration.java │ │ ├── WhenGetMediaFormat.java │ │ ├── WhenMediaDone.java │ │ ├── WhenRender.java │ │ ├── WhenReportProgress.java │ │ ├── WhenSingleTrack.java │ │ └── WhenTranscode.java │ │ └── pipeline │ │ ├── CommandHandlerFactoryTest.java │ │ ├── CommandProcessorTest.java │ │ ├── ConfigureVideoDecoderCommandHandlerSpy.java │ │ ├── ConfigureVideoDecoderCommandHandlerTest.java │ │ ├── CopyDataCommandHandlerTest.java │ │ ├── DrainCommandHandlerSpy.java │ │ ├── DrainCommandHandlerTest.java │ │ ├── DrainRenderCommandHandlerSpy.java │ │ ├── EncoderMediaFormatChangedCommandHandlerSpy.java │ │ ├── EofCommandHandlerSpy.java │ │ ├── MediaFormatChangedCommandHandlerTest.java │ │ ├── MuxRenderTest.java │ │ ├── OutputFormatChangedHandlerSpy.java │ │ ├── PipelineTest.java │ │ ├── PullDataCommandHandlerSpy.java │ │ ├── PushDataCommandHandlerSpy.java │ │ ├── PushDataCommandHandlerTest.java │ │ ├── PushSurfaceCommandHandlerSpy.java │ │ ├── PushSurfaceCommandHandlerTest.java │ │ ├── TriangleVerticesCalculatorTest.java │ │ ├── WhenOutputFormatChanged.java │ │ ├── WhenPipelineRelease.java │ │ ├── WhenProcessEofCommand.java │ │ ├── WhenProcessPullFrameCommand.java │ │ ├── WhenProcessPushFrameCommand.java │ │ └── WhenSinkReceivesEof.java │ └── resources │ └── logback-test.xml ├── effects ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── org │ └── m4m │ └── effects │ ├── AudioEffect.java │ ├── AudioReader.java │ ├── BlurEffectRS.java │ ├── DifferentRateAudioReader.java │ ├── EqualRateAudioReader.java │ ├── GrayScaleEffect.java │ ├── InverseEffect.java │ ├── JpegSubstituteEffect.java │ ├── MuteAudioEffect.java │ ├── OverlayEffect.java │ ├── RotateEffect.java │ ├── SepiaEffect.java │ ├── SubstituteAudioEffect.java │ └── TextOverlayEffect.java ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── how_to_contribute_to_M4M.txt ├── samples ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── org │ │ └── m4m │ │ └── samples │ │ ├── ActivityWithTimeline.java │ │ ├── CameraCapturerActivity.java │ │ ├── CameraStreamerActivity.java │ │ ├── CameraUtils.java │ │ ├── ComposerAudioEffectActivity.java │ │ ├── ComposerAudioEffectCoreActivity.java │ │ ├── ComposerCutActivity.java │ │ ├── ComposerCutCoreActivity.java │ │ ├── ComposerJoinActivity.java │ │ ├── ComposerJoinCoreActivity.java │ │ ├── ComposerMediaFileInfoActivity.java │ │ ├── ComposerMediaFileInfoCoreActivity.java │ │ ├── ComposerTimeScalingActivity.java │ │ ├── ComposerTimeScalingCoreActivity.java │ │ ├── ComposerTranscodeActivity.java │ │ ├── ComposerTranscodeCoreActivity.java │ │ ├── ComposerVideoEffectActivity.java │ │ ├── ComposerVideoEffectCoreActivity.java │ │ ├── DemoListAdapter.java │ │ ├── DemoListItem.java │ │ ├── ExpandableSamplesListAdapter.java │ │ ├── FPSCounter.java │ │ ├── Format.java │ │ ├── GameCapturing.java │ │ ├── GameRenderer.java │ │ ├── SamplesMainActivity.java │ │ ├── VideoCapture.java │ │ ├── VideoPlayerActivity.java │ │ └── controls │ │ ├── CameraCaptureSettingsPopup.java │ │ ├── GameCaptureSettingsPopup.java │ │ ├── GameGLSurfaceView.java │ │ ├── GameStreamingSettingsPopup.java │ │ ├── PlaybackToolbar.java │ │ ├── Popup.java │ │ ├── PopupMessage.java │ │ ├── RangeSelector.java │ │ ├── StreamingSettingsPopup.java │ │ ├── TimelineItem.java │ │ ├── TranscodeSurfaceView.java │ │ └── VideoPlayer.java │ └── res │ ├── anim │ ├── hide_bl_to_tr.xml │ ├── hide_br_to_tl.xml │ ├── hide_tl_to_br.xml │ ├── hide_tr_to_bl.xml │ ├── show_bl_to_tr.xml │ ├── show_br_to_tl.xml │ ├── show_tl_to_br.xml │ └── show_tr_to_bl.xml │ ├── drawable-hdpi │ ├── change_camera.png │ ├── effect_blur.png │ ├── effect_gray.png │ ├── effect_invert.png │ ├── effect_no.png │ ├── effect_sepia.png │ ├── effect_text.png │ ├── ic_delete.png │ ├── ic_empty_image.png │ ├── ic_open.png │ ├── ic_plus.png │ ├── rec_act.png │ ├── rec_inact.png │ └── settings.png │ ├── drawable-mdpi │ ├── change_camera.png │ ├── rec_act.png │ ├── rec_inact.png │ └── settings.png │ ├── drawable │ ├── activity_background.xml │ ├── background_popup.xml │ ├── background_toolbar.xml │ ├── bar_background.xml │ ├── button_pause.xml │ ├── button_pause_normal.png │ ├── button_pause_pressed.png │ ├── button_play.xml │ ├── button_play_normal.png │ ├── button_play_pressed.png │ ├── gallery_image_tint_active.xml │ ├── gallery_image_tint_normal.xml │ ├── gallery_item_active.xml │ ├── gallery_item_normal.xml │ ├── popup_message.xml │ ├── progress_bg.9.png │ ├── progress_fg.9.png │ ├── progress_play.xml │ ├── progress_play_thumb.xml │ ├── progress_thumb.png │ ├── round_border_button.xml │ ├── round_button.xml │ ├── round_focus_rect.xml │ ├── round_rect.xml │ ├── timeline_item_bar_background.xml │ ├── timeline_item_button_active.xml │ ├── timeline_item_button_background.xml │ ├── timeline_item_button_normal.xml │ └── toolbar_bg.png │ ├── layout │ ├── camera_capturer_activity.xml │ ├── camera_streamer_activity.xml │ ├── composer_cut_activity.xml │ ├── composer_join_activity.xml │ ├── composer_time_scaling_activity.xml │ ├── composer_transcode_activity.xml │ ├── composer_transcode_core_activity.xml │ ├── game_capturing.xml │ ├── main.xml │ ├── media_file_audio_info_table.xml │ ├── media_file_video_info_table.xml │ ├── media_streamer_activity.xml │ ├── playback_toolbar.xml │ ├── popup_camera_capture_settings.xml │ ├── popup_game_capture_settings.xml │ ├── popup_game_streaming_settings.xml │ ├── popup_message.xml │ ├── popup_streaming_settings.xml │ ├── recognition_activity.xml │ ├── sample_list_group.xml │ ├── sample_list_item.xml │ ├── streaming_params.xml │ ├── timeline_item.xml │ ├── video_player_activity.xml │ └── video_stream_player_activity.xml │ ├── menu │ └── game_capturing.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ └── values │ ├── strings.xml │ └── styles.xml └── settings.gradle /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | jdk: 3 | - oraclejdk8 4 | android: 5 | components: 6 | - platform-tools 7 | - tools 8 | - build-tools-24.0.0 9 | - android-24 10 | - extra-android-m2repository 11 | 12 | before_cache: 13 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 14 | 15 | cache: 16 | directories: 17 | - $HOME/.gradle/caches/ 18 | - $HOME/.gradle/wrapper/ 19 | 20 | script: ./gradlew test 21 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | } 5 | dependencies { 6 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' 7 | } 8 | } 9 | 10 | apply plugin: 'com.android.library' 11 | apply plugin: 'com.github.dcendents.android-maven' 12 | 13 | android { 14 | compileSdkVersion 25 15 | buildToolsVersion "25.0.3" 16 | 17 | defaultConfig { 18 | minSdkVersion 18 19 | targetSdkVersion 21 20 | versionCode 1 21 | versionName "1.0" 22 | } 23 | 24 | buildTypes { 25 | release { 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | } 31 | 32 | dependencies { 33 | compile project(':domain') 34 | testCompile 'junit:junit:4.12' 35 | } 36 | 37 | version = android.defaultConfig.versionName 38 | group = "org.m4m" -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /android/src/main/java/org/m4m/android/BufferInfoTranslator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.android; 18 | 19 | import android.media.MediaCodec; 20 | import org.m4m.domain.IMediaCodec; 21 | 22 | public class BufferInfoTranslator { 23 | 24 | public static IMediaCodec.BufferInfo convertFromAndroid(MediaCodec.BufferInfo androidBufferInfo, IMediaCodec.BufferInfo bufferInfo) 25 | { 26 | bufferInfo.flags = androidBufferInfo.flags; 27 | bufferInfo.presentationTimeUs = androidBufferInfo.presentationTimeUs; 28 | bufferInfo.offset = androidBufferInfo.offset; 29 | bufferInfo.size = androidBufferInfo.size; 30 | 31 | return bufferInfo; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /android/src/main/java/org/m4m/android/ByteBufferTranslator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.android; 18 | 19 | import android.media.MediaCodec; 20 | import org.m4m.domain.IMediaCodec; 21 | 22 | public class ByteBufferTranslator { 23 | public static MediaCodec.BufferInfo from(IMediaCodec.BufferInfo bufferInfo) { 24 | MediaCodec.BufferInfo result = new MediaCodec.BufferInfo(); 25 | result.flags = bufferInfo.flags; 26 | result.offset = bufferInfo.offset; 27 | result.size = bufferInfo.size; 28 | result.presentationTimeUs = bufferInfo.presentationTimeUs; 29 | return result; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /android/src/main/java/org/m4m/android/EGLContextWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.android; 18 | 19 | import android.opengl.EGL14; 20 | import android.opengl.EGLContext; 21 | import org.m4m.domain.IEglContext; 22 | import org.m4m.domain.IWrapper; 23 | 24 | public class EGLContextWrapper implements IWrapper, IEglContext { 25 | private EGLContext eglContext; 26 | 27 | public EGLContextWrapper(EGLContext eglContext) { 28 | this.eglContext = eglContext; 29 | } 30 | 31 | @Override 32 | public EGLContext getNativeObject() { 33 | return eglContext; 34 | } 35 | 36 | @Override 37 | public IEglContext getCurrentContext() { 38 | return new EGLContextWrapper(EGL14.eglGetCurrentContext()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /android/src/main/java/org/m4m/android/MediaCodecAudioDecoderPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.android; 18 | 19 | import android.media.MediaCodec; 20 | import org.m4m.domain.ISurfaceWrapper; 21 | import org.m4m.domain.MediaFormat; 22 | 23 | import java.io.IOException; 24 | 25 | public class MediaCodecAudioDecoderPlugin extends MediaCodecDecoderPlugin { 26 | public MediaCodecAudioDecoderPlugin() { 27 | super("audio/mp4a-latm"); 28 | } 29 | 30 | @Override 31 | public void configure(MediaFormat mediaFormat, ISurfaceWrapper surface, int flags) { 32 | mediaCodec.configure(MediaFormatTranslator.from(mediaFormat), null, null, flags); 33 | } 34 | 35 | @Override 36 | public void release() { 37 | mediaCodec.release(); 38 | } 39 | 40 | @Override 41 | public void recreate() { 42 | try { 43 | release(); 44 | this.mediaCodec = MediaCodec.createDecoderByType("audio/mp4a-latm"); 45 | } catch (IOException e) { 46 | e.printStackTrace(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /android/src/main/java/org/m4m/android/MediaFormatWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.android; 18 | 19 | import android.media.MediaFormat; 20 | 21 | import org.m4m.domain.IMediaFormatWrapper; 22 | import org.m4m.domain.Wrapper; 23 | 24 | public class MediaFormatWrapper extends Wrapper implements IMediaFormatWrapper { 25 | 26 | public MediaFormatWrapper(MediaFormat mediaFormat) { 27 | super(mediaFormat); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /android/src/main/java/org/m4m/android/MediaPipeline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.android; 18 | 19 | /** 20 | * This class represents media pipeline. 21 | */ 22 | public class MediaPipeline { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /android/src/main/java/org/m4m/android/SurfaceTextureWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.m4m.android; 17 | 18 | import android.graphics.SurfaceTexture; 19 | import org.m4m.domain.ISurfaceTexture; 20 | import org.m4m.domain.Wrapper; 21 | 22 | public class SurfaceTextureWrapper extends Wrapper implements ISurfaceTexture { 23 | public SurfaceTextureWrapper(SurfaceTexture surfaceTexture) { 24 | super(surfaceTexture); 25 | } 26 | 27 | @Override 28 | public float[] getTransformMatrix() { 29 | float[] transformMatrix = new float[16]; 30 | getNativeObject().getTransformMatrix(transformMatrix); 31 | return transformMatrix; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /android/src/main/java/org/m4m/android/SurfaceWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.android; 18 | 19 | import org.m4m.domain.ISurfaceWrapper; 20 | import org.m4m.domain.Wrapper; 21 | 22 | public class SurfaceWrapper extends Wrapper implements ISurfaceWrapper { 23 | 24 | SurfaceWrapper(android.view.Surface surface) { 25 | super(surface); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.3.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /domain/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: 'maven' 3 | 4 | dependencies { 5 | testCompile 'junit:junit:4.12' 6 | testCompile 'org.hamcrest:hamcrest-all:1.3' 7 | testCompile 'org.mockito:mockito-all:1.9.5' 8 | } 9 | 10 | sourceCompatibility = JavaVersion.VERSION_1_7 11 | targetCompatibility = JavaVersion.VERSION_1_7 12 | 13 | javadoc { 14 | exclude '**/org/m4m/domain/**' 15 | } -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/IProgressListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m; 18 | 19 | /** 20 | * Listener that notifies when composer changes state 21 | */ 22 | public interface IProgressListener { 23 | /** 24 | * Called to notify that composing started 25 | */ 26 | public void onMediaStart(); 27 | 28 | /** 29 | * Called to notify about current composing progress 30 | * 31 | * @param progress current progress as number [0, 1] 32 | */ 33 | public void onMediaProgress(float progress); 34 | 35 | /** 36 | * Called to notify that composing finished 37 | */ 38 | public void onMediaDone(); 39 | 40 | /** 41 | * Called to notify that composing paused 42 | */ 43 | public void onMediaPause(); 44 | 45 | /** 46 | * Called to notify that composing stopped 47 | */ 48 | public void onMediaStop(); 49 | 50 | /** 51 | * Called to notify that composing experienced some error 52 | * 53 | * @param exception 54 | */ 55 | public void onError(Exception exception); 56 | } 57 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/Uri.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m; 18 | 19 | /** 20 | * This class is used to store and pass Uri references that conform to RFC 2396 in String form. 21 | */ 22 | public class Uri { 23 | private String uri; 24 | 25 | /** 26 | * Instantiates an object using a specified URI. 27 | * 28 | * @param uri URI. 29 | */ 30 | public Uri(String uri) { 31 | this.uri = uri; 32 | } 33 | 34 | /** 35 | * Returns an URI. 36 | * 37 | * @return URI. 38 | */ 39 | public String getString() { 40 | return uri; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/AudioDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | 20 | public class AudioDecoder extends Decoder { 21 | public AudioDecoder(IMediaCodec mediaCodec) { 22 | super(mediaCodec, MediaFormatType.AUDIO); 23 | } 24 | 25 | @Override 26 | public void stop() { 27 | super.stop(); 28 | recreate(); 29 | } 30 | 31 | @Override 32 | public MediaFormat getOutputMediaFormat() { 33 | return outputMediaFormat; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/AudioSample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public class AudioSample { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/Command.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public enum Command { 20 | HasData, 21 | NeedData, 22 | OutputFormatChanged, 23 | NextPair, 24 | NeedInputFormat, 25 | Drained, 26 | EndOfFile, 27 | } 28 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ConnectedNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | 20 | import java.util.Collection; 21 | import java.util.LinkedList; 22 | 23 | class ConnectedNode { 24 | T node; 25 | LinkedList connectedTo = new LinkedList(); 26 | 27 | ConnectedNode(T node) { 28 | this.node = node; 29 | } 30 | 31 | public T value() { 32 | return node; 33 | } 34 | 35 | public boolean isConnected() { 36 | return !connectedTo.isEmpty(); 37 | } 38 | 39 | public Collection getConnector() { 40 | return connectedTo; 41 | } 42 | 43 | public void connect(T1 connector) { 44 | connectedTo.add(connector); 45 | } 46 | 47 | public void disconnect(T1 connector) { 48 | connectedTo.remove(connector); 49 | } 50 | 51 | public boolean isConnectedTo(T1 value) { 52 | return getConnector().contains(value); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/EofFrame.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.nio.ByteBuffer; 20 | 21 | class EofFrame extends Frame { 22 | public EofFrame() { 23 | super(ByteBuffer.allocate(0), -1, 0, 0, IMediaCodec.BUFFER_FLAG_END_OF_STREAM, -1); 24 | } 25 | 26 | @Override 27 | public boolean equals(Object o) { 28 | if (this == o) return true; 29 | if (o == null) return false; 30 | 31 | Frame frame = (Frame) o; 32 | return equals(frame); 33 | } 34 | 35 | public boolean equals(Frame frame) { 36 | return (frame.getFlags() & IMediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0 37 | || frame.getLength() == -1; 38 | } 39 | 40 | @Override 41 | public int hashCode() { 42 | return 0; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/FrameBuffer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.util.HashSet; 20 | import java.util.LinkedList; 21 | import java.util.Queue; 22 | import java.util.Set; 23 | 24 | class FrameBuffer { 25 | private int numberOfTracks; 26 | private final Set configuredTrackIndexes = new HashSet(); 27 | private final Queue frames = new LinkedList(); 28 | 29 | public FrameBuffer(int numberOfTracks) { 30 | this.numberOfTracks = numberOfTracks; 31 | } 32 | 33 | public void configure(int trackIndex) { 34 | configuredTrackIndexes.add(trackIndex); 35 | } 36 | 37 | public boolean areAllTracksConfigured() { 38 | return numberOfTracks == configuredTrackIndexes.size(); 39 | } 40 | 41 | public void push(Frame frame) { 42 | frames.add(frame); 43 | } 44 | 45 | public boolean canPull() { 46 | return areAllTracksConfigured() && !frames.isEmpty(); 47 | } 48 | 49 | public Frame pull() { 50 | return frames.poll(); 51 | } 52 | 53 | public void addTrack() { 54 | numberOfTracks++; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IAudioContentRecognition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package org.m4m.domain; 19 | 20 | import org.m4m.IRecognitionPlugin; 21 | 22 | public interface IAudioContentRecognition { 23 | 24 | public void setRecognizer(IRecognitionPlugin plugin); 25 | 26 | public void start(); 27 | public void stop(); 28 | } 29 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IAudioTrack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | 20 | public interface IAudioTrack { 21 | 22 | // static public int getMinBufferSize(int sampleRateInHz, int channelConfig, int audioFormat) { 23 | // /// TODO: to define the way of usage static methods from android API 24 | // return 0; 25 | // } 26 | 27 | void play(); 28 | 29 | void stop(); 30 | 31 | void release(); 32 | 33 | int write(byte[] audioData, int offsetInBytes, int sizeInBytes); 34 | } 35 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ICameraSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.io.Closeable; 20 | 21 | public interface ICameraSource extends IRunnable, IOutputRaw, IVideoOutput, Closeable { 22 | void setOutputSurface(ISurface surface); 23 | void setPreview(IPreview preview); 24 | void setCamera(Object camera); 25 | void configure(); 26 | Frame getFrame(); 27 | ISurface getSurface(); 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ICaptureSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface ICaptureSource extends IPluginOutput { 20 | /** 21 | * Initialize encoder with specific with and height, should be called from GLSurfaceView.Renderer.onSurfaceChanged 22 | * 23 | * @param width 24 | * @param height 25 | */ 26 | public void setSurfaceSize(int width, int height); 27 | 28 | /** 29 | * Will capture all draw function happened in-between 30 | */ 31 | public void beginCaptureFrame(); 32 | 33 | public void endCaptureFrame(); 34 | 35 | /** 36 | * start delivering end of stream 37 | */ 38 | //public void stopCapture(); 39 | 40 | 41 | /** 42 | * Register listener responsible to create and set surfaces to this source 43 | * 44 | * @param listenMe 45 | */ 46 | void addSetSurfaceListener(ISurfaceListener listenMe); 47 | } 48 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ICommandHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface ICommandHandler { 20 | public void handle(); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ICommandProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface ICommandProcessor { 20 | void process(); 21 | 22 | void add(OutputInputPair pair); 23 | 24 | void stop(); 25 | } 26 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IEffectorSurface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.m4m.domain.graphics.TextureRenderer; 20 | 21 | public interface IEffectorSurface extends ISurface { 22 | void getTransformMatrix(float[] projectionMatrix); 23 | 24 | int getSurfaceId(); 25 | 26 | void drawImage(int textureIdx, float[] matrix, TextureRenderer.FillMode fillMode); 27 | 28 | void drawImage2D(int textureIdx, float[] matrix); 29 | 30 | void drawImage2D(int textureIdx, float[] matrix, int angle, TextureRenderer.FillMode fillMode); 31 | 32 | void release(); 33 | } 34 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IEgl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | /** 20 | */ 21 | public interface IEgl { 22 | void init(int width, int height); 23 | 24 | void saveEglState(); 25 | 26 | void restoreEglState(); 27 | 28 | float[] getProjectionMatrix(); 29 | } 30 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IEglContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface IEglContext { 20 | IEglContext getCurrentContext(); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IFrameAllocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface IFrameAllocator { 20 | Frame findFreeFrame(); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IFrameBuffer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.m4m.domain; 17 | 18 | public interface IFrameBuffer { 19 | void setResolution(Resolution res); 20 | int getTextureId(); 21 | void release(); 22 | void bind(); 23 | void unbind(); 24 | } 25 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IHandlerCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface IHandlerCreator { 20 | ICommandHandler create(); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IInput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | 20 | import java.io.Closeable; 21 | 22 | public interface IInput extends IInputRaw, Closeable { 23 | void push(Frame frame); 24 | 25 | void drain(int bufferIndex); 26 | 27 | void setMediaFormat(MediaFormat mediaFormat); 28 | 29 | void skipProcessing(); 30 | 31 | int getTrackId(); 32 | 33 | void setTrackId(int trackId); 34 | } 35 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IInputRaw.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface IInputRaw { 20 | /** 21 | * Connection is always possible, if not connection might be possible in second attempt 22 | * 23 | * @param connector 24 | * @return 25 | */ 26 | boolean canConnectFirst(IOutputRaw connector); 27 | 28 | CommandQueue getInputCommandQueue(); 29 | 30 | void fillCommandQueues(); 31 | } 32 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IMediaExtractor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.m4m.Uri; 20 | 21 | import java.io.FileDescriptor; 22 | import java.nio.ByteBuffer; 23 | 24 | /** 25 | * IMediaExtractor abstract interface for MediaExtractor class 26 | */ 27 | public interface IMediaExtractor { 28 | public static final int SEEK_TO_PREVIOUS_SYNC = 0; 29 | public static final int SEEK_TO_NEXT_SYNC = 1; 30 | public static final int SEEK_TO_CLOSEST_SYNC = 2; 31 | 32 | int readSampleData(ByteBuffer inputBuffer); 33 | 34 | MediaFormat getTrackFormat(int i); 35 | 36 | long getSampleTime(); 37 | 38 | boolean advance(); 39 | 40 | int getTrackCount(); 41 | 42 | void selectTrack(int index); 43 | 44 | void unselectTrack(int index); 45 | 46 | int getSampleTrackIndex(); 47 | 48 | void release(); 49 | 50 | int getSampleFlags(); 51 | 52 | void seekTo(long timeUs, int mode); 53 | 54 | int getRotation(); 55 | 56 | String getFilePath(); 57 | 58 | FileDescriptor getFileDescriptor(); 59 | 60 | Uri getUri(); 61 | } 62 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IMediaFormatWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface IMediaFormatWrapper { 20 | } 21 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IMediaMuxer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.nio.ByteBuffer; 20 | 21 | public interface IMediaMuxer { 22 | int addTrack(MediaFormat mediaFormat); 23 | 24 | void release(); 25 | 26 | void setOrientationHint(int degrees); 27 | 28 | void start(); 29 | 30 | void stop(); 31 | 32 | void writeSampleData(int trackIndex, ByteBuffer byteBuf, IMediaCodec.BufferInfo bufferInfo); 33 | } -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IMediaSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.m4m.domain; 17 | 18 | public interface IMediaSource extends IOutput, IVideoOutput { 19 | public abstract int getTrackIdByMediaType(MediaFormatType mediaFormatType); 20 | public abstract void selectTrack(int trackId); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IMicrophoneSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface IMicrophoneSource extends IOutput { 20 | void configure(int sampleRate, int channels); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IOnFrameAvailableListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface IOnFrameAvailableListener { 20 | void onFrameAvailable(); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IOnSurfaceReady.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.m4m.domain; 17 | 18 | public interface IOnSurfaceReady { 19 | void onSurfaceReady(); 20 | } 21 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IOutput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.io.Closeable; 20 | 21 | public interface IOutput extends IRunnable, IOutputRaw, Closeable { 22 | void pull(Frame frame); 23 | 24 | MediaFormat getMediaFormatByType(MediaFormatType mediaFormatType); 25 | 26 | boolean isLastFile(); 27 | 28 | void incrementConnectedPluginsCount(); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IOutputRaw.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface IOutputRaw { 20 | /** 21 | * Connection is always possible, if not connection might be possible in second attempt 22 | * 23 | * @param connector 24 | * @return 25 | */ 26 | boolean canConnectFirst(IInputRaw connector); 27 | 28 | CommandQueue getOutputCommandQueue(); 29 | 30 | void fillCommandQueues(); 31 | } 32 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IPluginOutput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface IPluginOutput extends IOutput, IReadyFrameProvider, ISurfaceProvider { 20 | void setOutputSurface(ISurface surface); 21 | 22 | MediaFormatType getMediaFormatType(); 23 | 24 | MediaFormat getOutputMediaFormat(); 25 | 26 | void setTrackId(int trackId); 27 | 28 | void setOutputTrackId(int trackId); 29 | 30 | void releaseOutputBuffer(int outputBufferIndex); 31 | } 32 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IPreview.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.m4m.domain; 17 | 18 | import org.m4m.IVideoEffect; 19 | import org.m4m.domain.graphics.TextureRenderer; 20 | 21 | public interface IPreview { 22 | void setActiveEffect(IVideoEffect effectApplied); 23 | 24 | PreviewContext getSharedContext(); 25 | 26 | void updateCameraParameters(); 27 | 28 | void start(); 29 | 30 | void stop(); 31 | 32 | void setListener(IOnFrameAvailableListener listener); 33 | 34 | void renderSurfaceFromFrameBuffer(int id); 35 | 36 | void requestRendering(); 37 | 38 | void setOrientation(int screenOrientation); 39 | 40 | int getOrientation(); 41 | 42 | public void setFillMode(TextureRenderer.FillMode fillMode); 43 | 44 | public TextureRenderer.FillMode getFillMode(); 45 | } 46 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IReadyFrameProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | interface IReadyFrameProvider { 20 | Frame getFrame(); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | interface IRunnable { 20 | void start(); 21 | 22 | void stop(); 23 | } 24 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ISpecification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | interface ISpecification { 20 | boolean satisfiedBy(T a, T b); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ISurface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface ISurface { 20 | void awaitNewImage(); 21 | 22 | void drawImage(); 23 | 24 | void setPresentationTime(long presentationTimeInNanoSeconds); 25 | 26 | void swapBuffers(); 27 | 28 | void makeCurrent(); 29 | 30 | ISurfaceWrapper getCleanObject(); 31 | 32 | void setProjectionMatrix(float[] projectionMatrix); 33 | 34 | void setViewport(); 35 | 36 | void setInputSize(int width, int height); 37 | Resolution getInputSize(); 38 | 39 | void release(); 40 | 41 | void updateTexImage(); 42 | 43 | void awaitAndCopyNewImage(); 44 | } 45 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ISurfaceCreatedListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | 20 | public interface ISurfaceCreatedListener { 21 | public void onSurfaceCreated(ISurfaceListener obj1); 22 | } 23 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ISurfaceCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface ISurfaceCreator { 20 | /* 21 | * When create properly initialized and get surface can be called*/ 22 | void onSurfaceAvailable(IOnSurfaceReady listener); 23 | ISurface getSurface(); 24 | 25 | ISurface getSimpleSurface(IEglContext sharedContext); 26 | 27 | void notifySurfaceReady(ISurface surface); 28 | } 29 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ISurfaceListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface ISurfaceListener { 20 | public void onSurfaceAvailable(IEglContext eglContext); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ISurfaceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | interface ISurfaceProvider { 20 | ISurface getSurface(); 21 | 22 | void waitForSurface(long pts); 23 | } 24 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ISurfaceTexture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface ISurfaceTexture { 20 | float[] getTransformMatrix(); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ISurfaceWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface ISurfaceWrapper { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ITopologyTree.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.util.Collection; 20 | 21 | interface ITopologyTree { 22 | abstract T current(); 23 | 24 | abstract Collection> next(); 25 | } 26 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ITransform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface ITransform extends IOutput, IInput { 20 | void recreate(); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IVideoOutput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain;// 18 | 19 | public interface IVideoOutput extends IOutputRaw { 20 | Resolution getOutputResolution(); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public interface IWrapper { 20 | T getNativeObject(); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/IsConnectable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.util.Collection; 20 | 21 | public interface IsConnectable { 22 | //1->N connection 23 | boolean isConnectable(IOutputRaw output, Collection input); 24 | 25 | //N->1 connection 26 | boolean isConnectable(Collection output, IInputRaw input); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/MatchingCommands.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.util.ArrayList; 20 | 21 | public final class MatchingCommands extends ArrayList> { 22 | public MatchingCommands() { 23 | super(); 24 | add(new Pair(Command.HasData, Command.NeedData)); 25 | add(new Pair(Command.HasData, Command.NeedInputFormat)); 26 | add(new Pair(Command.OutputFormatChanged, Command.NeedInputFormat)); 27 | add(new Pair(Command.OutputFormatChanged, Command.NeedData)); 28 | add(new Pair(Command.EndOfFile, Command.NeedInputFormat)); 29 | add(new Pair(Command.EndOfFile, Command.NeedData)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/MediaFormat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.nio.ByteBuffer; 20 | 21 | public abstract class MediaFormat { 22 | protected static final java.lang.String KEY_MIME = "mime"; 23 | protected static final java.lang.String KEY_DURATION = "durationUs"; 24 | 25 | public String getMimeType() { 26 | return getString(KEY_MIME); 27 | } 28 | 29 | public long getDuration() { 30 | return getLong(KEY_DURATION); 31 | } 32 | 33 | abstract public ByteBuffer getByteBuffer(String key); 34 | 35 | abstract protected void setInteger(String key, int value); 36 | 37 | abstract protected int getInteger(String key); 38 | 39 | abstract protected long getLong(String key); 40 | 41 | abstract protected String getString(String key); 42 | } 43 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/MediaFormatType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public enum MediaFormatType { 20 | VIDEO("video"), 21 | AUDIO("audio"); 22 | 23 | private final String type; 24 | 25 | private MediaFormatType(String type) { 26 | this.type = type; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return type; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/OutputInputPair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public class OutputInputPair { 20 | public IOutputRaw output; 21 | public IInputRaw input; 22 | public CommandHandlerFactory commandHandlerFactory; 23 | 24 | public OutputInputPair(IOutputRaw output, IInputRaw input, CommandHandlerFactory commandHandlerFactory) { 25 | this.output = output; 26 | this.input = input; 27 | this.commandHandlerFactory = commandHandlerFactory; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/PairQueueSpecification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.util.List; 20 | 21 | class PairQueueSpecification implements ISpecification { 22 | private final PairCommandSpecification pairCommandSpecification; 23 | 24 | public PairQueueSpecification(List> matchingCommands) { 25 | pairCommandSpecification = new PairCommandSpecification(matchingCommands); 26 | } 27 | 28 | @Override 29 | public boolean satisfiedBy(CommandQueue sourceQueue, CommandQueue targetQueue) { 30 | Pair sourceCommand = sourceQueue.first(); 31 | Pair targetCommand = targetQueue.first(); 32 | if (targetCommand == null) return false; 33 | if (targetCommand.left == Command.NextPair) return true; 34 | if (sourceCommand == null) return false; 35 | if (sourceCommand.left == Command.NextPair) return true; 36 | return pairCommandSpecification.satisfiedBy(sourceCommand, targetCommand); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/PluginState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | enum PluginState { 20 | Normal, 21 | Starting, 22 | Draining, 23 | Drained, 24 | Paused, 25 | } 26 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/PreviewContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public class PreviewContext { 20 | ISurfaceTexture previewTexture; 21 | int previewTextureId; 22 | IEglContext eglContext; 23 | 24 | public PreviewContext(ISurfaceTexture previewTexture, int previewTextureId, IEglContext eglContext) { 25 | this.previewTexture = previewTexture; 26 | this.previewTextureId = previewTextureId; 27 | this.eglContext = eglContext; 28 | } 29 | 30 | public IEglContext getEglContext() { 31 | return eglContext; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/ProgressTracker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public class ProgressTracker { 20 | private float finish = 0f; 21 | private float currentProgress = 0f; 22 | 23 | public float getProgress() { 24 | return currentProgress / finish; 25 | } 26 | 27 | public void setFinish(float finish) { 28 | this.finish = finish; 29 | } 30 | 31 | public void track(float currentProgress) { 32 | if (currentProgress > this.currentProgress) { 33 | this.currentProgress = currentProgress; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/Render.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.m4m.domain.pipeline.IOnStopListener; 20 | 21 | public abstract class Render extends Input { 22 | protected IOnStopListener onStopListener; 23 | 24 | public abstract int getTrackIdByMediaFormat(MediaFormat mediaFormat); 25 | 26 | public abstract void start(); 27 | 28 | public void addOnStopListener(IOnStopListener onStopListener) { 29 | this.onStopListener = onStopListener; 30 | } 31 | 32 | public void pushWithReleaser(Frame frame, IPluginOutput releaser) {} 33 | 34 | public void syncSampleTimes(long sampleTime) { 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/Resolution.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.io.Serializable; 20 | 21 | public class Resolution implements Serializable { 22 | private final int width; 23 | private final int height; 24 | 25 | public Resolution(int width, int height) { 26 | this.width = width; 27 | this.height = height; 28 | } 29 | 30 | public int width() { 31 | return width; 32 | } 33 | 34 | public int height() { 35 | return height; 36 | } 37 | 38 | @Override 39 | public boolean equals(Object o) { 40 | if (this == o) return true; 41 | if (o == null || getClass() != o.getClass()) return false; 42 | 43 | Resolution that = (Resolution) o; 44 | 45 | if (height != that.height) return false; 46 | if (width != that.width) return false; 47 | 48 | return true; 49 | } 50 | 51 | @Override 52 | public int hashCode() { 53 | int result = width; 54 | result = 31 * result + height; 55 | return result; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/SampleRate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public enum SampleRate { 20 | SAMPLE_RATE_8000(8000), 21 | SAMPLE_RATE_16000(16000), 22 | SAMPLE_RATE_24000(24000), 23 | SAMPLE_RATE_22050(22050), 24 | SAMPLE_RATE_32000(32000), 25 | SAMPLE_RATE_44100(44100), 26 | SAMPLE_RATE_48000(48000); 27 | 28 | private final int sampleRate; 29 | 30 | private SampleRate(int sampleRate) { 31 | this.sampleRate = sampleRate; 32 | } 33 | 34 | public int getValue() { 35 | return sampleRate; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/SurfaceRender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.m4m.domain; 17 | 18 | 19 | public abstract class SurfaceRender extends Render { 20 | public abstract void onSurfaceAvailable(IOnSurfaceReady listener); 21 | public abstract ISurface getSurface() ; 22 | } 23 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/TopologyNet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import java.util.Collection; 20 | 21 | class TopologyNet implements ITopologyTree { 22 | Object value; 23 | private Collection mRight; 24 | 25 | TopologyNet(Object current) { 26 | value = current; 27 | } 28 | 29 | @Override 30 | public Object current() { 31 | return value; 32 | } 33 | 34 | @Override 35 | public Collection next() { 36 | return mRight; 37 | } 38 | 39 | public void setNext(Collection mRight) { 40 | this.mRight = mRight; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/Wrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | public class Wrapper implements IWrapper { 20 | private T t; 21 | 22 | public Wrapper(T t){ 23 | this.t = t; 24 | } 25 | 26 | /* 27 | public void setNativeObject(T t){ 28 | this.t = t; 29 | }*/ 30 | 31 | @Override 32 | public T getNativeObject(){ 33 | return t; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/graphics/IShaderProgram.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.graphics; 18 | 19 | public interface IShaderProgram { 20 | void create(String vertexCode, String fragmentCode); 21 | 22 | void use(); 23 | 24 | void unUse(); 25 | 26 | int getAttributeLocation(String attribute); 27 | } 28 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/graphics/Program.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.graphics; 18 | 19 | public class Program { 20 | public int programHandle; 21 | public int positionHandle; 22 | public int textureHandle; 23 | public int mvpMatrixHandle; 24 | public int stMatrixHandle; 25 | } 26 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/graphics/TextureType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.graphics; 18 | 19 | public enum TextureType { 20 | GL_TEXTURE_2D, 21 | GL_TEXTURE_EXTERNAL_OES 22 | } 23 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/AudioOutputFormatChangedCommandHadler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.Frame; 20 | import org.m4m.domain.ICommandHandler; 21 | import org.m4m.domain.MediaCodecPlugin; 22 | import org.m4m.domain.MediaFormat; 23 | 24 | class AudioPipelineOutputFormatChangeCommandHandler implements ICommandHandler { 25 | private MediaCodecPlugin output; 26 | private MediaCodecPlugin input; 27 | 28 | public AudioPipelineOutputFormatChangeCommandHandler(MediaCodecPlugin output, MediaCodecPlugin input) { 29 | super(); 30 | this.output = output; 31 | this.input = input; 32 | } 33 | 34 | @Override 35 | public void handle() { 36 | MediaFormat decoderMediaFormat = output.getOutputMediaFormat(); 37 | input.setInputMediaFormat(decoderMediaFormat); 38 | input.push(Frame.empty()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/ConfigureVideoDecoderCommandHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.Command; 20 | import org.m4m.domain.ICommandHandler; 21 | import org.m4m.domain.IVideoOutput; 22 | import org.m4m.domain.Plugin; 23 | 24 | class ConfigureVideoDecoderCommandHandler implements ICommandHandler { 25 | protected final IVideoOutput output; 26 | private final Plugin input; 27 | 28 | public ConfigureVideoDecoderCommandHandler(IVideoOutput output, Plugin decoder) { 29 | this.output = output; 30 | input = decoder; 31 | } 32 | 33 | @Override 34 | public void handle() { 35 | output.getOutputCommandQueue().queue(Command.HasData, input.getTrackId()); 36 | input.setInputResolution(output.getOutputResolution()); 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/ConfigureVideoEffectorCommandHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline;// 18 | 19 | import org.m4m.domain.Command; 20 | import org.m4m.domain.ICommandHandler; 21 | import org.m4m.domain.IVideoOutput; 22 | import org.m4m.domain.Plugin; 23 | 24 | class ConfigureVideoEffectorCommandHandler implements ICommandHandler { 25 | private final IVideoOutput output; 26 | private final Plugin input; 27 | 28 | public ConfigureVideoEffectorCommandHandler(IVideoOutput output, Plugin decoder) { 29 | this.output = output; 30 | input = decoder; 31 | } 32 | 33 | @Override 34 | public void handle() { 35 | output.getOutputCommandQueue().queue(Command.OutputFormatChanged, input.getTrackId()); 36 | input.getInputCommandQueue().queue(Command.NeedData, input.getTrackId()); 37 | 38 | input.setInputResolution(output.getOutputResolution()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/DrainCommandHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.ICommandHandler; 20 | import org.m4m.domain.MediaCodecPlugin; 21 | 22 | class DrainCommandHandler implements ICommandHandler { 23 | protected final MediaCodecPlugin plugin; 24 | 25 | public DrainCommandHandler(MediaCodecPlugin plugin) { 26 | this.plugin = plugin; 27 | } 28 | 29 | @Override 30 | public void handle() { 31 | plugin.drain(0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/DrainRenderCommandHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package org.m4m.domain.pipeline; 19 | 20 | import org.m4m.domain.ICommandHandler; 21 | import org.m4m.domain.Render; 22 | 23 | public class DrainRenderCommandHandler implements ICommandHandler { 24 | protected final Render render; 25 | 26 | public DrainRenderCommandHandler(Render render) { 27 | this.render = render; 28 | } 29 | 30 | @Override 31 | public void handle() { 32 | render.drain(0); 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/EncoderMediaFormatChangedCommandHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.ICommandHandler; 20 | import org.m4m.domain.Plugin; 21 | import org.m4m.domain.Render; 22 | 23 | class EncoderMediaFormatChangedCommandHandler implements ICommandHandler { 24 | protected Plugin plugin; 25 | protected Render render; 26 | 27 | public EncoderMediaFormatChangedCommandHandler(Plugin plugin, Render render) { 28 | this.plugin = plugin; 29 | this.render = render; 30 | } 31 | 32 | @Override 33 | public void handle() { 34 | render.setMediaFormat(plugin.getOutputMediaFormat()); 35 | plugin.setOutputTrackId(render.getTrackIdByMediaFormat(plugin.getOutputMediaFormat())); 36 | render.start(); 37 | plugin.checkIfOutputQueueHasData(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/IConnector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | interface IConnector { 20 | } 21 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/IOnStopListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | public interface IOnStopListener { 20 | void onStop(); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/ManyTypes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | class ManyTypes { 20 | private final Class[] types; 21 | 22 | public ManyTypes(Class... types) { 23 | this.types = types; 24 | } 25 | 26 | public Class[] getTypes() { 27 | return types; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/PullDataCommandHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.Frame; 20 | import org.m4m.domain.ICommandHandler; 21 | import org.m4m.domain.IPluginOutput; 22 | import org.m4m.domain.Render; 23 | 24 | class PullDataCommandHandler implements ICommandHandler { 25 | protected Render input; 26 | protected IPluginOutput output; 27 | 28 | public PullDataCommandHandler(IPluginOutput output, Render input) { 29 | super(); 30 | this.input = input; 31 | this.output = output; 32 | } 33 | 34 | @Override 35 | public void handle() { 36 | Frame frame = output.getFrame(); 37 | 38 | input.pushWithReleaser(frame, output); 39 | //input.push(frame); 40 | //output.releaseOutputBuffer(frame.getBufferIndex()); 41 | if (Frame.EOF().equals(frame)) { 42 | input.drain(frame.getBufferIndex()); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/PushNewDataCommandHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.Frame; 20 | import org.m4m.domain.ICommandHandler; 21 | import org.m4m.domain.IOutput; 22 | import org.m4m.domain.Render; 23 | 24 | import java.nio.ByteBuffer; 25 | 26 | 27 | class PushNewDataCommandHandler implements ICommandHandler { 28 | private IOutput output; 29 | private Render render; 30 | 31 | public PushNewDataCommandHandler(IOutput output, Render render) { 32 | super(); 33 | this.output = output; 34 | this.render = render; 35 | } 36 | 37 | @Override 38 | public void handle() { 39 | Frame frame = new Frame(ByteBuffer.allocate(1024 * 1024), 1024 * 1024, 0, 0, 0, 0); 40 | output.pull(frame); 41 | render.push(frame); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/PushSurfaceCommandHandlerForEffector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.Frame; 20 | import org.m4m.domain.ICommandHandler; 21 | import org.m4m.domain.IPluginOutput; 22 | import org.m4m.domain.Plugin; 23 | 24 | /* Will be merged with PushSurfaceCommandHandler. It should be one universal 25 | * handler version suits for all component used GL surface. 26 | */ 27 | class PushSurfaceCommandHandlerForEffector implements ICommandHandler { 28 | protected final IPluginOutput output; 29 | protected final Plugin input; 30 | 31 | public PushSurfaceCommandHandlerForEffector(IPluginOutput output, Plugin input) { 32 | this.output = output; 33 | this.input = input; 34 | } 35 | 36 | @Override 37 | public void handle() { 38 | Frame frame = output.getFrame(); 39 | output.releaseOutputBuffer(frame.getBufferIndex()); 40 | 41 | input.push(frame); 42 | input.checkIfOutputQueueHasData(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/PushSurfaceCommandHandlerForSurfaceRender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.m4m.domain.pipeline; 17 | 18 | import org.m4m.domain.Frame; 19 | import org.m4m.domain.ICommandHandler; 20 | import org.m4m.domain.IPluginOutput; 21 | import org.m4m.domain.SurfaceRender; 22 | 23 | public class PushSurfaceCommandHandlerForSurfaceRender implements ICommandHandler { 24 | private IPluginOutput decoder; 25 | private SurfaceRender render; 26 | 27 | public PushSurfaceCommandHandlerForSurfaceRender(IPluginOutput decoder, SurfaceRender render) { 28 | this.decoder = decoder; 29 | this.render = render; 30 | } 31 | @Override 32 | public void handle() { 33 | Frame frame = decoder.getFrame(); 34 | if (!frame.equals(Frame.EOF())) { 35 | decoder.releaseOutputBuffer(frame.getBufferIndex()); 36 | } 37 | 38 | render.push(frame); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /domain/src/main/java/org/m4m/domain/pipeline/SkipOutputFormatChangeCommandHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.Frame; 20 | import org.m4m.domain.ICommandHandler; 21 | import org.m4m.domain.IInput; 22 | 23 | class SkipOutputFormatChangeCommandHandler implements ICommandHandler { 24 | private IInput encoder; 25 | 26 | public SkipOutputFormatChangeCommandHandler(IInput encoder) { 27 | super(); 28 | this.encoder = encoder; 29 | } 30 | 31 | @Override 32 | public void handle() { 33 | encoder.push(Frame.empty()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/BufferInfoTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.junit.Test; 20 | import org.m4m.domain.IMediaCodec; 21 | 22 | import static org.junit.Assert.*; 23 | 24 | public class BufferInfoTest { 25 | @Test 26 | public void isEof_WhenEofFlagSet() { 27 | IMediaCodec.BufferInfo bufferInfo = new IMediaCodec.BufferInfo(); 28 | bufferInfo.flags = IMediaCodec.BUFFER_FLAG_END_OF_STREAM; 29 | 30 | assertTrue(bufferInfo.isEof()); 31 | } 32 | 33 | @Test 34 | public void isNotEof_WhenEofFlagNotSet() { 35 | IMediaCodec.BufferInfo bufferInfo = new IMediaCodec.BufferInfo(); 36 | bufferInfo.flags = 0; 37 | 38 | assertFalse(bufferInfo.isEof()); 39 | } 40 | 41 | @Test 42 | public void returnRightHashCode() { 43 | IMediaCodec.BufferInfo bufferInfo = new IMediaCodec.BufferInfo(); 44 | bufferInfo.flags = 1; 45 | bufferInfo.offset = 1; 46 | bufferInfo.presentationTimeUs = 3; 47 | bufferInfo.size = 2; 48 | assertEquals(bufferInfo.hashCode(), 30847); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/EofFrameTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.junit.Assert.*; 22 | 23 | public class EofFrameTest extends TestBase { 24 | @Test 25 | public void eofEqualsToEof() { 26 | assertEquals(Frame.EOF(), Frame.EOF()); 27 | assertTrue(Frame.EOF().equals(Frame.EOF())); 28 | } 29 | 30 | @Test 31 | public void eofNotEqualsToRegularFrame() { 32 | Frame frame = create.frame().construct(); 33 | Frame eof = Frame.EOF(); 34 | 35 | assertFalse(eof.equals(frame)); 36 | assertFalse(frame.equals(eof)); 37 | } 38 | 39 | @Test 40 | public void eofEqualsToFrameWithEofFLag() { 41 | Frame frame = create.frame().construct(); 42 | frame.setFlags(IMediaCodec.BUFFER_FLAG_END_OF_STREAM); 43 | Frame eof = Frame.EOF(); 44 | 45 | assertTrue(eof.equals(frame)); 46 | assertTrue(frame.equals(eof)); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/ProgressListenerStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.m4m.IProgressListener; 20 | 21 | public class ProgressListenerStub implements IProgressListener { 22 | @Override 23 | public void onMediaStart() {} 24 | 25 | @Override 26 | public void onMediaProgress(float progress) {} 27 | 28 | @Override 29 | public void onMediaDone() {} 30 | 31 | @Override 32 | public void onMediaPause() {} 33 | 34 | @Override 35 | public void onMediaStop() {} 36 | 37 | @Override 38 | public void onError(Exception exception) {} 39 | } 40 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/SegmentAssert.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.m4m.domain.Pair; 20 | import org.m4m.domain.Segments; 21 | 22 | import java.util.ArrayList; 23 | import java.util.Arrays; 24 | import java.util.List; 25 | 26 | import static org.hamcrest.Matchers.equalTo; 27 | import static org.hamcrest.Matchers.is; 28 | import static org.junit.Assert.assertThat; 29 | 30 | public class SegmentAssert { 31 | private final Segments segments; 32 | 33 | public SegmentAssert(Segments segments) { 34 | this.segments = segments; 35 | } 36 | 37 | public void equalsTo(Pair... expectedSegments) { 38 | List> actualSegments = new ArrayList>(); 39 | for (Pair actualSegment : segments.asCollection()) { 40 | actualSegments.add(actualSegment); 41 | } 42 | assertThat(actualSegments, is(equalTo(Arrays.asList(expectedSegments)))); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/WhenDecodeAudio.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.junit.Assert.assertTrue; 22 | 23 | public class WhenDecodeAudio extends TestBase { 24 | @Test 25 | public void canCreateAudioDecoderWithAudioFormat() { 26 | AudioDecoder audioDecoder = create.audioDecoder() 27 | .with(a.audioFormat().construct()) 28 | .construct(); 29 | 30 | assertTrue(audioDecoder.getMediaFormatByType(MediaFormatType.AUDIO).getMimeType().startsWith("audio")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/WhenDecoderInitializedTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.junit.Test; 20 | 21 | public class WhenDecoderInitializedTest extends TestBase { 22 | @Test 23 | public void addNeedInputFormatCommandToCommandQueue() { 24 | Plugin decoder = create.videoDecoder().construct(); 25 | decoder.setTrackId(0); 26 | 27 | assertThat(decoder.getInputCommandQueue()).equalsTo(Command.NeedInputFormat); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/WhenDrainDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.junit.Test; 20 | 21 | public class WhenDrainDecoder extends TestBase { 22 | @Test 23 | public void clearNeedDataFromInputQueue() throws Exception { 24 | Decoder decoder = create.videoDecoder().construct(); 25 | 26 | decoder.drain(0); 27 | 28 | assertThat(decoder.getInputCommandQueue()).isEmpty(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/WhenPushFrameToEncoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.junit.Ignore; 20 | import org.junit.Test; 21 | 22 | import static org.mockito.Mockito.verify; 23 | 24 | 25 | public class WhenPushFrameToEncoder extends TestBase { 26 | @Test 27 | @Ignore 28 | public void signalEndOfInputStream_WhenEof() throws Exception { 29 | IMediaCodec mediaCodec = create.mediaCodec().construct(); 30 | Encoder encoder = create.videoEncoder().with(mediaCodec).construct(); 31 | encoder.start(); 32 | 33 | encoder.push(Frame.EOF()); 34 | 35 | verify(mediaCodec).signalEndOfInputStream(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/WhenRenderInitialized.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain; 18 | 19 | import org.junit.Test; 20 | 21 | public class WhenRenderInitialized extends TestBase { 22 | @Test 23 | public void addFillInputCommandToCommandQueue() { 24 | Render render = create.render().construct(); 25 | assertThat(render.getInputCommandQueue()).isEmpty(); 26 | } 27 | } -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/commandHandler/SpyCommandHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.commandHandler; 18 | 19 | import org.m4m.domain.ICommandHandler; 20 | import org.m4m.domain.MediaSource; 21 | 22 | public class SpyCommandHandler implements ICommandHandler { 23 | private MediaSource mediaSource; 24 | 25 | public SpyCommandHandler(MediaSource mediaSource) { 26 | this.mediaSource = mediaSource; 27 | } 28 | 29 | @Override 30 | public void handle() { 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/AudioDecoderFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.domain.AudioDecoder; 20 | import org.m4m.domain.Frame; 21 | import org.m4m.domain.MediaFormat; 22 | import org.m4m.domain.MediaFormatType; 23 | 24 | public class AudioDecoderFather extends DecoderFather { 25 | public AudioDecoderFather(Father create) { 26 | super(create); 27 | with(MediaFormatType.AUDIO); 28 | with(create.audioFormat().construct()); 29 | } 30 | 31 | public AudioDecoderFather whichDecodesTo(Frame frame) { 32 | super.whichDecodesTo(frame); 33 | return this; 34 | } 35 | 36 | public AudioDecoderFather with(MediaFormat mediaFormat) { 37 | super.with(mediaFormat); 38 | return this; 39 | } 40 | 41 | public AudioDecoder construct() { 42 | AudioDecoder decoder = new AudioDecoder(mediaCodec != null ? mediaCodec : mediaCodecFather.construct()); 43 | decoder.setMediaFormat(mediaFormat); 44 | return decoder; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/AudioEffectorFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.domain.AudioEffector; 20 | 21 | public class AudioEffectorFather extends FatherOf { 22 | 23 | AudioEffectorFather(Father father) { 24 | super(father); 25 | } 26 | 27 | @Override 28 | public AudioEffector construct() { 29 | return new AudioEffector(create.mediaCodec().construct()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/FatherOf.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import java.io.IOException; 20 | 21 | public abstract class FatherOf { 22 | protected Father create; 23 | 24 | public FatherOf(Father create) { 25 | this.create = create; 26 | } 27 | 28 | public abstract T construct() throws IOException; 29 | } 30 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/InfiniteCommandQueue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.m4m.domain.dsl; 17 | 18 | import org.m4m.domain.Command; 19 | import org.m4m.domain.CommandQueue; 20 | import org.m4m.domain.Pair; 21 | 22 | import static org.m4m.domain.Command.EndOfFile; 23 | 24 | public class InfiniteCommandQueue extends CommandQueue { 25 | private Command infiniteCommand; 26 | 27 | InfiniteCommandQueue(Command infiniteCommand) { 28 | this.infiniteCommand = infiniteCommand; 29 | } 30 | 31 | @Override 32 | public void queue(Command command, Integer trackId) { 33 | if (command == EndOfFile) { 34 | super.clear(); 35 | } 36 | super.queue(command, trackId); 37 | } 38 | 39 | @Override 40 | public Pair dequeue() { 41 | if (dequeueLastCommand()) { 42 | if (EndOfFile != super.first().left) { 43 | queue(infiniteCommand, 0); 44 | } 45 | } 46 | return super.dequeue(); 47 | } 48 | 49 | private boolean dequeueLastCommand() { 50 | return queue.size() == 1; 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/MediaFileFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.MediaFile; 20 | import org.m4m.domain.Frame; 21 | 22 | public class MediaFileFather { 23 | private MediaSourceFather mediaSourceFather; 24 | 25 | public MediaFileFather(Father create) { 26 | mediaSourceFather = create.mediaSource(); 27 | } 28 | 29 | public MediaFileFather push(Frame frame) { 30 | mediaSourceFather.with(frame); 31 | return this; 32 | } 33 | 34 | public MediaFile construct() { 35 | return new MediaFile(mediaSourceFather.construct()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/MediaFileInfoFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.MediaFileInfo; 20 | import org.m4m.domain.MediaSource; 21 | import org.m4m.domain.mediaComposer.AndroidMediaObjectFactoryFake; 22 | 23 | public class MediaFileInfoFather extends FatherOf { 24 | AndroidMediaObjectFactoryFake androidMediaObjectFactoryFake; 25 | 26 | public MediaFileInfoFather(Father create) { 27 | super(create); 28 | androidMediaObjectFactoryFake = new AndroidMediaObjectFactoryFake(create); 29 | } 30 | 31 | public MediaFileInfoFather with(MediaSource mediaSource) { 32 | androidMediaObjectFactoryFake.withMediaSource(mediaSource); 33 | return this; 34 | } 35 | 36 | @Override 37 | public MediaFileInfo construct() { 38 | return new MediaFileInfo(androidMediaObjectFactoryFake); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/MediaMuxerFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.domain.IMediaMuxer; 20 | import org.mockito.invocation.InvocationOnMock; 21 | import org.mockito.stubbing.Answer; 22 | 23 | import static org.mockito.Mockito.doAnswer; 24 | import static org.mockito.Mockito.mock; 25 | 26 | public class MediaMuxerFather { 27 | private final IMediaMuxer mediaMuxer; 28 | 29 | public MediaMuxerFather() { 30 | mediaMuxer = mock(IMediaMuxer.class); 31 | } 32 | 33 | public MediaMuxerFather withSleepOnStart(final int sleep) { 34 | doAnswer(new Answer() { 35 | @Override 36 | public Object answer(InvocationOnMock invocation) throws Throwable { 37 | Thread.sleep(sleep); 38 | return null; 39 | } 40 | }).when(mediaMuxer).start(); 41 | return this; 42 | } 43 | 44 | public IMediaMuxer construct() { 45 | return mediaMuxer; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/MediaStreamerFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.domain.IMediaMuxer; 20 | 21 | import static org.mockito.Mockito.mock; 22 | 23 | public class MediaStreamerFather { 24 | private final IMediaMuxer mediaStreamer; 25 | 26 | public MediaStreamerFather() { 27 | mediaStreamer = mock(IMediaMuxer.class); 28 | } 29 | 30 | public IMediaMuxer construct() { 31 | return mediaStreamer; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/MicrophoneSourceFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.domain.IMicrophoneSource; 20 | 21 | import static org.mockito.Mockito.mock; 22 | 23 | public class MicrophoneSourceFather extends FatherOf { 24 | public MicrophoneSourceFather(Father create) { 25 | super(create); 26 | } 27 | 28 | public IMicrophoneSource construct() { 29 | return mock(IMicrophoneSource.class); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/ProgressListenerAssert.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.domain.mediaComposer.ProgressListenerFake; 20 | import org.hamcrest.Matcher; 21 | import org.junit.Assert; 22 | 23 | import static org.hamcrest.core.IsCollectionContaining.hasItem; 24 | 25 | public class ProgressListenerAssert { 26 | private final ProgressListenerFake progressListener; 27 | 28 | public ProgressListenerAssert(ProgressListenerFake progressListener) { 29 | this.progressListener = progressListener; 30 | } 31 | 32 | public void containsProgress(float... expectedProgresses) { 33 | for (float expectedProgress : expectedProgresses) { 34 | Assert.assertThat(progressListener.getProgress(), (Matcher) hasItem(expectedProgress)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/ResamplerFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.AudioFormat; 20 | import org.m4m.domain.Resampler; 21 | 22 | public class ResamplerFather extends FatherOf { 23 | private Resampler resampler = null; 24 | 25 | public ResamplerFather(Father father) { 26 | super(father); 27 | resampler = new Resampler(create.audioFormat().construct()); 28 | } 29 | 30 | public ResamplerFather withTargetAudioFormat(AudioFormat audioFormat) { 31 | resampler.setTargetParameters(audioFormat); 32 | return this; 33 | } 34 | 35 | public ResamplerFather withInputAudioFormat(AudioFormat audioFormat) { 36 | resampler.setInputParameters(audioFormat); 37 | return this; 38 | } 39 | 40 | public Resampler construct() { 41 | return resampler; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/ScreenCaptureFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.domain.ICaptureSource; 20 | 21 | import static org.mockito.Mockito.mock; 22 | 23 | public class ScreenCaptureFather extends FatherOf { 24 | ScreenCaptureFather(Father father) { 25 | super(father); 26 | } 27 | 28 | @Override 29 | public ICaptureSource construct() { 30 | return mock(ICaptureSource.class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/SinkAssert.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.domain.Frame; 20 | import org.m4m.domain.IPluginOutput; 21 | import org.m4m.domain.Render; 22 | import org.junit.Assert; 23 | import org.mockito.ArgumentCaptor; 24 | 25 | import static org.hamcrest.Matchers.equalTo; 26 | import static org.hamcrest.Matchers.is; 27 | import static org.mockito.Matchers.any; 28 | import static org.mockito.Mockito.verify; 29 | 30 | public class SinkAssert { 31 | private final Render sink; 32 | 33 | public SinkAssert(Render sink) { 34 | this.sink = sink; 35 | } 36 | 37 | public void willReceive(Frame expectedFrame) { 38 | ArgumentCaptor frame = ArgumentCaptor.forClass(Frame.class); 39 | verify(sink).pushWithReleaser(frame.capture(), any(IPluginOutput.class)); 40 | Assert.assertThat(frame.getValue().getByteBuffer().array(), is(equalTo(expectedFrame.getByteBuffer().array()))); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/SurfaceContainerFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.domain.ISurfaceWrapper; 20 | 21 | import static org.mockito.Mockito.mock; 22 | 23 | public class SurfaceContainerFather { 24 | public ISurfaceWrapper construct() { 25 | return mock(ISurfaceWrapper.class); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/SurfaceFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.dsl; 18 | 19 | import org.m4m.domain.ISurface; 20 | import org.m4m.domain.ISurfaceWrapper; 21 | 22 | import static org.mockito.Mockito.mock; 23 | import static org.mockito.Mockito.when; 24 | 25 | public class SurfaceFather { 26 | ISurfaceWrapper container = null; 27 | 28 | public SurfaceFather with(ISurfaceWrapper container) { 29 | this.container = container; 30 | return this; 31 | } 32 | 33 | public ISurface construct() { 34 | ISurface surface = mock(ISurface.class); 35 | if (container != null) { 36 | when(surface.getCleanObject()).thenReturn(container); 37 | } 38 | return surface; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/SurfaceRenderFather.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.m4m.domain.dsl; 17 | 18 | import org.m4m.domain.SurfaceRender; 19 | 20 | import static org.mockito.Mockito.mock; 21 | 22 | public class SurfaceRenderFather { 23 | public SurfaceRenderFather(Father father) { 24 | 25 | } 26 | public SurfaceRender construct() { 27 | return mock(SurfaceRender.class); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/dsl/VideoEffectAssert.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.m4m.domain.dsl; 17 | 18 | import org.m4m.IVideoEffect; 19 | import org.m4m.domain.Frame; 20 | 21 | import static org.mockito.Matchers.any; 22 | import static org.mockito.Matchers.anyInt; 23 | import static org.mockito.Matchers.eq; 24 | import static org.mockito.Mockito.*; 25 | 26 | public class VideoEffectAssert { 27 | private IVideoEffect videoEffect; 28 | 29 | public VideoEffectAssert(IVideoEffect videoEffect) {this.videoEffect = videoEffect;} 30 | 31 | public void received(Frame frame) { 32 | verify(videoEffect, atLeastOnce()).applyEffect(anyInt(), eq(frame.getSampleTime()), any(float[].class)); 33 | } 34 | 35 | public void receivedDuring(Frame frame, int milis) { 36 | verify(videoEffect, timeout(milis).atLeastOnce()).applyEffect(anyInt(), eq(frame.getSampleTime()), any(float[].class)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/mediaComposer/WhenGetMediaFormat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.mediaComposer; 18 | 19 | import org.m4m.AudioFormat; 20 | import org.m4m.VideoFormat; 21 | import org.m4m.domain.dsl.MediaSourceFather; 22 | import org.junit.Test; 23 | 24 | import static org.junit.Assert.assertEquals; 25 | 26 | public class WhenGetMediaFormat extends MediaComposerTest { 27 | @Test 28 | public void canGetAudioFormat() { 29 | MediaSourceFather mediaSource = create.mediaSource().withAudioTrack(0); 30 | mediaComposer = create.mediaComposer().with(mediaSource).construct(); 31 | AudioFormat audioFormat = create.audioFormat().construct(); 32 | 33 | mediaComposer.setTargetAudioFormat(audioFormat); 34 | 35 | assertEquals(audioFormat, mediaComposer.getTargetAudioFormat()); 36 | } 37 | 38 | @Test 39 | public void canGetVideoFormat() { 40 | VideoFormat videoFormat = create.videoFormat().construct(); 41 | 42 | mediaComposer.setTargetVideoFormat(videoFormat); 43 | 44 | assertEquals(videoFormat, mediaComposer.getTargetVideoFormat()); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/pipeline/ConfigureVideoDecoderCommandHandlerSpy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline;// 18 | 19 | import org.m4m.domain.IVideoOutput; 20 | import org.m4m.domain.VideoDecoder; 21 | import org.m4m.domain.dsl.CommandProcessorSpy; 22 | 23 | public class ConfigureVideoDecoderCommandHandlerSpy extends ConfigureVideoDecoderCommandHandler { 24 | private final CommandProcessorSpy commandProcessorSpy; 25 | private final VideoDecoder input; 26 | 27 | public ConfigureVideoDecoderCommandHandlerSpy(IVideoOutput output, VideoDecoder input, CommandProcessorSpy processor) { 28 | super(output, input); 29 | this.input = input; 30 | this.commandProcessorSpy = processor; 31 | } 32 | 33 | @Override 34 | public void handle() { 35 | commandProcessorSpy.logPair(output, input); 36 | super.handle(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/pipeline/ConfigureVideoDecoderCommandHandlerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.ISurface; 20 | import org.m4m.domain.MultipleMediaSource; 21 | import org.m4m.domain.TestBase; 22 | import org.m4m.domain.VideoDecoder; 23 | import org.junit.Test; 24 | 25 | import static org.mockito.Matchers.eq; 26 | import static org.mockito.Mockito.verify; 27 | 28 | 29 | public class ConfigureVideoDecoderCommandHandlerTest extends TestBase { 30 | @Test 31 | public void setInputSizeToSurface() { 32 | MultipleMediaSource multipleMediaSource = create.multipleMediaSource().withFrameSize(400, 300).construct(); 33 | VideoDecoder decoder = create.videoDecoder().construct(); 34 | ISurface surface = create.surface().construct(); 35 | decoder.setOutputSurface(surface); 36 | 37 | new ConfigureVideoDecoderCommandHandler(multipleMediaSource, decoder).handle(); 38 | 39 | verify(surface).setInputSize(eq(400), eq(300)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/pipeline/DrainCommandHandlerSpy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.Encoder; 20 | import org.m4m.domain.VideoDecoder; 21 | import org.m4m.domain.dsl.CommandProcessorSpy; 22 | 23 | public class DrainCommandHandlerSpy extends DrainCommandHandler { 24 | private final VideoDecoder decoder; 25 | private final CommandProcessorSpy commandProcessorSpy; 26 | 27 | public DrainCommandHandlerSpy(VideoDecoder decoder, Encoder encoder, CommandProcessorSpy commandProcessorSpy) { 28 | super(encoder); 29 | this.decoder = decoder; 30 | this.commandProcessorSpy = commandProcessorSpy; 31 | } 32 | 33 | @Override 34 | public void handle() { 35 | commandProcessorSpy.logPair(decoder, plugin); 36 | super.handle(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/pipeline/DrainRenderCommandHandlerSpy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.IPluginOutput; 20 | import org.m4m.domain.Render; 21 | import org.m4m.domain.dsl.CommandProcessorSpy; 22 | 23 | public class DrainRenderCommandHandlerSpy extends DrainRenderCommandHandler { 24 | 25 | private final CommandProcessorSpy commandProcessorSpy; 26 | private final IPluginOutput plugin; 27 | 28 | public DrainRenderCommandHandlerSpy(IPluginOutput plugin, Render render, CommandProcessorSpy processorSpy) { 29 | super(render); 30 | this.plugin = plugin; 31 | this.commandProcessorSpy = processorSpy; 32 | } 33 | 34 | @Override 35 | public void handle() { 36 | commandProcessorSpy.logPair(plugin, render); 37 | super.handle(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/pipeline/EncoderMediaFormatChangedCommandHandlerSpy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.Plugin; 20 | import org.m4m.domain.Render; 21 | import org.m4m.domain.dsl.CommandProcessorSpy; 22 | 23 | public class EncoderMediaFormatChangedCommandHandlerSpy extends EncoderMediaFormatChangedCommandHandler { 24 | private final CommandProcessorSpy commandProcessorSpy; 25 | 26 | public EncoderMediaFormatChangedCommandHandlerSpy(Plugin plugin, Render render, CommandProcessorSpy processor) { 27 | super(plugin, render); 28 | 29 | this.commandProcessorSpy = processor; 30 | } 31 | 32 | @Override 33 | public void handle() { 34 | commandProcessorSpy.logPair(plugin, render); 35 | super.handle(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/pipeline/EofCommandHandlerSpy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.IFrameAllocator; 20 | import org.m4m.domain.IOutput; 21 | import org.m4m.domain.Plugin; 22 | import org.m4m.domain.dsl.CommandProcessorSpy; 23 | 24 | public class EofCommandHandlerSpy extends EofCommandHandler { 25 | private final CommandProcessorSpy commandProcessorSpy; 26 | 27 | public EofCommandHandlerSpy(IOutput output, Plugin plugin, IFrameAllocator frameAllocator, CommandProcessorSpy commandProcessorSpy) { 28 | super(output, plugin, frameAllocator); 29 | this.commandProcessorSpy = commandProcessorSpy; 30 | } 31 | 32 | @Override 33 | public void handle() { 34 | commandProcessorSpy.logPair(output, plugin); 35 | super.handle(); 36 | } 37 | } -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/pipeline/OutputFormatChangedHandlerSpy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.IFrameAllocator; 20 | import org.m4m.domain.IOutput; 21 | import org.m4m.domain.Plugin; 22 | import org.m4m.domain.dsl.CommandProcessorSpy; 23 | 24 | public class OutputFormatChangedHandlerSpy extends OutputFormatChangedHandler { 25 | private final CommandProcessorSpy commandProcessorSpy; 26 | 27 | public OutputFormatChangedHandlerSpy(IOutput output, Plugin plugin, IFrameAllocator frameAllocator, CommandProcessorSpy commandProcessorSpy) { 28 | super(output, plugin, frameAllocator); 29 | this.commandProcessorSpy = commandProcessorSpy; 30 | } 31 | 32 | @Override 33 | public void handle() { 34 | commandProcessorSpy.logPair(output, plugin); 35 | super.handle(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/pipeline/PullDataCommandHandlerSpy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.IPluginOutput; 20 | import org.m4m.domain.Render; 21 | import org.m4m.domain.dsl.CommandProcessorSpy; 22 | 23 | 24 | public class PullDataCommandHandlerSpy extends PullDataCommandHandler { 25 | private final CommandProcessorSpy commandProcessorSpy; 26 | 27 | public PullDataCommandHandlerSpy(IPluginOutput output, Render input, CommandProcessorSpy commandProcessorSpy) { 28 | super(output, input); 29 | this.commandProcessorSpy = commandProcessorSpy; 30 | } 31 | 32 | @Override 33 | public void handle() { 34 | commandProcessorSpy.logPair(output, input); 35 | super.handle(); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/pipeline/PushDataCommandHandlerSpy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.IFrameAllocator; 20 | import org.m4m.domain.IOutput; 21 | import org.m4m.domain.Plugin; 22 | import org.m4m.domain.dsl.CommandProcessorSpy; 23 | 24 | 25 | public class PushDataCommandHandlerSpy extends PushDataCommandHandler { 26 | private final CommandProcessorSpy commandProcessorSpy; 27 | 28 | public PushDataCommandHandlerSpy(IOutput output, Plugin plugin, IFrameAllocator frameAllocator, CommandProcessorSpy commandProcessorSpy) { 29 | super(output, plugin, frameAllocator); 30 | this.commandProcessorSpy = commandProcessorSpy; 31 | } 32 | 33 | @Override 34 | public void handle() { 35 | commandProcessorSpy.logPair(output, plugin); 36 | super.handle(); 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /domain/src/test/java/org/m4m/domain/pipeline/PushSurfaceCommandHandlerSpy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.domain.pipeline; 18 | 19 | import org.m4m.domain.Encoder; 20 | import org.m4m.domain.VideoDecoder; 21 | import org.m4m.domain.dsl.CommandProcessorSpy; 22 | 23 | public class PushSurfaceCommandHandlerSpy extends PushSurfaceCommandHandler { 24 | private final CommandProcessorSpy commandProcessorSpy; 25 | 26 | public PushSurfaceCommandHandlerSpy(VideoDecoder decoder, Encoder encoder, CommandProcessorSpy commandProcessorSpy) { 27 | super(decoder, encoder); 28 | this.commandProcessorSpy = commandProcessorSpy; 29 | } 30 | 31 | @Override 32 | public void handle() { 33 | commandProcessorSpy.logPair(output, input); 34 | super.handle(); 35 | } 36 | } 37 | 38 | 39 | -------------------------------------------------------------------------------- /domain/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /effects/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | } 5 | dependencies { 6 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' 7 | } 8 | } 9 | 10 | apply plugin: 'com.android.library' 11 | apply plugin: 'com.github.dcendents.android-maven' 12 | 13 | android { 14 | compileSdkVersion 25 15 | buildToolsVersion "25.0.3" 16 | 17 | defaultConfig { 18 | minSdkVersion 18 19 | targetSdkVersion 21 20 | versionCode 1 21 | versionName "1.0" 22 | } 23 | buildTypes { 24 | release { 25 | minifyEnabled false 26 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 27 | } 28 | } 29 | } 30 | 31 | dependencies { 32 | compile project(':domain') 33 | compile project(':android') 34 | } 35 | 36 | group = "org.m4m" -------------------------------------------------------------------------------- /effects/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /effects/src/main/java/org/m4m/effects/AudioEffect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.effects; 18 | 19 | 20 | import org.m4m.IAudioEffect; 21 | import org.m4m.domain.Pair; 22 | 23 | public abstract class AudioEffect implements IAudioEffect { 24 | private Pair segment; 25 | 26 | @Override 27 | public void setSegment(Pair segment) { 28 | this.segment = segment; 29 | } 30 | 31 | @Override 32 | public Pair getSegment() { 33 | return segment; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /effects/src/main/java/org/m4m/effects/InverseEffect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.effects; 18 | 19 | import org.m4m.android.graphics.VideoEffect; 20 | import org.m4m.domain.graphics.IEglUtil; 21 | 22 | public class InverseEffect extends VideoEffect { 23 | 24 | public InverseEffect(int angle, IEglUtil eglUtil) { 25 | super(angle, eglUtil); 26 | setFragmentShader(getFragmentShader()); 27 | } 28 | 29 | protected String getFragmentShader() { 30 | return "#extension GL_OES_EGL_image_external : require\n" + 31 | "precision mediump float;\n" + 32 | "varying vec2 vTextureCoord;\n" + 33 | "uniform samplerExternalOES sTexture;\n" + 34 | "void main() {\n" + 35 | " vec4 color = texture2D(sTexture, vTextureCoord);\n" + 36 | " float colorR = (1.0 - color.r) / 1.0;\n" + 37 | " float colorG = (1.0 - color.g) / 1.0;\n" + 38 | " float colorB = (1.0 - color.b) / 1.0;\n" + 39 | " gl_FragColor = vec4(colorR, colorG, colorB, color.a);\n" + 40 | "}\n"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /effects/src/main/java/org/m4m/effects/MuteAudioEffect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.effects; 18 | 19 | import org.m4m.android.AudioFormatAndroid; 20 | import org.m4m.domain.MediaFormat; 21 | import java.nio.ByteBuffer; 22 | 23 | public class MuteAudioEffect extends AudioEffect { 24 | boolean isMute = false; 25 | private AudioFormatAndroid audioFormat = new AudioFormatAndroid("audio/mp4a-latm", 48000, 2); 26 | 27 | @Override 28 | public void applyEffect(ByteBuffer input, long timeProgress) { 29 | if (isMute) { 30 | input.rewind(); 31 | input.put(new byte[input.array().length]); 32 | } 33 | } 34 | 35 | public void setMute(boolean isMute) { 36 | this.isMute = isMute; 37 | } 38 | 39 | @Override 40 | public MediaFormat getMediaFormat() { 41 | return audioFormat; 42 | } 43 | } -------------------------------------------------------------------------------- /effects/src/main/java/org/m4m/effects/RotateEffect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.effects; 18 | 19 | import org.m4m.android.graphics.VideoEffect; 20 | import org.m4m.domain.graphics.IEglUtil; 21 | 22 | public class RotateEffect extends VideoEffect { 23 | public RotateEffect(int angle, IEglUtil eglUtil) { 24 | super(angle, eglUtil ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jun 15 11:33:07 CEST 2017 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-3.3-all.zip 7 | -------------------------------------------------------------------------------- /samples/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.3" 6 | 7 | defaultConfig { 8 | applicationId "org.m4m.samples" 9 | minSdkVersion 18 10 | targetSdkVersion 21 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile project(':domain') 24 | compile project(':android') 25 | compile project(':effects') 26 | } 27 | -------------------------------------------------------------------------------- /samples/src/main/java/org/m4m/samples/DemoListItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.samples; 18 | 19 | public class DemoListItem { 20 | private String mTitle; 21 | private String mClassName; 22 | 23 | public DemoListItem(String title, String className) { 24 | mTitle = title; 25 | mClassName = className; 26 | } 27 | 28 | public String getTitle() { 29 | return mTitle; 30 | } 31 | 32 | public String getClassName() { 33 | return mClassName; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /samples/src/main/java/org/m4m/samples/FPSCounter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.samples; 18 | 19 | public class FPSCounter 20 | { 21 | private long mTimeNow; 22 | private long mTimePrev; 23 | private long mTimeElapsed; 24 | 25 | private int mFrames; 26 | 27 | private int mFPS; 28 | 29 | private int mEveryXFrames; 30 | 31 | public FPSCounter(int xFrames) 32 | { 33 | mFrames = 0; 34 | mEveryXFrames = xFrames; 35 | } 36 | 37 | public boolean update() 38 | { 39 | mFrames = (mFrames + 1) % mEveryXFrames; 40 | 41 | if(mFrames == 0) 42 | { 43 | mTimeNow = System.currentTimeMillis(); 44 | mTimeElapsed = (mTimeNow - mTimePrev) / mEveryXFrames; 45 | mTimePrev = mTimeNow; 46 | 47 | mFPS = (int)(1000.0f / (float)mTimeElapsed); 48 | 49 | return true; 50 | } 51 | 52 | return false; 53 | } 54 | 55 | public int fps() 56 | { 57 | return mFPS; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /samples/src/main/java/org/m4m/samples/Format.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.samples; 18 | 19 | public class Format 20 | { 21 | public static String duration(long durationMs) { 22 | long duration = durationMs / 1000; 23 | long h = duration / 3600; 24 | long m = (duration - h * 3600) / 60; 25 | long s = duration - (h * 3600 + m * 60); 26 | 27 | String durationValue; 28 | 29 | if (h == 0) { 30 | durationValue = asTwoDigit(m) + ":" + asTwoDigit(s); 31 | } else { 32 | durationValue = asTwoDigit(h) + ":" + asTwoDigit(m) + ":" + asTwoDigit(s); 33 | } 34 | 35 | return durationValue; 36 | } 37 | 38 | public static String asTwoDigit(long digit) { 39 | String value = ""; 40 | 41 | if (digit < 10) { 42 | value = "0"; 43 | } 44 | 45 | value += String.valueOf(digit); 46 | 47 | return value; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /samples/src/main/java/org/m4m/samples/controls/GameGLSurfaceView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Media for Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.m4m.samples.controls; 18 | 19 | import android.content.Context; 20 | import android.opengl.GLSurfaceView; 21 | import android.util.AttributeSet; 22 | 23 | public class GameGLSurfaceView extends GLSurfaceView { 24 | public GameGLSurfaceView(Context context, AttributeSet attrs) { 25 | super(context, attrs); 26 | 27 | setEGLContextClientVersion(2); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /samples/src/main/res/anim/hide_bl_to_tr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 14 | -------------------------------------------------------------------------------- /samples/src/main/res/anim/hide_br_to_tl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /samples/src/main/res/anim/hide_tl_to_br.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 14 | -------------------------------------------------------------------------------- /samples/src/main/res/anim/hide_tr_to_bl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /samples/src/main/res/anim/show_bl_to_tr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 14 | -------------------------------------------------------------------------------- /samples/src/main/res/anim/show_br_to_tl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 14 | -------------------------------------------------------------------------------- /samples/src/main/res/anim/show_tl_to_br.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /samples/src/main/res/anim/show_tr_to_bl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 14 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/change_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/change_camera.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/effect_blur.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/effect_blur.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/effect_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/effect_gray.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/effect_invert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/effect_invert.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/effect_no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/effect_no.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/effect_sepia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/effect_sepia.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/effect_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/effect_text.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/ic_delete.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/ic_empty_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/ic_empty_image.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/ic_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/ic_open.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/ic_plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/ic_plus.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/rec_act.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/rec_act.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/rec_inact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/rec_inact.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-hdpi/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-hdpi/settings.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-mdpi/change_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-mdpi/change_camera.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-mdpi/rec_act.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-mdpi/rec_act.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-mdpi/rec_inact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-mdpi/rec_inact.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable-mdpi/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable-mdpi/settings.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable/activity_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/background_popup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 7 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/background_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/bar_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/button_pause.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/button_pause_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable/button_pause_normal.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable/button_pause_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable/button_pause_pressed.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable/button_play.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/button_play_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable/button_play_normal.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable/button_play_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable/button_play_pressed.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable/gallery_image_tint_active.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/gallery_image_tint_normal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/gallery_item_active.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/gallery_item_normal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/popup_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/progress_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable/progress_bg.9.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable/progress_fg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable/progress_fg.9.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable/progress_play.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/progress_play_thumb.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/progress_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable/progress_thumb.png -------------------------------------------------------------------------------- /samples/src/main/res/drawable/round_border_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/round_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/round_focus_rect.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/round_rect.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/timeline_item_bar_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/timeline_item_button_active.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/timeline_item_button_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/timeline_item_button_normal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable/toolbar_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/drawable/toolbar_bg.png -------------------------------------------------------------------------------- /samples/src/main/res/layout/composer_cut_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 15 | 16 | 22 | 23 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/composer_join_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 15 | 16 | 22 | 23 | 29 | 30 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/composer_time_scaling_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 15 | 16 | 22 | 23 | 30 | 31 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/composer_transcode_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 15 | 16 | 22 | 23 | 30 | 31 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/playback_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 12 | 13 | 17 | 18 | 19 | 21 | 22 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/popup_game_capture_settings.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 19 | 20 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/popup_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/recognition_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 10 | 11 | 18 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/sample_list_group.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 21 | 22 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/sample_list_item.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 20 | 21 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/video_player_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 16 | 17 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/video_stream_player_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 13 | 14 | 22 | 23 | 34 | 35 | -------------------------------------------------------------------------------- /samples/src/main/res/menu/game_capturing.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /samples/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INDExOS/media-for-mobile/43a9026f0973a2f0a74fa813132f6a16f7499c3a/samples/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':domain' 2 | include ':android' 3 | include ':effects' 4 | include ':samples' 5 | --------------------------------------------------------------------------------