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
d59cfb73
authored
Jan 07, 2022
by
claincly
Committed by
Ian Baker
Jan 10, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Replace static method with a static field.
PiperOrigin-RevId: 420307694
parent
bd52b19a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultCodecFactory.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultCodecFactory.java
View file @
d59cfb73
...
@@ -36,6 +36,18 @@ import java.io.IOException;
...
@@ -36,6 +36,18 @@ import java.io.IOException;
/* package */
final
class
DefaultCodecFactory
/* package */
final
class
DefaultCodecFactory
implements
Codec
.
DecoderFactory
,
Codec
.
EncoderFactory
{
implements
Codec
.
DecoderFactory
,
Codec
.
EncoderFactory
{
private
static
final
MediaCodecInfo
PLACEHOLDER_MEDIA_CODEC_INFO
=
MediaCodecInfo
.
newInstance
(
/* name= */
"name-placeholder"
,
/* mimeType= */
"mime-type-placeholder"
,
/* codecMimeType= */
"mime-type-placeholder"
,
/* capabilities= */
null
,
/* hardwareAccelerated= */
false
,
/* softwareOnly= */
false
,
/* vendor= */
false
,
/* forceDisableAdaptive= */
false
,
/* forceSecure= */
false
);
@Override
@Override
public
Codec
createForAudioDecoding
(
Format
format
)
throws
TransformationException
{
public
Codec
createForAudioDecoding
(
Format
format
)
throws
TransformationException
{
MediaFormat
mediaFormat
=
MediaFormat
mediaFormat
=
...
@@ -51,7 +63,7 @@ import java.io.IOException;
...
@@ -51,7 +63,7 @@ import java.io.IOException;
new
MediaCodecFactory
()
new
MediaCodecFactory
()
.
createAdapter
(
.
createAdapter
(
MediaCodecAdapter
.
Configuration
.
createForAudioDecoding
(
MediaCodecAdapter
.
Configuration
.
createForAudioDecoding
(
createPlaceholderMediaCodecInfo
()
,
mediaFormat
,
format
,
/* crypto= */
null
));
PLACEHOLDER_MEDIA_CODEC_INFO
,
mediaFormat
,
format
,
/* crypto= */
null
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
createTransformationException
(
e
,
format
,
/* isVideo= */
false
,
/* isDecoder= */
true
);
throw
createTransformationException
(
e
,
format
,
/* isVideo= */
false
,
/* isDecoder= */
true
);
}
}
...
@@ -81,7 +93,7 @@ import java.io.IOException;
...
@@ -81,7 +93,7 @@ import java.io.IOException;
new
MediaCodecFactory
()
new
MediaCodecFactory
()
.
createAdapter
(
.
createAdapter
(
MediaCodecAdapter
.
Configuration
.
createForVideoDecoding
(
MediaCodecAdapter
.
Configuration
.
createForVideoDecoding
(
createPlaceholderMediaCodecInfo
()
,
PLACEHOLDER_MEDIA_CODEC_INFO
,
mediaFormat
,
mediaFormat
,
format
,
format
,
surface
,
surface
,
...
@@ -105,7 +117,7 @@ import java.io.IOException;
...
@@ -105,7 +117,7 @@ import java.io.IOException;
new
MediaCodecFactory
()
new
MediaCodecFactory
()
.
createAdapter
(
.
createAdapter
(
MediaCodecAdapter
.
Configuration
.
createForAudioEncoding
(
MediaCodecAdapter
.
Configuration
.
createForAudioEncoding
(
createPlaceholderMediaCodecInfo
()
,
mediaFormat
,
format
));
PLACEHOLDER_MEDIA_CODEC_INFO
,
mediaFormat
,
format
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
createTransformationException
(
e
,
format
,
/* isVideo= */
false
,
/* isDecoder= */
false
);
throw
createTransformationException
(
e
,
format
,
/* isVideo= */
false
,
/* isDecoder= */
false
);
}
}
...
@@ -135,7 +147,7 @@ import java.io.IOException;
...
@@ -135,7 +147,7 @@ import java.io.IOException;
new
MediaCodecFactory
()
new
MediaCodecFactory
()
.
createAdapter
(
.
createAdapter
(
MediaCodecAdapter
.
Configuration
.
createForVideoEncoding
(
MediaCodecAdapter
.
Configuration
.
createForVideoEncoding
(
createPlaceholderMediaCodecInfo
()
,
mediaFormat
,
format
));
PLACEHOLDER_MEDIA_CODEC_INFO
,
mediaFormat
,
format
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
createTransformationException
(
e
,
format
,
/* isVideo= */
true
,
/* isDecoder= */
false
);
throw
createTransformationException
(
e
,
format
,
/* isVideo= */
true
,
/* isDecoder= */
false
);
}
}
...
@@ -155,19 +167,6 @@ import java.io.IOException;
...
@@ -155,19 +167,6 @@ import java.io.IOException;
}
}
}
}
private
static
MediaCodecInfo
createPlaceholderMediaCodecInfo
()
{
return
MediaCodecInfo
.
newInstance
(
/* name= */
"name-placeholder"
,
/* mimeType= */
"mime-type-placeholder"
,
/* codecMimeType= */
"mime-type-placeholder"
,
/* capabilities= */
null
,
/* hardwareAccelerated= */
false
,
/* softwareOnly= */
false
,
/* vendor= */
false
,
/* forceDisableAdaptive= */
false
,
/* forceSecure= */
false
);
}
private
static
TransformationException
createTransformationException
(
private
static
TransformationException
createTransformationException
(
Exception
cause
,
Format
format
,
boolean
isVideo
,
boolean
isDecoder
)
{
Exception
cause
,
Format
format
,
boolean
isVideo
,
boolean
isDecoder
)
{
String
componentName
=
(
isVideo
?
"Video"
:
"Audio"
)
+
(
isDecoder
?
"Decoder"
:
"Encoder"
);
String
componentName
=
(
isVideo
?
"Video"
:
"Audio"
)
+
(
isDecoder
?
"Decoder"
:
"Encoder"
);
...
...
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