Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9921dfd1
authored
May 05, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Deprecate FrameworkSampleSource as a deterrent.
parent
37827be8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
73 deletions
demo/src/main/java/com/google/android/exoplayer/demo/DemoUtil.java
demo/src/main/java/com/google/android/exoplayer/demo/PlayerActivity.java
demo/src/main/java/com/google/android/exoplayer/demo/player/DefaultRendererBuilder.java
library/src/main/java/com/google/android/exoplayer/FrameworkSampleSource.java
demo/src/main/java/com/google/android/exoplayer/demo/DemoUtil.java
View file @
9921dfd1
...
@@ -46,11 +46,10 @@ public class DemoUtil {
...
@@ -46,11 +46,10 @@ public class DemoUtil {
public
static
final
int
TYPE_HLS
=
2
;
public
static
final
int
TYPE_HLS
=
2
;
public
static
final
int
TYPE_MP4
=
3
;
public
static
final
int
TYPE_MP4
=
3
;
public
static
final
int
TYPE_MP3
=
4
;
public
static
final
int
TYPE_MP3
=
4
;
public
static
final
int
TYPE_M4A
=
5
;
public
static
final
int
TYPE_WEBM
=
5
;
public
static
final
int
TYPE_WEBM
=
5
;
public
static
final
int
TYPE_TS
=
6
;
public
static
final
int
TYPE_TS
=
6
;
public
static
final
int
TYPE_AAC
=
7
;
public
static
final
int
TYPE_AAC
=
7
;
public
static
final
int
TYPE_OTHER
=
8
;
public
static
final
int
TYPE_M4A
=
9
;
private
static
final
CookieManager
defaultCookieManager
;
private
static
final
CookieManager
defaultCookieManager
;
...
...
demo/src/main/java/com/google/android/exoplayer/demo/PlayerActivity.java
View file @
9921dfd1
...
@@ -20,7 +20,6 @@ import com.google.android.exoplayer.VideoSurfaceView;
...
@@ -20,7 +20,6 @@ import com.google.android.exoplayer.VideoSurfaceView;
import
com.google.android.exoplayer.audio.AudioCapabilities
;
import
com.google.android.exoplayer.audio.AudioCapabilities
;
import
com.google.android.exoplayer.audio.AudioCapabilitiesReceiver
;
import
com.google.android.exoplayer.audio.AudioCapabilitiesReceiver
;
import
com.google.android.exoplayer.demo.player.DashRendererBuilder
;
import
com.google.android.exoplayer.demo.player.DashRendererBuilder
;
import
com.google.android.exoplayer.demo.player.DefaultRendererBuilder
;
import
com.google.android.exoplayer.demo.player.DemoPlayer
;
import
com.google.android.exoplayer.demo.player.DemoPlayer
;
import
com.google.android.exoplayer.demo.player.DemoPlayer.RendererBuilder
;
import
com.google.android.exoplayer.demo.player.DemoPlayer.RendererBuilder
;
import
com.google.android.exoplayer.demo.player.ExtractorRendererBuilder
;
import
com.google.android.exoplayer.demo.player.ExtractorRendererBuilder
;
...
@@ -120,7 +119,7 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
...
@@ -120,7 +119,7 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
Intent
intent
=
getIntent
();
Intent
intent
=
getIntent
();
contentUri
=
intent
.
getData
();
contentUri
=
intent
.
getData
();
contentType
=
intent
.
getIntExtra
(
CONTENT_TYPE_EXTRA
,
DemoUtil
.
TYPE_OTHER
);
contentType
=
intent
.
getIntExtra
(
CONTENT_TYPE_EXTRA
,
-
1
);
contentId
=
intent
.
getStringExtra
(
CONTENT_ID_EXTRA
);
contentId
=
intent
.
getStringExtra
(
CONTENT_ID_EXTRA
);
setContentView
(
R
.
layout
.
player_activity
);
setContentView
(
R
.
layout
.
player_activity
);
...
@@ -248,7 +247,7 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
...
@@ -248,7 +247,7 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
return
new
ExtractorRendererBuilder
(
userAgent
,
contentUri
,
debugTextView
,
return
new
ExtractorRendererBuilder
(
userAgent
,
contentUri
,
debugTextView
,
new
WebmExtractor
());
new
WebmExtractor
());
default
:
default
:
return
new
DefaultRendererBuilder
(
this
,
contentUri
,
debugTextView
);
throw
new
IllegalStateException
(
"Unsupported type: "
+
contentType
);
}
}
}
}
...
...
demo/src/main/java/com/google/android/exoplayer/demo/player/DefaultRendererBuilder.java
deleted
100644 → 0
View file @
37827be8
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
google
.
android
.
exoplayer
.
demo
.
player
;
import
com.google.android.exoplayer.FrameworkSampleSource
;
import
com.google.android.exoplayer.MediaCodecAudioTrackRenderer
;
import
com.google.android.exoplayer.MediaCodecVideoTrackRenderer
;
import
com.google.android.exoplayer.TrackRenderer
;
import
com.google.android.exoplayer.demo.player.DemoPlayer.RendererBuilder
;
import
com.google.android.exoplayer.demo.player.DemoPlayer.RendererBuilderCallback
;
import
android.content.Context
;
import
android.media.MediaCodec
;
import
android.net.Uri
;
import
android.widget.TextView
;
/**
* A {@link RendererBuilder} for streams that can be read using
* {@link android.media.MediaExtractor}.
*/
public
class
DefaultRendererBuilder
implements
RendererBuilder
{
private
final
Context
context
;
private
final
Uri
uri
;
private
final
TextView
debugTextView
;
public
DefaultRendererBuilder
(
Context
context
,
Uri
uri
,
TextView
debugTextView
)
{
this
.
context
=
context
;
this
.
uri
=
uri
;
this
.
debugTextView
=
debugTextView
;
}
@Override
public
void
buildRenderers
(
DemoPlayer
player
,
RendererBuilderCallback
callback
)
{
// Build the video and audio renderers.
FrameworkSampleSource
sampleSource
=
new
FrameworkSampleSource
(
context
,
uri
,
null
,
2
);
MediaCodecVideoTrackRenderer
videoRenderer
=
new
MediaCodecVideoTrackRenderer
(
sampleSource
,
null
,
true
,
MediaCodec
.
VIDEO_SCALING_MODE_SCALE_TO_FIT
,
5000
,
null
,
player
.
getMainHandler
(),
player
,
50
);
MediaCodecAudioTrackRenderer
audioRenderer
=
new
MediaCodecAudioTrackRenderer
(
sampleSource
,
null
,
true
,
player
.
getMainHandler
(),
player
);
// Build the debug renderer.
TrackRenderer
debugRenderer
=
debugTextView
!=
null
?
new
DebugTrackRenderer
(
debugTextView
,
player
,
videoRenderer
)
:
null
;
// Invoke the callback.
TrackRenderer
[]
renderers
=
new
TrackRenderer
[
DemoPlayer
.
RENDERER_COUNT
];
renderers
[
DemoPlayer
.
TYPE_VIDEO
]
=
videoRenderer
;
renderers
[
DemoPlayer
.
TYPE_AUDIO
]
=
audioRenderer
;
renderers
[
DemoPlayer
.
TYPE_DEBUG
]
=
debugRenderer
;
callback
.
onRenderers
(
null
,
null
,
renderers
);
}
}
library/src/main/java/com/google/android/exoplayer/FrameworkSampleSource.java
View file @
9921dfd1
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
package
com
.
google
.
android
.
exoplayer
;
package
com
.
google
.
android
.
exoplayer
;
import
com.google.android.exoplayer.drm.DrmInitData
;
import
com.google.android.exoplayer.drm.DrmInitData
;
import
com.google.android.exoplayer.extractor.ExtractorSampleSource
;
import
com.google.android.exoplayer.extractor.mp4.Mp4Extractor
;
import
com.google.android.exoplayer.util.Assertions
;
import
com.google.android.exoplayer.util.Assertions
;
import
com.google.android.exoplayer.util.MimeTypes
;
import
com.google.android.exoplayer.util.MimeTypes
;
import
com.google.android.exoplayer.util.Util
;
import
com.google.android.exoplayer.util.Util
;
...
@@ -32,9 +34,26 @@ import java.util.UUID;
...
@@ -32,9 +34,26 @@ import java.util.UUID;
/**
/**
* Extracts samples from a stream using Android's {@link MediaExtractor}.
* Extracts samples from a stream using Android's {@link MediaExtractor}.
* <p>
* Warning - This class is marked as deprecated because there are known device specific issues
* associated with its use, including playbacks not starting, playbacks stuttering and other
* miscellaneous failures. For mp4, m4a, mp3, webm, mpeg-ts and aac playbacks it is strongly
* recommended to use {@link ExtractorSampleSource} instead, along with the corresponding extractor
* (e.g. {@link Mp4Extractor} for mp4 playbacks). Where this is not possible this class can still be
* used, but please be aware of the associated risks. Valid use cases of this class that are not
* yet supported by {@link ExtractorSampleSource} include:
* <ul>
* <li>Playing a container format for which an ExoPlayer extractor does not yet exist (e.g. ogg).
* </li>
* <li>Playing media whose container format is unknown and so needs to be inferred automatically.
* </li>
* </ul>
* Over time we hope to enhance {@link ExtractorSampleSource} to support these use cases, and hence
* make use of this class unnecessary.
*/
*/
// TODO: This implementation needs to be fixed so that its methods are non-blocking (either
// TODO: This implementation needs to be fixed so that its methods are non-blocking (either
// through use of a background thread, or through changes to the framework's MediaExtractor API).
// through use of a background thread, or through changes to the framework's MediaExtractor API).
@Deprecated
@TargetApi
(
16
)
@TargetApi
(
16
)
public
final
class
FrameworkSampleSource
implements
SampleSource
{
public
final
class
FrameworkSampleSource
implements
SampleSource
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment