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
a9090433
Commit
a9090433
authored
Sep 30, 2022
by
Linshizhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ENCODER.init
parent
ce8c2cd9
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
2 deletions
+31
-2
BUILD.gn
BUILD.gn
+1
-1
builtins-definitions.h
src/builtins/builtins-definitions.h
+1
-0
builtins-encoder.cc
src/builtins/builtins-encoder.cc
+27
-1
bootstrapper.cc
src/init/bootstrapper.cc
+2
-0
libavformat.so.59
third_party/ffmpeg/lib/libavformat.so.59
+0
-0
libavformat.so.59
third_party/ffmpeg/lib/libavformat.so.59
+0
-0
No files found.
BUILD.gn
View file @
a9090433
...
...
@@ -631,7 +631,7 @@ config("internal_config_base") {
config
(
"internal_config"
)
{
defines
=
[]
lib_dirs
=
[
"third_party/ffmpeg/lib"
]
libs
=
[
"avformat"
]
libs
=
[
"avformat"
,
"avutil"
]
#
Only
targets
in
this
file
and
its
subdirs
can
depend
on
this
.
visibility
=
[
"./*"
]
...
...
src/builtins/builtins-definitions.h
View file @
a9090433
...
...
@@ -621,6 +621,7 @@ namespace internal {
CPP(JsonStringify) \
\
/* ENCODER */
\
CPP(InitEncodeContext) \
CPP(Encode) \
\
/* Web snapshots */
\
...
...
src/builtins/builtins-encoder.cc
View file @
a9090433
...
...
@@ -5,18 +5,44 @@
extern
"C"
{
#include "libavformat/avformat.h"
#include "libavutil/avutil.h"
}
namespace
v8
{
namespace
internal
{
bool
inited
=
false
;
AVFormatContext
*
format
=
NULL
;
AVCodecContext
*
cc
;
BUILTIN
(
InitEncodeContext
)
{
HandleScope
scope
(
isolate
);
Handle
<
Object
>
path
=
args
.
atOrUndefined
(
isolate
,
1
);
Handle
<
String
>
string
;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION
(
isolate
,
string
,
Object
::
ToString
(
isolate
,
path
));
if
(
inited
)
return
*
isolate
->
factory
()
->
ToBoolean
(
false
);
int
ret
=
avformat_alloc_output_context2
(
&
format
,
NULL
,
NULL
,
"/home/linshizhi/aa.mp4"
);
if
(
ret
<
0
)
{
printf
(
"Failed to alloc output context: %s
\n
"
,
av_err2str
(
ret
));
return
*
isolate
->
factory
()
->
ToBoolean
(
false
);
}
inited
=
true
;
return
*
isolate
->
factory
()
->
ToBoolean
(
true
);
}
BUILTIN
(
Encode
)
{
HandleScope
scope
(
isolate
);
printf
(
"Encoding...
\n
"
);
AVFormatContext
*
format
=
avformat_alloc_context
();
return
*
isolate
->
factory
()
->
ToBoolean
(
format
!=
NULL
?
true
:
false
);
...
...
src/init/bootstrapper.cc
View file @
a9090433
...
...
@@ -2790,6 +2790,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle
<
JSObject
>
encoder
=
factory
->
NewJSObject
(
isolate_
->
object_function
(),
AllocationType
::
kOld
);
JSObject
::
AddProperty
(
isolate_
,
global
,
"ENCODER"
,
encoder
,
DONT_ENUM
);
SimpleInstallFunction
(
isolate_
,
encoder
,
"init"
,
Builtin
::
kInitEncodeContext
,
1
,
true
);
SimpleInstallFunction
(
isolate_
,
encoder
,
"encode"
,
Builtin
::
kEncode
,
0
,
true
);
InstallToStringTag
(
isolate_
,
encoder
,
"ENCODER"
);
...
...
third_party/ffmpeg/lib/libavformat.so.59
deleted
100755 → 0
View file @
ce8c2cd9
File deleted
third_party/ffmpeg/lib/libavformat.so.59
0 → 120000
View file @
a9090433
libavformat.so.59.5.100
\ No newline at end of file
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