Statistics
| Branch: | Revision:

ffmpeg / libavformat / flv.h @ 2912e87a

History | View | Annotate | Download (3.48 KB)

1
/**
2
 * @file
3
 * FLV common header
4
 *
5
 * Copyright (c) 2006 The Libav Project
6
 *
7
 * This file is part of Libav.
8
 *
9
 * Libav is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU Lesser General Public
11
 * License as published by the Free Software Foundation; either
12
 * version 2.1 of the License, or (at your option) any later version.
13
 *
14
 * Libav is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
 * Lesser General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Lesser General Public
20
 * License along with Libav; if not, write to the Free Software
21
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
 */
23

    
24
#ifndef AVFORMAT_FLV_H
25
#define AVFORMAT_FLV_H
26

    
27
/* offsets for packed values */
28
#define FLV_AUDIO_SAMPLESSIZE_OFFSET 1
29
#define FLV_AUDIO_SAMPLERATE_OFFSET  2
30
#define FLV_AUDIO_CODECID_OFFSET     4
31

    
32
#define FLV_VIDEO_FRAMETYPE_OFFSET   4
33

    
34
/* bitmasks to isolate specific values */
35
#define FLV_AUDIO_CHANNEL_MASK    0x01
36
#define FLV_AUDIO_SAMPLESIZE_MASK 0x02
37
#define FLV_AUDIO_SAMPLERATE_MASK 0x0c
38
#define FLV_AUDIO_CODECID_MASK    0xf0
39

    
40
#define FLV_VIDEO_CODECID_MASK    0x0f
41
#define FLV_VIDEO_FRAMETYPE_MASK  0xf0
42

    
43
#define AMF_END_OF_OBJECT         0x09
44

    
45
enum {
46
    FLV_HEADER_FLAG_HASVIDEO = 1,
47
    FLV_HEADER_FLAG_HASAUDIO = 4,
48
};
49

    
50
enum {
51
    FLV_TAG_TYPE_AUDIO = 0x08,
52
    FLV_TAG_TYPE_VIDEO = 0x09,
53
    FLV_TAG_TYPE_META  = 0x12,
54
};
55

    
56
enum {
57
    FLV_MONO   = 0,
58
    FLV_STEREO = 1,
59
};
60

    
61
enum {
62
    FLV_SAMPLESSIZE_8BIT  = 0,
63
    FLV_SAMPLESSIZE_16BIT = 1 << FLV_AUDIO_SAMPLESSIZE_OFFSET,
64
};
65

    
66
enum {
67
    FLV_SAMPLERATE_SPECIAL = 0, /**< signifies 5512Hz and 8000Hz in the case of NELLYMOSER */
68
    FLV_SAMPLERATE_11025HZ = 1 << FLV_AUDIO_SAMPLERATE_OFFSET,
69
    FLV_SAMPLERATE_22050HZ = 2 << FLV_AUDIO_SAMPLERATE_OFFSET,
70
    FLV_SAMPLERATE_44100HZ = 3 << FLV_AUDIO_SAMPLERATE_OFFSET,
71
};
72

    
73
enum {
74
    FLV_CODECID_PCM                  = 0,
75
    FLV_CODECID_ADPCM                = 1 << FLV_AUDIO_CODECID_OFFSET,
76
    FLV_CODECID_MP3                  = 2 << FLV_AUDIO_CODECID_OFFSET,
77
    FLV_CODECID_PCM_LE               = 3 << FLV_AUDIO_CODECID_OFFSET,
78
    FLV_CODECID_NELLYMOSER_16KHZ_MONO = 4 << FLV_AUDIO_CODECID_OFFSET,
79
    FLV_CODECID_NELLYMOSER_8KHZ_MONO = 5 << FLV_AUDIO_CODECID_OFFSET,
80
    FLV_CODECID_NELLYMOSER           = 6 << FLV_AUDIO_CODECID_OFFSET,
81
    FLV_CODECID_AAC                  = 10<< FLV_AUDIO_CODECID_OFFSET,
82
    FLV_CODECID_SPEEX                = 11<< FLV_AUDIO_CODECID_OFFSET,
83
};
84

    
85
enum {
86
    FLV_CODECID_H263    = 2,
87
    FLV_CODECID_SCREEN  = 3,
88
    FLV_CODECID_VP6     = 4,
89
    FLV_CODECID_VP6A    = 5,
90
    FLV_CODECID_SCREEN2 = 6,
91
    FLV_CODECID_H264    = 7,
92
};
93

    
94
enum {
95
    FLV_FRAME_KEY        = 1 << FLV_VIDEO_FRAMETYPE_OFFSET,
96
    FLV_FRAME_INTER      = 2 << FLV_VIDEO_FRAMETYPE_OFFSET,
97
    FLV_FRAME_DISP_INTER = 3 << FLV_VIDEO_FRAMETYPE_OFFSET,
98
};
99

    
100
typedef enum {
101
    AMF_DATA_TYPE_NUMBER      = 0x00,
102
    AMF_DATA_TYPE_BOOL        = 0x01,
103
    AMF_DATA_TYPE_STRING      = 0x02,
104
    AMF_DATA_TYPE_OBJECT      = 0x03,
105
    AMF_DATA_TYPE_NULL        = 0x05,
106
    AMF_DATA_TYPE_UNDEFINED   = 0x06,
107
    AMF_DATA_TYPE_REFERENCE   = 0x07,
108
    AMF_DATA_TYPE_MIXEDARRAY  = 0x08,
109
    AMF_DATA_TYPE_OBJECT_END  = 0x09,
110
    AMF_DATA_TYPE_ARRAY       = 0x0a,
111
    AMF_DATA_TYPE_DATE        = 0x0b,
112
    AMF_DATA_TYPE_LONG_STRING = 0x0c,
113
    AMF_DATA_TYPE_UNSUPPORTED = 0x0d,
114
} AMFDataType;
115

    
116
#endif /* AVFORMAT_FLV_H */