forked from google/ExoPlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DefaultMuxer forwarding to FrameworkMuxer
- The naming DefaultMuxer is more consistent with the rest of Transformer codebase (e.g. DefaultEncoderFactory). - By hiding the implementation details of DefaultMuxer, the transition to in-app Muxer will be seamless for apps using DefaultMuxer. - The current plan is that DefaultMuxer will become the in-app muxer. PiperOrigin-RevId: 481838790
- Loading branch information
1 parent
325e973
commit b4d7f06
Showing
3 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
...ary/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultMuxer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright 2022 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.google.android.exoplayer2.transformer; | ||
|
||
import android.os.ParcelFileDescriptor; | ||
import com.google.android.exoplayer2.C; | ||
import com.google.android.exoplayer2.Format; | ||
import com.google.common.collect.ImmutableList; | ||
import java.io.IOException; | ||
import java.nio.ByteBuffer; | ||
|
||
/** A default {@link Muxer} implementation. */ | ||
public final class DefaultMuxer implements Muxer { | ||
|
||
/** A {@link Muxer.Factory} for {@link DefaultMuxer}. */ | ||
public static final class Factory implements Muxer.Factory { | ||
private final Muxer.Factory muxerFactory; | ||
|
||
public Factory() { | ||
this.muxerFactory = new FrameworkMuxer.Factory(); | ||
} | ||
|
||
@Override | ||
public Muxer create(String path, String outputMimeType) throws IOException { | ||
return new DefaultMuxer(muxerFactory.create(path, outputMimeType)); | ||
} | ||
|
||
@Override | ||
public Muxer create(ParcelFileDescriptor parcelFileDescriptor, String outputMimeType) | ||
throws IOException { | ||
return new DefaultMuxer(muxerFactory.create(parcelFileDescriptor, outputMimeType)); | ||
} | ||
|
||
@Override | ||
public boolean supportsOutputMimeType(String mimeType) { | ||
return muxerFactory.supportsOutputMimeType(mimeType); | ||
} | ||
|
||
@Override | ||
public ImmutableList<String> getSupportedSampleMimeTypes( | ||
@C.TrackType int trackType, String containerMimeType) { | ||
return muxerFactory.getSupportedSampleMimeTypes(trackType, containerMimeType); | ||
} | ||
} | ||
|
||
private final Muxer muxer; | ||
|
||
private DefaultMuxer(Muxer muxer) { | ||
this.muxer = muxer; | ||
} | ||
|
||
@Override | ||
public int addTrack(Format format) throws MuxerException { | ||
return muxer.addTrack(format); | ||
} | ||
|
||
@Override | ||
public void writeSampleData( | ||
int trackIndex, ByteBuffer data, boolean isKeyFrame, long presentationTimeUs) | ||
throws MuxerException { | ||
muxer.writeSampleData(trackIndex, data, isKeyFrame, presentationTimeUs); | ||
} | ||
|
||
@Override | ||
public void release(boolean forCancellation) throws MuxerException { | ||
muxer.release(forCancellation); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters