use of androidx.media3.common.util.UnstableApi in project media by androidx.
the class VideoSize method toBundle.
@UnstableApi
@Override
public Bundle toBundle() {
Bundle bundle = new Bundle();
bundle.putInt(keyForField(FIELD_WIDTH), width);
bundle.putInt(keyForField(FIELD_HEIGHT), height);
bundle.putInt(keyForField(FIELD_UNAPPLIED_ROTATION_DEGREES), unappliedRotationDegrees);
bundle.putFloat(keyForField(FIELD_PIXEL_WIDTH_HEIGHT_RATIO), pixelWidthHeightRatio);
return bundle;
}
use of androidx.media3.common.util.UnstableApi in project media by androidx.
the class DeviceInfo method toBundle.
@UnstableApi
@Override
public Bundle toBundle() {
Bundle bundle = new Bundle();
bundle.putInt(keyForField(FIELD_PLAYBACK_TYPE), playbackType);
bundle.putInt(keyForField(FIELD_MIN_VOLUME), minVolume);
bundle.putInt(keyForField(FIELD_MAX_VOLUME), maxVolume);
return bundle;
}
use of androidx.media3.common.util.UnstableApi in project media by androidx.
the class Format method toLogString.
// Utility methods
/**
* Returns a prettier {@link String} than {@link #toString()}, intended for logging.
*/
@UnstableApi
public static String toLogString(@Nullable Format format) {
if (format == null) {
return "null";
}
StringBuilder builder = new StringBuilder();
builder.append("id=").append(format.id).append(", mimeType=").append(format.sampleMimeType);
if (format.bitrate != NO_VALUE) {
builder.append(", bitrate=").append(format.bitrate);
}
if (format.codecs != null) {
builder.append(", codecs=").append(format.codecs);
}
if (format.drmInitData != null) {
Set<String> schemes = new LinkedHashSet<>();
for (int i = 0; i < format.drmInitData.schemeDataCount; i++) {
UUID schemeUuid = format.drmInitData.get(i).uuid;
if (schemeUuid.equals(C.COMMON_PSSH_UUID)) {
schemes.add("cenc");
} else if (schemeUuid.equals(C.CLEARKEY_UUID)) {
schemes.add("clearkey");
} else if (schemeUuid.equals(C.PLAYREADY_UUID)) {
schemes.add("playready");
} else if (schemeUuid.equals(C.WIDEVINE_UUID)) {
schemes.add("widevine");
} else if (schemeUuid.equals(C.UUID_NIL)) {
schemes.add("universal");
} else {
schemes.add("unknown (" + schemeUuid + ")");
}
}
builder.append(", drm=[");
Joiner.on(',').appendTo(builder, schemes);
builder.append(']');
}
if (format.width != NO_VALUE && format.height != NO_VALUE) {
builder.append(", res=").append(format.width).append("x").append(format.height);
}
if (format.frameRate != NO_VALUE) {
builder.append(", fps=").append(format.frameRate);
}
if (format.channelCount != NO_VALUE) {
builder.append(", channels=").append(format.channelCount);
}
if (format.sampleRate != NO_VALUE) {
builder.append(", sample_rate=").append(format.sampleRate);
}
if (format.language != null) {
builder.append(", language=").append(format.language);
}
if (format.label != null) {
builder.append(", label=").append(format.label);
}
if (format.selectionFlags != 0) {
List<String> selectionFlags = new ArrayList<>();
// LINT.IfChange(selection_flags)
if ((format.selectionFlags & C.SELECTION_FLAG_AUTOSELECT) != 0) {
selectionFlags.add("auto");
}
if ((format.selectionFlags & C.SELECTION_FLAG_DEFAULT) != 0) {
selectionFlags.add("default");
}
if ((format.selectionFlags & C.SELECTION_FLAG_FORCED) != 0) {
selectionFlags.add("forced");
}
builder.append(", selectionFlags=[");
Joiner.on(',').appendTo(builder, selectionFlags);
builder.append("]");
}
if (format.roleFlags != 0) {
// LINT.IfChange(role_flags)
List<String> roleFlags = new ArrayList<>();
if ((format.roleFlags & C.ROLE_FLAG_MAIN) != 0) {
roleFlags.add("main");
}
if ((format.roleFlags & C.ROLE_FLAG_ALTERNATE) != 0) {
roleFlags.add("alt");
}
if ((format.roleFlags & C.ROLE_FLAG_SUPPLEMENTARY) != 0) {
roleFlags.add("supplementary");
}
if ((format.roleFlags & C.ROLE_FLAG_COMMENTARY) != 0) {
roleFlags.add("commentary");
}
if ((format.roleFlags & C.ROLE_FLAG_DUB) != 0) {
roleFlags.add("dub");
}
if ((format.roleFlags & C.ROLE_FLAG_EMERGENCY) != 0) {
roleFlags.add("emergency");
}
if ((format.roleFlags & C.ROLE_FLAG_CAPTION) != 0) {
roleFlags.add("caption");
}
if ((format.roleFlags & C.ROLE_FLAG_SUBTITLE) != 0) {
roleFlags.add("subtitle");
}
if ((format.roleFlags & C.ROLE_FLAG_SIGN) != 0) {
roleFlags.add("sign");
}
if ((format.roleFlags & C.ROLE_FLAG_DESCRIBES_VIDEO) != 0) {
roleFlags.add("describes-video");
}
if ((format.roleFlags & C.ROLE_FLAG_DESCRIBES_MUSIC_AND_SOUND) != 0) {
roleFlags.add("describes-music");
}
if ((format.roleFlags & C.ROLE_FLAG_ENHANCED_DIALOG_INTELLIGIBILITY) != 0) {
roleFlags.add("enhanced-intelligibility");
}
if ((format.roleFlags & C.ROLE_FLAG_TRANSCRIBES_DIALOG) != 0) {
roleFlags.add("transcribes-dialog");
}
if ((format.roleFlags & C.ROLE_FLAG_EASY_TO_READ) != 0) {
roleFlags.add("easy-read");
}
if ((format.roleFlags & C.ROLE_FLAG_TRICK_PLAY) != 0) {
roleFlags.add("trick-play");
}
builder.append(", roleFlags=[");
Joiner.on(',').appendTo(builder, roleFlags);
builder.append("]");
}
return builder.toString();
}
use of androidx.media3.common.util.UnstableApi in project media by androidx.
the class MediaItem method toBundle.
/**
* {@inheritDoc}
*
* <p>It omits the {@link #localConfiguration} field. The {@link #localConfiguration} of an
* instance restored by {@link #CREATOR} will always be {@code null}.
*/
@UnstableApi
@Override
public Bundle toBundle() {
Bundle bundle = new Bundle();
bundle.putString(keyForField(FIELD_MEDIA_ID), mediaId);
bundle.putBundle(keyForField(FIELD_LIVE_CONFIGURATION), liveConfiguration.toBundle());
bundle.putBundle(keyForField(FIELD_MEDIA_METADATA), mediaMetadata.toBundle());
bundle.putBundle(keyForField(FIELD_CLIPPING_PROPERTIES), clippingConfiguration.toBundle());
return bundle;
}
use of androidx.media3.common.util.UnstableApi in project media by androidx.
the class TrackGroup method toBundle.
@UnstableApi
@Override
public Bundle toBundle() {
Bundle bundle = new Bundle();
bundle.putParcelableArrayList(keyForField(FIELD_FORMATS), BundleableUtil.toBundleArrayList(Lists.newArrayList(formats)));
bundle.putString(keyForField(FIELD_ID), id);
return bundle;
}
Aggregations