Skip to content

Commit

Permalink
Merge pull request #826 from google/dev-1.5.0-rc
Browse files Browse the repository at this point in the history
1.5.0 release
  • Loading branch information
ojw28 committed Sep 29, 2015
2 parents 450105b + 62ce0ff commit 0c060f4
Show file tree
Hide file tree
Showing 177 changed files with 9,690 additions and 4,427 deletions.
15 changes: 11 additions & 4 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Release notes #

### Current dev branch (from r1.4.2) ###

* Nothing yet.
### r.1.5.0 ###

* Multi-track support.
* DASH: Limited support for multi-period manifests.
* HLS: Smoother format adaptation.
* HLS: Support for MP3 media segments.
* TTML: Support for most embedded TTML styling.
* WebVTT: Enhanced positioning support.
* Initial playback tests.
* Misc bug fixes.

### r1.4.2 ###

Expand All @@ -20,7 +27,7 @@
* Support for extracting Matroska streams (implemented by WebmExtractor).
* Support for tx3g captions in MP4 streams.
* Support for H.265 in MPEG-TS streams on supported devices.
* HLS: Added support for MPEG audio (e.g. MP3).
* HLS: Added support for MPEG audio (e.g. MP3) in TS media segments.
* HLS: Improved robustness against missing chunks and variants.
* MP4: Added support for embedded MPEG audio (e.g. MP3).
* TTML: Improved handling of whitespace.
Expand Down
4 changes: 2 additions & 2 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.exoplayer.demo"
android:versionCode="1402"
android:versionName="1.4.2"
android:versionCode="1500"
android:versionName="1.5.0"
android:theme="@style/RootTheme">

<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class EventLogger implements DemoPlayer.Listener, DemoPlayer.InfoListener

private long sessionStartTimeMs;
private long[] loadStartTimeMs;
private long[] seekRangeValuesUs;
private long[] availableRangeValuesUs;

public EventLogger() {
loadStartTimeMs = new long[DemoPlayer.RENDERER_COUNT];
Expand Down Expand Up @@ -76,8 +76,10 @@ public void onError(Exception e) {
}

@Override
public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) {
Log.d(TAG, "videoSizeChanged [" + width + ", " + height + ", " + pixelWidthHeightRatio + "]");
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees,
float pixelWidthHeightRatio) {
Log.d(TAG, "videoSizeChanged [" + width + ", " + height + ", " + unappliedRotationDegrees
+ ", " + pixelWidthHeightRatio + "]");
}

// DemoPlayer.InfoListener
Expand All @@ -95,7 +97,7 @@ public void onDroppedFrames(int count, long elapsed) {

@Override
public void onLoadStarted(int sourceId, long length, int type, int trigger, Format format,
int mediaStartTimeMs, int mediaEndTimeMs) {
long mediaStartTimeMs, long mediaEndTimeMs) {
loadStartTimeMs[sourceId] = SystemClock.elapsedRealtime();
if (VerboseLogUtil.isTagEnabled(TAG)) {
Log.v(TAG, "loadStart [" + getSessionTimeString() + ", " + sourceId + ", " + type
Expand All @@ -105,7 +107,7 @@ public void onLoadStarted(int sourceId, long length, int type, int trigger, Form

@Override
public void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigger, Format format,
int mediaStartTimeMs, int mediaEndTimeMs, long elapsedRealtimeMs, long loadDurationMs) {
long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long loadDurationMs) {
if (VerboseLogUtil.isTagEnabled(TAG)) {
long downloadTime = SystemClock.elapsedRealtime() - loadStartTimeMs[sourceId];
Log.v(TAG, "loadEnd [" + getSessionTimeString() + ", " + sourceId + ", " + downloadTime
Expand All @@ -114,13 +116,13 @@ public void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigge
}

@Override
public void onVideoFormatEnabled(Format format, int trigger, int mediaTimeMs) {
public void onVideoFormatEnabled(Format format, int trigger, long mediaTimeMs) {
Log.d(TAG, "videoFormat [" + getSessionTimeString() + ", " + format.id + ", "
+ Integer.toString(trigger) + "]");
}

@Override
public void onAudioFormatEnabled(Format format, int trigger, int mediaTimeMs) {
public void onAudioFormatEnabled(Format format, int trigger, long mediaTimeMs) {
Log.d(TAG, "audioFormat [" + getSessionTimeString() + ", " + format.id + ", "
+ Integer.toString(trigger) + "]");
}
Expand Down Expand Up @@ -169,10 +171,10 @@ public void onDecoderInitialized(String decoderName, long elapsedRealtimeMs,
}

@Override
public void onSeekRangeChanged(TimeRange seekRange) {
seekRangeValuesUs = seekRange.getCurrentBoundsUs(seekRangeValuesUs);
Log.d(TAG, "seekRange [ " + seekRange.type + ", " + seekRangeValuesUs[0] + ", "
+ seekRangeValuesUs[1] + "]");
public void onAvailableRangeChanged(TimeRange availableRange) {
availableRangeValuesUs = availableRange.getCurrentBoundsUs(availableRangeValuesUs);
Log.d(TAG, "availableRange [" + availableRange.isStatic() + ", " + availableRangeValuesUs[0]
+ ", " + availableRangeValuesUs[1] + "]");
}

private void printInternalError(String type, Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.google.android.exoplayer.AspectRatioFrameLayout;
import com.google.android.exoplayer.ExoPlayer;
import com.google.android.exoplayer.MediaFormat;
import com.google.android.exoplayer.audio.AudioCapabilities;
import com.google.android.exoplayer.audio.AudioCapabilitiesReceiver;
import com.google.android.exoplayer.demo.player.DashRendererBuilder;
Expand All @@ -33,6 +34,7 @@
import com.google.android.exoplayer.text.Cue;
import com.google.android.exoplayer.text.SubtitleLayout;
import com.google.android.exoplayer.util.DebugTextViewHelper;
import com.google.android.exoplayer.util.MimeTypes;
import com.google.android.exoplayer.util.Util;
import com.google.android.exoplayer.util.VerboseLogUtil;

Expand Down Expand Up @@ -66,6 +68,7 @@
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.util.List;
import java.util.Locale;
import java.util.Map;

/**
Expand Down Expand Up @@ -119,7 +122,6 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
private String contentId;

private AudioCapabilitiesReceiver audioCapabilitiesReceiver;
private AudioCapabilities audioCapabilities;

// Activity lifecycle

Expand Down Expand Up @@ -148,13 +150,12 @@ public boolean onTouch(View view, MotionEvent motionEvent) {
root.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
return mediaController.dispatchKeyEvent(event);
if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU) {
return false;
}
return false;
return mediaController.dispatchKeyEvent(event);
}
});
audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(getApplicationContext(), this);

shutterView = findViewById(R.id.shutter);
debugRootView = findViewById(R.id.controls_root);
Expand All @@ -179,15 +180,20 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
if (currentHandler != defaultCookieManager) {
CookieHandler.setDefault(defaultCookieManager);
}

audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this);
audioCapabilitiesReceiver.register();
}

@Override
public void onResume() {
super.onResume();
configureSubtitleView();

// The player will be prepared on receiving audio capabilities.
audioCapabilitiesReceiver.register();
if (player == null) {
preparePlayer(true);
} else {
player.setBackgrounded(false);
}
}

@Override
Expand All @@ -198,13 +204,13 @@ public void onPause() {
} else {
player.setBackgrounded(true);
}
audioCapabilitiesReceiver.unregister();
shutterView.setVisibility(View.VISIBLE);
}

@Override
public void onDestroy() {
super.onDestroy();
audioCapabilitiesReceiver.unregister();
releasePlayer();
}

Expand All @@ -213,22 +219,22 @@ public void onDestroy() {
@Override
public void onClick(View view) {
if (view == retryButton) {
preparePlayer();
preparePlayer(true);
}
}

// AudioCapabilitiesReceiver.Listener methods

@Override
public void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities) {
boolean audioCapabilitiesChanged = !audioCapabilities.equals(this.audioCapabilities);
if (player == null || audioCapabilitiesChanged) {
this.audioCapabilities = audioCapabilities;
releasePlayer();
preparePlayer();
} else if (player != null) {
player.setBackgrounded(false);
if (player == null) {
return;
}
boolean backgrounded = player.getBackgrounded();
boolean playWhenReady = player.getPlayWhenReady();
releasePlayer();
preparePlayer(playWhenReady);
player.setBackgrounded(backgrounded);
}

// Internal methods
Expand All @@ -241,17 +247,17 @@ private RendererBuilder getRendererBuilder() {
new SmoothStreamingTestMediaDrmCallback());
case TYPE_DASH:
return new DashRendererBuilder(this, userAgent, contentUri.toString(),
new WidevineTestMediaDrmCallback(contentId), audioCapabilities);
new WidevineTestMediaDrmCallback(contentId));
case TYPE_HLS:
return new HlsRendererBuilder(this, userAgent, contentUri.toString(), audioCapabilities);
return new HlsRendererBuilder(this, userAgent, contentUri.toString());
case TYPE_OTHER:
return new ExtractorRendererBuilder(this, userAgent, contentUri);
default:
throw new IllegalStateException("Unsupported type: " + contentType);
}
}

private void preparePlayer() {
private void preparePlayer(boolean playWhenReady) {
if (player == null) {
player = new DemoPlayer(getRendererBuilder());
player.addListener(this);
Expand All @@ -275,7 +281,7 @@ private void preparePlayer() {
updateButtonVisibilities();
}
player.setSurface(surfaceView.getHolder().getSurface());
player.setPlayWhenReady(true);
player.setPlayWhenReady(playWhenReady);
}

private void releasePlayer() {
Expand Down Expand Up @@ -338,7 +344,8 @@ public void onError(Exception e) {
}

@Override
public void onVideoSizeChanged(int width, int height, float pixelWidthAspectRatio) {
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees,
float pixelWidthAspectRatio) {
shutterView.setVisibility(View.GONE);
videoFrame.setAspectRatio(
height == 0 ? 1 : (width * pixelWidthAspectRatio) / height);
Expand Down Expand Up @@ -431,23 +438,68 @@ public boolean onMenuItemClick(MenuItem item) {
});
Menu menu = popup.getMenu();
// ID_OFFSET ensures we avoid clashing with Menu.NONE (which equals 0)
menu.add(MENU_GROUP_TRACKS, DemoPlayer.DISABLED_TRACK + ID_OFFSET, Menu.NONE, R.string.off);
if (trackCount == 1 && TextUtils.isEmpty(player.getTrackName(trackType, 0))) {
menu.add(MENU_GROUP_TRACKS, DemoPlayer.PRIMARY_TRACK + ID_OFFSET, Menu.NONE, R.string.on);
} else {
for (int i = 0; i < trackCount; i++) {
menu.add(MENU_GROUP_TRACKS, i + ID_OFFSET, Menu.NONE, player.getTrackName(trackType, i));
}
menu.add(MENU_GROUP_TRACKS, DemoPlayer.TRACK_DISABLED + ID_OFFSET, Menu.NONE, R.string.off);
for (int i = 0; i < trackCount; i++) {
menu.add(MENU_GROUP_TRACKS, i + ID_OFFSET, Menu.NONE,
buildTrackName(player.getTrackFormat(trackType, i)));
}
menu.setGroupCheckable(MENU_GROUP_TRACKS, true, true);
menu.findItem(player.getSelectedTrackIndex(trackType) + ID_OFFSET).setChecked(true);
menu.findItem(player.getSelectedTrack(trackType) + ID_OFFSET).setChecked(true);
}

private static String buildTrackName(MediaFormat format) {
if (format.adaptive) {
return "auto";
}
String trackName;
if (MimeTypes.isVideo(format.mimeType)) {
trackName = joinWithSeparator(joinWithSeparator(buildResolutionString(format),
buildBitrateString(format)), buildTrackIdString(format));
} else if (MimeTypes.isAudio(format.mimeType)) {
trackName = joinWithSeparator(joinWithSeparator(joinWithSeparator(buildLanguageString(format),
buildAudioPropertyString(format)), buildBitrateString(format)),
buildTrackIdString(format));
} else {
trackName = joinWithSeparator(joinWithSeparator(buildLanguageString(format),
buildBitrateString(format)), buildTrackIdString(format));
}
return trackName.length() == 0 ? "unknown" : trackName;
}

private static String buildResolutionString(MediaFormat format) {
return format.width == MediaFormat.NO_VALUE || format.height == MediaFormat.NO_VALUE
? "" : format.width + "x" + format.height;
}

private static String buildAudioPropertyString(MediaFormat format) {
return format.channelCount == MediaFormat.NO_VALUE || format.sampleRate == MediaFormat.NO_VALUE
? "" : format.channelCount + "ch, " + format.sampleRate + "Hz";
}

private static String buildLanguageString(MediaFormat format) {
return TextUtils.isEmpty(format.language) || "und".equals(format.language) ? ""
: format.language;
}

private static String buildBitrateString(MediaFormat format) {
return format.bitrate == MediaFormat.NO_VALUE ? ""
: String.format(Locale.US, "%.2fMbit", format.bitrate / 1000000f);
}

private static String joinWithSeparator(String first, String second) {
return first.length() == 0 ? second : (second.length() == 0 ? first : first + ", " + second);
}

private static String buildTrackIdString(MediaFormat format) {
return format.trackId == MediaFormat.NO_VALUE ? ""
: String.format(Locale.US, " (%d)", format.trackId);
}

private boolean onTrackItemClick(MenuItem item, int type) {
if (player == null || item.getGroupId() != MENU_GROUP_TRACKS) {
return false;
}
player.selectTrack(type, item.getItemId() - ID_OFFSET);
player.setSelectedTrack(type, item.getItemId() - ID_OFFSET);
return true;
}

Expand Down Expand Up @@ -518,17 +570,17 @@ public void surfaceDestroyed(SurfaceHolder holder) {
}

private void configureSubtitleView() {
CaptionStyleCompat captionStyle;
float captionFontScale;
CaptionStyleCompat style;
float fontScale;
if (Util.SDK_INT >= 19) {
captionStyle = getUserCaptionStyleV19();
captionFontScale = getUserCaptionFontScaleV19();
style = getUserCaptionStyleV19();
fontScale = getUserCaptionFontScaleV19();
} else {
captionStyle = CaptionStyleCompat.DEFAULT;
captionFontScale = 1.0f;
style = CaptionStyleCompat.DEFAULT;
fontScale = 1.0f;
}
subtitleLayout.setStyle(captionStyle);
subtitleLayout.setFontScale(captionFontScale);
subtitleLayout.setStyle(style);
subtitleLayout.setFractionalTextSize(SubtitleLayout.DEFAULT_TEXT_SIZE_FRACTION * fontScale);
}

@TargetApi(19)
Expand Down
Loading

0 comments on commit 0c060f4

Please sign in to comment.