Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.WithCustomProto
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.WithCustomProto
Commits
22f6a543
Commit
22f6a543
authored
Apr 16, 2022
by
NzSN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass all unittests
parent
df4f75b9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
ioctx.h
src/ioctx.h
+1
-0
proto.h
src/proto/proto.h
+0
-1
ioctxTestCases.cc
tests/ioctxTestCases.cc
+11
-10
No files found.
src/ioctx.h
View file @
22f6a543
...
...
@@ -101,6 +101,7 @@ public:
// FIXME: AVIOContext should be generated from proto
AVIOContext
*
ioctx
=
proto
->
to_avioctx
();
ioctx
->
direct
=
false
;
fmt
=
Utils
::
makeOutAVFormat
(
path
,
ioctx
,
ofmt
);
}
...
...
src/proto/proto.h
View file @
22f6a543
...
...
@@ -71,7 +71,6 @@ public:
[](
void
*
priv
,
int64_t
offset
,
int
whence
)
->
int64_t
{
return
static_cast
<
T
*>
(
priv
)
->
seek_packet
(
priv
,
offset
,
whence
);
});
io
->
direct
=
true
;
}
return
io
;
...
...
tests/ioctxTestCases.cc
View file @
22f6a543
...
...
@@ -63,7 +63,6 @@ protected:
IOCtx
::
OutCtx
oCtx
{
outFilePath
};
};
#if 0
TEST_F
(
IOCTX_With_Default_Proto_Fixture
,
Description
)
{
AVPacket
packet
;
...
...
@@ -88,19 +87,22 @@ TEST_F(IOCTX_With_Default_Proto_Fixture, Description) {
ASSERT_TRUE
(
Utils
::
isVideoValid
(
outFilePath
));
}
#endif
TEST_F
(
IOCTX_With_TransientMem_Proto_Fixture
,
Description
)
{
AVPacket
*
packet
=
av_packet_alloc
();
for
(
int
i
=
0
;
i
<
300
;
++
i
)
{
try
{
while
(
true
)
{
iCtx
.
readFrame
(
packet
);
outCtxCustom
->
writeFrame
(
packet
);
av_packet_unref
(
packet
);
}
outCtxCustom
->
closeCustomIO
();
}
catch
(
IOCtx
::
END_OF_FILE
e
)
{
outCtxCustom
->
writeTrailer
();
outCtxCustom
->
closeCustomIO
();
}
std
::
cerr
<<
"Data Size "
<<
IOProto
::
TransientMemProto
::
dataSize
<<
std
::
endl
;
TrMemProto
::
TransientMemProto
*
inProto
=
new
TrMemProto
::
TransientMemProto
(
nullptr
,
IOProto
::
read
);
...
...
@@ -114,7 +116,7 @@ TEST_F(IOCTX_With_TransientMem_Proto_Fixture, Description) {
throw
std
::
runtime_error
(
"Failed to init fixture"
);
oCtx
.
writeHeader
();
int
i
=
0
;
int
i
nit
=
false
;
int
timescale
=
90000
;
int
fps
=
30
;
...
...
@@ -128,12 +130,14 @@ TEST_F(IOCTX_With_TransientMem_Proto_Fixture, Description) {
// Make sure all buffered datas is used
inCtxCustom
->
readFrame
(
packet
);
if
(
i
==
0
)
{
if
(
i
nit
==
0
)
{
packet
->
pts
=
0
;
packet
->
dts
=
-
duration
;
packet
->
duration
=
duration
;
lastPTS
=
packet
->
pts
;
lastDTS
=
packet
->
dts
;
init
=
true
;
}
else
{
packet
->
pts
=
lastPTS
+
duration
;
packet
->
dts
=
lastDTS
+
duration
;
...
...
@@ -146,12 +150,9 @@ TEST_F(IOCTX_With_TransientMem_Proto_Fixture, Description) {
oCtx
.
writeFrame
(
packet
);
av_packet_unref
(
packet
);
++
i
;
}
}
catch
(
IOCtx
::
END_OF_FILE
e
)
{}
printf
(
"%d
\n
"
,
i
);
oCtx
.
writeTrailer
();
inCtxCustom
->
closeCustomIO
();
...
...
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