Loading api/current.txt +3 −3 Original line number Diff line number Diff line Loading @@ -12597,9 +12597,9 @@ package android.media { public final class MediaCodec { method public void configure(android.media.MediaFormat, android.view.Surface, android.media.MediaCrypto, int); method public static android.media.MediaCodec createByCodecName(java.lang.String) throws java.io.IOException; method public static android.media.MediaCodec createDecoderByType(java.lang.String) throws java.io.IOException; method public static android.media.MediaCodec createEncoderByType(java.lang.String) throws java.io.IOException; method public static android.media.MediaCodec createByCodecName(java.lang.String); method public static android.media.MediaCodec createDecoderByType(java.lang.String); method public static android.media.MediaCodec createEncoderByType(java.lang.String); method public final android.view.Surface createInputSurface(); method public final int dequeueInputBuffer(long); method public final int dequeueOutputBuffer(android.media.MediaCodec.BufferInfo, long); media/java/android/media/MediaCodec.java +6 −27 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.media.MediaFormat; import android.os.Bundle; import android.view.Surface; import java.io.IOException; import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Map; Loading Loading @@ -67,8 +66,8 @@ import java.util.Map; * * Each codec maintains a number of input and output buffers that are * referred to by index in API calls. * The contents of these buffers are represented by the ByteBuffer[] arrays * accessible through {@link #getInputBuffers} and {@link #getOutputBuffers}. * The contents of these buffers is represented by the ByteBuffer[] arrays * accessible through getInputBuffers() and getOutputBuffers(). * * After a successful call to {@link #start} the client "owns" neither * input nor output buffers, subsequent calls to {@link #dequeueInputBuffer} Loading Loading @@ -118,18 +117,7 @@ import java.util.Map; * own any buffers anymore. * Note that the format of the data submitted after a flush must not change, * flush does not support format discontinuities, * for this a full {@link #stop}, {@link #configure}, {@link #start} * cycle is necessary. * * <p> The factory methods * {@link #createByCodecName}, * {@link #createDecoderByType}, * and {@link #createEncoderByType} * throw {@link java.io.IOException} on failure which * the caller must catch or declare to pass up. * Other methods will throw {@link java.lang.IllegalStateException} * if the codec is in an Uninitialized, Invalid, or Error state (e.g. not * initialized properly). Exceptions are thrown elsewhere as noted. </p> * for this a full stop(), configure(), start() cycle is necessary. * */ final public class MediaCodec { Loading Loading @@ -193,22 +181,16 @@ final public class MediaCodec { * </ul> * * @param type The mime type of the input data. * @throws IOException if the codec cannot be created. * @throws IllegalArgumentException if type is null. */ public static MediaCodec createDecoderByType(String type) throws IOException { public static MediaCodec createDecoderByType(String type) { return new MediaCodec(type, true /* nameIsType */, false /* encoder */); } /** * Instantiate an encoder supporting output data of the given mime type. * @param type The desired mime type of the output data. * @throws IOException if the codec cannot be created. * @throws IllegalArgumentException if type is null. */ public static MediaCodec createEncoderByType(String type) throws IOException { public static MediaCodec createEncoderByType(String type) { return new MediaCodec(type, true /* nameIsType */, true /* encoder */); } Loading @@ -217,11 +199,8 @@ final public class MediaCodec { * use this method to instantiate it. Use with caution. * Likely to be used with information obtained from {@link android.media.MediaCodecList} * @param name The name of the codec to be instantiated. * @throws IOException if the codec cannot be created. * @throws IllegalArgumentException if name is null. */ public static MediaCodec createByCodecName(String name) throws IOException { public static MediaCodec createByCodecName(String name) { return new MediaCodec( name, false /* nameIsType */, false /* unused */); } Loading tests/AccessoryDisplay/sink/src/com/android/accessorydisplay/sink/DisplaySinkService.java +1 −7 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; import java.io.IOException; import java.nio.ByteBuffer; public class DisplaySinkService extends Service implements SurfaceHolder.Callback { Loading Loading @@ -151,12 +150,7 @@ public class DisplaySinkService extends Service implements SurfaceHolder.Callbac if (mSurface != null) { MediaFormat format = MediaFormat.createVideoFormat( "video/avc", mSurfaceWidth, mSurfaceHeight); try { mCodec = MediaCodec.createDecoderByType("video/avc"); } catch (IOException e) { throw new RuntimeException( "IOException in MediaCodec.createDecoderByType for video/avc", e); } mCodec.configure(format, mSurface, null, 0); mCodec.start(); mCodecBufferInfo = new BufferInfo(); Loading tests/AccessoryDisplay/source/src/com/android/accessorydisplay/source/DisplaySourceService.java +2 −8 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.Message; import android.view.Display; import android.view.Surface; import java.io.IOException; import java.nio.ByteBuffer; public class DisplaySourceService extends Service { Loading Loading @@ -192,13 +191,8 @@ public class DisplaySourceService extends Service { format.setInteger(MediaFormat.KEY_BIT_RATE, BIT_RATE); format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE); format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, I_FRAME_INTERVAL); MediaCodec codec; try { codec = MediaCodec.createEncoderByType("video/avc"); } catch (IOException e) { throw new RuntimeException( "IOException in MediaCodec.createEncoderByType for video/avc", e); } MediaCodec codec = MediaCodec.createEncoderByType("video/avc"); codec.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); Surface surface = codec.createInputSurface(); codec.start(); Loading tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/decoder/AudioTrackDecoder.java +2 −9 Original line number Diff line number Diff line Loading @@ -59,15 +59,8 @@ public class AudioTrackDecoder extends TrackDecoder { @Override protected MediaCodec initMediaCodec(MediaFormat format) { MediaCodec mediaCodec; try { mediaCodec = MediaCodec.createDecoderByType( MediaCodec mediaCodec = MediaCodec.createDecoderByType( format.getString(MediaFormat.KEY_MIME)); } catch (IOException e) { throw new RuntimeException( "IOException in MediaCodec.createDecoderByType for " + format.getString(MediaFormat.KEY_MIME), e); } mediaCodec.configure(format, null, null, 0); return mediaCodec; } Loading Loading
api/current.txt +3 −3 Original line number Diff line number Diff line Loading @@ -12597,9 +12597,9 @@ package android.media { public final class MediaCodec { method public void configure(android.media.MediaFormat, android.view.Surface, android.media.MediaCrypto, int); method public static android.media.MediaCodec createByCodecName(java.lang.String) throws java.io.IOException; method public static android.media.MediaCodec createDecoderByType(java.lang.String) throws java.io.IOException; method public static android.media.MediaCodec createEncoderByType(java.lang.String) throws java.io.IOException; method public static android.media.MediaCodec createByCodecName(java.lang.String); method public static android.media.MediaCodec createDecoderByType(java.lang.String); method public static android.media.MediaCodec createEncoderByType(java.lang.String); method public final android.view.Surface createInputSurface(); method public final int dequeueInputBuffer(long); method public final int dequeueOutputBuffer(android.media.MediaCodec.BufferInfo, long);
media/java/android/media/MediaCodec.java +6 −27 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.media.MediaFormat; import android.os.Bundle; import android.view.Surface; import java.io.IOException; import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Map; Loading Loading @@ -67,8 +66,8 @@ import java.util.Map; * * Each codec maintains a number of input and output buffers that are * referred to by index in API calls. * The contents of these buffers are represented by the ByteBuffer[] arrays * accessible through {@link #getInputBuffers} and {@link #getOutputBuffers}. * The contents of these buffers is represented by the ByteBuffer[] arrays * accessible through getInputBuffers() and getOutputBuffers(). * * After a successful call to {@link #start} the client "owns" neither * input nor output buffers, subsequent calls to {@link #dequeueInputBuffer} Loading Loading @@ -118,18 +117,7 @@ import java.util.Map; * own any buffers anymore. * Note that the format of the data submitted after a flush must not change, * flush does not support format discontinuities, * for this a full {@link #stop}, {@link #configure}, {@link #start} * cycle is necessary. * * <p> The factory methods * {@link #createByCodecName}, * {@link #createDecoderByType}, * and {@link #createEncoderByType} * throw {@link java.io.IOException} on failure which * the caller must catch or declare to pass up. * Other methods will throw {@link java.lang.IllegalStateException} * if the codec is in an Uninitialized, Invalid, or Error state (e.g. not * initialized properly). Exceptions are thrown elsewhere as noted. </p> * for this a full stop(), configure(), start() cycle is necessary. * */ final public class MediaCodec { Loading Loading @@ -193,22 +181,16 @@ final public class MediaCodec { * </ul> * * @param type The mime type of the input data. * @throws IOException if the codec cannot be created. * @throws IllegalArgumentException if type is null. */ public static MediaCodec createDecoderByType(String type) throws IOException { public static MediaCodec createDecoderByType(String type) { return new MediaCodec(type, true /* nameIsType */, false /* encoder */); } /** * Instantiate an encoder supporting output data of the given mime type. * @param type The desired mime type of the output data. * @throws IOException if the codec cannot be created. * @throws IllegalArgumentException if type is null. */ public static MediaCodec createEncoderByType(String type) throws IOException { public static MediaCodec createEncoderByType(String type) { return new MediaCodec(type, true /* nameIsType */, true /* encoder */); } Loading @@ -217,11 +199,8 @@ final public class MediaCodec { * use this method to instantiate it. Use with caution. * Likely to be used with information obtained from {@link android.media.MediaCodecList} * @param name The name of the codec to be instantiated. * @throws IOException if the codec cannot be created. * @throws IllegalArgumentException if name is null. */ public static MediaCodec createByCodecName(String name) throws IOException { public static MediaCodec createByCodecName(String name) { return new MediaCodec( name, false /* nameIsType */, false /* unused */); } Loading
tests/AccessoryDisplay/sink/src/com/android/accessorydisplay/sink/DisplaySinkService.java +1 −7 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; import java.io.IOException; import java.nio.ByteBuffer; public class DisplaySinkService extends Service implements SurfaceHolder.Callback { Loading Loading @@ -151,12 +150,7 @@ public class DisplaySinkService extends Service implements SurfaceHolder.Callbac if (mSurface != null) { MediaFormat format = MediaFormat.createVideoFormat( "video/avc", mSurfaceWidth, mSurfaceHeight); try { mCodec = MediaCodec.createDecoderByType("video/avc"); } catch (IOException e) { throw new RuntimeException( "IOException in MediaCodec.createDecoderByType for video/avc", e); } mCodec.configure(format, mSurface, null, 0); mCodec.start(); mCodecBufferInfo = new BufferInfo(); Loading
tests/AccessoryDisplay/source/src/com/android/accessorydisplay/source/DisplaySourceService.java +2 −8 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.Message; import android.view.Display; import android.view.Surface; import java.io.IOException; import java.nio.ByteBuffer; public class DisplaySourceService extends Service { Loading Loading @@ -192,13 +191,8 @@ public class DisplaySourceService extends Service { format.setInteger(MediaFormat.KEY_BIT_RATE, BIT_RATE); format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE); format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, I_FRAME_INTERVAL); MediaCodec codec; try { codec = MediaCodec.createEncoderByType("video/avc"); } catch (IOException e) { throw new RuntimeException( "IOException in MediaCodec.createEncoderByType for video/avc", e); } MediaCodec codec = MediaCodec.createEncoderByType("video/avc"); codec.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); Surface surface = codec.createInputSurface(); codec.start(); Loading
tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/decoder/AudioTrackDecoder.java +2 −9 Original line number Diff line number Diff line Loading @@ -59,15 +59,8 @@ public class AudioTrackDecoder extends TrackDecoder { @Override protected MediaCodec initMediaCodec(MediaFormat format) { MediaCodec mediaCodec; try { mediaCodec = MediaCodec.createDecoderByType( MediaCodec mediaCodec = MediaCodec.createDecoderByType( format.getString(MediaFormat.KEY_MIME)); } catch (IOException e) { throw new RuntimeException( "IOException in MediaCodec.createDecoderByType for " + format.getString(MediaFormat.KEY_MIME), e); } mediaCodec.configure(format, null, null, 0); return mediaCodec; } Loading