line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FLV::Util; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
34
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
951
|
|
4
|
6
|
|
|
6
|
|
30
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
175
|
|
5
|
6
|
|
|
6
|
|
484
|
use 5.008; |
|
6
|
|
|
|
|
25
|
|
|
6
|
|
|
|
|
270
|
|
6
|
6
|
|
|
6
|
|
39
|
use base 'Exporter'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
667
|
|
7
|
6
|
|
|
6
|
|
7935
|
use Readonly; |
|
6
|
|
|
|
|
31246
|
|
|
6
|
|
|
|
|
10160
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.24'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT = ## no critic(Modules::ProhibitAutomaticExportation) |
12
|
|
|
|
|
|
|
qw( |
13
|
|
|
|
|
|
|
%TAG_CLASSES |
14
|
|
|
|
|
|
|
%AUDIO_FORMATS |
15
|
|
|
|
|
|
|
%AUDIO_RATES |
16
|
|
|
|
|
|
|
%AUDIO_SIZES |
17
|
|
|
|
|
|
|
%AUDIO_TYPES |
18
|
|
|
|
|
|
|
%VIDEO_CODEC_IDS |
19
|
|
|
|
|
|
|
%VIDEO_FRAME_TYPES |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Readonly::Hash our %TAG_CLASSES => ( |
23
|
|
|
|
|
|
|
8 => 'FLV::AudioTag', |
24
|
|
|
|
|
|
|
9 => 'FLV::VideoTag', |
25
|
|
|
|
|
|
|
18 => 'FLV::MetaTag', |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Readonly::Hash our %AUDIO_FORMATS => ( |
29
|
|
|
|
|
|
|
0 => 'uncompressed', |
30
|
|
|
|
|
|
|
1 => 'ADPCM', |
31
|
|
|
|
|
|
|
2 => 'MP3', |
32
|
|
|
|
|
|
|
3 => 'Linear PCM, little endian', |
33
|
|
|
|
|
|
|
4 => 'Nellymoser 16kHz mono', |
34
|
|
|
|
|
|
|
5 => 'Nellymoser 8kHz mono', |
35
|
|
|
|
|
|
|
6 => 'Nellymoser', |
36
|
|
|
|
|
|
|
7 => 'G.711 A-law', |
37
|
|
|
|
|
|
|
8 => 'G.711 mu-law', |
38
|
|
|
|
|
|
|
10 => 'AAC', |
39
|
|
|
|
|
|
|
11 => 'Speex', |
40
|
|
|
|
|
|
|
14 => 'MP3 8kHz', |
41
|
|
|
|
|
|
|
15 => 'Device-specific sound', |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
Readonly::Hash our %AUDIO_RATES => ( |
44
|
|
|
|
|
|
|
0 => '5518 Hz', |
45
|
|
|
|
|
|
|
1 => '11025 Hz', |
46
|
|
|
|
|
|
|
2 => '22050 Hz', |
47
|
|
|
|
|
|
|
3 => '44100 Hz', |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
Readonly::Hash our %AUDIO_SIZES => ( |
50
|
|
|
|
|
|
|
0 => '8 bit', |
51
|
|
|
|
|
|
|
1 => '16 bit', |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
Readonly::Hash our %AUDIO_TYPES => ( |
54
|
|
|
|
|
|
|
0 => 'mono', |
55
|
|
|
|
|
|
|
1 => 'stereo', |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Readonly::Hash our %VIDEO_CODEC_IDS => ( |
59
|
|
|
|
|
|
|
1 => 'JPEG', |
60
|
|
|
|
|
|
|
2 => 'Sorenson H.263', |
61
|
|
|
|
|
|
|
3 => 'Screen video', |
62
|
|
|
|
|
|
|
4 => 'On2 VP6', |
63
|
|
|
|
|
|
|
5 => 'On2 VP6 + alpha', |
64
|
|
|
|
|
|
|
6 => 'Screen video v2', |
65
|
|
|
|
|
|
|
7 => 'AVC', |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
Readonly::Hash our %VIDEO_FRAME_TYPES => ( |
68
|
|
|
|
|
|
|
1 => 'keyframe', |
69
|
|
|
|
|
|
|
2 => 'interframe', |
70
|
|
|
|
|
|
|
3 => 'disposable interframe', |
71
|
|
|
|
|
|
|
4 => 'generated keyframe', |
72
|
|
|
|
|
|
|
5 => 'video info/command frame', |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub get_write_filehandle |
76
|
|
|
|
|
|
|
{ |
77
|
19
|
|
|
19
|
1
|
34
|
my $pkg = shift; |
78
|
19
|
|
|
|
|
40
|
my $outfile = shift; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# $OS_ERROR must be intact at the end |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
## no critic(RequireBriefOpen) |
83
|
|
|
|
|
|
|
|
84
|
19
|
|
|
|
|
31
|
my $outfh; |
85
|
19
|
50
|
|
|
|
3295
|
if (ref $outfile) |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
86
|
|
|
|
|
|
|
{ |
87
|
0
|
|
|
|
|
0
|
$outfh = $outfile; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
elsif (q{-} eq $outfile) |
90
|
|
|
|
|
|
|
{ |
91
|
0
|
|
|
|
|
0
|
$outfh = \*STDOUT; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
elsif (!open $outfh, '>', $outfile) |
94
|
|
|
|
|
|
|
{ |
95
|
2
|
|
|
|
|
5
|
$outfh = undef; |
96
|
|
|
|
|
|
|
} |
97
|
19
|
100
|
|
|
|
72
|
if ($outfh) |
98
|
|
|
|
|
|
|
{ |
99
|
17
|
|
|
|
|
62
|
binmode $outfh; |
100
|
|
|
|
|
|
|
} |
101
|
19
|
|
|
|
|
98
|
return $outfh; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__END__ |