Deprecate MimeTypes.TEXT_EXOPLAYER_CUES for APPLICATION_MEDIA3_CUES

Instead of `text/x-exoplayer-cues`, we will use `application/x-media3-cues`.

The prefix should be `application` not `text` since the encoded form is arbitrary bytes, not necessarily text. The name should not reference `exoplayer`, since the Media3 Extractors (which are not part of `exoplayer`) produce this format.

PiperOrigin-RevId: 550181852
This commit is contained in:
jbibik 2023-07-22 13:04:33 +01:00 committed by Rohit Singh
parent d7b5ab9f23
commit f4ad26451f
29 changed files with 38 additions and 36 deletions

View File

@ -38,6 +38,8 @@
* Add additional fields to Common Media Client Data (CMCD) logging:
streaming format (sf), stream type (st), version (v), top birate (tb),
object duration (d) and measured throughput (mtp).
* Rename `MimeTypes.TEXT_EXOPLAYER_CUES` to
`MimeTypes.APPLICATION_MEDIA3_CUES`.
* Transformer:
* Parse EXIF rotation data for image inputs.
* Remove `TransformationRequest.HdrMode` annotation type and its

View File

@ -108,9 +108,6 @@ public final class MimeTypes {
public static final String TEXT_VTT = BASE_TYPE_TEXT + "/vtt";
public static final String TEXT_SSA = BASE_TYPE_TEXT + "/x-ssa";
@UnstableApi
public static final String TEXT_EXOPLAYER_CUES = BASE_TYPE_TEXT + "/x-exoplayer-cues";
@UnstableApi public static final String TEXT_UNKNOWN = BASE_TYPE_TEXT + "/x-unknown";
// application/ MIME types
@ -152,6 +149,9 @@ public final class MimeTypes {
public static final String APPLICATION_AIT = BASE_TYPE_APPLICATION + "/vnd.dvb.ait";
public static final String APPLICATION_RTSP = BASE_TYPE_APPLICATION + "/x-rtsp";
@UnstableApi
public static final String APPLICATION_MEDIA3_CUES = BASE_TYPE_APPLICATION + "/x-media3-cues";
// image/ MIME types
public static final String IMAGE_JPEG = BASE_TYPE_IMAGE + "/jpeg";

View File

@ -41,7 +41,7 @@ import java.util.Deque;
/**
* A {@link SubtitleDecoder} that decodes subtitle samples of type {@link
* MimeTypes#TEXT_EXOPLAYER_CUES}
* MimeTypes#APPLICATION_MEDIA3_CUES}
*/
@UnstableApi
public final class ExoplayerCuesDecoder implements SubtitleDecoder {

View File

@ -71,7 +71,7 @@ public interface SubtitleDecoderFactory {
|| Objects.equals(mimeType, MimeTypes.APPLICATION_CEA608)
|| Objects.equals(mimeType, MimeTypes.APPLICATION_MP4CEA608)
|| Objects.equals(mimeType, MimeTypes.APPLICATION_CEA708)
|| Objects.equals(mimeType, MimeTypes.TEXT_EXOPLAYER_CUES);
|| Objects.equals(mimeType, MimeTypes.APPLICATION_MEDIA3_CUES);
}
@Override
@ -92,7 +92,7 @@ public interface SubtitleDecoderFactory {
Cea608Decoder.MIN_DATA_CHANNEL_TIMEOUT_MS);
case MimeTypes.APPLICATION_CEA708:
return new Cea708Decoder(format.accessibilityChannel, format.initializationData);
case MimeTypes.TEXT_EXOPLAYER_CUES:
case MimeTypes.APPLICATION_MEDIA3_CUES:
return new ExoplayerCuesDecoder();
default:
break;

View File

@ -344,8 +344,8 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
}
/**
* Enables transcoding of text track samples to {@link MimeTypes#TEXT_EXOPLAYER_CUES} before the
* data is emitted to {@link TrackOutput}.
* Enables transcoding of text track samples to {@link MimeTypes#APPLICATION_MEDIA3_CUES} before
* the data is emitted to {@link TrackOutput}.
*
* <p>Transcoding is disabled by default.
*

View File

@ -107,7 +107,7 @@ public class SubtitleExtractor implements Extractor {
this.format =
format
.buildUpon()
.setSampleMimeType(MimeTypes.TEXT_EXOPLAYER_CUES)
.setSampleMimeType(MimeTypes.APPLICATION_MEDIA3_CUES)
.setCodecs(format.sampleMimeType)
.build();
timestamps = new ArrayList<>();

View File

@ -30,11 +30,11 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/**
* A wrapping {@link Extractor} that transcodes {@linkplain C#TRACK_TYPE_TEXT text samples} from
* supported subtitle formats to {@link MimeTypes#TEXT_EXOPLAYER_CUES}.
* supported subtitle formats to {@link MimeTypes#APPLICATION_MEDIA3_CUES}.
*
* <p>Samples emitted by the delegate {@link Extractor} to {@linkplain C#TRACK_TYPE_TEXT text
* tracks} with a supported subtitle format are transcoded and the resulting {@link
* MimeTypes#TEXT_EXOPLAYER_CUES} samples are emitted to the underlying {@link TrackOutput}.
* MimeTypes#APPLICATION_MEDIA3_CUES} samples are emitted to the underlying {@link TrackOutput}.
*
* <p>Samples emitted by the delegate {@link Extractor} to non-text tracks (or text tracks with an
* unsupported format) are passed through to the underlying {@link TrackOutput} without

View File

@ -38,7 +38,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/**
* A wrapping {@link TrackOutput} which transcodes from a source subtitle format like {@link
* MimeTypes#APPLICATION_SUBRIP} to ExoPlayer's internal binary cue representation ({@link
* MimeTypes#TEXT_EXOPLAYER_CUES}).
* MimeTypes#APPLICATION_MEDIA3_CUES}).
*/
/* package */ class SubtitleTranscodingTrackOutput implements TrackOutput {
@ -89,7 +89,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
delegate.format(
format
.buildUpon()
.setSampleMimeType(MimeTypes.TEXT_EXOPLAYER_CUES)
.setSampleMimeType(MimeTypes.APPLICATION_MEDIA3_CUES)
.setCodecs(format.sampleMimeType)
// Reset this value to the default. All non-default timestamp adjustments are done
// below in sampleMetadata() and there are no 'subsamples' after transcoding.

View File

@ -73,7 +73,7 @@ public class SubtitleExtractorTest {
while (extractor.read(input, null) != Extractor.RESULT_END_OF_INPUT) {}
FakeTrackOutput trackOutput = output.trackOutputs.get(0);
assertThat(trackOutput.lastFormat.sampleMimeType).isEqualTo(MimeTypes.TEXT_EXOPLAYER_CUES);
assertThat(trackOutput.lastFormat.sampleMimeType).isEqualTo(MimeTypes.APPLICATION_MEDIA3_CUES);
assertThat(trackOutput.lastFormat.codecs).isEqualTo(MimeTypes.TEXT_VTT);
assertThat(trackOutput.getSampleCount()).isEqualTo(4);
CuesWithTiming cues0 = decodeSample(trackOutput, 0);
@ -121,7 +121,7 @@ public class SubtitleExtractorTest {
trackOutput.clear();
while (extractor.read(input, null) != Extractor.RESULT_END_OF_INPUT) {}
assertThat(trackOutput.lastFormat.sampleMimeType).isEqualTo(MimeTypes.TEXT_EXOPLAYER_CUES);
assertThat(trackOutput.lastFormat.sampleMimeType).isEqualTo(MimeTypes.APPLICATION_MEDIA3_CUES);
assertThat(trackOutput.lastFormat.codecs).isEqualTo(MimeTypes.TEXT_VTT);
assertThat(trackOutput.getSampleCount()).isEqualTo(3);
CuesWithTiming cues0 = decodeSample(trackOutput, 0);
@ -164,7 +164,7 @@ public class SubtitleExtractorTest {
trackOutput.clear();
while (extractor.read(input, null) != Extractor.RESULT_END_OF_INPUT) {}
assertThat(trackOutput.lastFormat.sampleMimeType).isEqualTo(MimeTypes.TEXT_EXOPLAYER_CUES);
assertThat(trackOutput.lastFormat.sampleMimeType).isEqualTo(MimeTypes.APPLICATION_MEDIA3_CUES);
assertThat(trackOutput.lastFormat.codecs).isEqualTo(MimeTypes.TEXT_VTT);
assertThat(trackOutput.getSampleCount()).isEqualTo(3);
CuesWithTiming cues0 = decodeSample(trackOutput, 0);

View File

@ -271,7 +271,7 @@ track 3:
sample count = 3
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = application/x-subrip
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 3
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = application/x-subrip
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 3
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = application/x-subrip
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 3
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = application/x-subrip
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 3
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = application/x-subrip
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 3
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = text/x-ssa
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 3
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = text/x-ssa
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 3
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = text/x-ssa
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 3
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = text/x-ssa
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 3
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = text/x-ssa
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 1
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = application/x-subrip
selectionFlags = 1
language = en

View File

@ -271,7 +271,7 @@ track 3:
sample count = 1
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = application/x-subrip
selectionFlags = 1
language = en

View File

@ -271,7 +271,7 @@ track 3:
sample count = 1
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = application/x-subrip
selectionFlags = 1
language = en

View File

@ -271,7 +271,7 @@ track 3:
sample count = 1
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = application/x-subrip
selectionFlags = 1
language = en

View File

@ -271,7 +271,7 @@ track 3:
sample count = 1
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = application/x-subrip
selectionFlags = 1
language = en

View File

@ -271,7 +271,7 @@ track 3:
sample count = 1
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = text/x-ssa
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 1
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = text/x-ssa
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 1
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = text/x-ssa
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 1
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = text/x-ssa
selectionFlags = 1
language = und

View File

@ -271,7 +271,7 @@ track 3:
sample count = 1
format 0:
id = 3
sampleMimeType = text/x-exoplayer-cues
sampleMimeType = application/x-media3-cues
codecs = text/x-ssa
selectionFlags = 1
language = und