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
d82343d0
authored
May 01, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove MediaFormat.bitrate.
parent
54f97c95
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
22 deletions
library/src/main/java/com/google/android/exoplayer/MediaFormat.java
library/src/main/java/com/google/android/exoplayer/extractor/mp3/Mp3Extractor.java
library/src/main/java/com/google/android/exoplayer/extractor/mp4/AtomParsers.java
library/src/main/java/com/google/android/exoplayer/MediaFormat.java
View file @
d82343d0
...
@@ -49,8 +49,6 @@ public class MediaFormat {
...
@@ -49,8 +49,6 @@ public class MediaFormat {
public
final
int
channelCount
;
public
final
int
channelCount
;
public
final
int
sampleRate
;
public
final
int
sampleRate
;
public
final
int
bitrate
;
public
final
List
<
byte
[]>
initializationData
;
public
final
List
<
byte
[]>
initializationData
;
private
int
maxWidth
;
private
int
maxWidth
;
...
@@ -81,7 +79,7 @@ public class MediaFormat {
...
@@ -81,7 +79,7 @@ public class MediaFormat {
public
static
MediaFormat
createVideoFormat
(
String
mimeType
,
int
maxInputSize
,
long
durationUs
,
public
static
MediaFormat
createVideoFormat
(
String
mimeType
,
int
maxInputSize
,
long
durationUs
,
int
width
,
int
height
,
float
pixelWidthHeightRatio
,
List
<
byte
[]>
initializationData
)
{
int
width
,
int
height
,
float
pixelWidthHeightRatio
,
List
<
byte
[]>
initializationData
)
{
return
new
MediaFormat
(
mimeType
,
maxInputSize
,
durationUs
,
width
,
height
,
pixelWidthHeightRatio
,
return
new
MediaFormat
(
mimeType
,
maxInputSize
,
durationUs
,
width
,
height
,
pixelWidthHeightRatio
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
initializationData
);
NO_VALUE
,
NO_VALUE
,
initializationData
);
}
}
public
static
MediaFormat
createAudioFormat
(
String
mimeType
,
int
maxInputSize
,
int
channelCount
,
public
static
MediaFormat
createAudioFormat
(
String
mimeType
,
int
maxInputSize
,
int
channelCount
,
...
@@ -92,14 +90,8 @@ public class MediaFormat {
...
@@ -92,14 +90,8 @@ public class MediaFormat {
public
static
MediaFormat
createAudioFormat
(
String
mimeType
,
int
maxInputSize
,
long
durationUs
,
public
static
MediaFormat
createAudioFormat
(
String
mimeType
,
int
maxInputSize
,
long
durationUs
,
int
channelCount
,
int
sampleRate
,
List
<
byte
[]>
initializationData
)
{
int
channelCount
,
int
sampleRate
,
List
<
byte
[]>
initializationData
)
{
return
createAudioFormat
(
mimeType
,
maxInputSize
,
durationUs
,
channelCount
,
sampleRate
,
NO_VALUE
,
initializationData
);
}
public
static
MediaFormat
createAudioFormat
(
String
mimeType
,
int
maxInputSize
,
long
durationUs
,
int
channelCount
,
int
sampleRate
,
int
bitrate
,
List
<
byte
[]>
initializationData
)
{
return
new
MediaFormat
(
mimeType
,
maxInputSize
,
durationUs
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
return
new
MediaFormat
(
mimeType
,
maxInputSize
,
durationUs
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
channelCount
,
sampleRate
,
bitrate
,
initializationData
);
channelCount
,
sampleRate
,
initializationData
);
}
}
public
static
MediaFormat
createId3Format
()
{
public
static
MediaFormat
createId3Format
()
{
...
@@ -116,7 +108,7 @@ public class MediaFormat {
...
@@ -116,7 +108,7 @@ public class MediaFormat {
public
static
MediaFormat
createFormatForMimeType
(
String
mimeType
)
{
public
static
MediaFormat
createFormatForMimeType
(
String
mimeType
)
{
return
new
MediaFormat
(
mimeType
,
NO_VALUE
,
C
.
UNKNOWN_TIME_US
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
return
new
MediaFormat
(
mimeType
,
NO_VALUE
,
C
.
UNKNOWN_TIME_US
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
NO_VALUE
,
null
);
NO_VALUE
,
NO_VALUE
,
null
);
}
}
@TargetApi
(
16
)
@TargetApi
(
16
)
...
@@ -128,7 +120,6 @@ public class MediaFormat {
...
@@ -128,7 +120,6 @@ public class MediaFormat {
height
=
getOptionalIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_HEIGHT
);
height
=
getOptionalIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_HEIGHT
);
channelCount
=
getOptionalIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_CHANNEL_COUNT
);
channelCount
=
getOptionalIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_CHANNEL_COUNT
);
sampleRate
=
getOptionalIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_SAMPLE_RATE
);
sampleRate
=
getOptionalIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_SAMPLE_RATE
);
bitrate
=
getOptionalIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_BIT_RATE
);
pixelWidthHeightRatio
=
getOptionalFloatV16
(
format
,
KEY_PIXEL_WIDTH_HEIGHT_RATIO
);
pixelWidthHeightRatio
=
getOptionalFloatV16
(
format
,
KEY_PIXEL_WIDTH_HEIGHT_RATIO
);
initializationData
=
new
ArrayList
<
byte
[]>();
initializationData
=
new
ArrayList
<
byte
[]>();
for
(
int
i
=
0
;
format
.
containsKey
(
"csd-"
+
i
);
i
++)
{
for
(
int
i
=
0
;
format
.
containsKey
(
"csd-"
+
i
);
i
++)
{
...
@@ -145,7 +136,7 @@ public class MediaFormat {
...
@@ -145,7 +136,7 @@ public class MediaFormat {
}
}
private
MediaFormat
(
String
mimeType
,
int
maxInputSize
,
long
durationUs
,
int
width
,
int
height
,
private
MediaFormat
(
String
mimeType
,
int
maxInputSize
,
long
durationUs
,
int
width
,
int
height
,
float
pixelWidthHeightRatio
,
int
channelCount
,
int
sampleRate
,
int
bitrate
,
float
pixelWidthHeightRatio
,
int
channelCount
,
int
sampleRate
,
List
<
byte
[]>
initializationData
)
{
List
<
byte
[]>
initializationData
)
{
this
.
mimeType
=
mimeType
;
this
.
mimeType
=
mimeType
;
this
.
maxInputSize
=
maxInputSize
;
this
.
maxInputSize
=
maxInputSize
;
...
@@ -155,7 +146,6 @@ public class MediaFormat {
...
@@ -155,7 +146,6 @@ public class MediaFormat {
this
.
pixelWidthHeightRatio
=
pixelWidthHeightRatio
;
this
.
pixelWidthHeightRatio
=
pixelWidthHeightRatio
;
this
.
channelCount
=
channelCount
;
this
.
channelCount
=
channelCount
;
this
.
sampleRate
=
sampleRate
;
this
.
sampleRate
=
sampleRate
;
this
.
bitrate
=
bitrate
;
this
.
initializationData
=
initializationData
==
null
?
Collections
.<
byte
[]>
emptyList
()
this
.
initializationData
=
initializationData
==
null
?
Collections
.<
byte
[]>
emptyList
()
:
initializationData
;
:
initializationData
;
maxWidth
=
NO_VALUE
;
maxWidth
=
NO_VALUE
;
...
@@ -192,7 +182,6 @@ public class MediaFormat {
...
@@ -192,7 +182,6 @@ public class MediaFormat {
result
=
31
*
result
+
maxHeight
;
result
=
31
*
result
+
maxHeight
;
result
=
31
*
result
+
channelCount
;
result
=
31
*
result
+
channelCount
;
result
=
31
*
result
+
sampleRate
;
result
=
31
*
result
+
sampleRate
;
result
=
31
*
result
+
bitrate
;
for
(
int
i
=
0
;
i
<
initializationData
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
initializationData
.
size
();
i
++)
{
result
=
31
*
result
+
Arrays
.
hashCode
(
initializationData
.
get
(
i
));
result
=
31
*
result
+
Arrays
.
hashCode
(
initializationData
.
get
(
i
));
}
}
...
@@ -228,7 +217,6 @@ public class MediaFormat {
...
@@ -228,7 +217,6 @@ public class MediaFormat {
||
(!
ignoreMaxDimensions
&&
(
maxWidth
!=
other
.
maxWidth
||
maxHeight
!=
other
.
maxHeight
))
||
(!
ignoreMaxDimensions
&&
(
maxWidth
!=
other
.
maxWidth
||
maxHeight
!=
other
.
maxHeight
))
||
channelCount
!=
other
.
channelCount
||
sampleRate
!=
other
.
sampleRate
||
channelCount
!=
other
.
channelCount
||
sampleRate
!=
other
.
sampleRate
||
!
Util
.
areEqual
(
mimeType
,
other
.
mimeType
)
||
!
Util
.
areEqual
(
mimeType
,
other
.
mimeType
)
||
bitrate
!=
other
.
bitrate
||
initializationData
.
size
()
!=
other
.
initializationData
.
size
())
{
||
initializationData
.
size
()
!=
other
.
initializationData
.
size
())
{
return
false
;
return
false
;
}
}
...
@@ -243,8 +231,8 @@ public class MediaFormat {
...
@@ -243,8 +231,8 @@ public class MediaFormat {
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"MediaFormat("
+
mimeType
+
", "
+
maxInputSize
+
", "
+
width
+
", "
+
height
+
", "
return
"MediaFormat("
+
mimeType
+
", "
+
maxInputSize
+
", "
+
width
+
", "
+
height
+
", "
+
pixelWidthHeightRatio
+
", "
+
channelCount
+
", "
+
sampleRate
+
", "
+
bitrate
+
", "
+
pixelWidthHeightRatio
+
", "
+
channelCount
+
", "
+
sampleRate
+
", "
+
durationUs
+
", "
+
durationUs
+
", "
+
maxWidth
+
", "
+
maxHeight
+
")"
;
+
maxWidth
+
", "
+
maxHeight
+
")"
;
}
}
/**
/**
...
@@ -260,7 +248,6 @@ public class MediaFormat {
...
@@ -260,7 +248,6 @@ public class MediaFormat {
maybeSetIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_HEIGHT
,
height
);
maybeSetIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_HEIGHT
,
height
);
maybeSetIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_CHANNEL_COUNT
,
channelCount
);
maybeSetIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_CHANNEL_COUNT
,
channelCount
);
maybeSetIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_SAMPLE_RATE
,
sampleRate
);
maybeSetIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_SAMPLE_RATE
,
sampleRate
);
maybeSetIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_BIT_RATE
,
bitrate
);
maybeSetFloatV16
(
format
,
KEY_PIXEL_WIDTH_HEIGHT_RATIO
,
pixelWidthHeightRatio
);
maybeSetFloatV16
(
format
,
KEY_PIXEL_WIDTH_HEIGHT_RATIO
,
pixelWidthHeightRatio
);
for
(
int
i
=
0
;
i
<
initializationData
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
initializationData
.
size
();
i
++)
{
format
.
setByteBuffer
(
"csd-"
+
i
,
ByteBuffer
.
wrap
(
initializationData
.
get
(
i
)));
format
.
setByteBuffer
(
"csd-"
+
i
,
ByteBuffer
.
wrap
(
initializationData
.
get
(
i
)));
...
...
library/src/main/java/com/google/android/exoplayer/extractor/mp3/Mp3Extractor.java
View file @
d82343d0
...
@@ -258,7 +258,7 @@ public final class Mp3Extractor implements Extractor {
...
@@ -258,7 +258,7 @@ public final class Mp3Extractor implements Extractor {
trackOutput
.
format
(
MediaFormat
.
createAudioFormat
(
trackOutput
.
format
(
MediaFormat
.
createAudioFormat
(
MIME_TYPE_BY_LAYER
[
synchronizedHeader
.
layerIndex
],
MAX_FRAME_SIZE_BYTES
,
MIME_TYPE_BY_LAYER
[
synchronizedHeader
.
layerIndex
],
MAX_FRAME_SIZE_BYTES
,
seeker
.
getDurationUs
(),
synchronizedHeader
.
channels
,
synchronizedHeader
.
sampleRate
,
seeker
.
getDurationUs
(),
synchronizedHeader
.
channels
,
synchronizedHeader
.
sampleRate
,
synchronizedHeader
.
bitrate
*
1000
,
Collections
.<
byte
[]>
emptyList
()));
Collections
.<
byte
[]>
emptyList
()));
}
}
return
headerPosition
;
return
headerPosition
;
...
...
library/src/main/java/com/google/android/exoplayer/extractor/mp4/AtomParsers.java
View file @
d82343d0
...
@@ -498,7 +498,6 @@ import java.util.List;
...
@@ -498,7 +498,6 @@ import java.util.List;
int
sampleSize
=
parent
.
readUnsignedShort
();
int
sampleSize
=
parent
.
readUnsignedShort
();
parent
.
skipBytes
(
4
);
parent
.
skipBytes
(
4
);
int
sampleRate
=
parent
.
readUnsignedFixedPoint1616
();
int
sampleRate
=
parent
.
readUnsignedFixedPoint1616
();
int
bitrate
=
MediaFormat
.
NO_VALUE
;
byte
[]
initializationData
=
null
;
byte
[]
initializationData
=
null
;
int
childPosition
=
parent
.
getPosition
();
int
childPosition
=
parent
.
getPosition
();
...
@@ -536,7 +535,7 @@ import java.util.List;
...
@@ -536,7 +535,7 @@ import java.util.List;
}
}
out
.
mediaFormat
=
MediaFormat
.
createAudioFormat
(
out
.
mediaFormat
=
MediaFormat
.
createAudioFormat
(
MimeTypes
.
AUDIO_AAC
,
sampleSize
,
durationUs
,
channelCount
,
sampleRate
,
bitrate
,
MimeTypes
.
AUDIO_AAC
,
sampleSize
,
durationUs
,
channelCount
,
sampleRate
,
initializationData
==
null
?
null
:
Collections
.
singletonList
(
initializationData
));
initializationData
==
null
?
null
:
Collections
.
singletonList
(
initializationData
));
}
}
...
...
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