Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-04-17 16:16:17 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9861fc4fe3368967063de5cb29600dba21acf66d
9861fc4f
1 parent
56ff70cd
refine dvr, add comments
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
17 行增加
和
7 行删除
trunk/src/app/srs_app_dvr.cpp
trunk/src/app/srs_app_dvr.hpp
trunk/src/app/srs_app_dvr.cpp
查看文件 @
9861fc4
...
...
@@ -258,7 +258,7 @@ int SrsFlvEncoder::write_video(int32_t timestamp, char* data, int size)
return
ret
;
}
int
SrsFlvEncoder
::
write_tag
(
char
*
header
,
int
header_size
,
char
*
data
,
int
size
)
int
SrsFlvEncoder
::
write_tag
(
char
*
header
,
int
header_size
,
char
*
tag
,
int
tag_
size
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -269,7 +269,7 @@ int SrsFlvEncoder::write_tag(char* header, int header_size, char* data, int size
}
// write tag data.
if
((
ret
=
_fs
->
write
(
data
,
size
,
NULL
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
_fs
->
write
(
tag
,
tag_
size
,
NULL
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"write flv tag failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -279,7 +279,7 @@ int SrsFlvEncoder::write_tag(char* header, int header_size, char* data, int size
if
((
ret
=
tag_stream
->
initialize
(
pre_size
,
4
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
tag_stream
->
write_4bytes
(
size
+
header_size
);
tag_stream
->
write_4bytes
(
tag_
size
+
header_size
);
if
((
ret
=
_fs
->
write
(
pre_size
,
sizeof
(
pre_size
),
NULL
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"write flv previous tag size failed. ret=%d"
,
ret
);
return
ret
;
...
...
trunk/src/app/srs_app_dvr.hpp
查看文件 @
9861fc4
...
...
@@ -75,24 +75,34 @@ public:
SrsFlvEncoder
();
virtual
~
SrsFlvEncoder
();
public
:
/**
* initialize the underlayer file stream,
* user can initialize multiple times to encode multiple flv files.
*/
virtual
int
initialize
(
SrsFileStream
*
fs
);
public
:
/**
* write flv header.
* user can invoke this method multiple times,
* for example, when get audio/video sequence header.
*
* write following:
* 1. E.2 The FLV header
* 2. PreviousTagSize0 UI32 Always 0
* that is, 9+4=13bytes.
*/
virtual
int
write_header
();
/**
* write flv metadata.
* serialize from:
* AMF0 string: onMetaData,
* AMF0 object: the metadata object.
*/
virtual
int
write_metadata
(
char
*
data
,
int
size
);
/**
* write audio/video packet.
*/
virtual
int
write_audio
(
int32_t
timestamp
,
char
*
data
,
int
size
);
virtual
int
write_video
(
int32_t
timestamp
,
char
*
data
,
int
size
);
private
:
virtual
int
write_tag
(
char
*
header
,
int
header_size
,
char
*
data
,
int
size
);
virtual
int
write_tag
(
char
*
header
,
int
header_size
,
char
*
tag
,
int
tag_
size
);
};
/**
...
...
请
注册
或
登录
后发表评论