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: * Add additional fields to Common Media Client Data (CMCD) logging:
streaming format (sf), stream type (st), version (v), top birate (tb), streaming format (sf), stream type (st), version (v), top birate (tb),
object duration (d) and measured throughput (mtp). object duration (d) and measured throughput (mtp).
* Rename `MimeTypes.TEXT_EXOPLAYER_CUES` to
`MimeTypes.APPLICATION_MEDIA3_CUES`.
* Transformer: * Transformer:
* Parse EXIF rotation data for image inputs. * Parse EXIF rotation data for image inputs.
* Remove `TransformationRequest.HdrMode` annotation type and its * 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_VTT = BASE_TYPE_TEXT + "/vtt";
public static final String TEXT_SSA = BASE_TYPE_TEXT + "/x-ssa"; 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"; @UnstableApi public static final String TEXT_UNKNOWN = BASE_TYPE_TEXT + "/x-unknown";
// application/ MIME types // 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_AIT = BASE_TYPE_APPLICATION + "/vnd.dvb.ait";
public static final String APPLICATION_RTSP = BASE_TYPE_APPLICATION + "/x-rtsp"; 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 // image/ MIME types
public static final String IMAGE_JPEG = BASE_TYPE_IMAGE + "/jpeg"; 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 * A {@link SubtitleDecoder} that decodes subtitle samples of type {@link
* MimeTypes#TEXT_EXOPLAYER_CUES} * MimeTypes#APPLICATION_MEDIA3_CUES}
*/ */
@UnstableApi @UnstableApi
public final class ExoplayerCuesDecoder implements SubtitleDecoder { 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_CEA608)
|| Objects.equals(mimeType, MimeTypes.APPLICATION_MP4CEA608) || Objects.equals(mimeType, MimeTypes.APPLICATION_MP4CEA608)
|| Objects.equals(mimeType, MimeTypes.APPLICATION_CEA708) || Objects.equals(mimeType, MimeTypes.APPLICATION_CEA708)
|| Objects.equals(mimeType, MimeTypes.TEXT_EXOPLAYER_CUES); || Objects.equals(mimeType, MimeTypes.APPLICATION_MEDIA3_CUES);
} }
@Override @Override
@ -92,7 +92,7 @@ public interface SubtitleDecoderFactory {
Cea608Decoder.MIN_DATA_CHANNEL_TIMEOUT_MS); Cea608Decoder.MIN_DATA_CHANNEL_TIMEOUT_MS);
case MimeTypes.APPLICATION_CEA708: case MimeTypes.APPLICATION_CEA708:
return new Cea708Decoder(format.accessibilityChannel, format.initializationData); return new Cea708Decoder(format.accessibilityChannel, format.initializationData);
case MimeTypes.TEXT_EXOPLAYER_CUES: case MimeTypes.APPLICATION_MEDIA3_CUES:
return new ExoplayerCuesDecoder(); return new ExoplayerCuesDecoder();
default: default:
break; 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 * Enables transcoding of text track samples to {@link MimeTypes#APPLICATION_MEDIA3_CUES} before
* data is emitted to {@link TrackOutput}. * the data is emitted to {@link TrackOutput}.
* *
* <p>Transcoding is disabled by default. * <p>Transcoding is disabled by default.
* *

View file

@ -107,7 +107,7 @@ public class SubtitleExtractor implements Extractor {
this.format = this.format =
format format
.buildUpon() .buildUpon()
.setSampleMimeType(MimeTypes.TEXT_EXOPLAYER_CUES) .setSampleMimeType(MimeTypes.APPLICATION_MEDIA3_CUES)
.setCodecs(format.sampleMimeType) .setCodecs(format.sampleMimeType)
.build(); .build();
timestamps = new ArrayList<>(); 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 * 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 * <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 * 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 * <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 * 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 * 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#APPLICATION_SUBRIP} to ExoPlayer's internal binary cue representation ({@link
* MimeTypes#TEXT_EXOPLAYER_CUES}). * MimeTypes#APPLICATION_MEDIA3_CUES}).
*/ */
/* package */ class SubtitleTranscodingTrackOutput implements TrackOutput { /* package */ class SubtitleTranscodingTrackOutput implements TrackOutput {
@ -89,7 +89,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
delegate.format( delegate.format(
format format
.buildUpon() .buildUpon()
.setSampleMimeType(MimeTypes.TEXT_EXOPLAYER_CUES) .setSampleMimeType(MimeTypes.APPLICATION_MEDIA3_CUES)
.setCodecs(format.sampleMimeType) .setCodecs(format.sampleMimeType)
// Reset this value to the default. All non-default timestamp adjustments are done // Reset this value to the default. All non-default timestamp adjustments are done
// below in sampleMetadata() and there are no 'subsamples' after transcoding. // 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) {} while (extractor.read(input, null) != Extractor.RESULT_END_OF_INPUT) {}
FakeTrackOutput trackOutput = output.trackOutputs.get(0); 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.lastFormat.codecs).isEqualTo(MimeTypes.TEXT_VTT);
assertThat(trackOutput.getSampleCount()).isEqualTo(4); assertThat(trackOutput.getSampleCount()).isEqualTo(4);
CuesWithTiming cues0 = decodeSample(trackOutput, 0); CuesWithTiming cues0 = decodeSample(trackOutput, 0);
@ -121,7 +121,7 @@ public class SubtitleExtractorTest {
trackOutput.clear(); trackOutput.clear();
while (extractor.read(input, null) != Extractor.RESULT_END_OF_INPUT) {} 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.lastFormat.codecs).isEqualTo(MimeTypes.TEXT_VTT);
assertThat(trackOutput.getSampleCount()).isEqualTo(3); assertThat(trackOutput.getSampleCount()).isEqualTo(3);
CuesWithTiming cues0 = decodeSample(trackOutput, 0); CuesWithTiming cues0 = decodeSample(trackOutput, 0);
@ -164,7 +164,7 @@ public class SubtitleExtractorTest {
trackOutput.clear(); trackOutput.clear();
while (extractor.read(input, null) != Extractor.RESULT_END_OF_INPUT) {} 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.lastFormat.codecs).isEqualTo(MimeTypes.TEXT_VTT);
assertThat(trackOutput.getSampleCount()).isEqualTo(3); assertThat(trackOutput.getSampleCount()).isEqualTo(3);
CuesWithTiming cues0 = decodeSample(trackOutput, 0); CuesWithTiming cues0 = decodeSample(trackOutput, 0);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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