364 Commits

Author SHA1 Message Date
eguven
b6b6a3cbc3 Merge build*DataSourceFactory methods.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131291816
2016-08-31 15:25:25 +01:00
eguven
8b3f489bc9 Tweak Demo app code to facilitate overriding Application methods and change the used DataSourceFactory.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131288634
2016-08-31 15:25:25 +01:00
olly
5f1a2c71f0 Finalize V2 ExoPlayer API
There's still some internal to clean up to do, and in particular
it remains a TODO to be able to handle seek calls before the
timeline is set (for this CL, such calls are dropped). This change
does however finalize the API.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131171318
2016-08-31 15:25:25 +01:00
olly
94c908e89c Rename Window->MediaWindow, Timline->MediaTimeline
Window is potentially confusing with Android's Window class.
Once Window is renamed, it makes sense to rename Timeline too.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130938392
2016-08-31 15:25:24 +01:00
olly
fb55254f90 Fix a bunch more Javadoc
Also inline a few methods/classes where they can be made
private and therefore be removed from the public API.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130935090
2016-08-31 15:25:24 +01:00
olly
1579b68cf6 Sanitize constants
- Use a single constant for unset/unknown times across
  all time bases. Note also that this moves away from
  use of -1 for unset/unknown times in ms, which was a
  bad choice (it might conflict with real times, such
  as a time representing being just behind the start
  of a live window).
- Add a few other unset constants, and use them.
- Fix some hardcoding of -1 where existing constants
  should have been used.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130775594
2016-08-31 15:25:18 +01:00
olly
0d2dbb165d Demo app bug fixes
- Restore position to start of period if period is not
  seekable, rather than not at all.
- Get the correct window when saving position.
- Disable position restore in onNewIntent.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130527704
2016-08-31 15:25:17 +01:00
olly
b35648eafb Add window based methods to ExoPlayer
- This change also enables seeking in live windows in the
  ExoPlayer demo app.
- The added playlist doesn't transition properly by itself,
  but for manual transitions it works correctly, and
  demonstrates seeking into a default position.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130515880
2016-08-31 15:25:07 +01:00
andrewlewis
5296d5b198 Move isFinal flag to the Window.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130503190
2016-08-31 15:25:07 +01:00
olly
e35f9addaf Remove playWhenReadyCommitted.
This was always a bit of a hack; for Play Movies. It may well
no longer be necessary, and if not I'd like to think of a nicer
or more general way of doing it. We can always bring it back
if needed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130373433
2016-08-31 15:25:06 +01:00
olly
1a909fd163 Change SeekWindow -> Window, and add window duration.
- This avoids the need to have to use the timeline to
  calculate a window duration, which can be awkward.
- Window now represents a window of availability with
  an isSeekable flag, rather than a window of
  seekability.
- Promoted Timeline and Window to top package; they're
  pretty important :).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130278509
2016-08-31 15:25:06 +01:00
olly
0ca81b1a4c Make sure TrackSelections refer to the correct TrackGroups
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130111048
2016-08-31 15:25:05 +01:00
vigneshv
a2dfc62e08 MatroskaExtractor: Implement subsample encryption
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129908648
2016-08-31 13:20:50 +01:00
olly
91c7551cc3 Remove Timeline.UNKNOWN_PERIOD_COUNT
It's no longer used.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129870115
2016-08-10 20:13:37 +01:00
olly
cd4cc1dc14 Add absolute start time to Timeline
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129869741
2016-08-10 20:12:29 +01:00
andrewlewis
23981a6fc4 Hide the shutter view when no video is being rendered.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129849825
2016-08-10 20:10:14 +01:00
andrewlewis
88bf1d0739 Expose the seekable window.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129747377
2016-08-10 20:07:56 +01:00
olly
39482f244b Fix broken Javadoc
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129733571
2016-08-10 20:07:20 +01:00
aquilescanta
52d9539878 Fix NPE in track selection view
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129336905
2016-08-08 11:53:30 +01:00
olly
9a272068b4 Allow resetting of position when setting source
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129083335
2016-08-08 11:14:18 +01:00
olly
5345702ec5 Improve formatting in demo app track selector
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129080823
2016-08-08 11:11:40 +01:00
olly
ced7906737 Make track selection dialog d-pad friendly
This wont help much until the buttons to get the dialogs
to display are focusable! Use of MediaController seems to
make that tricky (to be continued...).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128989328
2016-08-08 11:10:19 +01:00
andrewlewis
8d122a101d Use new import ordering.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128967776
2016-08-08 11:06:48 +01:00
olly
f66b90e34b Eliminate cruft from the demo apps's PlayerActivity
Useful functionality promoted to core library:

1. Management of SurfaceHolder.Callback lifecycle
   promoted to SimpleExoPlayer
2. Ability to determine whether audio/video tracks
   exist but are all unsupported promoted to
   MappingTrackSelector.TrackInfo
3. Read external storage permissions check promoted
   to Util
4. SubtitleView given ability to act directly as a
   TextRenderer.Output to remove layer of indirection
5. SubtitleView given ability to configure itself to
   user's platform wide caption styling
6. KeyCompatibleMediaController promoted to library's
   UI package.

Relocation of boring stuff:

1. ID3 frame logging moved to EventLogger.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128714230
2016-07-28 20:04:41 +01:00
olly
3501332dd3 Converge track selection to a single place.
This change merges the duties of FormatEvaluator into
TrackSelection classes, so that both the static and
dynamic parts of track selection are implemented in a
single place.

New feature: Demo app now allows you to enable random
adaptation in the track selection dialog.

Notes:

- It should be quite easy to allow application side
track blacklisting in addition to source side, as an
extension to this. That would effectively allow
applications to do seamless/deferred track selection
by creating a TrackSelection with all tracks enabled,
and then toggling the blacklist flags to select the
ones they want to be active.

- It should be trivial to implement format blacklisting
for DASH and SS as an extension to this. Will do in a
follow up CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128707517
2016-07-28 20:04:40 +01:00
olly
c82a3db5ac Enable next/prev seeking in demo app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128682992
2016-07-28 20:04:40 +01:00
olly
2f20fd7c03 Simple language + Javadoc consistency
- Invoked --> Called
- Gets --> Returns
- "True if X. False otherwise." --> "Whether X."
- Removed some @returns where the Javadoc is in "Returns X" form

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128678638
2016-07-28 20:04:40 +01:00
olly
c5aa376bc4 Rename only part of FormatEvaluator/TrackSelection merge
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128471102
2016-07-28 20:04:39 +01:00
olly
0b4284d060 Remove TrackGroup.adaptive flag.
It's only "needed" for HLS, and this requirement will
go away soon. It's safe to remove the flag ahead of
this because a TrackSelector can/should not attempt to
adapt between multiple audio/text tracks.

Also remove unnecessary restrictions on TrackGroups
being non-empty and only of known types.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128376601
2016-07-28 19:40:15 +01:00
andrewlewis
d657360341 Expose period information from MediaSources.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128357449
2016-07-28 19:39:07 +01:00
olly
ba0a4235a0 Consistent Javadoc for text package
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128160177
2016-07-22 22:41:36 +01:00
olly
692d756ee6 Simplification: Move common logic to TrackSelection
- TrackSelection now exposes the selected formats, ordered
  by decreasing bandwidth. This removes the need for DASH,
  SS and HLS to do the sorting individually.
- The change also removes the need to reconstruct TrackSelection
  instances with a different group index in various places
  (e.g. MergingMediaPeriod).
- This is also a step toward potentially packaging the
  FormatEvaluator inside of the TrackSelection (TBD).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128159064
2016-07-22 22:41:36 +01:00
olly
722e05b8ba Some brevity/consistency renaming in source package
SmoothStreaming -> Ss
MediaPresentationDescription -> DashManifest
DashSingleSegmentIndex -> SingleSegmentIndex

Moved DASH and Ss manifest classes to matching
manifest packages for consistency. For Hls the
package is called playlist still, since that's
what they're widely known as.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127925961
2016-07-22 22:41:35 +01:00
olly
fc457e4c1b Move default DRM callback implementation to library
This also removes direct use of HttpURLConnection and
allows use of any HttpDataSource for license requests,
which means those using OkHttp can finally use the
same network stack for license requests as they're using
for everything else, without having to implement their
own callback.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127841045
2016-07-22 22:41:35 +01:00
olly
9304cb3f8f Plumb key-rotation and drm-playlist support
With this change, MediaCodecRenderer acquires a session
from its DrmSessionManager whenever the DrmInitData in
the format changes. The DrmSessionManager is permitted
to return the same session if it can be re-used.

This plumbing adds support for:

1. Key-rotation, in the case that a key-rotation-aware
   DrmSessionManager is used. Such an implementation will
   return the same DrmSession for every aquisition, but
   will be making use of multiple MediaDrm instances within
   that session to enable the rotation.

2. Playlists with mixed clear and protected content. One
   final piece to this will be to have each MediaPeriod
   provide its own license URL. We could also allow each
   MediaPeriod to specify the DRM UUID, but switching from
   PlayReady to Widevine in a playlist seems like quite a
   hypothetical thing.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127816046
2016-07-22 22:41:35 +01:00
olly
6c2a967763 BandwidthMeter shouldn't extend TransferListener
There may be other ways to estimate bandwidth that don't
require listening to our own transfers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127741651
2016-07-22 22:21:54 +01:00
olly
74b43e26bd Allow injection of custom ChunkSources
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127737169
2016-07-22 22:21:06 +01:00
olly
5360ddc519 Allow injection of custom FormatEvaluators
This was possible previously, but now we support things
like multi-period DASH we need to do the injection in
the form of factories rather than concrete instances.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127735816
2016-07-22 22:20:32 +01:00
olly
98a0c5f05c Fix restoring of position.
This change restores ExoPlayer to its previous behaviour.
I think we'll want a "resetPosition" boolean parameter on
setMediaSource at some point, but no need to add it right
now. Note that this would not always reset to the start
of the source. For a live playback it will reset to the
desired position (normally somewhere slightly behind the
live edge).

Issue: #1667
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127549700
2016-07-15 18:21:40 +01:00
olly
dcc1ac56df Make Renderer an interface
In V1 we received complaints that Renderer was too locked down.
In particular, it wasn't possible to implement a Renderer that
wrapped another Renderer, since most of the methods were package
private and final (e.g. enable).

This change defines Renderer as a proper interface, removing
this limitation. A method-reordering-only change will follow
this one, to get things into a nice consistent/sane order in
each of the Renderer classes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127527995
2016-07-15 18:19:23 +01:00
olly
f758082d40 Big (and hopefully near-final) rename.
1. Rename "extensions" package to "decoder". It's used by both
   text and (should be used by) metadata, so it's no longer just
   for extensions.
2. Move Buffer objects move into the decoder package.
3. Rename SubtitleParser and MetadataParser to SubtitleDecoder
   and MetadataDecoder respectively, since they extend Decoder.
   Ditto for all subclasses.
4. Subtitle and Metadata decoders now throw their own exception
   types rather than ParserException.
5. Move MediaCodec classes into a mediacodec package, with the
   exception of the concrete audio and video renderers.
6. Create an audio package to hold the two audio renderer classes
   plus related util classes.
7. Create a video package to hold the one video renderer class
   plus related util classes.

After this change the following nice properties hold:

1. Want a video renderer? Look in the video package. Ditto for
   audio, text and metadata.
2. All TrackRenderer implementations use a decoder of some kind
   to decode buffers received from the source, so we have
   consistent terminology there.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127326805
2016-07-15 18:14:55 +01:00
olly
4f718363b5 Remove BandwidthMeter from SimpleExoPlayer
The BandwidthMeter should only be used by MediaSource
instances and the objects they reference, so there's
really no reason for the player to need to know about it.

This change sacrifices DebugTextViewHelper showing the
estimated bandwidth, but I think that's a price worth
paying.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127316755
2016-07-15 18:14:14 +01:00
[]inger
e4a3483d6f Propagate audioSessionId.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127300225
2016-07-15 18:12:20 +01:00
olly
d4d1640808 Use extension rather than composition for track selection
It doesn't look like TrackSelectionPolicy is going to be
useful other than with DefaultTrackSelector, and it's kinda
confusing dealing with both "selector" and "policy"
terminology. This change does the following:

DefaultTrackSelector -> selector.MappingTrackSelector
DefaultTrackSelectionPolicy -> selector.DefaultTrackSelector
TrackSelectionPolicy -> [deleted]
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127196326
2016-07-15 18:08:36 +01:00
olly
be9d77c59c Add new UI package.
There aren't really enough classes to justify it right
now, but if we're going to do a VideoView equivalent and
sensible player controls at some point, it's worth making
now to get classes into the correct place.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127184374
2016-07-15 18:06:12 +01:00
aquilescanta
9385b4fdf4 Add version to SampleChooserActivity for Exoplayer2
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127179274
2016-07-15 18:05:37 +01:00
olly
4e86c55361 Introduce source package for sources
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127073630
2016-07-15 18:02:31 +01:00
olly
9558a4cb99 Rename TrackRenderer -> Renderer
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127065122
2016-07-15 18:00:32 +01:00
olly
8e0354c0a6 Finalize class naming
SampleSourceProvider -> MediaSource
SampleSource -> MediaPeriod
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=126914964
2016-07-15 17:59:52 +01:00
olly
dbb43567a3 Finalize v2 directory + package name
- The package is renamed to avoid conflicts with v1, should any
app wish to include both v1 and v2 for a period of time. This is
similar to the approach used by some other open source projects
(e.g. okhttp).
- Copyright year is updated everywhere for completeness.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=126895326
2016-07-08 12:12:09 +01:00