Make SpeedChangingAudioProcessor public
PiperOrigin-RevId: 542533743
This commit is contained in:
parent
b8ac5b4210
commit
69cef452a0
@ -14,14 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package androidx.media3.transformer;
|
||||
package androidx.media3.common.audio;
|
||||
|
||||
import static java.lang.Math.min;
|
||||
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.audio.AudioProcessor;
|
||||
import androidx.media3.common.audio.BaseAudioProcessor;
|
||||
import androidx.media3.common.audio.SonicAudioProcessor;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.common.util.Util;
|
||||
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
||||
import java.nio.ByteBuffer;
|
||||
@ -29,9 +27,10 @@ import java.nio.ByteBuffer;
|
||||
/**
|
||||
* An {@link AudioProcessor} that changes the speed of audio samples depending on their timestamp.
|
||||
*/
|
||||
// TODO(b/198772621): Consider making the processor inactive and skipping it in the processor chain
|
||||
// TODO(b/288221200): Consider making the processor inactive and skipping it in the processor chain
|
||||
// when speed is 1.
|
||||
/* package */ final class SpeedChangingAudioProcessor extends BaseAudioProcessor {
|
||||
@UnstableApi
|
||||
public final class SpeedChangingAudioProcessor extends BaseAudioProcessor {
|
||||
|
||||
/** The speed provider that provides the speed for each timestamp. */
|
||||
private final SpeedProvider speedProvider;
|
@ -13,18 +13,20 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.transformer;
|
||||
package androidx.media3.common.audio;
|
||||
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
|
||||
/** A custom interface that determines the speed for media at specific timestamps. */
|
||||
/* package */ interface SpeedProvider {
|
||||
@UnstableApi
|
||||
public interface SpeedProvider {
|
||||
|
||||
/**
|
||||
* Provides the speed that the media should be played at, based on the timeUs.
|
||||
* Returns the media speed at the provided timestamp.
|
||||
*
|
||||
* @param timeUs The timestamp of the media.
|
||||
* @return The speed that the media should be played at, based on the timeUs.
|
||||
* @return The speed that the media should be played at.
|
||||
*/
|
||||
float getSpeed(long timeUs);
|
||||
|
@ -13,14 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.transformer;
|
||||
package androidx.media3.common.audio;
|
||||
|
||||
import static androidx.media3.common.audio.AudioProcessor.EMPTY_BUFFER;
|
||||
import static androidx.media3.common.util.Assertions.checkArgument;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.audio.AudioProcessor;
|
||||
import androidx.media3.common.util.Util;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import java.nio.ByteBuffer;
|
@ -30,6 +30,7 @@ import androidx.media3.common.MimeTypes;
|
||||
import androidx.media3.common.audio.AudioProcessingPipeline;
|
||||
import androidx.media3.common.audio.AudioProcessor;
|
||||
import androidx.media3.common.audio.AudioProcessor.AudioFormat;
|
||||
import androidx.media3.common.audio.SpeedChangingAudioProcessor;
|
||||
import androidx.media3.common.util.Util;
|
||||
import androidx.media3.decoder.DecoderInputBuffer;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -21,6 +21,7 @@ import static androidx.media3.extractor.metadata.mp4.SlowMotionData.Segment.BY_S
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.Metadata;
|
||||
import androidx.media3.common.audio.SpeedProvider;
|
||||
import androidx.media3.common.util.Util;
|
||||
import androidx.media3.extractor.metadata.mp4.SlowMotionData;
|
||||
import androidx.media3.extractor.metadata.mp4.SlowMotionData.Segment;
|
||||
|
Loading…
x
Reference in New Issue
Block a user