Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
ParaEncode
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
ParaEncode
Commits
bb0f1fe9
Commit
bb0f1fe9
authored
Apr 30, 2022
by
NzSN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a5adc0f9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
7 deletions
+19
-7
build-with-docker-no-external.sh
build-with-docker-no-external.sh
+3
-0
encWW.js
resources/workers/encWW.js
+1
-1
muxWW.js
resources/workers/muxWW.js
+1
-1
interfaces.cc
src/wasms/interfaces.cc
+8
-3
wasm-build.sh
wasm-build.sh
+6
-2
No files found.
build-with-docker-no-external.sh
0 → 100755
View file @
bb0f1fe9
#!/bin/bash
bash build-with-docker.sh
"EXTERNAL"
resources/workers/encWW.js
View file @
bb0f1fe9
...
@@ -21,7 +21,7 @@ let encBuf = null;
...
@@ -21,7 +21,7 @@ let encBuf = null;
self
.
importScripts
(
'defs.js'
);
self
.
importScripts
(
'defs.js'
);
// Load wasm encoder
// Load wasm encoder
self
.
importScripts
(
'
mp4
encoder.js'
);
self
.
importScripts
(
'
para
encoder.js'
);
createParaEncoder
().
then
(
m
=>
{
createParaEncoder
().
then
(
m
=>
{
encoder
=
m
;
encoder
=
m
;
});
});
...
...
resources/workers/muxWW.js
View file @
bb0f1fe9
...
@@ -18,7 +18,7 @@ let muxBuffer = null;
...
@@ -18,7 +18,7 @@ let muxBuffer = null;
self
.
importScripts
(
'defs.js'
);
self
.
importScripts
(
'defs.js'
);
// Load wasm encoder
// Load wasm encoder
self
.
importScripts
(
'./
mp4
encoder.js'
);
self
.
importScripts
(
'./
para
encoder.js'
);
createParaEncoder
().
then
(
m
=>
{
createParaEncoder
().
then
(
m
=>
{
muxer
=
m
;
muxer
=
m
;
});
});
...
...
src/wasms/interfaces.cc
View file @
bb0f1fe9
...
@@ -40,6 +40,8 @@ EM_PORT_API(int) getPackets(uint8_t *buffer, uint32_t size, uint32_t *osize);
...
@@ -40,6 +40,8 @@ EM_PORT_API(int) getPackets(uint8_t *buffer, uint32_t size, uint32_t *osize);
EM_PORT_API
(
uint8_t
)
encodeInit
(
int
width
,
int
height
,
int
fps
)
{
EM_PORT_API
(
uint8_t
)
encodeInit
(
int
width
,
int
height
,
int
fps
)
{
int
ret
=
0
;
width_
=
width
;
width_
=
width
;
height_
=
height
;
height_
=
height
;
framerate_
=
fps
;
framerate_
=
fps
;
...
@@ -62,8 +64,9 @@ EM_PORT_API(uint8_t) encodeInit(int width, int height, int fps) {
...
@@ -62,8 +64,9 @@ EM_PORT_API(uint8_t) encodeInit(int width, int height, int fps) {
cc
->
time_base
=
(
AVRational
){
1
,
timescale
};
cc
->
time_base
=
(
AVRational
){
1
,
timescale
};
cc
->
gop_size
=
0
;
cc
->
gop_size
=
0
;
if
(
avcodec_open2
(
cc
,
encoder
,
NULL
)
<
0
)
{
if
((
ret
=
avcodec_open2
(
cc
,
encoder
,
NULL
)
<
0
))
{
fprintf
(
stderr
,
"Unable to open codec context
\n
"
);
fprintf
(
stderr
,
"Unable to open codec context: %s
\n
"
,
av_err2str
(
ret
));
return
3
;
return
3
;
}
}
...
@@ -76,7 +79,8 @@ EM_PORT_API(uint8_t) encodeInit(int width, int height, int fps) {
...
@@ -76,7 +79,8 @@ EM_PORT_API(uint8_t) encodeInit(int width, int height, int fps) {
frame
->
format
=
cc
->
pix_fmt
;
frame
->
format
=
cc
->
pix_fmt
;
frame
->
width
=
cc
->
width
;
frame
->
width
=
cc
->
width
;
frame
->
height
=
cc
->
height
;
frame
->
height
=
cc
->
height
;
int
ret
=
av_frame_get_buffer
(
frame
,
0
);
ret
=
av_frame_get_buffer
(
frame
,
0
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"Could not allocate the video frame data
\n
"
);
fprintf
(
stderr
,
"Could not allocate the video frame data
\n
"
);
return
4
;
return
4
;
...
@@ -210,6 +214,7 @@ EM_PORT_API(int) getPackets(uint8_t *buffer, uint32_t size, uint32_t *osize) {
...
@@ -210,6 +214,7 @@ EM_PORT_API(int) getPackets(uint8_t *buffer, uint32_t size, uint32_t *osize) {
}
}
DONE
:
DONE
:
*
osize
=
size
-
remainSize
;
*
osize
=
size
-
remainSize
;
return
ret
;
return
ret
;
...
...
wasm-build.sh
View file @
bb0f1fe9
...
@@ -25,6 +25,8 @@ DEBUG="-O3"
...
@@ -25,6 +25,8 @@ DEBUG="-O3"
BUILD_DIR
=
${
WORKPATH
}
/Build
BUILD_DIR
=
${
WORKPATH
}
/Build
if
[
"
$3
"
]
;
then
if
[
!
-d
"
${
BUILD_DIR
}
"
]
;
then
if
[
!
-d
"
${
BUILD_DIR
}
"
]
;
then
mkdir
${
BUILD_DIR
}
mkdir
${
BUILD_DIR
}
fi
fi
...
@@ -55,6 +57,7 @@ emmake make install
...
@@ -55,6 +57,7 @@ emmake make install
chown
-R
"
$1
:
$2
"
${
BUILD_DIR
}
chown
-R
"
$1
:
$2
"
${
BUILD_DIR
}
chown
-R
"
$1
:
$2
"
${
LIB_DIR
}
/ffmpeg.protos/build
chown
-R
"
$1
:
$2
"
${
LIB_DIR
}
/ffmpeg.protos/build
fi
###############################################################################
###############################################################################
# FFMPEG Core #
# FFMPEG Core #
...
@@ -78,8 +81,9 @@ fi
...
@@ -78,8 +81,9 @@ fi
FLAGS
=(
FLAGS
=(
-I
$BUILD_DIR
/include
-L
$BUILD_DIR
/lib
-I
$LIB_DIR
/ffmpeg.wasm-core
-Wno-deprecated-declarations
-I
$BUILD_DIR
/include
-L
$BUILD_DIR
/lib
-I
$LIB_DIR
/ffmpeg.wasm-core
-Wno-deprecated-declarations
-Wno-pointer-sign
-Wno-implicit-int-float-conversion
-Wno-switch
-Wno-parentheses
-Qunused-arguments
-lavdevice
-lavfilter
-lavformat
-lavcodec
-Wno-pointer-sign
-Wno-implicit-int-float-conversion
-Wno-switch
-Wno-parentheses
-Qunused-arguments
-lswresample
-lswscale
-lavutil
-lpostproc
-lm
-lx264
-lz
-lshmproto
-lavdevice
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
-lpostproc
-lm
-lharfbuzz
-lfribidi
-lass
-lx264
-lx265
-lvpx
-lwavpack
-lmp3lame
-lfdk-aac
-lvorbis
-lvorbisenc
-lvorbisfile
-logg
-ltheora
-ltheoraenc
-ltheoradec
-lz
-lfreetype
-lopus
-lwebp
-lshmproto
$WASM_DIR
/interfaces.cc
$WASM_DIR
/interfaces.cc
...
...
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