Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
V
V8
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
V8
Commits
4aa5018c
Commit
4aa5018c
authored
Jan 11, 2023
by
Linshizhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stage
parent
1ab8cca1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
0 deletions
+89
-0
builtins-definitions.h
src/builtins/builtins-definitions.h
+1
-0
builtins-encoder.cc
src/builtins/builtins-encoder.cc
+88
-0
No files found.
src/builtins/builtins-definitions.h
View file @
4aa5018c
...
@@ -629,6 +629,7 @@ namespace internal {
...
@@ -629,6 +629,7 @@ namespace internal {
CPP(AddAudioBuffer) \
CPP(AddAudioBuffer) \
CPP(MergeMP4) \
CPP(MergeMP4) \
CPP(ApplyAudioEffects) \
CPP(ApplyAudioEffects) \
CPP(AddAudioURL) \
\
\
/* Web snapshots */
\
/* Web snapshots */
\
CPP(WebSnapshotSerialize) \
CPP(WebSnapshotSerialize) \
...
...
src/builtins/builtins-encoder.cc
View file @
4aa5018c
...
@@ -18,6 +18,7 @@ char *audioPath;
...
@@ -18,6 +18,7 @@ char *audioPath;
void
*
loadedSyms
;
void
*
loadedSyms
;
void
*
encoder
;
void
*
encoder
;
void
*
audioEffecter
;
void
*
audioEffecter
;
void
*
resourcer
;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Dynamic load procedures //
// Dynamic load procedures //
...
@@ -48,6 +49,10 @@ void (*removeInputsAE)(void *effecter);
...
@@ -48,6 +49,10 @@ void (*removeInputsAE)(void *effecter);
void
*
(
*
spawnMerger
)(
const
char
*
output
,
const
char
*
videoPath
,
const
char
*
audioPath
);
void
*
(
*
spawnMerger
)(
const
char
*
output
,
const
char
*
videoPath
,
const
char
*
audioPath
);
void
(
*
merging
)(
void
*
merger_
);
void
(
*
merging
)(
void
*
merger_
);
// Resourcer
void
*
(
*
getResourcer
)();
int
(
*
fetchRe
)(
void
*
resourcer
,
const
char
*
url
,
const
char
*
fsPath
);
}
}
BUILTIN
(
InitEncodeContext
)
{
BUILTIN
(
InitEncodeContext
)
{
...
@@ -138,6 +143,20 @@ BUILTIN(InitEncodeContext) {
...
@@ -138,6 +143,20 @@ BUILTIN(InitEncodeContext) {
THROW_NEW_ERROR_RETURN_FAILURE
(
THROW_NEW_ERROR_RETURN_FAILURE
(
isolate
,
NewEvalError
(
MessageTemplate
::
kInvalidArgument
));
isolate
,
NewEvalError
(
MessageTemplate
::
kInvalidArgument
));
}
}
getResourcer
=
reinterpret_cast
<
decltype
(
getResourcer
)
>
(
dlsym
(
loadedSyms
,
"getResourcer"
));
if
(
getResourcer
==
NULL
)
{
THROW_NEW_ERROR_RETURN_FAILURE
(
isolate
,
NewEvalError
(
MessageTemplate
::
kInvalidArgument
));
}
fetchRe
=
reinterpret_cast
<
decltype
(
fetchRe
)
>
(
dlsym
(
loadedSyms
,
"fetchRe"
));
if
(
fetchRe
==
NULL
)
{
THROW_NEW_ERROR_RETURN_FAILURE
(
isolate
,
NewEvalError
(
MessageTemplate
::
kInvalidArgument
));
}
}
}
// Width
// Width
...
@@ -342,6 +361,75 @@ BUILTIN(Save) {
...
@@ -342,6 +361,75 @@ BUILTIN(Save) {
return
*
isolate
->
factory
()
->
ToBoolean
(
true
);
return
*
isolate
->
factory
()
->
ToBoolean
(
true
);
}
}
BUILTIN
(
AddAudioURL
)
{
HandleScope
scope
(
isolate
);
Handle
<
Object
>
url
=
args
.
atOrUndefined
(
isolate
,
1
);
Handle
<
String
>
url_str
;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION
(
isolate
,
url_str
,
Object
::
ToString
(
isolate
,
url
));
std
::
string
url_cppstr
=
url_str
->
ToCString
().
get
();
std
::
string
outpath
=
std
::
tmpnam
(
nullptr
);
outpath
+=
".aac"
;
// Add audio file into AudioEffecter
Handle
<
Object
>
volume
=
args
.
atOrUndefined
(
isolate
,
2
);
Handle
<
Object
>
strong_end_time
=
args
.
atOrUndefined
(
isolate
,
3
);
Handle
<
Object
>
start_time
=
args
.
atOrUndefined
(
isolate
,
4
);
Handle
<
Object
>
end_time
=
args
.
atOrUndefined
(
isolate
,
5
);
Handle
<
Object
>
delay
=
args
.
atOrUndefined
(
isolate
,
6
);
Handle
<
Object
>
duration
=
args
.
atOrUndefined
(
isolate
,
7
);
Handle
<
Object
>
fade_out_duration
=
args
.
atOrUndefined
(
isolate
,
8
);
Handle
<
Object
>
isLoop
=
args
.
atOrUndefined
(
isolate
,
9
);
if
(
!
volume
->
IsNumber
()
||
!
strong_end_time
->
IsNumber
()
||
!
start_time
->
IsNumber
()
||
!
end_time
->
IsNumber
()
||
!
delay
->
IsNumber
()
||
!
duration
->
IsNumber
()
||
!
fade_out_duration
->
IsNumber
()
||
!
isLoop
->
IsNumber
())
{
THROW_NEW_ERROR_RETURN_FAILURE
(
isolate
,
NewTypeError
(
MessageTemplate
::
kInvalidArgument
));
}
double
volume_
,
strong_end_time_
,
start_time_
,
end_time_
,
delay_
,
duration_
,
fade_out_duration_
,
isLoop_
;
volume_
=
volume
->
Number
();
strong_end_time_
=
strong_end_time
->
Number
();
start_time_
=
start_time
->
Number
();
end_time_
=
end_time
->
Number
();
delay_
=
delay
->
Number
();
duration_
=
duration
->
Number
();
fade_out_duration_
=
fade_out_duration
->
Number
();
isLoop_
=
isLoop
->
Number
();
if
(
audioEffecter
==
NULL
)
{
audioEffecter
=
getAudioEffecter
();
if
(
audioEffecter
==
NULL
)
{
THROW_NEW_ERROR_RETURN_FAILURE
(
isolate
,
NewEvalError
(
MessageTemplate
::
kInvalidArgument
));
}
}
bool
isLoop_bool
=
isLoop_
==
1
;
addInputFileAE
(
audioEffecter
,
outpath
.
c_str
(),
volume_
,
strong_end_time_
,
start_time_
,
end_time_
,
delay_
,
duration_
,
fade_out_duration_
,
isLoop_bool
);
if
(
resourcer
==
NULL
)
{
resourcer
=
getResourcer
();
}
int
errorCode
=
fetchRe
(
resourcer
,
url_cppstr
.
c_str
(),
outpath
.
c_str
());
return
*
isolate
->
factory
()
->
NewNumberFromInt
(
errorCode
);
}
BUILTIN
(
AddAudioBuffer
)
{
BUILTIN
(
AddAudioBuffer
)
{
HandleScope
scope
(
isolate
);
HandleScope
scope
(
isolate
);
...
...
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