FFmpeg
flv.h
Go to the documentation of this file.
1 /*
2  * FLV common header
3  *
4  * Copyright (c) 2006 The FFmpeg Project
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * FLV common header
26  */
27 
28 #ifndef AVFORMAT_FLV_H
29 #define AVFORMAT_FLV_H
30 
31 /* offsets for packed values */
32 #define FLV_AUDIO_SAMPLESSIZE_OFFSET 1
33 #define FLV_AUDIO_SAMPLERATE_OFFSET 2
34 #define FLV_AUDIO_CODECID_OFFSET 4
35 
36 #define FLV_VIDEO_FRAMETYPE_OFFSET 4
37 
38 /* Extended VideoTagHeader
39  * defined in reference link:
40  * https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
41  * */
42 #define FLV_IS_EX_HEADER 0x80
43 
44 /* bitmasks to isolate specific values */
45 #define FLV_AUDIO_CHANNEL_MASK 0x01
46 #define FLV_AUDIO_SAMPLESIZE_MASK 0x02
47 #define FLV_AUDIO_SAMPLERATE_MASK 0x0c
48 #define FLV_AUDIO_CODECID_MASK 0xf0
49 
50 #define FLV_VIDEO_CODECID_MASK 0x0f
51 #define FLV_VIDEO_FRAMETYPE_MASK 0x70
52 
53 #define AMF_END_OF_OBJECT 0x09
54 
55 #define KEYFRAMES_TAG "keyframes"
56 #define KEYFRAMES_TIMESTAMP_TAG "times"
57 #define KEYFRAMES_BYTEOFFSET_TAG "filepositions"
58 
59 
60 enum {
63 };
64 
65 enum FlvTagType {
69 };
70 
71 enum {
77 };
78 
79 enum {
80  FLV_MONO = 0,
82 };
83 
84 enum {
87 };
88 
89 enum {
90  FLV_SAMPLERATE_SPECIAL = 0, /**< signifies 5512Hz and 8000Hz in the case of NELLYMOSER */
94 };
95 
96 enum {
108 };
109 
110 enum {
119 };
120 
121 enum {
128 };
129 
130 enum {
131  FLV_FRAME_KEY = 1 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< key frame (for AVC, a seekable frame)
132  FLV_FRAME_INTER = 2 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< inter frame (for AVC, a non-seekable frame)
133  FLV_FRAME_DISP_INTER = 3 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< disposable inter frame (H.263 only)
134  FLV_FRAME_GENERATED_KEY = 4 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< generated key frame (reserved for server use only)
135  FLV_FRAME_VIDEO_INFO_CMD = 5 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< video info/command frame
136 };
137 
138 typedef enum {
152 } AMFDataType;
153 
154 #endif /* AVFORMAT_FLV_H */
FLV_CODECID_PCM_MULAW
@ FLV_CODECID_PCM_MULAW
Definition: flv.h:105
FLV_SAMPLERATE_11025HZ
@ FLV_SAMPLERATE_11025HZ
Definition: flv.h:91
FLV_CODECID_SPEEX
@ FLV_CODECID_SPEEX
Definition: flv.h:107
AMF_DATA_TYPE_OBJECT_END
@ AMF_DATA_TYPE_OBJECT_END
Definition: flv.h:147
FLV_TAG_TYPE_VIDEO
@ FLV_TAG_TYPE_VIDEO
Definition: flv.h:67
AMF_DATA_TYPE_REFERENCE
@ AMF_DATA_TYPE_REFERENCE
Definition: flv.h:145
FLV_FRAME_VIDEO_INFO_CMD
@ FLV_FRAME_VIDEO_INFO_CMD
video info/command frame
Definition: flv.h:135
FLV_CODECID_VP6A
@ FLV_CODECID_VP6A
Definition: flv.h:114
FLV_FRAME_INTER
@ FLV_FRAME_INTER
inter frame (for AVC, a non-seekable frame)
Definition: flv.h:132
FLV_SAMPLESSIZE_16BIT
@ FLV_SAMPLESSIZE_16BIT
Definition: flv.h:86
FLV_FRAME_GENERATED_KEY
@ FLV_FRAME_GENERATED_KEY
generated key frame (reserved for server use only)
Definition: flv.h:134
FLV_SAMPLERATE_22050HZ
@ FLV_SAMPLERATE_22050HZ
Definition: flv.h:92
AMF_DATA_TYPE_UNDEFINED
@ AMF_DATA_TYPE_UNDEFINED
Definition: flv.h:144
AMF_DATA_TYPE_DATE
@ AMF_DATA_TYPE_DATE
Definition: flv.h:149
FLV_STREAM_TYPE_DATA
@ FLV_STREAM_TYPE_DATA
Definition: flv.h:75
FLV_SAMPLERATE_44100HZ
@ FLV_SAMPLERATE_44100HZ
Definition: flv.h:93
AMF_DATA_TYPE_OBJECT
@ AMF_DATA_TYPE_OBJECT
Definition: flv.h:142
FLV_SAMPLERATE_SPECIAL
@ FLV_SAMPLERATE_SPECIAL
signifies 5512Hz and 8000Hz in the case of NELLYMOSER
Definition: flv.h:90
FLV_CODECID_PCM_LE
@ FLV_CODECID_PCM_LE
Definition: flv.h:100
FLV_CODECID_H263
@ FLV_CODECID_H263
Definition: flv.h:111
FLV_CODECID_NELLYMOSER
@ FLV_CODECID_NELLYMOSER
Definition: flv.h:103
FLV_STREAM_TYPE_AUDIO
@ FLV_STREAM_TYPE_AUDIO
Definition: flv.h:73
FLV_CODECID_NELLYMOSER_16KHZ_MONO
@ FLV_CODECID_NELLYMOSER_16KHZ_MONO
Definition: flv.h:101
FLV_FRAME_KEY
@ FLV_FRAME_KEY
key frame (for AVC, a seekable frame)
Definition: flv.h:131
FLV_CODECID_NELLYMOSER_8KHZ_MONO
@ FLV_CODECID_NELLYMOSER_8KHZ_MONO
Definition: flv.h:102
PacketTypeCodedFramesX
@ PacketTypeCodedFramesX
Definition: flv.h:125
FLV_AUDIO_CODECID_OFFSET
#define FLV_AUDIO_CODECID_OFFSET
Definition: flv.h:34
FLV_CODECID_PCM_ALAW
@ FLV_CODECID_PCM_ALAW
Definition: flv.h:104
FLV_AUDIO_SAMPLESSIZE_OFFSET
#define FLV_AUDIO_SAMPLESSIZE_OFFSET
Definition: flv.h:32
AMFDataType
AMFDataType
Definition: flv.h:138
FLV_CODECID_SCREEN
@ FLV_CODECID_SCREEN
Definition: flv.h:112
AMF_DATA_TYPE_UNSUPPORTED
@ AMF_DATA_TYPE_UNSUPPORTED
Definition: flv.h:151
FLV_CODECID_ADPCM
@ FLV_CODECID_ADPCM
Definition: flv.h:98
FLV_HEADER_FLAG_HASVIDEO
@ FLV_HEADER_FLAG_HASVIDEO
Definition: flv.h:61
AMF_DATA_TYPE_BOOL
@ AMF_DATA_TYPE_BOOL
Definition: flv.h:140
PacketTypeSequenceStart
@ PacketTypeSequenceStart
Definition: flv.h:122
AMF_DATA_TYPE_ARRAY
@ AMF_DATA_TYPE_ARRAY
Definition: flv.h:148
FLV_STREAM_TYPE_VIDEO
@ FLV_STREAM_TYPE_VIDEO
Definition: flv.h:72
FLV_CODECID_H264
@ FLV_CODECID_H264
Definition: flv.h:116
PacketTypeMPEG2TSSequenceStart
@ PacketTypeMPEG2TSSequenceStart
Definition: flv.h:127
FLV_TAG_TYPE_AUDIO
@ FLV_TAG_TYPE_AUDIO
Definition: flv.h:66
FLV_STREAM_TYPE_NB
@ FLV_STREAM_TYPE_NB
Definition: flv.h:76
PacketTypeCodedFrames
@ PacketTypeCodedFrames
Definition: flv.h:123
FLV_CODECID_AAC
@ FLV_CODECID_AAC
Definition: flv.h:106
FLV_MONO
@ FLV_MONO
Definition: flv.h:80
FLV_CODECID_MPEG4
@ FLV_CODECID_MPEG4
Definition: flv.h:118
FLV_FRAME_DISP_INTER
@ FLV_FRAME_DISP_INTER
disposable inter frame (H.263 only)
Definition: flv.h:133
FLV_AUDIO_SAMPLERATE_OFFSET
#define FLV_AUDIO_SAMPLERATE_OFFSET
Definition: flv.h:33
FLV_STEREO
@ FLV_STEREO
Definition: flv.h:81
FLV_CODECID_REALH263
@ FLV_CODECID_REALH263
Definition: flv.h:117
FLV_VIDEO_FRAMETYPE_OFFSET
#define FLV_VIDEO_FRAMETYPE_OFFSET
Definition: flv.h:36
AMF_DATA_TYPE_MIXEDARRAY
@ AMF_DATA_TYPE_MIXEDARRAY
Definition: flv.h:146
AMF_DATA_TYPE_STRING
@ AMF_DATA_TYPE_STRING
Definition: flv.h:141
PacketTypeSequenceEnd
@ PacketTypeSequenceEnd
Definition: flv.h:124
FLV_HEADER_FLAG_HASAUDIO
@ FLV_HEADER_FLAG_HASAUDIO
Definition: flv.h:62
FLV_TAG_TYPE_META
@ FLV_TAG_TYPE_META
Definition: flv.h:68
AMF_DATA_TYPE_LONG_STRING
@ AMF_DATA_TYPE_LONG_STRING
Definition: flv.h:150
FLV_CODECID_PCM
@ FLV_CODECID_PCM
Definition: flv.h:97
AMF_DATA_TYPE_NUMBER
@ AMF_DATA_TYPE_NUMBER
Definition: flv.h:139
PacketTypeMetadata
@ PacketTypeMetadata
Definition: flv.h:126
FLV_SAMPLESSIZE_8BIT
@ FLV_SAMPLESSIZE_8BIT
Definition: flv.h:85
FLV_CODECID_SCREEN2
@ FLV_CODECID_SCREEN2
Definition: flv.h:115
FLV_STREAM_TYPE_SUBTITLE
@ FLV_STREAM_TYPE_SUBTITLE
Definition: flv.h:74
FlvTagType
FlvTagType
Definition: flv.h:65
AMF_DATA_TYPE_NULL
@ AMF_DATA_TYPE_NULL
Definition: flv.h:143
FLV_CODECID_MP3
@ FLV_CODECID_MP3
Definition: flv.h:99
FLV_CODECID_VP6
@ FLV_CODECID_VP6
Definition: flv.h:113