Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
ccfcd3ff
Commit
ccfcd3ff
authored
Apr 27, 2015
by
Thomas Guillem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mediacodec: factor GetMediaCodecName
parent
d5248dbb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
36 deletions
+49
-36
modules/codec/omxil/android_mediacodec.c
modules/codec/omxil/android_mediacodec.c
+49
-36
No files found.
modules/codec/omxil/android_mediacodec.c
View file @
ccfcd3ff
...
...
@@ -433,50 +433,23 @@ static int H264GetSPSPPS(uint8_t *p_buf, size_t i_buf,
return
-
1
;
}
/*****************************************************************************
* OpenMediaCodec: Create the mediacodec instance
*****************************************************************************/
static
int
OpenMediaCodec
(
decoder_t
*
p_dec
,
JNIEnv
*
env
)
static
jstring
GetMediaCodecName
(
decoder_t
*
p_dec
,
JNIEnv
*
env
,
const
char
*
mime
,
jstring
jmime
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
const
char
*
mime
=
NULL
;
int
num_codecs
;
size_t
fmt_profile
=
0
;
int
i_ret
=
VLC_EGENERIC
;
jstring
jmime
=
NULL
;
jstring
jcodec_name
=
NULL
;
jobject
jcodec
=
NULL
;
jobject
jcsd0_buffer
=
NULL
;
jstring
jcsd0_string
=
NULL
;
jobject
jformat
=
NULL
;
jstring
jrotation_string
=
NULL
;
jobject
jinput_buffers
=
NULL
;
jobject
joutput_buffers
=
NULL
;
jobject
jbuffer_info
=
NULL
;
switch
(
p_dec
->
fmt_in
.
i_codec
)
{
case
VLC_CODEC_HEVC
:
mime
=
"video/hevc"
;
break
;
case
VLC_CODEC_H264
:
mime
=
"video/avc"
;
break
;
case
VLC_CODEC_H263
:
mime
=
"video/3gpp"
;
break
;
case
VLC_CODEC_MP4V
:
mime
=
"video/mp4v-es"
;
break
;
case
VLC_CODEC_WMV3
:
mime
=
"video/x-ms-wmv"
;
break
;
case
VLC_CODEC_VC1
:
mime
=
"video/wvc1"
;
break
;
case
VLC_CODEC_VP8
:
mime
=
"video/x-vnd.on2.vp8"
;
break
;
case
VLC_CODEC_VP9
:
mime
=
"video/x-vnd.on2.vp9"
;
break
;
default:
vlc_assert_unreachable
();
}
jmime
=
(
*
env
)
->
NewStringUTF
(
env
,
mime
);
if
(
!
jmime
)
return
VLC_EGENERIC
;
if
(
p_dec
->
fmt_in
.
i_codec
==
VLC_CODEC_H264
)
h264_get_profile_level
(
&
p_dec
->
fmt_in
,
&
fmt_profile
,
NULL
,
NULL
);
int
num_codecs
=
(
*
env
)
->
CallStaticIntMethod
(
env
,
jfields
.
media_codec_list_class
,
jfields
.
get_codec_count
);
num_codecs
=
(
*
env
)
->
CallStaticIntMethod
(
env
,
jfields
.
media_codec_list_class
,
jfields
.
get_codec_count
);
for
(
int
i
=
0
;
i
<
num_codecs
;
i
++
)
{
for
(
int
i
=
0
;
i
<
num_codecs
;
i
++
)
{
jobject
codec_capabilities
=
NULL
;
jobject
profile_levels
=
NULL
;
jobject
info
=
NULL
;
...
...
@@ -500,7 +473,8 @@ static int OpenMediaCodec(decoder_t *p_dec, JNIEnv *env)
if
((
*
env
)
->
CallBooleanMethod
(
env
,
info
,
jfields
.
is_encoder
))
goto
loopclean
;
codec_capabilities
=
(
*
env
)
->
CallObjectMethod
(
env
,
info
,
jfields
.
get_capabilities_for_type
,
codec_capabilities
=
(
*
env
)
->
CallObjectMethod
(
env
,
info
,
jfields
.
get_capabilities_for_type
,
jmime
);
if
(
CHECK_EXCEPTION
())
{
msg_Warn
(
p_dec
,
"Exception occurred in MediaCodecInfo.getCapabilitiesForType"
);
...
...
@@ -571,7 +545,46 @@ loopclean:
if
(
found
)
break
;
}
return
jcodec_name
;
}
/*****************************************************************************
* OpenMediaCodec: Create the mediacodec instance
*****************************************************************************/
static
int
OpenMediaCodec
(
decoder_t
*
p_dec
,
JNIEnv
*
env
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
const
char
*
mime
=
NULL
;
int
i_ret
=
VLC_EGENERIC
;
jstring
jmime
=
NULL
;
jstring
jcodec_name
=
NULL
;
jobject
jcodec
=
NULL
;
jobject
jcsd0_buffer
=
NULL
;
jstring
jcsd0_string
=
NULL
;
jobject
jformat
=
NULL
;
jstring
jrotation_string
=
NULL
;
jobject
jinput_buffers
=
NULL
;
jobject
joutput_buffers
=
NULL
;
jobject
jbuffer_info
=
NULL
;
switch
(
p_dec
->
fmt_in
.
i_codec
)
{
case
VLC_CODEC_HEVC
:
mime
=
"video/hevc"
;
break
;
case
VLC_CODEC_H264
:
mime
=
"video/avc"
;
break
;
case
VLC_CODEC_H263
:
mime
=
"video/3gpp"
;
break
;
case
VLC_CODEC_MP4V
:
mime
=
"video/mp4v-es"
;
break
;
case
VLC_CODEC_WMV3
:
mime
=
"video/x-ms-wmv"
;
break
;
case
VLC_CODEC_VC1
:
mime
=
"video/wvc1"
;
break
;
case
VLC_CODEC_VP8
:
mime
=
"video/x-vnd.on2.vp8"
;
break
;
case
VLC_CODEC_VP9
:
mime
=
"video/x-vnd.on2.vp9"
;
break
;
default:
vlc_assert_unreachable
();
}
jmime
=
(
*
env
)
->
NewStringUTF
(
env
,
mime
);
if
(
!
jmime
)
return
VLC_EGENERIC
;
jcodec_name
=
GetMediaCodecName
(
p_dec
,
env
,
mime
,
jmime
);
if
(
!
jcodec_name
)
{
msg_Dbg
(
p_dec
,
"No suitable codec matching %s was found"
,
mime
);
goto
error
;
...
...
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