mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Make Mp4Muxers and FragmentedMp4Muxers implement AutoCloseable
PiperOrigin-RevId: 717549236
This commit is contained in:
parent
a31c7ad9a8
commit
6fe011beb4
@ -83,7 +83,7 @@ import java.nio.ByteBuffer;
|
||||
* </ul>
|
||||
*/
|
||||
@UnstableApi
|
||||
public final class FragmentedMp4Muxer {
|
||||
public final class FragmentedMp4Muxer implements AutoCloseable {
|
||||
/** The default fragment duration. */
|
||||
public static final long DEFAULT_FRAGMENT_DURATION_MS = 2_000;
|
||||
|
||||
@ -254,6 +254,7 @@ public final class FragmentedMp4Muxer {
|
||||
*
|
||||
* @throws MuxerException If the muxer fails to finish writing the output.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws MuxerException {
|
||||
try {
|
||||
fragmentedMp4Writer.close();
|
||||
|
@ -109,7 +109,7 @@ import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
|
||||
* </ul>
|
||||
*/
|
||||
@UnstableApi
|
||||
public final class Mp4Muxer {
|
||||
public final class Mp4Muxer implements AutoCloseable {
|
||||
/** Parameters for {@link #FILE_FORMAT_MP4_WITH_AUXILIARY_TRACKS_EXTENSION}. */
|
||||
public static final class Mp4AtFileParameters {
|
||||
/** Provides temporary cache files to be used by the muxer. */
|
||||
@ -535,6 +535,7 @@ public final class Mp4Muxer {
|
||||
*
|
||||
* @throws MuxerException If the muxer fails to finish writing the output.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws MuxerException {
|
||||
@Nullable MuxerException exception = null;
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user