1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
#!/usr/bin/perl -w
=head1 NAME
dh_gstscancodecs - enumerate and classify gstreamer codecs
=cut
use strict;
use Debian::Debhelper::Dh_Lib;
use File::Temp;
=head1 SYNOPSIS
dh_gstscancodecs [debhelper options]
=head1 DESCRIPTION
This program is meant to assist in building a package that provides
codecs, demultiplexers and other media-handling components for
gstreamer-based applications.
dh_gstscancodecs generates substitution variable for debian/control,
by scanning libraries /usr/lib/gstreamer-1.0/*.so and
/usr/lib/$DEB_HOST_MULTIARCH/gstreamer-1.0/*.so.
The generated substitution variables are
=over 4
=item gstreamer:Version
Should be added to XB-GStreamer-Version
=item gstreamer:Elements
Should be added to XB-GStreamer-Elements
=item gstreamer:Provides
Should be added to Provides
=item gstreamer:URISources
Should be added to XB-GStreamer-URI-Sources
=item gstreamer:URISinks
Should be added to XB-GStreamer-URI-Sinks
=item gstreamer:Encoders
Should be added to XB-GStreamer-Encoders
=item gstreamer:Decoders
Should be added to XB-GStreamer-Decoders
=back
This control fields will be used by the /usr/bin/gstreamer-codec-install
helper to install required missing GStreamer elements.
=head1 OPTIONS
The standard debhelper options are supported.
=cut
init();
my $deb_host_multiarch = `dpkg-architecture -qDEB_HOST_MULTIARCH`;
chop $deb_host_multiarch;
$::pluginlibdirprefix = '/usr/lib/'.$deb_host_multiarch.'/gstreamer-';
$::pluginlibdirlegacy = '/usr/lib/gstreamer-';
foreach my $package (@{$dh{DOPACKAGES}}) {
my $tmp = tmpdir($package);
delsubstvar($package, "gstreamer:Version");
delsubstvar($package, "gstreamer:URISinks");
delsubstvar($package, "gstreamer:URISources");
delsubstvar($package, "gstreamer:Encoders");
delsubstvar($package, "gstreamer:Decoders");
foreach my $sodir (glob "$tmp$::pluginlibdirprefix* $tmp$::pluginlibdirlegacy*") {
my $gstversion = $sodir;
$gstversion =~ s/^$tmp$::pluginlibdirprefix//;
$gstversion =~ s/^$tmp$::pluginlibdirlegacy//;
verbose_print("# gstreamer version $gstversion");
my (undef, $tmpfile) = File::Temp::tempfile("/tmp/".basename($0).".XXXX", UNLINK => 1);
my (undef, $registryfile) = File::Temp::tempfile("/tmp/".basename($0).".XXXX", UNLINK => 1);
my $command="GST_REGISTRY=$registryfile GST_PLUGIN_SYSTEM_PATH= GST_PLUGIN_PATH=$sodir gst-codec-info-$gstversion " . join(' ', (glob "$sodir/*.so")) . " > $tmpfile";
system($command);
if ($?) {
my $output;
{
local *F;
open(F, $tmpfile);
local $/;
$output = <F>;
close(F);
}
die("gst-codec-info-$gstversion call failed: '".$command."' rc: $? output: $output");
}
local *F;
open(F, $tmpfile);
my ($variable, $value);
while(<F>) {
$variable = $1 if /([a-zA-Z]*:[a-zA-Z]*)=/;
$value = $2 if /([a-zA-Z]*:[a-zA-Z]*)=(.*)\n/;
addsubstvar($package, $variable, $value);
}
}
}
=head1 SEE ALSO
L<debhelper(1)>
This program is an extension to debhelper.
=head1 AUTHOR
Ian Jackson <iwj@ubuntu.com>
Sebastian Dröge <sebastian.droege@collabora.co.uk>
=cut
|