Loading apex/media/framework/api/system-current.txt +2 −5 Original line number Diff line number Diff line Loading @@ -18,11 +18,9 @@ package android.media { method @NonNull public android.net.Uri getSourceUri(); } public static class MediaTranscodeManager.TranscodingRequest.MediaFormatResolver { ctor public MediaTranscodeManager.TranscodingRequest.MediaFormatResolver(); public static class MediaTranscodeManager.TranscodingRequest.VideoFormatResolver { ctor public MediaTranscodeManager.TranscodingRequest.VideoFormatResolver(@NonNull android.media.ApplicationMediaCapabilities, @NonNull android.media.MediaFormat); method @Nullable public android.media.MediaFormat resolveVideoFormat(); method @NonNull public android.media.MediaTranscodeManager.TranscodingRequest.MediaFormatResolver setClientCapabilities(@NonNull android.media.ApplicationMediaCapabilities); method @NonNull public android.media.MediaTranscodeManager.TranscodingRequest.MediaFormatResolver setSourceVideoFormatHint(@NonNull android.media.MediaFormat); method public boolean shouldTranscode(); } Loading @@ -34,7 +32,6 @@ package android.media { method public int getSessionId(); method public int getStatus(); method public void setOnProgressUpdateListener(@NonNull java.util.concurrent.Executor, @Nullable android.media.MediaTranscodeManager.TranscodingSession.OnProgressUpdateListener); method public void setOnProgressUpdateListener(int, @NonNull java.util.concurrent.Executor, @Nullable android.media.MediaTranscodeManager.TranscodingSession.OnProgressUpdateListener); field public static final int ERROR_DROPPED_BY_SERVICE = 1; // 0x1 field public static final int ERROR_NONE = 0; // 0x0 field public static final int ERROR_SERVICE_DIED = 2; // 0x2 Loading apex/media/framework/java/android/media/MediaTranscodeManager.java +70 −71 Original line number Diff line number Diff line Loading @@ -822,83 +822,102 @@ public final class MediaTranscodeManager { } /** * Helper class for deciding if transcoding is needed, and if so, the track * formats to use. * Abstract base class for all the format resolvers. */ public static class MediaFormatResolver { private static final int BIT_RATE = 20000000; // 20Mbps abstract static class MediaFormatResolver { private @NonNull ApplicationMediaCapabilities mClientCaps; private MediaFormat mSrcVideoFormatHint; private MediaFormat mSrcAudioFormatHint; private ApplicationMediaCapabilities mClientCaps; /** * Prevents public constructor access. */ /* package private */ MediaFormatResolver() { } /** * Sets the abilities of the client consuming the media. Must be called * before {@link #shouldTranscode()} or {@link #resolveVideoFormat()}. * Constructs MediaFormatResolver object. * * @param clientCaps An ApplicationMediaCapabilities object containing the client's * capabilities. * @return the same VideoFormatResolver instance. */ @NonNull public MediaFormatResolver setClientCapabilities( @NonNull ApplicationMediaCapabilities clientCaps) { MediaFormatResolver(@NonNull ApplicationMediaCapabilities clientCaps) { if (clientCaps == null) { throw new IllegalArgumentException("Client capabilities must not be null"); } mClientCaps = clientCaps; return this; } /** * Sets the video format hint about the source. Must be called before * {@link #shouldTranscode()} or {@link #resolveVideoFormat()}. * * @param format A MediaFormat object containing information about the source's * video track format that could affect the transcoding decision. * Such information could include video codec types, color spaces, * whether special format info (eg. slow-motion markers) are present, * etc.. If a particular information is not present, it will not be * used to make the decision. * @return the same MediaFormatResolver instance. * Returns the client capabilities. */ @NonNull public MediaFormatResolver setSourceVideoFormatHint(@NonNull MediaFormat format) { mSrcVideoFormatHint = format; return this; /* package */ ApplicationMediaCapabilities getClientCapabilities() { return mClientCaps; } abstract boolean shouldTranscode(); } /** * VideoFormatResolver for deciding if video transcoding is needed, and if so, the track * formats to use. */ public static class VideoFormatResolver extends MediaFormatResolver { private static final int BIT_RATE = 20000000; // 20Mbps private MediaFormat mSrcVideoFormatHint; private MediaFormat mSrcAudioFormatHint; /** * Sets the audio format hint about the source. * Constructs a new VideoFormatResolver object. * * @param format A MediaFormat object containing information about the source's * audio track format that could affect the transcoding decision. * @return the same MediaFormatResolver instance. * @param clientCaps An ApplicationMediaCapabilities object containing the client's * capabilities. * @param srcVideoFormatHint A MediaFormat object containing information about the * source's video track format that could affect the * transcoding decision. Such information could include video * codec types, color spaces, whether special format info (eg. * slow-motion markers) are present, etc.. If a particular * information is not present, it will not be used to make the * decision. */ public VideoFormatResolver(@NonNull ApplicationMediaCapabilities clientCaps, @NonNull MediaFormat srcVideoFormatHint) { super(clientCaps); mSrcVideoFormatHint = srcVideoFormatHint; } /** * Constructs a new VideoFormatResolver object. * * @param clientCaps An ApplicationMediaCapabilities object containing the client's * capabilities. * @param srcVideoFormatHint A MediaFormat object containing information about the * source's video track format that could affect the * transcoding decision. Such information could include video * codec types, color spaces, whether special format info (eg. * slow-motion markers) are present, etc.. If a particular * information is not present, it will not be used to make the * decision. * @param srcAudioFormatHint A MediaFormat object containing information about the * source's audio track format that could affect the * transcoding decision. * @hide */ @NonNull public MediaFormatResolver setSourceAudioFormatHint(@NonNull MediaFormat format) { mSrcAudioFormatHint = format; return this; VideoFormatResolver(@NonNull ApplicationMediaCapabilities clientCaps, @NonNull MediaFormat srcVideoFormatHint, @NonNull MediaFormat srcAudioFormatHint) { super(clientCaps); mSrcVideoFormatHint = srcVideoFormatHint; mSrcAudioFormatHint = srcAudioFormatHint; } /** * Returns whether the source content should be transcoded. * * @return true if the source should be transcoded. * @throws UnsupportedOperationException * if {@link #setClientCapabilities(ApplicationMediaCapabilities)} * or {@link #setSourceVideoFormatHint(MediaFormat)} was not called. */ public boolean shouldTranscode() { if (mClientCaps == null) { throw new UnsupportedOperationException( "Client caps must be set!"); } // Video src hint must be provided, audio src hint is not used right now. if (mSrcVideoFormatHint == null) { throw new UnsupportedOperationException( "Source video format hint must be set!"); } boolean supportHevc = mClientCaps.isVideoMimeTypeSupported( boolean supportHevc = getClientCapabilities().isVideoMimeTypeSupported( MediaFormat.MIMETYPE_VIDEO_HEVC); if (!supportHevc && MediaFormat.MIMETYPE_VIDEO_HEVC.equals( mSrcVideoFormatHint.getString(MediaFormat.KEY_MIME))) { Loading @@ -910,13 +929,11 @@ public final class MediaTranscodeManager { /** * Retrieves the video track format to be used on * {@link Builder#setVideoTrackFormat(MediaFormat)} for this configuration. * {@link VideoTranscodingRequest.Builder#setVideoTrackFormat(MediaFormat)} for this * configuration. * * @return the video track format to be used if transcoding should be performed, * and null otherwise. * @throws UnsupportedOperationException * if {@link #setClientCapabilities(ApplicationMediaCapabilities)} * or {@link #setSourceVideoFormatHint(MediaFormat)} was not called. */ @Nullable public MediaFormat resolveVideoFormat() { Loading Loading @@ -1015,9 +1032,6 @@ public final class MediaTranscodeManager { * * @return the audio track format to be used if transcoding should be performed, and * null otherwise. * @throws UnsupportedOperationException * if {@link #setClientCapabilities(ApplicationMediaCapabilities)} * or {@link #setSourceVideoFormatHint(MediaFormat)} was not called. * @hide */ @Nullable Loading Loading @@ -1366,21 +1380,6 @@ public final class MediaTranscodeManager { public void setOnProgressUpdateListener( @NonNull @CallbackExecutor Executor executor, @Nullable OnProgressUpdateListener listener) { setOnProgressUpdateListener( 0 /* minProgressUpdateInterval */, executor, listener); } /** * Set a progress listener with specified progress update interval. * @param minProgressUpdateInterval The minimum interval between each progress update. * @param executor The executor on which listener will be invoked. * @param listener The progress listener. */ public void setOnProgressUpdateListener( int minProgressUpdateInterval, @NonNull @CallbackExecutor Executor executor, @Nullable OnProgressUpdateListener listener) { synchronized (mLock) { Objects.requireNonNull(executor, "listenerExecutor must not be null"); Objects.requireNonNull(listener, "listener must not be null"); Loading Loading
apex/media/framework/api/system-current.txt +2 −5 Original line number Diff line number Diff line Loading @@ -18,11 +18,9 @@ package android.media { method @NonNull public android.net.Uri getSourceUri(); } public static class MediaTranscodeManager.TranscodingRequest.MediaFormatResolver { ctor public MediaTranscodeManager.TranscodingRequest.MediaFormatResolver(); public static class MediaTranscodeManager.TranscodingRequest.VideoFormatResolver { ctor public MediaTranscodeManager.TranscodingRequest.VideoFormatResolver(@NonNull android.media.ApplicationMediaCapabilities, @NonNull android.media.MediaFormat); method @Nullable public android.media.MediaFormat resolveVideoFormat(); method @NonNull public android.media.MediaTranscodeManager.TranscodingRequest.MediaFormatResolver setClientCapabilities(@NonNull android.media.ApplicationMediaCapabilities); method @NonNull public android.media.MediaTranscodeManager.TranscodingRequest.MediaFormatResolver setSourceVideoFormatHint(@NonNull android.media.MediaFormat); method public boolean shouldTranscode(); } Loading @@ -34,7 +32,6 @@ package android.media { method public int getSessionId(); method public int getStatus(); method public void setOnProgressUpdateListener(@NonNull java.util.concurrent.Executor, @Nullable android.media.MediaTranscodeManager.TranscodingSession.OnProgressUpdateListener); method public void setOnProgressUpdateListener(int, @NonNull java.util.concurrent.Executor, @Nullable android.media.MediaTranscodeManager.TranscodingSession.OnProgressUpdateListener); field public static final int ERROR_DROPPED_BY_SERVICE = 1; // 0x1 field public static final int ERROR_NONE = 0; // 0x0 field public static final int ERROR_SERVICE_DIED = 2; // 0x2 Loading
apex/media/framework/java/android/media/MediaTranscodeManager.java +70 −71 Original line number Diff line number Diff line Loading @@ -822,83 +822,102 @@ public final class MediaTranscodeManager { } /** * Helper class for deciding if transcoding is needed, and if so, the track * formats to use. * Abstract base class for all the format resolvers. */ public static class MediaFormatResolver { private static final int BIT_RATE = 20000000; // 20Mbps abstract static class MediaFormatResolver { private @NonNull ApplicationMediaCapabilities mClientCaps; private MediaFormat mSrcVideoFormatHint; private MediaFormat mSrcAudioFormatHint; private ApplicationMediaCapabilities mClientCaps; /** * Prevents public constructor access. */ /* package private */ MediaFormatResolver() { } /** * Sets the abilities of the client consuming the media. Must be called * before {@link #shouldTranscode()} or {@link #resolveVideoFormat()}. * Constructs MediaFormatResolver object. * * @param clientCaps An ApplicationMediaCapabilities object containing the client's * capabilities. * @return the same VideoFormatResolver instance. */ @NonNull public MediaFormatResolver setClientCapabilities( @NonNull ApplicationMediaCapabilities clientCaps) { MediaFormatResolver(@NonNull ApplicationMediaCapabilities clientCaps) { if (clientCaps == null) { throw new IllegalArgumentException("Client capabilities must not be null"); } mClientCaps = clientCaps; return this; } /** * Sets the video format hint about the source. Must be called before * {@link #shouldTranscode()} or {@link #resolveVideoFormat()}. * * @param format A MediaFormat object containing information about the source's * video track format that could affect the transcoding decision. * Such information could include video codec types, color spaces, * whether special format info (eg. slow-motion markers) are present, * etc.. If a particular information is not present, it will not be * used to make the decision. * @return the same MediaFormatResolver instance. * Returns the client capabilities. */ @NonNull public MediaFormatResolver setSourceVideoFormatHint(@NonNull MediaFormat format) { mSrcVideoFormatHint = format; return this; /* package */ ApplicationMediaCapabilities getClientCapabilities() { return mClientCaps; } abstract boolean shouldTranscode(); } /** * VideoFormatResolver for deciding if video transcoding is needed, and if so, the track * formats to use. */ public static class VideoFormatResolver extends MediaFormatResolver { private static final int BIT_RATE = 20000000; // 20Mbps private MediaFormat mSrcVideoFormatHint; private MediaFormat mSrcAudioFormatHint; /** * Sets the audio format hint about the source. * Constructs a new VideoFormatResolver object. * * @param format A MediaFormat object containing information about the source's * audio track format that could affect the transcoding decision. * @return the same MediaFormatResolver instance. * @param clientCaps An ApplicationMediaCapabilities object containing the client's * capabilities. * @param srcVideoFormatHint A MediaFormat object containing information about the * source's video track format that could affect the * transcoding decision. Such information could include video * codec types, color spaces, whether special format info (eg. * slow-motion markers) are present, etc.. If a particular * information is not present, it will not be used to make the * decision. */ public VideoFormatResolver(@NonNull ApplicationMediaCapabilities clientCaps, @NonNull MediaFormat srcVideoFormatHint) { super(clientCaps); mSrcVideoFormatHint = srcVideoFormatHint; } /** * Constructs a new VideoFormatResolver object. * * @param clientCaps An ApplicationMediaCapabilities object containing the client's * capabilities. * @param srcVideoFormatHint A MediaFormat object containing information about the * source's video track format that could affect the * transcoding decision. Such information could include video * codec types, color spaces, whether special format info (eg. * slow-motion markers) are present, etc.. If a particular * information is not present, it will not be used to make the * decision. * @param srcAudioFormatHint A MediaFormat object containing information about the * source's audio track format that could affect the * transcoding decision. * @hide */ @NonNull public MediaFormatResolver setSourceAudioFormatHint(@NonNull MediaFormat format) { mSrcAudioFormatHint = format; return this; VideoFormatResolver(@NonNull ApplicationMediaCapabilities clientCaps, @NonNull MediaFormat srcVideoFormatHint, @NonNull MediaFormat srcAudioFormatHint) { super(clientCaps); mSrcVideoFormatHint = srcVideoFormatHint; mSrcAudioFormatHint = srcAudioFormatHint; } /** * Returns whether the source content should be transcoded. * * @return true if the source should be transcoded. * @throws UnsupportedOperationException * if {@link #setClientCapabilities(ApplicationMediaCapabilities)} * or {@link #setSourceVideoFormatHint(MediaFormat)} was not called. */ public boolean shouldTranscode() { if (mClientCaps == null) { throw new UnsupportedOperationException( "Client caps must be set!"); } // Video src hint must be provided, audio src hint is not used right now. if (mSrcVideoFormatHint == null) { throw new UnsupportedOperationException( "Source video format hint must be set!"); } boolean supportHevc = mClientCaps.isVideoMimeTypeSupported( boolean supportHevc = getClientCapabilities().isVideoMimeTypeSupported( MediaFormat.MIMETYPE_VIDEO_HEVC); if (!supportHevc && MediaFormat.MIMETYPE_VIDEO_HEVC.equals( mSrcVideoFormatHint.getString(MediaFormat.KEY_MIME))) { Loading @@ -910,13 +929,11 @@ public final class MediaTranscodeManager { /** * Retrieves the video track format to be used on * {@link Builder#setVideoTrackFormat(MediaFormat)} for this configuration. * {@link VideoTranscodingRequest.Builder#setVideoTrackFormat(MediaFormat)} for this * configuration. * * @return the video track format to be used if transcoding should be performed, * and null otherwise. * @throws UnsupportedOperationException * if {@link #setClientCapabilities(ApplicationMediaCapabilities)} * or {@link #setSourceVideoFormatHint(MediaFormat)} was not called. */ @Nullable public MediaFormat resolveVideoFormat() { Loading Loading @@ -1015,9 +1032,6 @@ public final class MediaTranscodeManager { * * @return the audio track format to be used if transcoding should be performed, and * null otherwise. * @throws UnsupportedOperationException * if {@link #setClientCapabilities(ApplicationMediaCapabilities)} * or {@link #setSourceVideoFormatHint(MediaFormat)} was not called. * @hide */ @Nullable Loading Loading @@ -1366,21 +1380,6 @@ public final class MediaTranscodeManager { public void setOnProgressUpdateListener( @NonNull @CallbackExecutor Executor executor, @Nullable OnProgressUpdateListener listener) { setOnProgressUpdateListener( 0 /* minProgressUpdateInterval */, executor, listener); } /** * Set a progress listener with specified progress update interval. * @param minProgressUpdateInterval The minimum interval between each progress update. * @param executor The executor on which listener will be invoked. * @param listener The progress listener. */ public void setOnProgressUpdateListener( int minProgressUpdateInterval, @NonNull @CallbackExecutor Executor executor, @Nullable OnProgressUpdateListener listener) { synchronized (mLock) { Objects.requireNonNull(executor, "listenerExecutor must not be null"); Objects.requireNonNull(listener, "listener must not be null"); Loading