mirror of
https://github.com/samsonjs/media.git
synced 2026-04-10 12:05:47 +00:00
Move FlacConstant to lib-extractor
PiperOrigin-RevId: 397156268
This commit is contained in:
parent
c21d5c7f33
commit
f7abce6aea
11 changed files with 13 additions and 15 deletions
|
|
@ -22,7 +22,6 @@ import com.google.android.exoplayer2.extractor.ExtractorInput;
|
|||
import com.google.android.exoplayer2.extractor.FlacStreamMetadata;
|
||||
import com.google.android.exoplayer2.extractor.SeekMap;
|
||||
import com.google.android.exoplayer2.util.Assertions;
|
||||
import com.google.android.exoplayer2.util.FlacConstants;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
|
@ -50,6 +49,8 @@ import java.nio.ByteBuffer;
|
|||
}
|
||||
}
|
||||
|
||||
private static final int MIN_FRAME_HEADER_SIZE = 6;
|
||||
|
||||
private final FlacDecoderJni decoderJni;
|
||||
|
||||
/**
|
||||
|
|
@ -76,8 +77,7 @@ import java.nio.ByteBuffer;
|
|||
/* floorBytePosition= */ firstFramePosition,
|
||||
/* ceilingBytePosition= */ inputLength,
|
||||
/* approxBytesPerFrame= */ streamMetadata.getApproxBytesPerFrame(),
|
||||
/* minimumSearchRange= */ max(
|
||||
FlacConstants.MIN_FRAME_HEADER_SIZE, streamMetadata.minFrameSize));
|
||||
/* minimumSearchRange= */ max(MIN_FRAME_HEADER_SIZE, streamMetadata.minFrameSize));
|
||||
this.decoderJni = Assertions.checkNotNull(decoderJni);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import com.google.android.exoplayer2.audio.AudioSink;
|
|||
import com.google.android.exoplayer2.audio.DecoderAudioRenderer;
|
||||
import com.google.android.exoplayer2.decoder.CryptoConfig;
|
||||
import com.google.android.exoplayer2.extractor.FlacStreamMetadata;
|
||||
import com.google.android.exoplayer2.util.FlacConstants;
|
||||
import com.google.android.exoplayer2.util.MimeTypes;
|
||||
import com.google.android.exoplayer2.util.TraceUtil;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
|
|
@ -35,6 +34,8 @@ public final class LibflacAudioRenderer extends DecoderAudioRenderer<FlacDecoder
|
|||
|
||||
private static final String TAG = "LibflacAudioRenderer";
|
||||
private static final int NUM_BUFFERS = 16;
|
||||
private static final int STREAM_MARKER_SIZE = 4;
|
||||
private static final int METADATA_BLOCK_HEADER_SIZE = 4;
|
||||
|
||||
public LibflacAudioRenderer() {
|
||||
this(/* eventHandler= */ null, /* eventListener= */ null);
|
||||
|
|
@ -92,8 +93,7 @@ public final class LibflacAudioRenderer extends DecoderAudioRenderer<FlacDecoder
|
|||
outputFormat =
|
||||
Util.getPcmFormat(C.ENCODING_PCM_16BIT, format.channelCount, format.sampleRate);
|
||||
} else {
|
||||
int streamMetadataOffset =
|
||||
FlacConstants.STREAM_MARKER_SIZE + FlacConstants.METADATA_BLOCK_HEADER_SIZE;
|
||||
int streamMetadataOffset = STREAM_MARKER_SIZE + METADATA_BLOCK_HEADER_SIZE;
|
||||
FlacStreamMetadata streamMetadata =
|
||||
new FlacStreamMetadata(format.initializationData.get(0), streamMetadataOffset);
|
||||
outputFormat = getOutputFormat(streamMetadata);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
package com.google.android.exoplayer2.extractor;
|
||||
|
||||
import com.google.android.exoplayer2.ParserException;
|
||||
import com.google.android.exoplayer2.util.FlacConstants;
|
||||
import com.google.android.exoplayer2.extractor.flac.FlacConstants;
|
||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import java.io.IOException;
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ package com.google.android.exoplayer2.extractor;
|
|||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.ParserException;
|
||||
import com.google.android.exoplayer2.extractor.VorbisUtil.CommentHeader;
|
||||
import com.google.android.exoplayer2.extractor.flac.FlacConstants;
|
||||
import com.google.android.exoplayer2.metadata.Metadata;
|
||||
import com.google.android.exoplayer2.metadata.flac.PictureFrame;
|
||||
import com.google.android.exoplayer2.metadata.id3.Id3Decoder;
|
||||
import com.google.android.exoplayer2.util.FlacConstants;
|
||||
import com.google.android.exoplayer2.util.ParsableBitArray;
|
||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
import com.google.common.base.Charsets;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import com.google.android.exoplayer2.extractor.FlacFrameReader;
|
|||
import com.google.android.exoplayer2.extractor.FlacFrameReader.SampleNumberHolder;
|
||||
import com.google.android.exoplayer2.extractor.FlacStreamMetadata;
|
||||
import com.google.android.exoplayer2.extractor.SeekMap;
|
||||
import com.google.android.exoplayer2.util.FlacConstants;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer2.util;
|
||||
package com.google.android.exoplayer2.extractor.flac;
|
||||
|
||||
/** Defines constants used by the FLAC extractor. */
|
||||
public final class FlacConstants {
|
||||
|
|
@ -36,7 +36,6 @@ import com.google.android.exoplayer2.extractor.SeekMap;
|
|||
import com.google.android.exoplayer2.extractor.TrackOutput;
|
||||
import com.google.android.exoplayer2.metadata.Metadata;
|
||||
import com.google.android.exoplayer2.util.Assertions;
|
||||
import com.google.android.exoplayer2.util.FlacConstants;
|
||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Documented;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import com.google.android.exoplayer2.extractor.FlacSeekTableSeekMap;
|
|||
import com.google.android.exoplayer2.extractor.FlacStreamMetadata;
|
||||
import com.google.android.exoplayer2.extractor.FlacStreamMetadata.SeekTable;
|
||||
import com.google.android.exoplayer2.extractor.SeekMap;
|
||||
import com.google.android.exoplayer2.util.FlacConstants;
|
||||
import com.google.android.exoplayer2.extractor.flac.FlacConstants;
|
||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import java.util.Arrays;
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ import androidx.test.core.app.ApplicationProvider;
|
|||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.android.exoplayer2.extractor.FlacFrameReader.SampleNumberHolder;
|
||||
import com.google.android.exoplayer2.extractor.FlacMetadataReader.FlacStreamMetadataHolder;
|
||||
import com.google.android.exoplayer2.extractor.flac.FlacConstants;
|
||||
import com.google.android.exoplayer2.testutil.FakeExtractorInput;
|
||||
import com.google.android.exoplayer2.testutil.TestUtil;
|
||||
import com.google.android.exoplayer2.util.FlacConstants;
|
||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
import java.io.IOException;
|
||||
import org.junit.Test;
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ import androidx.test.core.app.ApplicationProvider;
|
|||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.android.exoplayer2.ParserException;
|
||||
import com.google.android.exoplayer2.extractor.FlacMetadataReader.FlacStreamMetadataHolder;
|
||||
import com.google.android.exoplayer2.extractor.flac.FlacConstants;
|
||||
import com.google.android.exoplayer2.metadata.Metadata;
|
||||
import com.google.android.exoplayer2.metadata.flac.PictureFrame;
|
||||
import com.google.android.exoplayer2.metadata.flac.VorbisComment;
|
||||
import com.google.android.exoplayer2.testutil.FakeExtractorInput;
|
||||
import com.google.android.exoplayer2.testutil.TestUtil;
|
||||
import com.google.android.exoplayer2.util.FlacConstants;
|
||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ import static com.google.common.truth.Truth.assertThat;
|
|||
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.android.exoplayer2.extractor.flac.FlacConstants;
|
||||
import com.google.android.exoplayer2.metadata.Metadata;
|
||||
import com.google.android.exoplayer2.metadata.flac.VorbisComment;
|
||||
import com.google.android.exoplayer2.testutil.TestUtil;
|
||||
import com.google.android.exoplayer2.util.FlacConstants;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import org.junit.Test;
|
||||
|
|
|
|||
Loading…
Reference in a new issue