[libdvbpsi-devel] remove dr-api-rename.pl, it's of no use now
Daniel Kamil Kozar
git at videolan.org
Mon Jan 11 09:43:20 CET 2016
libdvbpsi | branch: master | Daniel Kamil Kozar <dkk089 at gmail.com> | Sun Oct 11 22:47:42 2015 +0200| [0778a214f41ddc5f0d50e5f47fa3c942519164fd] | committer: Daniel Kamil Kozar
remove dr-api-rename.pl, it's of no use now
> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=0778a214f41ddc5f0d50e5f47fa3c942519164fd
---
dr-api-rename.pl | 144 ------------------------------------------------------
1 file changed, 144 deletions(-)
diff --git a/dr-api-rename.pl b/dr-api-rename.pl
deleted file mode 100755
index 631dac9..0000000
--- a/dr-api-rename.pl
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use File::Find;
-use Tie::File;
-use Data::Dumper;
-use File::Basename;
-
-my @dr_headers;
-
-sub wanted_dr_h {
- push @dr_headers, $File::Find::name if /^dr_[0-f]{2}\.h$/;
-}
-
-find(\&wanted_dr_h, 'src/descriptors');
-
-for(@dr_headers) {
- my $hdrinfo = parse_header($_);
- if(not defined $hdrinfo) {
- if(/dr_a1\.h$/) {
- $hdrinfo = {
- old => { stru => 'dvbpsi_service_location_dr',
- gen => 'dvbpsi_GenServiceLocationDr',
- decode => 'dvbpsi_DecodeServiceLocationDr'
- },
- new => { stru => 'dvbpsi_atsc_service_location_dr',
- gen => 'dvbpsi_gen_atsc_service_location_dr',
- decode => 'dvbpsi_decode_atsc_service_location_dr'
- }
- }
- }
- elsif(/dr_49\.h$/) {
- $hdrinfo = {
- old => { stru => 'dvbpsi_country_availability_dr',
- gen => 'dvbpsi_GenCountryAvailabilityDr',
- decode => 'dvbpsi_DecodeCountryAvailability'
- },
- new => { stru => 'dvbpsi_dvb_country_availability_dr',
- gen => 'dvbpsi_gen_dvb_country_availability_dr',
- decode => 'dvbpsi_decode_dvb_country_availability_dr'
- }
- }
- }
- else {
- print STDERR "Failed to process $_\n";
- next;
- }
- }
- replace_names($hdrinfo);
-}
-
-exit 0;
-
-sub parse_header {
- my $dr_h = shift;
- my $sname;
- my $fname;
- my @decode_decl;
- my @file;
- my $rv;
- tie @file, 'Tie::File', $dr_h or die "Can't open $dr_h";
-
- for(@file) {
- if(/^typedef struct dvbpsi_(.*?)_dr_(?:t|s)$/) {
- $sname = $1;
- last;
- }
- }
- goto end if not defined $sname;
-
- for(my $i = 0 ; $i < scalar(@file) ; ++$i) {
- if($file[$i] =~ /^dvbpsi_${sname}_dr_t *?\* *?dvbpsi_Decode(.*?)Dr/) {
- $fname = $1;
- push @decode_decl, $file[$i];
- last if($file[$i] =~ /.*;.*/);
- $i++;
- while(1) {
- push @decode_decl, $file[$i];
- if($file[$i] =~ /.*;.*/) {
- last;
- }
- else {
- $i++;
- }
- }
- }
- }
- goto end if not defined $fname;
- $dr_h =~ /dr_([0-9a-f]{2})\.h$/;
- my $drnum = hex($1);
-
- my $oldinfo = {
- stru => "dvbpsi_${sname}_dr",
- gen => "dvbpsi_Gen${fname}Dr",
- decode => "dvbpsi_Decode${fname}Dr"
- };
- $rv = { old => $oldinfo, new => get_new_hdrinfo($sname, get_dr_system($drnum)) };
-
-end:
- untie @file;
- return $rv;
-}
-
-sub get_dr_system {
- my $drnum = shift;
- return "mpeg" if $drnum >= 2 && $drnum <= 63;
- return "dvb" if $drnum >= 64 && $drnum <= 127;
- return "atsc" if $drnum == 0xa0 || $drnum == 0x86 || $drnum == 0x81;
- return "eacem" if $drnum == 0x83;
- return "scte" if $drnum == 0x8a;
- return "custom" if $drnum >= 128 && $drnum <= 254;
- die "Forbidden descriptor $drnum";
-}
-
-sub get_new_hdrinfo {
- (my $sname, my $sys) = @_;
- return {
- stru => "dvbpsi_${sys}_${sname}_dr",
- gen => "dvbpsi_gen_${sys}_${sname}_dr",
- decode => "dvbpsi_decode_${sys}_${sname}_dr"
- }
-}
-
-my $replacer;
-
-sub wanted_global_c_or_h {
- return unless /\.(c|h)$/;
- my @file;
- my $old = $replacer->{old};
- my $new = $replacer->{new};
- tie @file, 'Tie::File', $_ or die "Cannot open $_";
- for(@file) {
- s/$old->{stru}/$new->{stru}/g;
- s/$old->{gen}/$new->{gen}/g;
- s/$old->{decode}/$new->{decode}/g;
- }
- untie @file;
-}
-
-sub replace_names {
- $replacer = shift;
- find(\&wanted_global_c_or_h, '.');
-}
More information about the libdvbpsi-devel
mailing list