line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SMIL::MediaFactory; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = "0.898"; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
require Exporter; |
6
|
|
|
|
|
|
|
@ISA = qw( Exporter ); |
7
|
|
|
|
|
|
|
@EXPORT = qw( getMediaObject ); |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
736
|
use SMIL::Href; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
10
|
1
|
|
|
1
|
|
2480
|
use SMIL::AnchoredMedia; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
68
|
|
11
|
1
|
|
|
1
|
|
29
|
use SMIL::UnanchoredMedia; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
682
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $href = 'href'; |
14
|
|
|
|
|
|
|
my $layout = 'layout'; |
15
|
|
|
|
|
|
|
my $anchors = 'anchors'; |
16
|
|
|
|
|
|
|
my $switch = 'switch'; |
17
|
|
|
|
|
|
|
my $switch_target = 'switch-target'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub getMediaObject { |
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
5
|
0
|
15
|
my %hash = @_ ; |
23
|
|
|
|
|
|
|
# check here to see if we have a 'href', if so create Href object, |
24
|
|
|
|
|
|
|
# otherwise create either Unanchored or Anchored media depending |
25
|
|
|
|
|
|
|
# on existence of 'anchors' element |
26
|
5
|
|
|
|
|
8
|
my $ref; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Look for the switch parameter |
29
|
5
|
|
|
|
|
8
|
my $switch_param = $hash{ $switch }; |
30
|
5
|
100
|
|
|
|
34
|
if( $switch_param ) { |
31
|
|
|
|
|
|
|
# Ok, look for the 'switch-target' item in the hash and put that |
32
|
|
|
|
|
|
|
# as the switch element |
33
|
2
|
|
|
|
|
5
|
$hash{ $switch_param } = $hash{ $switch_target }; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
5
|
|
|
|
|
24
|
@_ = %hash; |
37
|
|
|
|
|
|
|
|
38
|
5
|
100
|
|
|
|
26
|
if( $hash{ $href } ) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
39
|
1
|
|
|
|
|
13
|
$ref = new SMIL::Href( @_ ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
elsif( $hash{ $anchors } ) { |
42
|
1
|
|
|
|
|
13
|
$ref = new SMIL::AnchoredMedia( @_ ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
elsif( $hash{ $layout } ) { |
45
|
0
|
|
|
|
|
0
|
$ref = new SMIL::Layout( @_ ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
else { # No anchors or hrefs or layouts, create normal media object |
48
|
3
|
|
|
|
|
19
|
$ref = new SMIL::UnanchoredMedia( @_ ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
5
|
|
|
|
|
31
|
return $ref; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|