2011-07-14 04:11:19 +03:00
|
|
|
/*
|
2006-12-06 02:23:04 +02:00
|
|
|
* FLV common header
|
|
|
|
*
|
2009-01-19 17:46:40 +02:00
|
|
|
* Copyright (c) 2006 The FFmpeg Project
|
2006-12-06 02:23:04 +02:00
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2011-07-14 04:11:19 +03:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* FLV common header
|
|
|
|
*/
|
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#ifndef AVFORMAT_FLV_H
|
|
|
|
#define AVFORMAT_FLV_H
|
2006-12-06 02:23:04 +02:00
|
|
|
|
|
|
|
/* offsets for packed values */
|
|
|
|
#define FLV_AUDIO_SAMPLESSIZE_OFFSET 1
|
|
|
|
#define FLV_AUDIO_SAMPLERATE_OFFSET 2
|
|
|
|
#define FLV_AUDIO_CODECID_OFFSET 4
|
|
|
|
|
|
|
|
#define FLV_VIDEO_FRAMETYPE_OFFSET 4
|
|
|
|
|
2023-05-26 04:33:30 +02:00
|
|
|
/* Extended VideoTagHeader
|
|
|
|
* defined in reference link:
|
|
|
|
* https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
|
|
|
|
* */
|
|
|
|
#define FLV_IS_EX_HEADER 0x80
|
|
|
|
|
2006-12-06 02:23:04 +02:00
|
|
|
/* bitmasks to isolate specific values */
|
|
|
|
#define FLV_AUDIO_CHANNEL_MASK 0x01
|
|
|
|
#define FLV_AUDIO_SAMPLESIZE_MASK 0x02
|
|
|
|
#define FLV_AUDIO_SAMPLERATE_MASK 0x0c
|
|
|
|
#define FLV_AUDIO_CODECID_MASK 0xf0
|
|
|
|
|
|
|
|
#define FLV_VIDEO_CODECID_MASK 0x0f
|
|
|
|
#define FLV_VIDEO_FRAMETYPE_MASK 0xf0
|
|
|
|
|
|
|
|
#define AMF_END_OF_OBJECT 0x09
|
|
|
|
|
2011-04-01 14:45:39 +03:00
|
|
|
#define KEYFRAMES_TAG "keyframes"
|
|
|
|
#define KEYFRAMES_TIMESTAMP_TAG "times"
|
|
|
|
#define KEYFRAMES_BYTEOFFSET_TAG "filepositions"
|
|
|
|
|
|
|
|
|
2006-12-06 02:23:04 +02:00
|
|
|
enum {
|
|
|
|
FLV_HEADER_FLAG_HASVIDEO = 1,
|
|
|
|
FLV_HEADER_FLAG_HASAUDIO = 4,
|
|
|
|
};
|
|
|
|
|
2015-06-11 15:27:27 +02:00
|
|
|
enum FlvTagType {
|
2006-12-06 02:23:04 +02:00
|
|
|
FLV_TAG_TYPE_AUDIO = 0x08,
|
|
|
|
FLV_TAG_TYPE_VIDEO = 0x09,
|
|
|
|
FLV_TAG_TYPE_META = 0x12,
|
|
|
|
};
|
|
|
|
|
2011-08-26 04:36:32 +03:00
|
|
|
enum {
|
|
|
|
FLV_STREAM_TYPE_VIDEO,
|
|
|
|
FLV_STREAM_TYPE_AUDIO,
|
2018-10-05 15:11:08 +02:00
|
|
|
FLV_STREAM_TYPE_SUBTITLE,
|
2018-10-05 15:16:11 +02:00
|
|
|
FLV_STREAM_TYPE_DATA,
|
2011-12-22 02:48:38 +03:00
|
|
|
FLV_STREAM_TYPE_NB,
|
2011-08-26 04:36:32 +03:00
|
|
|
};
|
|
|
|
|
2006-12-06 02:23:04 +02:00
|
|
|
enum {
|
|
|
|
FLV_MONO = 0,
|
|
|
|
FLV_STEREO = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
FLV_SAMPLESSIZE_8BIT = 0,
|
|
|
|
FLV_SAMPLESSIZE_16BIT = 1 << FLV_AUDIO_SAMPLESSIZE_OFFSET,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
FLV_SAMPLERATE_SPECIAL = 0, /**< signifies 5512Hz and 8000Hz in the case of NELLYMOSER */
|
|
|
|
FLV_SAMPLERATE_11025HZ = 1 << FLV_AUDIO_SAMPLERATE_OFFSET,
|
|
|
|
FLV_SAMPLERATE_22050HZ = 2 << FLV_AUDIO_SAMPLERATE_OFFSET,
|
|
|
|
FLV_SAMPLERATE_44100HZ = 3 << FLV_AUDIO_SAMPLERATE_OFFSET,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2008-10-18 15:08:55 +03:00
|
|
|
FLV_CODECID_PCM = 0,
|
|
|
|
FLV_CODECID_ADPCM = 1 << FLV_AUDIO_CODECID_OFFSET,
|
|
|
|
FLV_CODECID_MP3 = 2 << FLV_AUDIO_CODECID_OFFSET,
|
|
|
|
FLV_CODECID_PCM_LE = 3 << FLV_AUDIO_CODECID_OFFSET,
|
2010-11-03 22:12:07 +02:00
|
|
|
FLV_CODECID_NELLYMOSER_16KHZ_MONO = 4 << FLV_AUDIO_CODECID_OFFSET,
|
2008-10-18 15:08:55 +03:00
|
|
|
FLV_CODECID_NELLYMOSER_8KHZ_MONO = 5 << FLV_AUDIO_CODECID_OFFSET,
|
|
|
|
FLV_CODECID_NELLYMOSER = 6 << FLV_AUDIO_CODECID_OFFSET,
|
2012-06-28 17:28:56 +03:00
|
|
|
FLV_CODECID_PCM_ALAW = 7 << FLV_AUDIO_CODECID_OFFSET,
|
|
|
|
FLV_CODECID_PCM_MULAW = 8 << FLV_AUDIO_CODECID_OFFSET,
|
2008-10-18 15:08:55 +03:00
|
|
|
FLV_CODECID_AAC = 10<< FLV_AUDIO_CODECID_OFFSET,
|
|
|
|
FLV_CODECID_SPEEX = 11<< FLV_AUDIO_CODECID_OFFSET,
|
2006-12-06 02:23:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2007-02-23 23:08:43 +02:00
|
|
|
FLV_CODECID_H263 = 2,
|
|
|
|
FLV_CODECID_SCREEN = 3,
|
|
|
|
FLV_CODECID_VP6 = 4,
|
2007-02-23 23:09:50 +02:00
|
|
|
FLV_CODECID_VP6A = 5,
|
|
|
|
FLV_CODECID_SCREEN2 = 6,
|
2008-05-24 01:02:29 +03:00
|
|
|
FLV_CODECID_H264 = 7,
|
2011-08-26 00:04:37 +03:00
|
|
|
FLV_CODECID_REALH263= 8,
|
|
|
|
FLV_CODECID_MPEG4 = 9,
|
2006-12-06 02:23:04 +02:00
|
|
|
};
|
|
|
|
|
2023-05-26 04:33:30 +02:00
|
|
|
enum {
|
|
|
|
PacketTypeSequenceStart = 0,
|
|
|
|
PacketTypeCodedFrames = 1,
|
|
|
|
PacketTypeSequenceEnd = 2,
|
|
|
|
PacketTypeCodedFramesX = 3,
|
|
|
|
PacketTypeMetadata = 4,
|
|
|
|
PacketTypeMPEG2TSSequenceStart = 5,
|
|
|
|
};
|
|
|
|
|
2006-12-06 02:23:04 +02:00
|
|
|
enum {
|
2012-03-19 16:49:04 +03:00
|
|
|
FLV_FRAME_KEY = 1 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< key frame (for AVC, a seekable frame)
|
|
|
|
FLV_FRAME_INTER = 2 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< inter frame (for AVC, a non-seekable frame)
|
|
|
|
FLV_FRAME_DISP_INTER = 3 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< disposable inter frame (H.263 only)
|
|
|
|
FLV_FRAME_GENERATED_KEY = 4 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< generated key frame (reserved for server use only)
|
|
|
|
FLV_FRAME_VIDEO_INFO_CMD = 5 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< video info/command frame
|
2006-12-06 02:23:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
AMF_DATA_TYPE_NUMBER = 0x00,
|
|
|
|
AMF_DATA_TYPE_BOOL = 0x01,
|
|
|
|
AMF_DATA_TYPE_STRING = 0x02,
|
|
|
|
AMF_DATA_TYPE_OBJECT = 0x03,
|
|
|
|
AMF_DATA_TYPE_NULL = 0x05,
|
|
|
|
AMF_DATA_TYPE_UNDEFINED = 0x06,
|
|
|
|
AMF_DATA_TYPE_REFERENCE = 0x07,
|
|
|
|
AMF_DATA_TYPE_MIXEDARRAY = 0x08,
|
2009-07-21 10:18:14 +03:00
|
|
|
AMF_DATA_TYPE_OBJECT_END = 0x09,
|
2006-12-06 02:23:04 +02:00
|
|
|
AMF_DATA_TYPE_ARRAY = 0x0a,
|
|
|
|
AMF_DATA_TYPE_DATE = 0x0b,
|
2009-07-21 10:18:14 +03:00
|
|
|
AMF_DATA_TYPE_LONG_STRING = 0x0c,
|
2006-12-06 02:23:04 +02:00
|
|
|
AMF_DATA_TYPE_UNSUPPORTED = 0x0d,
|
|
|
|
} AMFDataType;
|
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#endif /* AVFORMAT_FLV_H */
|