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
a038b421
authored
Nov 12, 2020
by
samrobinson
Committed by
Christos Tsilopoulos
Nov 13, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add additional SEF data types.
PiperOrigin-RevId: 342034166
parent
e3c725aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
10 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/SefReader.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/SefReader.java
View file @
a038b421
...
@@ -63,10 +63,20 @@ import java.util.List;
...
@@ -63,10 +63,20 @@ import java.util.List;
/** Supported data types. */
/** Supported data types. */
@Documented
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
@Retention
(
RetentionPolicy
.
SOURCE
)
@IntDef
({
TYPE_SLOW_MOTION_DATA
})
@IntDef
({
TYPE_SLOW_MOTION_DATA
,
TYPE_SUPER_SLOW_MOTION_DATA
,
TYPE_SUPER_SLOW_MOTION_BGM
,
TYPE_SUPER_SLOW_MOTION_EDIT_DATA
,
TYPE_SUPER_SLOW_DEFLICKERING_ON
})
private
@interface
DataType
{}
private
@interface
DataType
{}
private
static
final
int
TYPE_SLOW_MOTION_DATA
=
0x0890
;
private
static
final
int
TYPE_SLOW_MOTION_DATA
=
0x0890
;
// 2192
private
static
final
int
TYPE_SUPER_SLOW_MOTION_DATA
=
0x0b00
;
// 2816
private
static
final
int
TYPE_SUPER_SLOW_MOTION_BGM
=
0x0b01
;
// 2817
private
static
final
int
TYPE_SUPER_SLOW_MOTION_EDIT_DATA
=
0x0b03
;
// 2819
private
static
final
int
TYPE_SUPER_SLOW_DEFLICKERING_ON
=
0x0b04
;
// 2820
private
static
final
String
TAG
=
"SefReader"
;
private
static
final
String
TAG
=
"SefReader"
;
...
@@ -150,14 +160,20 @@ import java.util.List;
...
@@ -150,14 +160,20 @@ import java.util.List;
for
(
int
i
=
0
;
i
<
sdrsLength
/
LENGTH_OF_ONE_SDR
;
i
++)
{
for
(
int
i
=
0
;
i
<
sdrsLength
/
LENGTH_OF_ONE_SDR
;
i
++)
{
scratch
.
skipBytes
(
2
);
// SDR data sub info flag and reserved bits (2).
scratch
.
skipBytes
(
2
);
// SDR data sub info flag and reserved bits (2).
@DataType
int
dataType
=
scratch
.
readLittleEndianShort
();
@DataType
int
dataType
=
scratch
.
readLittleEndianShort
();
if
(
dataType
==
TYPE_SLOW_MOTION_DATA
)
{
switch
(
dataType
)
{
// The read int is the distance from the tail info to the start of the metadata.
case
TYPE_SLOW_MOTION_DATA:
// Calculated as an offset from the start by working backwards.
case
TYPE_SUPER_SLOW_MOTION_DATA:
long
startOffset
=
streamLength
-
tailLength
-
scratch
.
readLittleEndianInt
();
case
TYPE_SUPER_SLOW_MOTION_BGM:
int
size
=
scratch
.
readLittleEndianInt
();
case
TYPE_SUPER_SLOW_MOTION_EDIT_DATA:
dataReferences
.
add
(
new
DataReference
(
dataType
,
startOffset
,
size
));
case
TYPE_SUPER_SLOW_DEFLICKERING_ON:
}
else
{
// The read int is the distance from the tail info to the start of the metadata.
scratch
.
skipBytes
(
8
);
// startPosition (4), size (4).
// Calculated as an offset from the start by working backwards.
long
startOffset
=
streamLength
-
tailLength
-
scratch
.
readLittleEndianInt
();
int
size
=
scratch
.
readLittleEndianInt
();
dataReferences
.
add
(
new
DataReference
(
dataType
,
startOffset
,
size
));
break
;
default
:
scratch
.
skipBytes
(
8
);
// startPosition (4), size (4).
}
}
}
}
...
@@ -208,6 +224,24 @@ import java.util.List;
...
@@ -208,6 +224,24 @@ import java.util.List;
}
}
}
}
@DataType
private
static
int
nameToDataType
(
String
name
)
throws
ParserException
{
switch
(
name
)
{
case
"SlowMotion_Data"
:
return
TYPE_SLOW_MOTION_DATA
;
case
"Super_SlowMotion_Data"
:
return
TYPE_SUPER_SLOW_MOTION_DATA
;
case
"Super_SlowMotion_BGM"
:
return
TYPE_SUPER_SLOW_MOTION_BGM
;
case
"Super_SlowMotion_Edit_Data"
:
return
TYPE_SUPER_SLOW_MOTION_EDIT_DATA
;
case
"Super_SlowMotion_Deflickering_On"
:
return
TYPE_SUPER_SLOW_DEFLICKERING_ON
;
default
:
throw
new
ParserException
(
"Invalid SEF name"
);
}
}
private
static
final
class
DataReference
{
private
static
final
class
DataReference
{
@DataType
public
final
int
dataType
;
@DataType
public
final
int
dataType
;
public
final
long
startOffset
;
public
final
long
startOffset
;
...
...
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