Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
80890928
authored
Mar 29, 2022
by
hschlueter
Committed by
Ian Baker
Apr 06, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Use @linkplain for link text that doesn't match symbol name.
PiperOrigin-RevId: 437992927
parent
9d48cff9
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
132 additions
and
126 deletions
libraries/transformer/src/main/java/androidx/media3/transformer/AdvancedFrameProcessor.java
libraries/transformer/src/main/java/androidx/media3/transformer/Codec.java
libraries/transformer/src/main/java/androidx/media3/transformer/DefaultEncoderFactory.java
libraries/transformer/src/main/java/androidx/media3/transformer/EncoderSelector.java
libraries/transformer/src/main/java/androidx/media3/transformer/EncoderUtil.java
libraries/transformer/src/main/java/androidx/media3/transformer/ExternalCopyFrameProcessor.java
libraries/transformer/src/main/java/androidx/media3/transformer/FallbackListener.java
libraries/transformer/src/main/java/androidx/media3/transformer/FrameProcessorChain.java
libraries/transformer/src/main/java/androidx/media3/transformer/FrameworkMuxer.java
libraries/transformer/src/main/java/androidx/media3/transformer/GlFrameProcessor.java
libraries/transformer/src/main/java/androidx/media3/transformer/Muxer.java
libraries/transformer/src/main/java/androidx/media3/transformer/MuxerWrapper.java
libraries/transformer/src/main/java/androidx/media3/transformer/SefSlowMotionFlattener.java
libraries/transformer/src/main/java/androidx/media3/transformer/TransformationException.java
libraries/transformer/src/main/java/androidx/media3/transformer/TransformationRequest.java
libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java
libraries/transformer/src/main/java/androidx/media3/transformer/VideoEncoderSettings.java
libraries/transformer/src/main/java/androidx/media3/transformer/AdvancedFrameProcessor.java
View file @
80890928
...
...
@@ -28,10 +28,11 @@ import java.io.IOException;
import
org.checkerframework.checker.nullness.qual.MonotonicNonNull
;
/**
* Applies a transformation matrix in the vertex shader. Operations are done on normalized device
* coordinates (-1 to 1 on x and y axes). No automatic adjustments (like done in {@link
* ScaleToFitFrameProcessor}) are applied on the transformation. Width and height are not modified.
* The background color will default to black.
* Applies a transformation matrix in the vertex shader.
*
* <p>Operations are done on normalized device coordinates (-1 to 1 on x and y axes). No automatic
* adjustments (like done in {@link ScaleToFitFrameProcessor}) are applied on the transformation.
* Width and height are not modified. The background color will default to black.
*/
@UnstableApi
public
final
class
AdvancedFrameProcessor
implements
GlFrameProcessor
{
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/Codec.java
View file @
80890928
...
...
@@ -36,7 +36,7 @@ import java.util.List;
@UnstableApi
public
interface
Codec
{
/** A factory for {@link Codec decoder} instances. */
/** A factory for {@link
plain
Codec decoder} instances. */
interface
DecoderFactory
{
/** A default {@code DecoderFactory} implementation. */
...
...
@@ -67,7 +67,7 @@ public interface Codec {
throws
TransformationException
;
}
/** A factory for {@link Codec encoder} instances. */
/** A factory for {@link
plain
Codec encoder} instances. */
interface
EncoderFactory
{
/** A default {@code EncoderFactory} implementation. */
...
...
@@ -77,13 +77,13 @@ public interface Codec {
* Returns a {@link Codec} for audio encoding.
*
* <p>This method must validate that the {@link Codec} is configured to produce one of the
* {@code allowedMimeTypes}. The {@link
Format#sampleMimeType sample MIME type} given in {@code
* format} is not necessarily allowed.
* {@code allowedMimeTypes}. The {@link
plain Format#sampleMimeType sample MIME type} given in
*
{@code
format} is not necessarily allowed.
*
* @param format The {@link Format} (of the output data) used to determine the underlying
* encoder and its configuration values.
* @param allowedMimeTypes The non-empty list of allowed output sample {@link
MimeTypes MIME
* types}.
* @param allowedMimeTypes The non-empty list of allowed output sample {@link
plain MimeTypes
*
MIME
types}.
* @return A {@link Codec} for audio encoding.
* @throws TransformationException If no suitable {@link Codec} can be created.
*/
...
...
@@ -94,8 +94,8 @@ public interface Codec {
* Returns a {@link Codec} for video encoding.
*
* <p>This method must validate that the {@link Codec} is configured to produce one of the
* {@code allowedMimeTypes}. The {@link
Format#sampleMimeType sample MIME type} given in {@code
* format} is not necessarily allowed.
* {@code allowedMimeTypes}. The {@link
plain Format#sampleMimeType sample MIME type} given in
*
{@code
format} is not necessarily allowed.
*
* @param format The {@link Format} (of the output data) used to determine the underlying
* encoder and its configuration values. {@link Format#sampleMimeType}, {@link Format#width}
...
...
@@ -103,8 +103,8 @@ public interface Codec {
* Format#rotationDegrees} is 0 and {@link Format#width} {@code >=} {@link Format#height},
* therefore the video is always in landscape orientation. {@link Format#frameRate} is set
* to the output video's frame rate, if available.
* @param allowedMimeTypes The non-empty list of allowed output sample {@link
MimeTypes MIME
* types}.
* @param allowedMimeTypes The non-empty list of allowed output sample {@link
plain MimeTypes
*
MIME
types}.
* @return A {@link Codec} for video encoding.
* @throws TransformationException If no suitable {@link Codec} can be created.
*/
...
...
@@ -142,8 +142,8 @@ public interface Codec {
/**
* Dequeues a writable input buffer, if available.
*
* <p>This method must not be called from video encoders because they must use
{@link Surface
*
surfaces} as inputs
.
* <p>This method must not be called from video encoders because they must use
a {@link Surface}
*
to receive input
.
*
* @param inputBuffer The buffer where the dequeued buffer data is stored, at {@link
* DecoderInputBuffer#data inputBuffer.data}.
...
...
@@ -153,13 +153,13 @@ public interface Codec {
boolean
maybeDequeueInputBuffer
(
DecoderInputBuffer
inputBuffer
)
throws
TransformationException
;
/**
* Queues an input buffer to the {@code Codec}. No buffers may be queued after {@link
* Queues an input buffer to the {@code Codec}. No buffers may be queued after {@link
plain
* DecoderInputBuffer#isEndOfStream() end of stream} buffer has been queued.
*
* <p>This method must not be called from video encoders because they must use
{@link Surface
*
surfaces} as inputs
.
* <p>This method must not be called from video encoders because they must use
a {@link Surface}
*
to receive input
.
*
* @param inputBuffer The {@link DecoderInputBuffer input buffer}.
* @param inputBuffer The {@link
plain
DecoderInputBuffer input buffer}.
* @throws TransformationException If the underlying decoder or encoder encounters a problem.
*/
void
queueInputBuffer
(
DecoderInputBuffer
inputBuffer
)
throws
TransformationException
;
...
...
@@ -169,7 +169,8 @@ public interface Codec {
*
* <p>This method must only be called on video encoders because they must use a {@link Surface} as
* input. For audio/video decoders or audio encoders, the {@link C#BUFFER_FLAG_END_OF_STREAM} flag
* should be set on the last input buffer {@link #queueInputBuffer(DecoderInputBuffer) queued}.
* should be set on the last input buffer {@linkplain #queueInputBuffer(DecoderInputBuffer)
* queued}.
*
* @throws TransformationException If the underlying video encoder encounters a problem.
*/
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/DefaultEncoderFactory.java
View file @
80890928
...
...
@@ -199,9 +199,9 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
}
/**
* Finds an {@link MediaCodecInfo encoder} that supports the requested format most closely.
* Finds an {@link
plain
MediaCodecInfo encoder} that supports the requested format most closely.
*
* <p>Returns the {@link MediaCodecInfo encoder} and the supported {@link Format} in a {@link
* <p>Returns the {@link
plain
MediaCodecInfo encoder} and the supported {@link Format} in a {@link
* Pair}, or {@code null} if none is found.
*/
@RequiresNonNull
(
"#1.sampleMimeType"
)
...
...
@@ -402,22 +402,22 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
private
interface
EncoderFallbackCost
{
/**
* Returns a cost that represents the gap between the requested encoding parameter(s) and the
* {@link MediaCodecInfo encoder}'s support for them.
* {@link
plain
MediaCodecInfo encoder}'s support for them.
*
* <p>The method must return {@link Integer#MAX_VALUE} when the {@link
MediaCodecInfo encoder}
* does not support the encoding parameters.
* <p>The method must return {@link Integer#MAX_VALUE} when the {@link
plain MediaCodecInfo
*
encoder}
does not support the encoding parameters.
*/
int
getParameterSupportGap
(
MediaCodecInfo
encoderInfo
);
}
/**
* Filters a list of {@link
MediaCodecInfo encoders} by a {@link EncoderFallbackCost c
ost
* function}.
* Filters a list of {@link
plain MediaCodecInfo encoders} by a {@linkplain EncoderFallbackC
ost
*
cost
function}.
*
* @param encoders A list of {@link MediaCodecInfo encoders}.
* @param cost A {@link EncoderFallbackCost cost function}.
* @return A list of {@link
MediaCodecInfo encoders} with the lowest costs, empty if the costs of
* all encoders are {@link Integer#MAX_VALUE}.
* @param encoders A list of {@link
plain
MediaCodecInfo encoders}.
* @param cost A {@link
plain
EncoderFallbackCost cost function}.
* @return A list of {@link
plain MediaCodecInfo encoders} with the lowest costs, empty if the
*
costs of
all encoders are {@link Integer#MAX_VALUE}.
*/
private
static
ImmutableList
<
MediaCodecInfo
>
filterEncoders
(
List
<
MediaCodecInfo
>
encoders
,
EncoderFallbackCost
cost
,
String
filterName
)
{
...
...
@@ -454,7 +454,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
}
/**
* Finds a {@link MimeTypes MIME type} that is supported by the encoder and in the {@code
* Finds a {@link
plain
MimeTypes MIME type} that is supported by the encoder and in the {@code
* allowedMimeTypes}.
*/
@Nullable
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/EncoderSelector.java
View file @
80890928
...
...
@@ -36,8 +36,8 @@ public interface EncoderSelector {
* Returns a list of encoders that can encode media in the specified {@code mimeType}, in priority
* order.
*
* @param mimeType The {@link MimeTypes MIME type} for which an encoder is required.
* @return An unmodifiable list of {@link
MediaCodecInfo encoders} that supports
the {@code
* @param mimeType The {@link
plain
MimeTypes MIME type} for which an encoder is required.
* @return An unmodifiable list of {@link
plain MediaCodecInfo encoders} that support
the {@code
* mimeType}. The list may be empty.
*/
List
<
MediaCodecInfo
>
selectEncoderInfos
(
String
mimeType
);
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/EncoderUtil.java
View file @
80890928
...
...
@@ -47,8 +47,8 @@ public final class EncoderUtil {
private
static
final
List
<
MediaCodecInfo
>
encoders
=
new
ArrayList
<>();
/**
* Returns a list of {@link
MediaCodecInfo encoders} that support the given {@code mimeType}, or
* an empty list if there is none.
* Returns a list of {@link
plain MediaCodecInfo encoders} that support the given {@code mimeType},
*
or
an empty list if there is none.
*/
public
static
ImmutableList
<
MediaCodecInfo
>
getSupportedEncoders
(
String
mimeType
)
{
maybePopulateEncoderInfos
();
...
...
@@ -67,22 +67,22 @@ public final class EncoderUtil {
}
/**
* Finds a
{@link
MediaCodecInfo encoder}'s supported resolution from a given resolution.
* Finds a
n {@linkplain
MediaCodecInfo encoder}'s supported resolution from a given resolution.
*
* <p>The input resolution is returned, if it (after aligning to the encoders requirement) is
* supported by the {@link MediaCodecInfo encoder}.
* <p>The input resolution is returned, if it (after aligning to the encoder
'
s requirement) is
* supported by the {@link
plain
MediaCodecInfo encoder}.
*
* <p>The resolution will be adjusted to be within the {@link
MediaCodecInfo encoder}'s range of
*
supported resolutions, and will be aligned to the {@link MediaCodecInfo encoder}'s alignment
*
requirement. The adjustment process takes into account the original aspect ratio. But the fixed
*
resolution may not preserve the original aspect ratio, depending on the encoder's required size
* alignment.
* <p>The resolution will be adjusted to be within the {@link
plain MediaCodecInfo encoder}'s range
*
of supported resolutions, and will be aligned to the {@linkplain MediaCodecInfo encoder}'s
*
alignment requirement. The adjustment process takes into account the original aspect ratio. But
*
the fixed resolution may not preserve the original aspect ratio, depending on the encoder's
*
required size
alignment.
*
* @param encoderInfo The {@link MediaCodecInfo} of the encoder.
* @param mimeType The output MIME type.
* @param width The original width.
* @param height The original height.
* @return A {@link Size supported resolution}, or {@code null} if unable to find a fallback.
* @return A {@link
plain
Size supported resolution}, or {@code null} if unable to find a fallback.
*/
@Nullable
public
static
Size
getSupportedResolution
(
...
...
@@ -136,7 +136,7 @@ public final class EncoderUtil {
* Finds the highest supported encoding level given a profile.
*
* @param encoderInfo The {@link MediaCodecInfo encoderInfo}.
* @param mimeType The {@link MimeTypes MIME type}.
* @param mimeType The {@link
plain
MimeTypes MIME type}.
* @param profile The encoding profile.
* @return The highest supported encoding level, as documented in {@link
* MediaCodecInfo.CodecProfileLevel}, or {@link #LEVEL_UNSET} if the profile is not supported.
...
...
@@ -157,8 +157,8 @@ public final class EncoderUtil {
}
/**
* Finds a {@link MediaCodec
codec} that supports the {@link MediaFormat}, or {@code null} if none
*
is
found.
* Finds a {@link MediaCodec
} that supports the {@link MediaFormat}, or {@code null} if none is
* found.
*/
@Nullable
public
static
String
findCodecForFormat
(
MediaFormat
format
,
boolean
isDecoder
)
{
...
...
@@ -183,7 +183,8 @@ public final class EncoderUtil {
}
/**
* Finds the {@link MediaCodecInfo encoder}'s closest supported bitrate from the given bitrate.
* Finds the {@linkplain MediaCodecInfo encoder}'s closest supported bitrate from the given
* bitrate.
*/
public
static
int
getClosestSupportedBitrate
(
MediaCodecInfo
encoderInfo
,
String
mimeType
,
int
bitrate
)
{
...
...
@@ -203,7 +204,7 @@ public final class EncoderUtil {
.
isBitrateModeSupported
(
bitrateMode
);
}
/** Checks if a {@link MediaCodecInfo codec} is hardware-accelerated. */
/** Checks if a {@link
plain
MediaCodecInfo codec} is hardware-accelerated. */
public
static
boolean
isHardwareAccelerated
(
MediaCodecInfo
encoderInfo
,
String
mimeType
)
{
// TODO(b/214964116): Merge into MediaCodecUtil.
if
(
Util
.
SDK_INT
>=
29
)
{
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/ExternalCopyFrameProcessor.java
View file @
80890928
...
...
@@ -92,7 +92,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* Sets the texture transform matrix for converting an external surface texture's coordinates to
* sampling locations.
*
* @param textureTransformMatrix The external surface texture's {@link
* @param textureTransformMatrix The external surface texture's {@link
plain
* android.graphics.SurfaceTexture#getTransformMatrix(float[]) transform matrix}.
*/
public
void
setTextureTransformMatrix
(
float
[]
textureTransformMatrix
)
{
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/FallbackListener.java
View file @
80890928
...
...
@@ -40,7 +40,8 @@ import androidx.media3.common.util.Util;
* Creates a new instance.
*
* @param mediaItem The {@link MediaItem} to transform.
* @param transformerListeners The {@link Transformer.Listener listeners} to forward events to.
* @param transformerListeners The {@linkplain Transformer.Listener listeners} to forward events
* to.
* @param originalTransformationRequest The original {@link TransformationRequest}.
*/
public
FallbackListener
(
...
...
@@ -56,7 +57,7 @@ import androidx.media3.common.util.Util;
/**
* Registers an output track.
*
* <p>All tracks must be registered before a transformation request is {@link
* <p>All tracks must be registered before a transformation request is {@link
plain
* #onTransformationRequestFinalized(TransformationRequest) finalized}.
*/
public
void
registerTrack
()
{
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/FrameProcessorChain.java
View file @
80890928
...
...
@@ -52,12 +52,12 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/**
* {@code FrameProcessorChain} applies changes to individual video frames.
*
* <p>Input becomes available on its {@link
#getInputSurface() input surface} asynchronously and is
*
processed on a background thread as it becomes available. All input frames should be {@link
*
#registerInputFrame() registered} before they are rendered to the input surface. {@link
*
#getPendingFrameCount()} can be used to check whether there are frames that have not been fully
*
processed yet. Output is written to its {@link #configure(Surface, int, int, SurfaceView) output
* surface}.
* <p>Input becomes available on its {@link
plain #getInputSurface() input surface} asynchronously
*
and is processed on a background thread as it becomes available. All input frames should be
*
{@linkplain #registerInputFrame() registered} before they are rendered to the input surface.
*
{@link #getPendingFrameCount()} can be used to check whether there are frames that have not been
*
fully processed yet. Output is written to its {@linkplain #configure(Surface, int, int,
*
SurfaceView) output
surface}.
*/
/* package */
final
class
FrameProcessorChain
{
...
...
@@ -74,7 +74,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
private
final
ExecutorService
singleThreadExecutorService
;
/** Futures corresponding to the executor service's pending tasks. */
private
final
ConcurrentLinkedQueue
<
Future
<?>>
futures
;
/** Number of frames {@link #registerInputFrame() registered} but not fully processed. */
/** Number of frames {@link
plain
#registerInputFrame() registered} but not fully processed. */
private
final
AtomicInteger
pendingFrameCount
;
/** Prevents further frame processing tasks from being scheduled after {@link #release()}. */
private
volatile
boolean
releaseRequested
;
...
...
@@ -186,7 +186,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/**
* Configures the {@code FrameProcessorChain} to process frames to the specified output targets.
*
* <p>This method may only be called once and may override the {@link
* <p>This method may only be called once and may override the {@link
plain
* GlFrameProcessor#configureOutputSize(int, int) output size} of the final {@link
* GlFrameProcessor}.
*
...
...
@@ -253,8 +253,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/**
* Returns the input {@link Surface}.
*
* <p>The {@code FrameProcessorChain} must be {@link
#configure(Surface, int, int, SurfaceView)
* configured}.
* <p>The {@code FrameProcessorChain} must be {@link
plain #configure(Surface, int, int,
*
SurfaceView)
configured}.
*/
public
Surface
getInputSurface
()
{
checkStateNotNull
(
inputSurface
,
"The FrameProcessorChain must be configured."
);
...
...
@@ -296,8 +296,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
/**
* Returns the number of input frames that have been {@link
#registerInputFrame() registered} but
* not completely processed yet.
* Returns the number of input frames that have been {@link
plain #registerInputFrame() registered}
*
but
not completely processed yet.
*/
public
int
getPendingFrameCount
()
{
return
pendingFrameCount
.
get
();
...
...
@@ -316,9 +316,9 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/**
* Releases all resources.
*
* <p>If the frame processor chain is released before it has {@link
#isEnded() ended}, it will
*
attempt to cancel processing any input frames that have already become available. Input frames
* that become available after release are ignored.
* <p>If the frame processor chain is released before it has {@link
plain #isEnded() ended}, it
*
will attempt to cancel processing any input frames that have already become available. Input
*
frames
that become available after release are ignored.
*/
public
void
release
()
{
releaseRequested
=
true
;
...
...
@@ -447,7 +447,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
/**
* Configures the input and output {@link Size sizes} of a list of {@link GlFrameProcessor
* Configures the input and output {@link
plain
Size sizes} of a list of {@link GlFrameProcessor
* GlFrameProcessors}.
*
* @param inputWidth The width of frames passed to the first {@link GlFrameProcessor}, in pixels.
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/FrameworkMuxer.java
View file @
80890928
...
...
@@ -221,13 +221,13 @@ import java.nio.ByteBuffer;
}
/**
* Converts a {@link
MimeTypes MIME type} into a {@link MediaMuxer.OutputFormat MediaMuxer outpu
t
* format}.
* Converts a {@link
plain MimeTypes MIME type} into a {@linkplain MediaMuxer.OutputForma
t
*
MediaMuxer output
format}.
*
* @param mimeType The {@link MimeTypes MIME type} to convert.
* @return The corresponding {@link MediaMuxer.OutputFormat MediaMuxer output format}.
* @throws IllegalArgumentException If the {@link
MimeTypes MIME type} is not supported as output
* format.
* @param mimeType The {@link
plain
MimeTypes MIME type} to convert.
* @return The corresponding {@link
plain
MediaMuxer.OutputFormat MediaMuxer output format}.
* @throws IllegalArgumentException If the {@link
plain MimeTypes MIME type} is not supported as
*
output
format.
*/
private
static
int
mimeTypeToMuxerOutputFormat
(
String
mimeType
)
{
if
(
mimeType
.
equals
(
MimeTypes
.
VIDEO_MP4
))
{
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/GlFrameProcessor.java
View file @
80890928
...
...
@@ -57,8 +57,8 @@ public interface GlFrameProcessor {
/**
* Updates the shader program's vertex attributes and uniforms, binds them, and draws.
*
* <p>The frame processor must be {@link
#initialize(int) initialized}. The caller is responsible
* for focussing the correct render target before calling this method.
* <p>The frame processor must be {@link
plain #initialize(int) initialized}. The caller is
*
responsible
for focussing the correct render target before calling this method.
*
* @param presentationTimeNs The presentation timestamp of the current frame, in nanoseconds.
*/
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/Muxer.java
View file @
80890928
...
...
@@ -27,12 +27,12 @@ import java.nio.ByteBuffer;
/**
* Abstracts media muxing operations.
*
* <p>Query whether {@link
Factory#supportsOutputMimeType(String) container MIME type} and {@link
*
Factory#supportsSampleMimeType(String, String) sample MIME types} are supported and {@link
*
#addTrack(Format) add all tracks}, then {@link #writeSampleData(int, ByteBuffer, boolean, long)
*
write sample data} to mux samples. Once any sample data has been written, it is not possible to
*
add tracks. After writing all sample data, {@link #release(boolean) release} the instance to
* finish writing to the output and return any resources to the system.
* <p>Query whether {@link
plain Factory#supportsOutputMimeType(String) container MIME type} and
*
{@linkplain Factory#supportsSampleMimeType(String, String) sample MIME types} are supported and
*
{@linkplain #addTrack(Format) add all tracks}, then {@linkplain #writeSampleData(int, ByteBuffer,
*
boolean, long) write sample data} to mux samples. Once any sample data has been written, it is
*
not possible to add tracks. After writing all sample data, {@linkplain #release(boolean) release}
*
the instance to
finish writing to the output and return any resources to the system.
*/
/* package */
interface
Muxer
{
...
...
@@ -55,7 +55,7 @@ import java.nio.ByteBuffer;
* Returns a new muxer writing to a file.
*
* @param path The path to the output file.
* @param outputMimeType The container {@link MimeTypes MIME type} of the output file.
* @param outputMimeType The container {@link
plain
MimeTypes MIME type} of the output file.
* @throws IllegalArgumentException If the path is invalid or the MIME type is not supported.
* @throws IOException If an error occurs opening the output file for writing.
*/
...
...
@@ -68,7 +68,7 @@ import java.nio.ByteBuffer;
* output. The file referenced by this ParcelFileDescriptor should not be used before the
* muxer is released. It is the responsibility of the caller to close the
* ParcelFileDescriptor. This can be done after this method returns.
* @param outputMimeType The {@link MimeTypes MIME type} of the output.
* @param outputMimeType The {@link
plain
MimeTypes MIME type} of the output.
* @throws IllegalArgumentException If the file descriptor is invalid or the MIME type is not
* supported.
* @throws IOException If an error occurs opening the output file descriptor for writing.
...
...
@@ -76,18 +76,20 @@ import java.nio.ByteBuffer;
Muxer
create
(
ParcelFileDescriptor
parcelFileDescriptor
,
String
outputMimeType
)
throws
IOException
;
/** Returns whether the {@link MimeTypes MIME type} provided is a supported output format. */
/**
* Returns whether the {@linkplain MimeTypes MIME type} provided is a supported output format.
*/
boolean
supportsOutputMimeType
(
String
mimeType
);
/**
* Returns whether the sample {@link
MimeTypes MIME type} is supported with the given container
*
{@link
MimeTypes MIME type}.
* Returns whether the sample {@link
plain MimeTypes MIME type} is supported with the given
*
container {@linkplain
MimeTypes MIME type}.
*/
boolean
supportsSampleMimeType
(
@Nullable
String
sampleMimeType
,
String
containerMimeType
);
/**
* Returns the supported sample {@link
MimeTypes MIME types} for the given {@link C.TrackType}
*
and container {@link
MimeTypes MIME type}.
* Returns the supported sample {@link
plain MimeTypes MIME types} for the given {@link
*
C.TrackType} and container {@linkplain
MimeTypes MIME type}.
*/
ImmutableList
<
String
>
getSupportedSampleMimeTypes
(
@C
.
TrackType
int
trackType
,
String
containerMimeType
);
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/MuxerWrapper.java
View file @
80890928
...
...
@@ -70,10 +70,10 @@ import java.nio.ByteBuffer;
/**
* Registers an output track.
*
* <p>All tracks must be registered before any track format is {@link #addTrackFormat(Format)
* <p>All tracks must be registered before any track format is {@link
plain
#addTrackFormat(Format)
* added}.
*
* @throws IllegalStateException If a track format was {@link #addTrackFormat(Format) added}
* @throws IllegalStateException If a track format was {@link
plain
#addTrackFormat(Format) added}
* before calling this method.
*/
public
void
registerTrack
()
{
...
...
@@ -82,14 +82,14 @@ import java.nio.ByteBuffer;
trackCount
++;
}
/** Returns whether the sample {@link MimeTypes MIME type} is supported. */
/** Returns whether the sample {@link
plain
MimeTypes MIME type} is supported. */
public
boolean
supportsSampleMimeType
(
@Nullable
String
mimeType
)
{
return
muxerFactory
.
supportsSampleMimeType
(
mimeType
,
containerMimeType
);
}
/**
* Returns the supported {@link
MimeTypes MIME types} for the given {@link C.TrackType track
* type}.
* Returns the supported {@link
plain MimeTypes MIME types} for the given {@linkplain C.TrackType
* t
rack t
ype}.
*/
public
ImmutableList
<
String
>
getSupportedSampleMimeTypes
(
@C
.
TrackType
int
trackType
)
{
return
muxerFactory
.
getSupportedSampleMimeTypes
(
trackType
,
containerMimeType
);
...
...
@@ -98,9 +98,9 @@ import java.nio.ByteBuffer;
/**
* Adds a track format to the muxer.
*
* <p>The tracks must all be {@link
#registerTrack() registered} before any format is added an
d
* a
ll the formats must be added before samples are {@link #writeSample(int, ByteBuffer, boolean
,
* long) written}.
* <p>The tracks must all be {@link
plain #registerTrack() registered} before any format is adde
d
* a
nd all the formats must be added before samples are {@linkplain #writeSample(int, ByteBuffer
,
*
boolean,
long) written}.
*
* @param format The {@link Format} to be added.
* @throws IllegalStateException If the format is unsupported or if there is already a track
...
...
@@ -133,16 +133,16 @@ import java.nio.ByteBuffer;
/**
* Attempts to write a sample to the muxer.
*
* @param trackType The {@link C.TrackType track type} of the sample.
* @param trackType The {@link
plain
C.TrackType track type} of the sample.
* @param data The sample to write.
* @param isKeyFrame Whether the sample is a key frame.
* @param presentationTimeUs The presentation time of the sample in microseconds.
* @return Whether the sample was successfully written. This is {@code false} if the muxer hasn't
* {@link
#addTrackFormat(Format) received a format} for every {@link #registerTrack()
*
registered track}, or if it should write samples of other track types first to ensure a
* good interleaving.
* @throws IllegalStateException If the muxer doesn't have any {@link
#endTrack(int) non-ended}
* track of the given track type.
* {@link
plain #addTrackFormat(Format) received a format} for every {@linkplain
*
#registerTrack() registered track}, or if it should write samples of other track types
*
first to ensure a
good interleaving.
* @throws IllegalStateException If the muxer doesn't have any {@link
plain #endTrack(int)
*
non-ended}
track of the given track type.
* @throws Muxer.MuxerException If the underlying muxer fails to write the sample.
*/
public
boolean
writeSample
(
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/SefSlowMotionFlattener.java
View file @
80890928
...
...
@@ -247,8 +247,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
* output frame rate might be variable.
*
* <p>This method can only be called if all the frames until the current one (included) have been
* {@link
#processCurrentFrame(int, long) processed} in order, and if the next frames have not
* been processed yet.
* {@link
plain #processCurrentFrame(int, long) processed} in order, and if the next frames have
*
not
been processed yet.
*/
@VisibleForTesting
/* package */
long
getCurrentFrameOutputTimeUs
(
long
inputTimeUs
)
{
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/TransformationException.java
View file @
80890928
...
...
@@ -147,7 +147,7 @@ public final class TransformationException extends Exception {
/**
* Caused by the output format for a track not being supported.
*
* <p>Supported output formats are limited by the muxer's capabilities and the {@link
* <p>Supported output formats are limited by the muxer's capabilities and the {@link
plain
* Codec.DecoderFactory encoders} available.
*/
public
static
final
int
ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED
=
4003
;
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/TransformationRequest.java
View file @
80890928
...
...
@@ -161,7 +161,7 @@ public final class TransformationRequest {
* @param videoMimeType The MIME type of the video samples in the output.
* @return This builder.
* @throws IllegalArgumentException If the {@code videoMimeType} is non-null but not a video
* {@link MimeTypes MIME type}.
* {@link
plain
MimeTypes MIME type}.
*/
public
Builder
setVideoMimeType
(
@Nullable
String
videoMimeType
)
{
checkArgument
(
...
...
@@ -186,7 +186,7 @@ public final class TransformationRequest {
* @param audioMimeType The MIME type of the audio samples in the output.
* @return This builder.
* @throws IllegalArgumentException If the {@code audioMimeType} is non-null but not an audio
* {@link MimeTypes MIME type}.
* {@link
plain
MimeTypes MIME type}.
*/
public
Builder
setAudioMimeType
(
@Nullable
String
audioMimeType
)
{
checkArgument
(
...
...
@@ -218,7 +218,7 @@ public final class TransformationRequest {
*
* <p>This method is experimental, and will be renamed or removed in a future release. The HDR
* editing feature is under development and is intended for developing/testing HDR processing
* and encoding support. HDR editing can't be enabled at the same time as {@link
* and encoding support. HDR editing can't be enabled at the same time as {@link
plain
* #setEnableRequestSdrToneMapping(boolean) SDR tone-mapping}.
*
* @param enableHdrEditing Whether to attempt to process any input video stream as a high
...
...
@@ -278,15 +278,15 @@ public final class TransformationRequest {
*/
public
final
int
outputHeight
;
/**
* The requested output audio sample {@link
MimeTypes MIME type}, or {@code null} if inferred from
* the input.
* The requested output audio sample {@link
plain MimeTypes MIME type}, or {@code null} if inferred
*
from
the input.
*
* @see Builder#setAudioMimeType(String)
*/
@Nullable
public
final
String
audioMimeType
;
/**
* The requested output video sample {@link
MimeTypes MIME type}, or {@code null} if inferred from
* the input.
* The requested output video sample {@link
plain MimeTypes MIME type}, or {@code null} if inferred
*
from
the input.
*
* @see Builder#setVideoMimeType(String)
*/
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java
View file @
80890928
...
...
@@ -208,7 +208,7 @@ public final class Transformer {
* Sets the {@link MediaSource.Factory} to be used to retrieve the inputs to transform.
*
* <p>The default value is a {@link DefaultMediaSourceFactory} built with the context provided
* in {@link #Builder(Context) the constructor}.
* in {@link
plain
#Builder(Context) the constructor}.
*
* @param mediaSourceFactory A {@link MediaSource.Factory}.
* @return This builder.
...
...
@@ -309,7 +309,7 @@ public final class Transformer {
}
/**
* Removes all {@link Transformer.Listener listeners}.
* Removes all {@link
plain
Transformer.Listener listeners}.
*
* <p>This is equivalent to {@link Transformer#removeAllListeners()}.
*
...
...
@@ -639,7 +639,7 @@ public final class Transformer {
}
/**
* Removes all {@link Transformer.Listener listeners}.
* Removes all {@link
plain
Transformer.Listener listeners}.
*
* @throws IllegalStateException If this method is called from the wrong thread.
*/
...
...
@@ -651,14 +651,14 @@ public final class Transformer {
/**
* Starts an asynchronous operation to transform the given {@link MediaItem}.
*
* <p>The transformation state is notified through the {@link Builder#addListener(Listener)
* <p>The transformation state is notified through the {@link
plain
Builder#addListener(Listener)
* listener}.
*
* <p>Concurrent transformations on the same Transformer object are not allowed.
*
* <p>The output is an MP4 file. It can contain at most one video track and one audio track. Other
* track types are ignored. For adaptive bitrate {@link
MediaSource media sources}, the highest
* bitrate video and audio streams are selected.
* track types are ignored. For adaptive bitrate {@link
plain MediaSource media sources}, the
*
highest
bitrate video and audio streams are selected.
*
* @param mediaItem The {@link MediaItem} to transform.
* @param path The path to the output file.
...
...
@@ -674,14 +674,14 @@ public final class Transformer {
/**
* Starts an asynchronous operation to transform the given {@link MediaItem}.
*
* <p>The transformation state is notified through the {@link Builder#addListener(Listener)
* <p>The transformation state is notified through the {@link
plain
Builder#addListener(Listener)
* listener}.
*
* <p>Concurrent transformations on the same Transformer object are not allowed.
*
* <p>The output is an MP4 file. It can contain at most one video track and one audio track. Other
* track types are ignored. For adaptive bitrate {@link
MediaSource media sources}, the highest
* bitrate video and audio streams are selected.
* track types are ignored. For adaptive bitrate {@link
plain MediaSource media sources}, the
*
highest
bitrate video and audio streams are selected.
*
* @param mediaItem The {@link MediaItem} to transform.
* @param parcelFileDescriptor A readable and writable {@link ParcelFileDescriptor} of the output.
...
...
@@ -767,7 +767,7 @@ public final class Transformer {
* Returns the current {@link ProgressState} and updates {@code progressHolder} with the current
* progress if it is {@link #PROGRESS_STATE_AVAILABLE available}.
*
* <p>After a transformation {@link Listener#onTransformationCompleted(MediaItem,
* <p>After a transformation {@link
plain
Listener#onTransformationCompleted(MediaItem,
* TransformationResult) completes}, this method returns {@link
* #PROGRESS_STATE_NO_TRANSFORMATION}.
*
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/VideoEncoderSettings.java
View file @
80890928
...
...
@@ -181,7 +181,7 @@ public final class VideoEncoderSettings {
/** The encoding bitrate. */
public
final
int
bitrate
;
/** One of {@link BitrateMode the allowed modes}. */
/** One of {@link
plain
BitrateMode the allowed modes}. */
public
final
@BitrateMode
int
bitrateMode
;
/** The encoding profile. */
public
final
int
profile
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment