Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
7b915a40
Commit
7b915a40
authored
Apr 18, 2012
by
Mohamed Naufal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libstagefright: explicitly set positive timestamps as stagefright expects them so
parent
e46b625d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
configure
configure
+1
-1
libstagefright.cpp
libavcodec/libstagefright.cpp
+23
-5
build_libstagefright
tools/build_libstagefright
+3
-3
No files found.
configure
View file @
7b915a40
...
...
@@ -2951,7 +2951,7 @@ enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schr
enabled libspeex
&&
require libspeex speex/speex.h speex_decoder_init
-lspeex
enabled libstagefright_h264
&&
require_cpp libstagefright_h264
"binder/ProcessState.h media/stagefright/MetaData.h
media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
media/stagefright/OMXClient.h media/stagefright/OMXCodec.h"
android::OMXClient
-lstagefright
-lmedia
-lutils
-lbinder
media/stagefright/OMXClient.h media/stagefright/OMXCodec.h"
android::OMXClient
-lstagefright
-lmedia
-lutils
-lbinder
-lgnustl_static
enabled libtheora
&&
require libtheora theora/theoraenc.h th_info_init
-ltheoraenc
-ltheoradec
-logg
enabled libvo_aacenc
&&
require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI
-lvo-aacenc
enabled libvo_amrwbenc
&&
require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init
-lvo-amrwbenc
...
...
libavcodec/libstagefright.cpp
View file @
7b915a40
...
...
@@ -31,6 +31,7 @@
#include <media/stagefright/OMXCodec.h>
#include <utils/List.h>
#include <new>
#include <map>
extern
"C"
{
#include "avcodec.h"
...
...
@@ -51,6 +52,11 @@ struct Frame {
int32_t
w
,
h
;
};
struct
TimeStamp
{
int64_t
pts
;
int64_t
reordered_opaque
;
};
class
CustomSource
;
struct
StagefrightContext
{
...
...
@@ -69,6 +75,8 @@ struct StagefrightContext {
volatile
sig_atomic_t
thread_started
,
thread_exited
,
stop_decode
;
AVFrame
ret_frame
;
std
::
map
<
int64_t
,
TimeStamp
>
*
ts_map
;
int64_t
frame_index
;
uint8_t
*
dummy_buf
;
int
dummy_bufsize
;
...
...
@@ -234,10 +242,11 @@ static av_cold int Stagefright_init(AVCodecContext *avctx)
*
s
->
source
=
new
CustomSource
(
avctx
,
meta
);
s
->
in_queue
=
new
List
<
Frame
*>
;
s
->
out_queue
=
new
List
<
Frame
*>
;
s
->
ts_map
=
new
std
::
map
<
int64_t
,
TimeStamp
>
;
s
->
client
=
new
OMXClient
;
s
->
end_frame
=
(
Frame
*
)
av_mallocz
(
sizeof
(
Frame
));
if
(
s
->
source
==
NULL
||
!
s
->
in_queue
||
!
s
->
out_queue
||
!
s
->
client
||
!
s
->
end_frame
)
{
!
s
->
ts_map
||
!
s
->
end_frame
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
...
...
@@ -282,6 +291,7 @@ fail:
av_freep
(
&
s
->
end_frame
);
delete
s
->
in_queue
;
delete
s
->
out_queue
;
delete
s
->
ts_map
;
delete
s
->
client
;
return
ret
;
}
...
...
@@ -300,6 +310,7 @@ static int Stagefright_decode_frame(AVCodecContext *avctx, void *data,
int
src_linesize
[
3
];
int
orig_size
=
avpkt
->
size
;
AVPacket
pkt
=
*
avpkt
;
int64_t
out_frame_index
=
0
;
int
ret
;
if
(
!
s
->
thread_started
)
{
...
...
@@ -326,10 +337,6 @@ static int Stagefright_decode_frame(AVCodecContext *avctx, void *data,
if
(
avpkt
->
data
)
{
frame
->
status
=
OK
;
frame
->
size
=
avpkt
->
size
;
// Stagefright can't handle negative timestamps -
// if needed, work around this by offsetting them manually?
if
(
avpkt
->
pts
>=
0
)
frame
->
time
=
avpkt
->
pts
;
frame
->
key
=
avpkt
->
flags
&
AV_PKT_FLAG_KEY
?
1
:
0
;
frame
->
buffer
=
(
uint8_t
*
)
av_malloc
(
avpkt
->
size
);
if
(
!
frame
->
buffer
)
{
...
...
@@ -343,6 +350,10 @@ static int Stagefright_decode_frame(AVCodecContext *avctx, void *data,
frame
->
size
=
orig_size
;
}
memcpy
(
frame
->
buffer
,
ptr
,
orig_size
);
frame
->
time
=
++
s
->
frame_index
;
(
*
s
->
ts_map
)[
s
->
frame_index
].
pts
=
avpkt
->
pts
;
(
*
s
->
ts_map
)[
s
->
frame_index
].
reordered_opaque
=
avctx
->
reordered_opaque
;
}
else
{
frame
->
status
=
ERROR_END_OF_STREAM
;
s
->
source_done
=
true
;
...
...
@@ -431,6 +442,12 @@ static int Stagefright_decode_frame(AVCodecContext *avctx, void *data,
src_data
,
src_linesize
,
avctx
->
pix_fmt
,
avctx
->
width
,
avctx
->
height
);
mbuffer
->
meta_data
()
->
findInt64
(
kKeyTime
,
&
out_frame_index
);
if
(
out_frame_index
&&
s
->
ts_map
->
count
(
out_frame_index
)
>
0
)
{
s
->
ret_frame
.
pts
=
(
*
s
->
ts_map
)[
out_frame_index
].
pts
;
s
->
ret_frame
.
reordered_opaque
=
(
*
s
->
ts_map
)[
out_frame_index
].
reordered_opaque
;
s
->
ts_map
->
erase
(
out_frame_index
);
}
*
data_size
=
sizeof
(
AVFrame
);
*
(
AVFrame
*
)
data
=
s
->
ret_frame
;
ret
=
orig_size
;
...
...
@@ -523,6 +540,7 @@ static av_cold int Stagefright_close(AVCodecContext *avctx)
delete
s
->
in_queue
;
delete
s
->
out_queue
;
delete
s
->
ts_map
;
delete
s
->
client
;
delete
s
->
decoder
;
delete
s
->
source
;
...
...
tools/build_libstagefright
View file @
7b915a40
...
...
@@ -28,6 +28,7 @@ TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86`
export
PATH
=
$TOOLCHAIN
/bin:
$PATH
ANDROID_SOURCE
=
../android-source
ANDROID_LIBS
=
../android-libs
ABI
=
"armeabi-v7a"
rm
-rf
../build/stagefright
mkdir
-p
../build/stagefright
...
...
@@ -40,12 +41,11 @@ FLAGS="$FLAGS --disable-avdevice --disable-decoder=h264 --disable-decoder=h264_v
EXTRA_CFLAGS
=
"-I
$ANDROID_SOURCE
/frameworks/base/include -I
$ANDROID_SOURCE
/system/core/include"
EXTRA_CFLAGS
=
"
$EXTRA_CFLAGS
-I
$ANDROID_SOURCE
/frameworks/base/media/libstagefright"
EXTRA_CFLAGS
=
"
$EXTRA_CFLAGS
-I
$ANDROID_SOURCE
/frameworks/base/include/media/stagefright/openmax"
EXTRA_CFLAGS
=
"
$EXTRA_CFLAGS
-I
$NDK
/sources/cxx-stl/
system
/include"
EXTRA_CFLAGS
=
"
$EXTRA_CFLAGS
-I
$NDK
/sources/cxx-stl/
gnu-libstdc++/include -I
$NDK
/sources/cxx-stl/gnu-libstdc++/libs/
$ABI
/include"
EXTRA_CFLAGS
=
"
$EXTRA_CFLAGS
-march=armv7-a -mfloat-abi=softfp -mfpu=neon"
EXTRA_LDFLAGS
=
"-Wl,--fix-cortex-a8 -L
$ANDROID_LIBS
-Wl,-rpath-link,
$ANDROID_LIBS
"
EXTRA_LDFLAGS
=
"-Wl,--fix-cortex-a8 -L
$ANDROID_LIBS
-Wl,-rpath-link,
$ANDROID_LIBS
-L
$NDK
/sources/cxx-stl/gnu-libstdc++/libs/
$ABI
"
EXTRA_CXXFLAGS
=
"-Wno-multichar -fno-exceptions -fno-rtti"
ABI
=
"armeabi-v7a"
DEST
=
"
$DEST
/
$ABI
"
FLAGS
=
"
$FLAGS
--prefix=
$DEST
"
...
...
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