Commit 56bd97cc authored by Daniel Kamil Kozar's avatar Daniel Kamil Kozar

add a script for easing the transition

parent 9c482eaf
#!/usr/bin/perl
# A simple script that is aimed to help libdvbpsi users in the transition to the
# new descriptor API. All it really does is substituting the names of structures
# and functions to the ones found in the new API. The substitutions are limited
# to C and C++ header and source files. Uses the working directory by default,
# custom dir is used if given via the commandline.
use warnings;
use strict;
use File::Find;
use Tie::File;
my %names = (
'dvbpsi_max_bitrate_dr' => 'dvbpsi_mpeg_max_bitrate_dr',
'dvbpsi_GenMaxBitrateDr' => 'dvbpsi_gen_mpeg_max_bitrate_dr',
'dvbpsi_DecodeMaxBitrateDr' => 'dvbpsi_decode_mpeg_max_bitrate_dr',
'dvbpsi_terr_deliv_sys_dr' => 'dvbpsi_dvb_terr_deliv_sys_dr',
'dvbpsi_GenTerrDelivSysDr' => 'dvbpsi_gen_dvb_terr_deliv_sys_dr',
'dvbpsi_DecodeTerrDelivSysDr' => 'dvbpsi_decode_dvb_terr_deliv_sys_dr',
'dvbpsi_aac_dr' => 'dvbpsi_dvb_aac_dr',
'dvbpsi_GenAACDr' => 'dvbpsi_gen_dvb_aac_dr',
'dvbpsi_DecodeAACDr' => 'dvbpsi_decode_dvb_aac_dr',
'dvbpsi_vwindow_dr' => 'dvbpsi_mpeg_vwindow_dr',
'dvbpsi_GenVWindowDr' => 'dvbpsi_gen_mpeg_vwindow_dr',
'dvbpsi_DecodeVWindowDr' => 'dvbpsi_decode_mpeg_vwindow_dr',
'dvbpsi_service_dr' => 'dvbpsi_dvb_service_dr',
'dvbpsi_GenServiceDr' => 'dvbpsi_gen_dvb_service_dr',
'dvbpsi_DecodeServiceDr' => 'dvbpsi_decode_dvb_service_dr',
'dvbpsi_extended_event_dr' => 'dvbpsi_dvb_extended_event_dr',
'dvbpsi_GenExtendedEventDr' => 'dvbpsi_gen_dvb_extended_event_dr',
'dvbpsi_DecodeExtendedEventDr' => 'dvbpsi_decode_dvb_extended_event_dr',
'dvbpsi_target_bg_grid_dr' => 'dvbpsi_mpeg_target_bg_grid_dr',
'dvbpsi_GenTargetBgGridDr' => 'dvbpsi_gen_mpeg_target_bg_grid_dr',
'dvbpsi_DecodeTargetBgGridDr' => 'dvbpsi_decode_mpeg_target_bg_grid_dr',
'dvbpsi_linkage_dr' => 'dvbpsi_dvb_linkage_dr',
'dvbpsi_GenLinkageDr' => 'dvbpsi_gen_dvb_linkage_dr',
'dvbpsi_DecodeLinkageDr' => 'dvbpsi_decode_dvb_linkage_dr',
'dvbpsi_cable_deliv_sys_dr' => 'dvbpsi_dvb_cable_deliv_sys_dr',
'dvbpsi_GenCableDelivSysDr' => 'dvbpsi_gen_dvb_cable_deliv_sys_dr',
'dvbpsi_DecodeCableDelivSysDr' => 'dvbpsi_decode_dvb_cable_deliv_sys_dr',
'dvbpsi_cuei_dr' => 'dvbpsi_scte_cuei_dr',
'dvbpsi_GenCUEIDr' => 'dvbpsi_gen_scte_cuei_dr',
'dvbpsi_DecodeCUEIDr' => 'dvbpsi_decode_scte_cuei_dr',
'dvbpsi_teletext_dr' => 'dvbpsi_dvb_teletext_dr',
'dvbpsi_GenTeletextDr' => 'dvbpsi_gen_dvb_teletext_dr',
'dvbpsi_DecodeTeletextDr' => 'dvbpsi_decode_dvb_teletext_dr',
'dvbpsi_lcn_dr' => 'dvbpsi_eacem_lcn_dr',
'dvbpsi_GenLCNDr' => 'dvbpsi_gen_eacem_lcn_dr',
'dvbpsi_DecodeLCNDr' => 'dvbpsi_decode_eacem_lcn_dr',
'dvbpsi_service_location_dr' => 'dvbpsi_atsc_service_location_dr',
'dvbpsi_GenServiceLocationDr' => 'dvbpsi_gen_atsc_service_location_dr',
'dvbpsi_DecodeServiceLocationDr' => 'dvbpsi_decode_atsc_service_location_dr',
'dvbpsi_registration_dr' => 'dvbpsi_mpeg_registration_dr',
'dvbpsi_GenRegistrationDr' => 'dvbpsi_gen_mpeg_registration_dr',
'dvbpsi_DecodeRegistrationDr' => 'dvbpsi_decode_mpeg_registration_dr',
'dvbpsi_content_dr' => 'dvbpsi_dvb_content_dr',
'dvbpsi_GenContentDr' => 'dvbpsi_gen_dvb_content_dr',
'dvbpsi_DecodeContentDr' => 'dvbpsi_decode_dvb_content_dr',
'dvbpsi_caption_service_dr' => 'dvbpsi_atsc_caption_service_dr',
'dvbpsi_GenCaptionServiceDr' => 'dvbpsi_gen_atsc_caption_service_dr',
'dvbpsi_DecodeCaptionServiceDr' => 'dvbpsi_decode_atsc_caption_service_dr',
'dvbpsi_content_labelling_dr' => 'dvbpsi_mpeg_content_labelling_dr',
'dvbpsi_GenContentLabellingDr' => 'dvbpsi_gen_mpeg_content_labelling_dr',
'dvbpsi_DecodeContentLabellingDr' => 'dvbpsi_decode_mpeg_content_labelling_dr',
'dvbpsi_default_authority_dr' => 'dvbpsi_dvb_default_authority_dr',
'dvbpsi_GenDefaultAuthorityDr' => 'dvbpsi_gen_dvb_default_authority_dr',
'dvbpsi_DecodeDefaultAuthorityDr' => 'dvbpsi_decode_dvb_default_authority_dr',
'dvbpsi_tshifted_service_dr' => 'dvbpsi_dvb_tshifted_service_dr',
'dvbpsi_GenTimeShiftedServiceDr' => 'dvbpsi_gen_dvb_tshifted_service_dr',
'dvbpsi_DecodeTimeShiftedServiceDr' => 'dvbpsi_decode_dvb_tshifted_service_dr',
'dvbpsi_hierarchy_dr' => 'dvbpsi_mpeg_hierarchy_dr',
'dvbpsi_GenHierarchyDr' => 'dvbpsi_gen_mpeg_hierarchy_dr',
'dvbpsi_DecodeHierarchyDr' => 'dvbpsi_decode_mpeg_hierarchy_dr',
'dvbpsi_bouquet_name_dr' => 'dvbpsi_dvb_bouquet_name_dr',
'dvbpsi_GenBouquetNameDr' => 'dvbpsi_gen_dvb_bouquet_name_dr',
'dvbpsi_DecodeBouquetNameDr' => 'dvbpsi_decode_dvb_bouquet_name_dr',
'dvbpsi_ac3_audio_dr' => 'dvbpsi_atsc_ac3_audio_dr',
'dvbpsi_GenAc3AudioDr' => 'dvbpsi_gen_atsc_ac3_audio_dr',
'dvbpsi_DecodeAc3AudioDr' => 'dvbpsi_decode_atsc_ac3_audio_dr',
'dvbpsi_copyright_dr' => 'dvbpsi_mpeg_copyright_dr',
'dvbpsi_GenCopyrightDr' => 'dvbpsi_gen_mpeg_copyright_dr',
'dvbpsi_DecodeCopyrightDr' => 'dvbpsi_decode_mpeg_copyright_dr',
'dvbpsi_content_id_dr' => 'dvbpsi_dvb_content_id_dr',
'dvbpsi_GenContentIdDr' => 'dvbpsi_gen_dvb_content_id_dr',
'dvbpsi_DecodeContentIdDr' => 'dvbpsi_decode_dvb_content_id_dr',
'dvbpsi_PDC_dr' => 'dvbpsi_dvb_PDC_dr',
'dvbpsi_GenPDCDr' => 'dvbpsi_gen_dvb_PDC_dr',
'dvbpsi_DecodePDCDr' => 'dvbpsi_decode_dvb_PDC_dr',
'dvbpsi_ca_dr' => 'dvbpsi_mpeg_ca_dr',
'dvbpsi_GenCADr' => 'dvbpsi_gen_mpeg_ca_dr',
'dvbpsi_DecodeCADr' => 'dvbpsi_decode_mpeg_ca_dr',
'dvbpsi_network_name_dr' => 'dvbpsi_dvb_network_name_dr',
'dvbpsi_GenNetworkNameDr' => 'dvbpsi_gen_dvb_network_name_dr',
'dvbpsi_DecodeNetworkNameDr' => 'dvbpsi_decode_dvb_network_name_dr',
'dvbpsi_nvod_ref_dr' => 'dvbpsi_dvb_nvod_ref_dr',
'dvbpsi_GenNVODReferenceDr' => 'dvbpsi_gen_dvb_nvod_ref_dr',
'dvbpsi_DecodeNVODReferenceDr' => 'dvbpsi_decode_dvb_nvod_ref_dr',
'dvbpsi_smoothing_buffer_dr' => 'dvbpsi_mpeg_smoothing_buffer_dr',
'dvbpsi_GenSmoothingBufferDr' => 'dvbpsi_gen_mpeg_smoothing_buffer_dr',
'dvbpsi_DecodeSmoothingBufferDr' => 'dvbpsi_decode_mpeg_smoothing_buffer_dr',
'dvbpsi_component_dr' => 'dvbpsi_dvb_component_dr',
'dvbpsi_GenComponentDr' => 'dvbpsi_gen_dvb_component_dr',
'dvbpsi_DecodeComponentDr' => 'dvbpsi_decode_dvb_component_dr',
'dvbpsi_carousel_id_dr' => 'dvbpsi_mpeg_carousel_id_dr',
'dvbpsi_GenCarouselIdDr' => 'dvbpsi_gen_mpeg_carousel_id_dr',
'dvbpsi_DecodeCarouselIdDr' => 'dvbpsi_decode_mpeg_carousel_id_dr',
'dvbpsi_association_tag_dr' => 'dvbpsi_mpeg_association_tag_dr',
'dvbpsi_GenAssociationTagDr' => 'dvbpsi_gen_mpeg_association_tag_dr',
'dvbpsi_DecodeAssociationTagDr' => 'dvbpsi_decode_mpeg_association_tag_dr',
'dvbpsi_private_data_dr' => 'dvbpsi_mpeg_private_data_dr',
'dvbpsi_GenPrivateDataDr' => 'dvbpsi_gen_mpeg_private_data_dr',
'dvbpsi_DecodePrivateDataDr' => 'dvbpsi_decode_mpeg_private_data_dr',
'dvbpsi_ibp_dr' => 'dvbpsi_mpeg_ibp_dr',
'dvbpsi_GenIBPDr' => 'dvbpsi_gen_mpeg_ibp_dr',
'dvbpsi_DecodeIBPDr' => 'dvbpsi_decode_mpeg_ibp_dr',
'dvbpsi_vstream_dr' => 'dvbpsi_mpeg_vstream_dr',
'dvbpsi_GenVStreamDr' => 'dvbpsi_gen_mpeg_vstream_dr',
'dvbpsi_DecodeVStreamDr' => 'dvbpsi_decode_mpeg_vstream_dr',
'dvbpsi_system_clock_dr' => 'dvbpsi_mpeg_system_clock_dr',
'dvbpsi_GenSystemClockDr' => 'dvbpsi_gen_mpeg_system_clock_dr',
'dvbpsi_DecodeSystemClockDr' => 'dvbpsi_decode_mpeg_system_clock_dr',
'dvbpsi_ca_identifier_dr' => 'dvbpsi_dvb_ca_identifier_dr',
'dvbpsi_GenCAIdentifierDr' => 'dvbpsi_gen_dvb_ca_identifier_dr',
'dvbpsi_DecodeCAIdentifierDr' => 'dvbpsi_decode_dvb_ca_identifier_dr',
'dvbpsi_extended_channel_name_dr' => 'dvbpsi_atsc_extended_channel_name_dr',
'dvbpsi_GenExtendedChannelNameDr' => 'dvbpsi_gen_atsc_extended_channel_name_dr',
'dvbpsi_DecodeExtendedChannelNameDr' => 'dvbpsi_decode_atsc_extended_channel_name_dr',
'dvbpsi_stream_identifier_dr' => 'dvbpsi_dvb_stream_identifier_dr',
'dvbpsi_GenStreamIdentifierDr' => 'dvbpsi_gen_dvb_stream_identifier_dr',
'dvbpsi_DecodeStreamIdentifierDr' => 'dvbpsi_decode_dvb_stream_identifier_dr',
'dvbpsi_parental_rating_dr' => 'dvbpsi_dvb_parental_rating_dr',
'dvbpsi_GenParentalRatingDr' => 'dvbpsi_gen_dvb_parental_rating_dr',
'dvbpsi_DecodeParentalRatingDr' => 'dvbpsi_decode_dvb_parental_rating_dr',
'dvbpsi_mx_buff_utilization_dr' => 'dvbpsi_mpeg_mx_buff_utilization_dr',
'dvbpsi_GenMxBuffUtilizationDr' => 'dvbpsi_gen_mpeg_mx_buff_utilization_dr',
'dvbpsi_DecodeMxBuffUtilizationDr' => 'dvbpsi_decode_mpeg_mx_buff_utilization_dr',
'dvbpsi_stuffing_dr' => 'dvbpsi_dvb_stuffing_dr',
'dvbpsi_GenStuffingDr' => 'dvbpsi_gen_dvb_stuffing_dr',
'dvbpsi_DecodeStuffingDr' => 'dvbpsi_decode_dvb_stuffing_dr',
'dvbpsi_vbi_dr' => 'dvbpsi_dvb_vbi_dr',
'dvbpsi_GenVBIDataDr' => 'dvbpsi_gen_dvb_vbi_dr',
'dvbpsi_DecodeVBIDataDr' => 'dvbpsi_decode_dvb_vbi_dr',
'dvbpsi_subtitling_dr' => 'dvbpsi_dvb_subtitling_dr',
'dvbpsi_GenSubtitlingDr' => 'dvbpsi_gen_dvb_subtitling_dr',
'dvbpsi_DecodeSubtitlingDr' => 'dvbpsi_decode_dvb_subtitling_dr',
'dvbpsi_mpeg4_video_dr' => 'dvbpsi_mpeg_mpeg4_video_dr',
'dvbpsi_GenMPEG4VideoDr' => 'dvbpsi_gen_mpeg_mpeg4_video_dr',
'dvbpsi_DecodeMPEG4VideoDr' => 'dvbpsi_decode_mpeg_mpeg4_video_dr',
'dvbpsi_data_broadcast_id_dr' => 'dvbpsi_dvb_data_broadcast_id_dr',
'dvbpsi_GenDataBroadcastIdDr' => 'dvbpsi_gen_dvb_data_broadcast_id_dr',
'dvbpsi_DecodeDataBroadcastIdDr' => 'dvbpsi_decode_dvb_data_broadcast_id_dr',
'dvbpsi_frequency_list_dr' => 'dvbpsi_dvb_frequency_list_dr',
'dvbpsi_GenFrequencyListDr' => 'dvbpsi_gen_dvb_frequency_list_dr',
'dvbpsi_DecodeFrequencyListDr' => 'dvbpsi_decode_dvb_frequency_list_dr',
'dvbpsi_short_event_dr' => 'dvbpsi_dvb_short_event_dr',
'dvbpsi_GenShortEventDr' => 'dvbpsi_gen_dvb_short_event_dr',
'dvbpsi_DecodeShortEventDr' => 'dvbpsi_decode_dvb_short_event_dr',
'dvbpsi_tshifted_ev_dr' => 'dvbpsi_dvb_tshifted_ev_dr',
'dvbpsi_GenTimeShiftedEventDr' => 'dvbpsi_gen_dvb_tshifted_ev_dr',
'dvbpsi_DecodeTimeShiftedEventDr' => 'dvbpsi_decode_dvb_tshifted_ev_dr',
'dvbpsi_country_availability_dr' => 'dvbpsi_dvb_country_availability_dr',
'dvbpsi_GenCountryAvailabilityDr' => 'dvbpsi_gen_dvb_country_availability_dr',
'dvbpsi_DecodeCountryAvailability' => 'dvbpsi_decode_dvb_country_availability_dr',
'dvbpsi_service_list_dr' => 'dvbpsi_dvb_service_list_dr',
'dvbpsi_GenServiceListDr' => 'dvbpsi_gen_dvb_service_list_dr',
'dvbpsi_DecodeServiceListDr' => 'dvbpsi_decode_dvb_service_list_dr',
'dvbpsi_ds_alignment_dr' => 'dvbpsi_mpeg_ds_alignment_dr',
'dvbpsi_GenDSAlignmentDr' => 'dvbpsi_gen_mpeg_ds_alignment_dr',
'dvbpsi_DecodeDSAlignmentDr' => 'dvbpsi_decode_mpeg_ds_alignment_dr',
'dvbpsi_astream_dr' => 'dvbpsi_mpeg_astream_dr',
'dvbpsi_GenAStreamDr' => 'dvbpsi_gen_mpeg_astream_dr',
'dvbpsi_DecodeAStreamDr' => 'dvbpsi_decode_mpeg_astream_dr',
'dvbpsi_iso639_dr' => 'dvbpsi_mpeg_iso639_dr',
'dvbpsi_GenISO639Dr' => 'dvbpsi_gen_mpeg_iso639_dr',
'dvbpsi_DecodeISO639Dr' => 'dvbpsi_decode_mpeg_iso639_dr',
'dvbpsi_sat_deliv_sys_dr' => 'dvbpsi_dvb_sat_deliv_sys_dr',
'dvbpsi_GenSatDelivSysDr' => 'dvbpsi_gen_dvb_sat_deliv_sys_dr',
'dvbpsi_DecodeSatDelivSysDr' => 'dvbpsi_decode_dvb_sat_deliv_sys_dr',
'dvbpsi_std_dr' => 'dvbpsi_mpeg_std_dr',
'dvbpsi_GenSTDDr' => 'dvbpsi_gen_mpeg_std_dr',
'dvbpsi_DecodeSTDDr' => 'dvbpsi_decode_mpeg_std_dr',
'dvbpsi_mpeg4_audio_dr' => 'dvbpsi_mpeg_mpeg4_audio_dr',
'dvbpsi_GenMPEG4AudioDr' => 'dvbpsi_gen_mpeg_mpeg4_audio_dr',
'dvbpsi_DecodeMPEG4AudioDr' => 'dvbpsi_decode_mpeg_mpeg4_audio_dr',
'dvbpsi_local_time_offset_dr' => 'dvbpsi_dvb_local_time_offset_dr',
'dvbpsi_GenLocalTimeOffsetDr' => 'dvbpsi_gen_dvb_local_time_offset_dr',
'dvbpsi_DecodeLocalTimeOffsetDr' => 'dvbpsi_decode_dvb_local_time_offset_dr',
);
sub wanted {
return unless /\.(c|h|cc|cpp|cxx|C|c\+\+|hh|hpp|hxx|h\+\+)$/;
my @file;
tie @file, 'Tie::File', $_ or do {
print STDERR "Could not open $File::Find::name for writing\n";
return;
};
print STDERR;
my $r_names = 0;
for(@file) {
foreach my $key (keys(%names)) {
++$r_names if s/$key/$names{$key}/g;
}
}
untie @file;
print STDERR " : $r_names\n";
}
find(\&wanted, $ARGV[0] ? $ARGV[0] : '.');
exit 0;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment