mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
set audio/video flag to 0 in flv header.
This commit is contained in:
parent
73459547e1
commit
271b969d0b
2 changed files with 3 additions and 20 deletions
|
@ -143,8 +143,6 @@ off_t SrsFileStream::lseek(off_t offset)
|
||||||
SrsFlvEncoder::SrsFlvEncoder()
|
SrsFlvEncoder::SrsFlvEncoder()
|
||||||
{
|
{
|
||||||
_fs = NULL;
|
_fs = NULL;
|
||||||
has_audio = false;
|
|
||||||
has_video = false;
|
|
||||||
tag_stream = new SrsStream();
|
tag_stream = new SrsStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +156,6 @@ int SrsFlvEncoder::initialize(SrsFileStream* fs)
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
_fs = fs;
|
_fs = fs;
|
||||||
has_audio = true;
|
|
||||||
has_video = true;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -179,16 +175,9 @@ int SrsFlvEncoder::write_header()
|
||||||
(char)0x00, (char)0x00, (char)0x00, (char)0x00// PreviousTagSize0 UI32 Always 0
|
(char)0x00, (char)0x00, (char)0x00, (char)0x00// PreviousTagSize0 UI32 Always 0
|
||||||
};
|
};
|
||||||
|
|
||||||
// generate audio/video flag.
|
// flv specification should set the audio and video flag,
|
||||||
const static int av_index = 4;
|
// actually in practise, application generally ignore this flag,
|
||||||
|
// so we generally set the audio/video to 0.
|
||||||
flv_header[av_index] = 0x00;
|
|
||||||
if (has_audio) {
|
|
||||||
flv_header[av_index] += 4;
|
|
||||||
}
|
|
||||||
if (has_video) {
|
|
||||||
flv_header[av_index] += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// write data.
|
// write data.
|
||||||
if ((ret = _fs->write(flv_header, sizeof(flv_header), NULL)) != ERROR_SUCCESS) {
|
if ((ret = _fs->write(flv_header, sizeof(flv_header), NULL)) != ERROR_SUCCESS) {
|
||||||
|
@ -229,8 +218,6 @@ int SrsFlvEncoder::write_audio(int32_t timestamp, char* data, int size)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
has_audio = true;
|
|
||||||
|
|
||||||
static char tag_header[] = {
|
static char tag_header[] = {
|
||||||
(char)8, // TagType UB [5], 8 = audio
|
(char)8, // TagType UB [5], 8 = audio
|
||||||
(char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
|
(char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
|
||||||
|
@ -260,8 +247,6 @@ int SrsFlvEncoder::write_video(int32_t timestamp, char* data, int size)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
has_video = true;
|
|
||||||
|
|
||||||
static char tag_header[] = {
|
static char tag_header[] = {
|
||||||
(char)9, // TagType UB [5], 9 = video
|
(char)9, // TagType UB [5], 9 = video
|
||||||
(char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
|
(char)0x00, (char)0x00, (char)0x00, // DataSize UI24 Length of the message.
|
||||||
|
|
|
@ -79,8 +79,6 @@ class SrsFlvEncoder
|
||||||
private:
|
private:
|
||||||
SrsFileStream* _fs;
|
SrsFileStream* _fs;
|
||||||
private:
|
private:
|
||||||
bool has_audio;
|
|
||||||
bool has_video;
|
|
||||||
SrsStream* tag_stream;
|
SrsStream* tag_stream;
|
||||||
public:
|
public:
|
||||||
SrsFlvEncoder();
|
SrsFlvEncoder();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue