summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-10-05 18:20:55 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-10-05 18:20:55 +0000
commitd32030ae51012a5bd86f8d0db70ee670114aae1e (patch)
tree0a4b65f9ca6da9bf2d7a2f41f4d115cce477dd26
parentc1aed14da1f321034f34246af4410993cd0e8912 (diff)
downloadkaffeine-d32030ae51012a5bd86f8d0db70ee670114aae1e.tar.gz
kaffeine-d32030ae51012a5bd86f8d0db70ee670114aae1e.zip
Updated Kaffeine to latest upstream version
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kaffeine@1182813 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--ChangeLog25
-rw-r--r--VERSION2
-rw-r--r--acinclude.m42308
-rw-r--r--aclocal.m413024
-rw-r--r--configure.in14
-rw-r--r--configure.in.in7
-rw-r--r--doc/kaffeine/discwindow.pngbin193843 -> 193848 bytes
-rw-r--r--doc/kaffeine/dvbbroadcast.pngbin17420 -> 17421 bytes
-rw-r--r--doc/kaffeine/dvbclient.pngbin399894 -> 399897 bytes
-rw-r--r--doc/kaffeine/dvbconfig.pngbin38307 -> 38308 bytes
-rw-r--r--doc/kaffeine/dvbepg.pngbin25148 -> 25149 bytes
-rw-r--r--doc/kaffeine/dvbscan.pngbin44517 -> 44518 bytes
-rw-r--r--doc/kaffeine/dvbtimers.pngbin33003 -> 33004 bytes
-rw-r--r--doc/kaffeine/dvbwin.pngbin266094 -> 266099 bytes
-rw-r--r--doc/kaffeine/gstpart.pngbin43273 -> 43274 bytes
-rw-r--r--doc/kaffeine/kaffeinepart.pngbin106672 -> 106676 bytes
-rw-r--r--doc/kaffeine/playlistwin.pngbin85131 -> 85132 bytes
-rw-r--r--doc/kaffeine/startwindow.pngbin38148 -> 38149 bytes
-rw-r--r--kaffeine/configure.in.in2
-rw-r--r--kaffeine/images/dvbdata.tar.gzbin62343 -> 72330 bytes
-rw-r--r--kaffeine/src/input/disc/Makefile.am2
-rw-r--r--kaffeine/src/input/disc/paranoia.cpp16
-rw-r--r--kaffeine/src/input/disc/paranoia.h8
-rw-r--r--kaffeine/src/input/disc/plugins/oggvorbis/Makefile.am2
-rw-r--r--kaffeine/src/input/dvb/Makefile.am2
-rw-r--r--kaffeine/src/input/dvb/camdialog.ui149
-rw-r--r--kaffeine/src/input/dvb/cammenudialog.ui67
-rw-r--r--kaffeine/src/input/dvb/channeldesc.cpp4
-rw-r--r--kaffeine/src/input/dvb/channeldesc.h2
-rw-r--r--kaffeine/src/input/dvb/channeleditor.cpp62
-rw-r--r--kaffeine/src/input/dvb/channeleditor.h3
-rw-r--r--kaffeine/src/input/dvb/channeleditorui.ui86
-rw-r--r--kaffeine/src/input/dvb/dvbcam.cpp1252
-rw-r--r--kaffeine/src/input/dvb/dvbcam.h175
-rw-r--r--kaffeine/src/input/dvb/dvbconfig.cpp174
-rw-r--r--kaffeine/src/input/dvb/dvbconfig.h69
-rw-r--r--kaffeine/src/input/dvb/dvbout.cpp57
-rw-r--r--kaffeine/src/input/dvb/dvbout.h3
-rw-r--r--kaffeine/src/input/dvb/dvbpanel.cpp129
-rw-r--r--kaffeine/src/input/dvb/dvbpanel.h3
-rw-r--r--kaffeine/src/input/dvb/dvbsi.cpp305
-rw-r--r--kaffeine/src/input/dvb/dvbsi.h9
-rw-r--r--kaffeine/src/input/dvb/dvbstream.cpp423
-rw-r--r--kaffeine/src/input/dvb/dvbstream.h9
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbapi/Makefile.am5
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbapi/dvbaudio.c50
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbapi/dvbaudio.h55
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbapi/dvbdemux.c12
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbapi/dvbdemux.h6
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbapi/dvbfe.c580
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbapi/dvbfe.h233
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbapi/dvbnet.c11
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbapi/dvbnet.h10
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbapi/dvbvideo.c46
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbapi/dvbvideo.h46
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/Makefile.am5
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/asn_1.c90
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/asn_1.h16
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ai.c242
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ai.h47
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_auth.c247
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_auth.h48
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ca.c1030
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ca.h126
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_datetime.c212
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_datetime.h45
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_dvb.c387
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_dvb.h68
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_epg.c217
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_epg.h52
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_lowspeed.c899
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_lowspeed.h113
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_mmi.c2397
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_mmi.h307
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_rm.c451
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_rm.h67
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_smartcard.c447
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_smartcard.h79
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_tags.h24
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_teletext.c174
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_teletext.h39
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_utils.c23
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_utils.h59
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_errno.h37
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_session.c1785
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_session.h96
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam.c54
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam.h102
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam_hlci.c216
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam_llci.c437
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_transport.c2250
-rw-r--r--kaffeine/src/input/dvb/lib/libdvben50221/en50221_transport.h85
-rw-r--r--kaffeine/src/input/dvb/lib/libdvbmisc/dvbmisc.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/Makefile.am8
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/Makefile.am17
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/ac3_descriptor.h112
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/atsc_text.c743
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/caption_service_descriptor.h137
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/component_name_descriptor.h92
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/content_advisory_descriptor.h235
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/cvct_section.c77
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/cvct_section.h228
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/dcc_arriving_request_descriptor.h107
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/dcc_departing_request_descriptor.h108
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/dccsct_section.c109
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/dccsct_section.h327
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/dcct_section.c96
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/dcct_section.h380
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/descriptor.h30
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/eit_section.c71
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/eit_section.h191
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/ett_section.c42
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/ett_section.h91
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/extended_channel_name_descriptor.h92
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/genre_descriptor.h82
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/mgt_section.c76
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/mgt_section.h215
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/rc_descriptor.h83
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/rrt_section.c108
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/rrt_section.h379
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/section.h65
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/service_location_descriptor.h141
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/stt_section.c42
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/stt_section.h105
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/stuffing_descriptor.h82
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/time_shifted_service_descriptor.h136
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/tvct_section.c81
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/tvct_section.h227
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/types.c71
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/atsc/types.h227
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/crc32.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/descriptor.h6
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/ac3_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/adaptation_field_data_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/ait_application_descriptor.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/ait_application_icons_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/ancillary_data_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/announcement_support_descriptor.h8
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/application_signalling_descriptor.h6
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/bat_section.c4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/bat_section.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/cable_delivery_descriptor.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/cell_frequency_link_descriptor.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/cell_list_descriptor.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/component_descriptor.h6
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/content_descriptor.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/content_identifier_descriptor.h17
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/country_availability_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/data_broadcast_id_descriptor.h131
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/descriptor.h38
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/eit_section.c10
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/eit_section.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/extended_event_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/frequency_list_descriptor.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/int_section.c7
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/int_section.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_platform_name_descriptor.h87
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_platform_provider_name_descriptor.h87
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_stream_location_descriptor.h73
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/linkage_descriptor.h14
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/local_time_offset_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/mhp_data_broadcast_id_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/mosaic_descriptor.h6
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/mpe_fec_section.h73
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/nit_section.c5
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/parental_rating_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/partial_transport_stream_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/pdc_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/rnt_rar_over_dvb_stream_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/rnt_rar_over_ip_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/rst_section.c4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/rst_section.h3
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/s2_satellite_delivery_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/satellite_delivery_descriptor.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/sdt_section.c4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/sdt_section.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/section.h1
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/service_availability_descriptor.h6
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/service_descriptor.h9
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/short_smoothing_buffer_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/sit_section.c5
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/sit_section.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_address_descriptor.h116
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_slash_descriptor.h116
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_source_slash_descriptor.h118
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_address_descriptor.h116
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_slash_descriptor.h116
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_source_slash_descriptor.h118
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/tdt_section.c2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/telephone_descriptor.h6
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/teletext_descriptor.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/terrestrial_delivery_descriptor.h6
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/time_slice_fec_identifier_descriptor.h94
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/tot_section.c6
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/tva_container_section.c2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/tva_container_section.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/tva_id_descriptor.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/types.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/vbi_data_descriptor.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/dvb/vbi_teletext_descriptor.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/cat_section.c2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/cat_section.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/datagram_section.h81
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/metadata_section.c1
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/odsmt_section.c4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/odsmt_section.h22
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/pat_section.c4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/pat_section.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/pmt_section.c4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/pmt_section.h12
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/section.h4
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/tsdt_section.c3
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/mpeg/tsdt_section.h2
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/section.h68
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/section_buf.h7
-rw-r--r--kaffeine/src/input/dvb/lib/libucsi/transport_packet.h2
-rw-r--r--kaffeine/src/input/dvb/plugins/epg/kaffeinedvbsection.cpp3
-rw-r--r--kaffeine/src/input/dvb/scandialog.cpp58
-rw-r--r--kaffeine/src/input/dvb/scandialogui.ui376
-rw-r--r--kaffeine/src/input/dvb/ts2rtp.cpp7
-rw-r--r--kaffeine/src/kaffeine.cpp26
-rw-r--r--kaffeine/src/kaffeine.desktop8
-rw-r--r--kaffeine/src/kaffeine.h1
-rw-r--r--kaffeine/src/kaffeine.profile.xml4
-rw-r--r--kaffeine/src/kaffeineiface.h2
-rw-r--r--kaffeine/src/main.cpp2
-rw-r--r--kaffeine/src/player-parts/dummy-part/Makefile825
-rw-r--r--kaffeine/src/player-parts/gstreamer-part/Makefile.am2
-rw-r--r--kaffeine/src/player-parts/gstreamer-part/gstreamer_part.desktop5
-rw-r--r--kaffeine/src/player-parts/kaffeine-part/kaffeinepart.cpp26
-rw-r--r--kaffeine/src/player-parts/kaffeine-part/kaffeinepart.h5
-rw-r--r--kaffeine/src/player-parts/xine-part/Makefile.am2
-rw-r--r--kaffeine/src/player-parts/xine-part/kxinewidget.cpp50
-rw-r--r--kaffeine/src/player-parts/xine-part/kxinewidget.h1
-rw-r--r--kaffeine/src/player-parts/xine-part/xine_part.desktop5
-rw-r--r--kaffeine/src/version.h2
236 files changed, 31023 insertions, 9964 deletions
diff --git a/ChangeLog b/ChangeLog
index d0906a6..5c2eb6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,31 @@
* KAFFEINE ChangeLog *
****************************
+0.8.8
+
+* DVB: allow OSD on HD channels.
+* DVB: PAT/PMT radios fixes.
+* DVB: added live ringbuffer size option (in misc page)
+* DVB: added tuner priority option.
+* DVB: added mini-Diseqc option.
+* DVB: added "Sending diseqc cmds twice" option.
+* DVB: added "External positionner" option.
+* DVB: option to disable MFE probing.
+* DVB: add DVB-S2 support.
+* DVB: port to S2API.
+* DVB: fixed crash that sometimes occurred during ATSC scanning
+* DVB: improve support for ATSC scanning on cable (QAM)
+
+0.8.7
+
+* kaffeine: add MOD/STM mimetypes
+* kaffeine: fullscreen fix, patch by Einars Lielmanis <einars@gmail.com>
+* DVB: updated libdvb, added CAM menu.
+* DVB: added multiservices CAM support.
+* DVB: added ATSC scanning, patch by "Devin Heitmueller" <devin.heitmueller@gmail.com>
+* DVB: added 7MHz autoscan.
+* DVB: reworked CAM support.
+
0.8.6
* kaffeine: new jpeg logo (the animated one is renamed logo.avi)
diff --git a/VERSION b/VERSION
index fb396f6..830a33c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-kaffeine version 0.8.6
+kaffeine version 0.8.8
diff --git a/acinclude.m4 b/acinclude.m4
index 360ee48..b052f24 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1689,6 +1689,15 @@ AC_DEFUN([KDE_CHECK_CLOSURE],
KDE_USE_CLOSURE_TRUE="#"
KDE_USE_CLOSURE_FALSE=""
KDE_NO_UNDEFINED=""
+ case $host in
+ *-*-linux-gnu)
+ KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined],
+ [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined],
+ [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"],
+ [KDE_NO_UNDEFINED=""])],
+ [KDE_NO_UNDEFINED=""])
+ ;;
+ esac
fi
AC_SUBST(KDE_USE_CLOSURE_TRUE)
AC_SUBST(KDE_USE_CLOSURE_FALSE)
@@ -2135,6 +2144,9 @@ AC_LANG_CPLUSPLUS
save_CXXFLAGS="$CXXFLAGS"
kde_safe_LIBS="$LIBS"
LIBS="$LIBS $X_EXTRA_LIBS"
+if test "$GXX" = "yes"; then
+CXXFLAGS="$CXXFLAGS -pedantic-errors"
+fi
AC_TRY_COMPILE([
$2
],
@@ -5959,15 +5971,30 @@ AC_DEFUN([KDE_CHECK_PIE_SUPPORT],
fi
])
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-## Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007
+## Copyright 1996, 1997, 1998, 1999, 2000, 2001
## Free Software Foundation, Inc.
## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
##
-## This file is free software; the Free Software Foundation gives
-## unlimited permission to copy and/or distribute it, with or without
-## modifications, as long as this notice is preserved.
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+##
+## As a special exception to the GNU General Public License, if you
+## distribute this file as part of a program that contains a
+## configuration script generated by Autoconf, you may include it under
+## the same distribution terms that you use for the rest of that program.
-# serial 51 Debian 1.5.24-1 AC_PROG_LIBTOOL
+# serial 47 AC_PROG_LIBTOOL
# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
@@ -6027,7 +6054,7 @@ AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
AC_SUBST(LIBTOOL)dnl
# Prevent multiple expansion
@@ -6077,7 +6104,7 @@ esac
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
-Xsed='sed -e 1s/^X//'
+Xsed='sed -e s/^X//'
[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
# Same as above, but do not quote variable references.
@@ -6097,7 +6124,7 @@ rm="rm -f"
default_ofile=libtool
can_build_shared=yes
-# All known linkers require a `.a' archive for static linking (except MSVC,
+# All known linkers require a `.a' archive for static linking (except M$VC,
# which needs '.lib').
libext=a
ltmain="$ac_aux_dir/ltmain.sh"
@@ -6117,7 +6144,6 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru
test -z "$AS" && AS=as
test -z "$CC" && CC=cc
test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
test -z "$DLLTOOL" && DLLTOOL=dlltool
test -z "$LD" && LD=ld
test -z "$LN_S" && LN_S="ln -s"
@@ -6130,24 +6156,22 @@ test -z "$STRIP" && STRIP=:
test -z "$ac_objext" && ac_objext=o
# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
old_postinstall_cmds='chmod 644 $oldlib'
old_postuninstall_cmds=
if test -n "$RANLIB"; then
case $host_os in
openbsd*)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
;;
*)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
;;
esac
old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
fi
-_LT_CC_BASENAME([$compiler])
-
# Only perform the check for file, if the check method requires it
case $deplibs_check_method in
file_magic*)
@@ -6188,58 +6212,11 @@ AC_DEFUN([_LT_AC_SYS_COMPILER],
# If no C compiler was specified, use CC.
LTCC=${LTCC-"$CC"}
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
# Allow CC to be a program name with arguments.
compiler=$CC
])# _LT_AC_SYS_COMPILER
-# _LT_CC_BASENAME(CC)
-# -------------------
-# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
-AC_DEFUN([_LT_CC_BASENAME],
-[for cc_temp in $1""; do
- case $cc_temp in
- compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
- distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
- \-*) ;;
- *) break;;
- esac
-done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
-])
-
-
-# _LT_COMPILER_BOILERPLATE
-# ------------------------
-# Check for compiler boilerplate output or warnings with
-# the simple compiler test code.
-AC_DEFUN([_LT_COMPILER_BOILERPLATE],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
-])# _LT_COMPILER_BOILERPLATE
-
-
-# _LT_LINKER_BOILERPLATE
-# ----------------------
-# Check for linker boilerplate output or warnings with
-# the simple link test code.
-AC_DEFUN([_LT_LINKER_BOILERPLATE],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm conftest*
-])# _LT_LINKER_BOILERPLATE
-
-
# _LT_AC_SYS_LIBPATH_AIX
# ----------------------
# Links a minimal program and checks the executable
@@ -6249,20 +6226,12 @@ $rm conftest*
# If we don't find anything, use the default library path according
# to the aix ld manual.
AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\(.*\)$/\1/
- p
- }
- }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi],[])
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi],[])
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
])# _LT_AC_SYS_LIBPATH_AIX
@@ -6320,15 +6289,15 @@ fi
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
if test -z "$ECHO"; then
if test "X${echo_test_string+set}" != Xset; then
# find a string as large as possible, as long as the shell can cope with it
for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
# expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
- if (echo_test_string=`eval $cmd`) 2>/dev/null &&
- echo_test_string=`eval $cmd` &&
+ if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+ echo_test_string="`eval $cmd`" &&
(test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
then
break
@@ -6493,21 +6462,18 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|sparc*-*linux*)
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
- case `/usr/bin/file conftest.o` in
+ case "`/usr/bin/file conftest.o`" in
*32-bit*)
+ LINUX_64_MODE="32"
case $host in
- x86_64-*kfreebsd*-gnu)
- LD="${LD-ld} -m elf_i386_fbsd"
- ;;
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ ppc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6519,10 +6485,8 @@ s390*-*linux*|sparc*-*linux*)
esac
;;
*64-bit*)
+ LINUX_64_MODE="64"
case $host in
- x86_64-*kfreebsd*-gnu)
- LD="${LD-ld} -m elf_x86_64_fbsd"
- ;;
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
@@ -6555,22 +6519,6 @@ s390*-*linux*|sparc*-*linux*)
CFLAGS="$SAVE_CFLAGS"
fi
;;
-sparc*-*solaris*)
- # Find out which ABI we are using.
- echo 'int i;' > conftest.$ac_ext
- if AC_TRY_EVAL(ac_compile); then
- case `/usr/bin/file conftest.o` in
- *64-bit*)
- case $lt_cv_prog_gnu_ld in
- yes*) LD="${LD-ld} -m elf64_sparc" ;;
- *) LD="${LD-ld} -64" ;;
- esac
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-
AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
@@ -6594,7 +6542,7 @@ AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
AC_CACHE_CHECK([$1], [$2],
[$2=no
ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
- echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="$3"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
@@ -6602,7 +6550,7 @@ AC_CACHE_CHECK([$1], [$2],
# with a dollar sign (not a hyphen), so the echo should work correctly.
# The option is referenced via a variable to avoid confusing sed.
lt_compile=`echo "$ac_compile" | $SED \
- -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
@@ -6612,10 +6560,8 @@ AC_CACHE_CHECK([$1], [$2],
echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
- # So say no if there are warnings other than the usual output.
- $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ # So say no if there are warnings
+ if test ! -s conftest.err; then
$2=yes
fi
fi
@@ -6635,23 +6581,17 @@ fi
# ------------------------------------------------------------
# Check whether the given compiler option works
AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
+[AC_CACHE_CHECK([$1], [$2],
[$2=no
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $3"
- echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ printf "$lt_simple_link_test_code" > conftest.$ac_ext
if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
- # The linker can only warn and ignore the option if not recognized
+ # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s conftest.err; then
# Append any errors to the config.log.
cat conftest.err 1>&AS_MESSAGE_LOG_FD
- $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if diff conftest.exp conftest.er2 >/dev/null; then
- $2=yes
- fi
else
$2=yes
fi
@@ -6675,7 +6615,7 @@ AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
AC_MSG_CHECKING([the maximum length of command line arguments])
AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
i=0
- teststring="ABCD"
+ testring="ABCD"
case $build_os in
msdosdjgpp*)
@@ -6704,77 +6644,24 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
lt_cv_sys_max_cmd_len=8192;
;;
- amigaos*)
- # On AmigaOS with pdksh, this test takes hours, literally.
- # So we just punt and use a minimum line length of 8192.
- lt_cv_sys_max_cmd_len=8192;
- ;;
-
- netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
- # This has been around since 386BSD, at least. Likely further.
- if test -x /sbin/sysctl; then
- lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
- elif test -x /usr/sbin/sysctl; then
- lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
- else
- lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
- fi
- # And add a safety zone
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
- ;;
-
- interix*)
- # We know the value 262144 and hardcode it with a safety zone (like BSD)
- lt_cv_sys_max_cmd_len=196608
- ;;
-
- osf*)
- # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
- # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
- # nice to cause kernel panics so lets avoid the loop below.
- # First set a reasonable default.
- lt_cv_sys_max_cmd_len=16384
- #
- if test -x /sbin/sysconfig; then
- case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
- *1*) lt_cv_sys_max_cmd_len=-1 ;;
- esac
- fi
- ;;
- sco3.2v5*)
- lt_cv_sys_max_cmd_len=102400
- ;;
- sysv5* | sco5v6* | sysv4.2uw2*)
- kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
- if test -n "$kargmax"; then
- lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
- else
- lt_cv_sys_max_cmd_len=32768
- fi
- ;;
- *)
- lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
- if test -n "$lt_cv_sys_max_cmd_len"; then
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
- else
- SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
- while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
- = "XX$teststring") >/dev/null 2>&1 &&
- new_result=`expr "X$teststring" : ".*" 2>&1` &&
- lt_cv_sys_max_cmd_len=$new_result &&
- test $i != 17 # 1/2 MB should be enough
- do
- i=`expr $i + 1`
- teststring=$teststring$teststring
- done
- teststring=
- # Add a significant safety factor because C++ compilers can tack on massive
- # amounts of additional arguments before passing them to the linker.
- # It appears as though 1/2 is a usable value.
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
- fi
+ *)
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \
+ = "XX$testring") >/dev/null 2>&1 &&
+ new_result=`expr "X$testring" : ".*" 2>&1` &&
+ lt_cv_sys_max_cmd_len=$new_result &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ testring=$testring$testring
+ done
+ testring=
+ # Add a significant safety factor because C++ compilers can tack on massive
+ # amounts of additional arguments before passing them to the linker.
+ # It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
;;
esac
])
@@ -6787,7 +6674,7 @@ fi
# _LT_AC_CHECK_DLFCN
-# ------------------
+# --------------------
AC_DEFUN([_LT_AC_CHECK_DLFCN],
[AC_CHECK_HEADERS(dlfcn.h)dnl
])# _LT_AC_CHECK_DLFCN
@@ -6795,7 +6682,7 @@ AC_DEFUN([_LT_AC_CHECK_DLFCN],
# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
-# ---------------------------------------------------------------------
+# ------------------------------------------------------------------
AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
if test "$cross_compiling" = yes; then :
@@ -6861,19 +6748,17 @@ int main ()
else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
/* dlclose (self); */
}
- else
- puts (dlerror ());
exit (status);
}]
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
- (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ (./conftest; exit; ) 2>/dev/null
lt_status=$?
case x$lt_status in
x$lt_dlno_uscore) $1 ;;
x$lt_dlneed_uscore) $2 ;;
- x$lt_dlunknown|x*) $3 ;;
+ x$lt_unknown|x*) $3 ;;
esac
else :
# compilation failed
@@ -6885,7 +6770,7 @@ rm -fr conftest*
# AC_LIBTOOL_DLOPEN_SELF
-# ----------------------
+# -------------------
AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
if test "x$enable_dlopen" != xyes; then
@@ -6922,7 +6807,7 @@ else
lt_cv_dlopen_self=yes
])
;;
-
+
*)
AC_CHECK_FUNC([shl_load],
[lt_cv_dlopen="shl_load"],
@@ -6956,7 +6841,7 @@ else
test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
save_LDFLAGS="$LDFLAGS"
- wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
save_LIBS="$LIBS"
LIBS="$lt_cv_dlopen_libs $LIBS"
@@ -6969,7 +6854,7 @@ else
])
if test "x$lt_cv_dlopen_self" = xyes; then
- wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ LDFLAGS="$LDFLAGS $link_static_flag"
AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
lt_cv_dlopen_self_static, [dnl
_LT_AC_TRY_DLOPEN_SELF(
@@ -7001,8 +6886,7 @@ fi
# ---------------------------------
# Check to see if options -c and -o are simultaneously supported by compiler
AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
[_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
[_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
@@ -7010,7 +6894,14 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
mkdir conftest
cd conftest
mkdir out
- echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+ # that will create temporary files in the current directory regardless of
+ # the output directory. Thus, making CWD read-only will cause this test
+ # to fail, enabling locking or at least warning the user not to do parallel
+ # builds.
+ chmod -w .
lt_compiler_flag="-o out/conftest2.$ac_objext"
# Insert the option either (1) after the last *FLAGS variable, or
@@ -7018,7 +6909,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
# Note that $ac_compile itself does not contain backslashes and begins
# with a dollar sign (not a hyphen), so the echo should work correctly.
lt_compile=`echo "$ac_compile" | $SED \
- -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
@@ -7030,18 +6921,13 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
- $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
- $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
- if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ if test ! -s out/conftest.err; then
_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
fi
fi
- chmod u+w . 2>&AS_MESSAGE_LOG_FD
- $rm conftest*
- # SGI C++ compiler will create directory out/ii_files/ for
- # template instantiation
- test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
- $rm out/* && rmdir out
+ chmod u+w .
+ $rm conftest* out/*
+ rmdir out
cd ..
rmdir conftest
$rm conftest*
@@ -7100,8 +6986,8 @@ AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
[AC_MSG_CHECKING([how to hardcode library paths into programs])
_LT_AC_TAGVAR(hardcode_action, $1)=
if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
- test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
- test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+ test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \
+ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then
# We can hardcode non-existant directories.
if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
@@ -7150,7 +7036,6 @@ else
darwin*)
if test -n "$STRIP" ; then
striplib="$STRIP -x"
- old_striplib="$STRIP -S"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
@@ -7159,7 +7044,7 @@ fi
*)
AC_MSG_RESULT([no])
;;
- esac
+ esac
fi
])# AC_LIBTOOL_SYS_LIB_STRIP
@@ -7168,12 +7053,11 @@ fi
# -----------------------------
# PORTME Fill in your ld.so characteristics
AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_MSG_CHECKING([dynamic linker characteristics])
+[AC_MSG_CHECKING([dynamic linker characteristics])
library_names_spec=
libname_spec='lib$name'
soname_spec=
-shrext_cmds=".so"
+shrext=".so"
postinstall_cmds=
postuninstall_cmds=
finish_cmds=
@@ -7183,58 +7067,7 @@ shlibpath_overrides_runpath=unknown
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_dlsearch_path_spec="/lib /usr/lib"
-m4_if($1,[],[
-if test "$GCC" = yes; then
- case $host_os in
- darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
- *) lt_awk_arg="/^libraries:/" ;;
- esac
- lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
- if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
- # if the path contains ";" then we assume it to be the separator
- # otherwise default to the standard path separator (i.e. ":") - it is
- # assumed that no part of a normal pathname contains ";" but that should
- # okay in the real world where ";" in dirpaths is itself problematic.
- lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
- else
- lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
- fi
- # Ok, now we have the path, separated by spaces, we can step through it
- # and add multilib dir if necessary.
- lt_tmp_lt_search_path_spec=
- lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
- for lt_sys_path in $lt_search_path_spec; do
- if test -d "$lt_sys_path/$lt_multi_os_dir"; then
- lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
- else
- test -d "$lt_sys_path" && \
- lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
- fi
- done
- lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
-BEGIN {RS=" "; FS="/|\n";} {
- lt_foo="";
- lt_count=0;
- for (lt_i = NF; lt_i > 0; lt_i--) {
- if ($lt_i != "" && $lt_i != ".") {
- if ($lt_i == "..") {
- lt_count++;
- } else {
- if (lt_count == 0) {
- lt_foo="/" $lt_i lt_foo;
- } else {
- lt_count--;
- }
- }
- }
- }
- if (lt_foo != "") { lt_freq[[lt_foo]]++; }
- if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
-}'`
- sys_lib_search_path_spec=`echo $lt_search_path_spec`
-else
- sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi])
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
need_lib_prefix=unknown
hardcode_into_libs=no
@@ -7299,7 +7132,7 @@ aix4* | aix5*)
amigaos*)
library_names_spec='$libname.ixlibrary $libname.a'
# Create ${libname}_ixlibrary.a entries in /sys/libs.
- finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
;;
beos*)
@@ -7308,7 +7141,7 @@ beos*)
shlibpath_var=LIBRARY_PATH
;;
-bsdi[[45]]*)
+bsdi4*)
version_type=linux
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -7324,7 +7157,7 @@ bsdi[[45]]*)
cygwin* | mingw* | pw32*)
version_type=windows
- shrext_cmds=".dll"
+ shrext=".dll"
need_version=no
need_lib_prefix=no
@@ -7336,8 +7169,7 @@ cygwin* | mingw* | pw32*)
dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
dldir=$destdir/`dirname \$dlpath`~
test -d \$dldir || mkdir -p \$dldir~
- $install_prog $dir/$dlname \$dldir/$dlname~
- chmod a+x \$dldir/$dlname'
+ $install_prog $dir/$dlname \$dldir/$dlname'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
$rm \$dlpath'
@@ -7367,7 +7199,7 @@ cygwin* | mingw* | pw32*)
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
- library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
;;
esac
;;
@@ -7390,9 +7222,13 @@ darwin* | rhapsody*)
soname_spec='${libname}${release}${major}$shared_ext'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
- m4_if([$1], [],[
- sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+ shrext='$(test .$module = .yes && echo .so || echo .dylib)'
+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+ if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+ else
+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+ fi
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
;;
@@ -7409,17 +7245,20 @@ freebsd1*)
dynamic_linker=no
;;
-freebsd* | dragonfly*)
- # DragonFly does not have aout. When/if they implement a new
- # versioning mechanism, adjust this.
- if test -x /usr/bin/objformat; then
- objformat=`/usr/bin/objformat`
- else
- case $host_os in
- freebsd[[123]]*) objformat=aout ;;
- *) objformat=elf ;;
- esac
- fi
+kfreebsd*-gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
version_type=freebsd-$objformat
case $version_type in
freebsd-elf*)
@@ -7437,19 +7276,14 @@ freebsd* | dragonfly*)
freebsd2*)
shlibpath_overrides_runpath=yes
;;
- freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+ freebsd3.[01]* | freebsdelf3.[01]*)
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
- freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
- freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+ *) # from 3.2 on
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
- *) # from 4.6 on, and DragonFly
- shlibpath_overrides_runpath=yes
- hardcode_into_libs=yes
- ;;
esac
;;
@@ -7469,9 +7303,9 @@ hpux9* | hpux10* | hpux11*)
version_type=sunos
need_lib_prefix=no
need_version=no
- case $host_cpu in
+ case "$host_cpu" in
ia64*)
- shrext_cmds='.so'
+ shrext='.so'
hardcode_into_libs=yes
dynamic_linker="$host_os dld.so"
shlibpath_var=LD_LIBRARY_PATH
@@ -7486,7 +7320,7 @@ hpux9* | hpux10* | hpux11*)
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
hppa*64*)
- shrext_cmds='.sl'
+ shrext='.sl'
hardcode_into_libs=yes
dynamic_linker="$host_os dld.sl"
shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
@@ -7497,7 +7331,7 @@ hpux9* | hpux10* | hpux11*)
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
*)
- shrext_cmds='.sl'
+ shrext='.sl'
dynamic_linker="$host_os dld.sl"
shlibpath_var=SHLIB_PATH
shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
@@ -7509,18 +7343,6 @@ hpux9* | hpux10* | hpux11*)
postinstall_cmds='chmod 555 $lib'
;;
-interix[[3-9]]*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
-
irix5* | irix6* | nonstopux*)
case $host_os in
nonstopux*) version_type=nonstopux ;;
@@ -7564,26 +7386,29 @@ linux*oldld* | linux*aout* | linux*coff*)
;;
# This must be Linux ELF.
-linux* | k*bsd*-gnu)
+linux*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ libsuff=
+ if test "x$LINUX_64_MODE" = x64; then
+ # Some platforms are per default 64-bit, so there's no /lib64
+ if test -d /lib64 -a ! -h /lib64; then
+ libsuff=64
+ fi
+ fi
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
# This implies no fast_install, which is unacceptable.
# Some rework will be needed to allow for fast_install
# before this can be enabled.
hardcode_into_libs=yes
- # Append ld.so.conf contents to the search path
- if test -f /etc/ld.so.conf; then
- lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
- fi
-
# We used to test for /lib/ld.so.1 and disable shared libraries on
# powerpc, because MkLinux only supported shared libraries with the
# GNU dynamic linker. Since this was broken with cross compilers,
@@ -7593,18 +7418,6 @@ linux* | k*bsd*-gnu)
dynamic_linker='GNU/Linux ld.so'
;;
-netbsdelf*-gnu)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- dynamic_linker='NetBSD ld.elf_so'
- ;;
-
netbsd*)
version_type=sunos
need_lib_prefix=no
@@ -7614,7 +7427,7 @@ netbsd*)
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
dynamic_linker='NetBSD ld.elf_so'
fi
@@ -7642,13 +7455,8 @@ nto-qnx*)
openbsd*)
version_type=sunos
- sys_lib_dlsearch_path_spec="/usr/lib"
need_lib_prefix=no
- # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
- case $host_os in
- openbsd3.3 | openbsd3.3.*) need_version=yes ;;
- *) need_version=no ;;
- esac
+ need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
@@ -7668,7 +7476,7 @@ openbsd*)
os2*)
libname_spec='$name'
- shrext_cmds=".dll"
+ shrext=".dll"
need_lib_prefix=no
library_names_spec='$libname${shared_ext} $libname.a'
dynamic_linker='OS/2 ld.exe'
@@ -7686,8 +7494,11 @@ osf3* | osf4* | osf5*)
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
;;
-rdos*)
- dynamic_linker=no
+sco3.2v5*)
+ version_type=osf
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
;;
solaris*)
@@ -7715,7 +7526,7 @@ sunos4*)
need_version=yes
;;
-sysv4 | sysv4.3*)
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
version_type=linux
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
@@ -7748,29 +7559,6 @@ sysv4*MP*)
fi
;;
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- version_type=freebsd-elf
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- hardcode_into_libs=yes
- if test "$with_gnu_ld" = yes; then
- sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
- shlibpath_overrides_runpath=no
- else
- sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
- shlibpath_overrides_runpath=yes
- case $host_os in
- sco3.2v5*)
- sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
- ;;
- esac
- fi
- sys_lib_dlsearch_path_spec='/usr/lib'
- ;;
-
uts4*)
version_type=linux
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -7784,19 +7572,13 @@ uts4*)
esac
AC_MSG_RESULT([$dynamic_linker])
test "$dynamic_linker" = no && can_build_shared=no
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
- variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
# _LT_AC_TAGCONFIG
# ----------------
AC_DEFUN([_LT_AC_TAGCONFIG],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_ARG_WITH([tags],
+[AC_ARG_WITH([tags],
[AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
[include additional configurations @<:@automatic@:>@])],
[tagnames="$withval"])
@@ -7814,9 +7596,6 @@ if test -f "$ltmain" && test -n "$tagnames"; then
AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
fi
fi
- if test -z "$LTCFLAGS"; then
- eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
- fi
# Extract list of available tagged configurations in $ofile.
# Note that this assumes the entire list is on one line.
@@ -7843,9 +7622,7 @@ if test -f "$ltmain" && test -n "$tagnames"; then
case $tagname in
CXX)
- if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
- ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
- (test "X$CXX" != "Xg++"))) ; then
+ if test -n "$CXX" && test "X$CXX" != "Xno"; then
AC_LIBTOOL_LANG_CXX_CONFIG
else
tagname=""
@@ -7907,7 +7684,7 @@ AC_DEFUN([AC_LIBTOOL_DLOPEN],
# AC_LIBTOOL_WIN32_DLL
# --------------------
-# declare package support for building win32 DLLs
+# declare package support for building win32 dll's
AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
])# AC_LIBTOOL_WIN32_DLL
@@ -7945,7 +7722,7 @@ AC_ARG_ENABLE([shared],
# AC_DISABLE_SHARED
# -----------------
-# set the default shared flag to --disable-shared
+#- set the default shared flag to --disable-shared
AC_DEFUN([AC_DISABLE_SHARED],
[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_SHARED(no)
@@ -8057,7 +7834,7 @@ m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
# AC_PATH_TOOL_PREFIX
# -------------------
-# find a file program which can recognize shared library
+# find a file program which can recognise shared library
AC_DEFUN([AC_PATH_TOOL_PREFIX],
[AC_REQUIRE([AC_PROG_EGREP])dnl
AC_MSG_CHECKING([for $1])
@@ -8081,7 +7858,7 @@ dnl not every word. This closes a longstanding sh security hole.
if test -n "$file_magic_test_file"; then
case $deplibs_check_method in
"file_magic "*)
- file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
$EGREP "$file_magic_regex" > /dev/null; then
@@ -8120,7 +7897,7 @@ fi
# AC_PATH_MAGIC
# -------------
-# find a file program which can recognize a shared library
+# find a file program which can recognise a shared library
AC_DEFUN([AC_PATH_MAGIC],
[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
if test -z "$lt_cv_path_MAGIC_CMD"; then
@@ -8191,7 +7968,7 @@ AC_CACHE_VAL(lt_cv_path_LD,
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
lt_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some variants of GNU ld only accept -v.
+ # but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
@@ -8223,7 +8000,7 @@ AC_PROG_LD_GNU
AC_DEFUN([AC_PROG_LD_GNU],
[AC_REQUIRE([AC_PROG_EGREP])dnl
AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
case `$LD -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
lt_cv_prog_gnu_ld=yes
@@ -8250,15 +8027,6 @@ case $reload_flag in
*) reload_flag=" $reload_flag" ;;
esac
reload_cmds='$LD$reload_flag -o $output$reload_objs'
-case $host_os in
- darwin*)
- if test "$GCC" = yes; then
- reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
- else
- reload_cmds='$LD$reload_flag -o $output$reload_objs'
- fi
- ;;
-esac
])# AC_PROG_LD_RELOAD_FLAG
@@ -8267,7 +8035,7 @@ esac
# how to check for library dependencies
# -- PORTME fill in with the dynamic library characteristics
AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
-[AC_CACHE_CHECK([how to recognize dependent libraries],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
lt_cv_deplibs_check_method,
[lt_cv_file_magic_cmd='$MAGIC_CMD'
lt_cv_file_magic_test_file=
@@ -8292,42 +8060,44 @@ beos*)
lt_cv_deplibs_check_method=pass_all
;;
-bsdi[[45]]*)
+bsdi4*)
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
lt_cv_file_magic_cmd='/usr/bin/file -L'
lt_cv_file_magic_test_file=/shlib/libc.so
;;
cygwin*)
- # func_win32_libid is a shell function defined in ltmain.sh
- lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
- lt_cv_file_magic_cmd='func_win32_libid'
+ lt_cv_deplibs_check_method=pass_all
;;
-
+
mingw* | pw32*)
- # Base MSYS/MinGW do not provide the 'file' command needed by
- # func_win32_libid shell function, so use a weaker test based on 'objdump',
- # unless we find 'file', for example because we are cross-compiling.
- if ( file / ) >/dev/null 2>&1; then
- lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
- lt_cv_file_magic_cmd='func_win32_libid'
- else
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
- fi
+ # win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='win32_libid'
;;
darwin* | rhapsody*)
+ # this will be overwritten by pass_all, but leave it in just in case
+ lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ lt_cv_file_magic_test_file=`/System/Library/Frameworks/System.framework/System`
+ ;;
+ *) # Darwin 1.3 on
+ lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+ ;;
+ esac
lt_cv_deplibs_check_method=pass_all
;;
-freebsd* | dragonfly*)
+freebsd* | kfreebsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
case $host_cpu in
i*86 )
# Not sure whether the presence of OpenBSD here was a mistake.
# Let's accept both of them until this is cleared up.
- lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
;;
@@ -8343,7 +8113,7 @@ gnu*)
hpux10.20* | hpux11*)
lt_cv_file_magic_cmd=/usr/bin/file
- case $host_cpu in
+ case "$host_cpu" in
ia64*)
lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
@@ -8359,27 +8129,43 @@ hpux10.20* | hpux11*)
esac
;;
-interix[[3-9]]*)
- # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
- lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
- ;;
-
irix5* | irix6* | nonstopux*)
- case $LD in
- *-32|*"-32 ") libmagic=32-bit;;
- *-n32|*"-n32 ") libmagic=N32;;
- *-64|*"-64 ") libmagic=64-bit;;
- *) libmagic=never-match;;
+ case $host_os in
+ irix5* | nonstopux*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1"
+ ;;
esac
+ lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
lt_cv_deplibs_check_method=pass_all
;;
# This must be Linux ELF.
-linux* | k*bsd*-gnu)
- lt_cv_deplibs_check_method=pass_all
+linux*)
+ case $host_cpu in
+ alpha* | hppa* | i*86 | ia64* | m68* | mips* | powerpc* | sparc* | s390* | sh* | x86_64* )
+ lt_cv_deplibs_check_method=pass_all ;;
+ # the debian people say, arm and glibc 2.3.1 works for them with pass_all
+ arm* )
+ lt_cv_deplibs_check_method=pass_all ;;
+ *)
+ # glibc up to 2.1.1 does not perform some relocations on ARM
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
;;
-netbsd* | netbsdelf*-gnu)
+netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
else
@@ -8398,26 +8184,32 @@ nto-qnx*)
;;
openbsd*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object'
else
- lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
fi
;;
osf3* | osf4* | osf5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+ lt_cv_file_magic_test_file=/shlib/libc.so
lt_cv_deplibs_check_method=pass_all
;;
-rdos*)
+sco3.2v5*)
lt_cv_deplibs_check_method=pass_all
;;
solaris*)
lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=/lib/libc.so
;;
-sysv4 | sysv4.3*)
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
case $host_vendor in
motorola)
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
@@ -8438,13 +8230,10 @@ sysv4 | sysv4.3*)
siemens)
lt_cv_deplibs_check_method=pass_all
;;
- pc)
- lt_cv_deplibs_check_method=pass_all
- ;;
esac
;;
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*)
lt_cv_deplibs_check_method=pass_all
;;
esac
@@ -8464,43 +8253,36 @@ AC_DEFUN([AC_PROG_NM],
# Let the user override the test.
lt_cv_path_NM="$NM"
else
- lt_nm_to_check="${ac_tool_prefix}nm"
- if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
- lt_nm_to_check="$lt_nm_to_check nm"
- fi
- for lt_tmp_nm in $lt_nm_to_check; do
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
- IFS="$lt_save_ifs"
- test -z "$ac_dir" && ac_dir=.
- tmp_nm="$ac_dir/$lt_tmp_nm"
- if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
- # Check to see if the nm accepts a BSD-compat flag.
- # Adding the `sed 1q' prevents false positives on HP-UX, which says:
- # nm: unknown option "B" ignored
- # Tru64's nm complains that /dev/null is an invalid object file
- case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
- */dev/null* | *'Invalid file or object type'*)
- lt_cv_path_NM="$tmp_nm -B"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/${ac_tool_prefix}nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
break
;;
*)
- case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
- */dev/null*)
- lt_cv_path_NM="$tmp_nm -p"
- break
- ;;
- *)
- lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
- continue # so that we can try to find one that supports BSD flags
- ;;
- esac
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
;;
esac
- fi
- done
- IFS="$lt_save_ifs"
+ esac
+ fi
done
+ IFS="$lt_save_ifs"
test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
fi])
NM="$lt_cv_path_NM"
@@ -8532,13 +8314,13 @@ esac
# -----------------------------------
# sets LIBLTDL to the link flags for the libltdl convenience library and
# LTDLINCL to the include flags for the libltdl header and adds
-# --enable-ltdl-convenience to the configure arguments. Note that
-# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
-# it is assumed to be `libltdl'. LIBLTDL will be prefixed with
-# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
-# (note the single quotes!). If your package is not flat and you're not
-# using automake, define top_builddir and top_srcdir appropriately in
-# the Makefiles.
+# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL
+# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If
+# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will
+# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
case $enable_ltdl_convenience in
@@ -8557,13 +8339,13 @@ AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
# -----------------------------------
# sets LIBLTDL to the link flags for the libltdl installable library and
# LTDLINCL to the include flags for the libltdl header and adds
-# --enable-ltdl-install to the configure arguments. Note that
-# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
-# and an installed libltdl is not found, it is assumed to be `libltdl'.
-# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
-# '${top_srcdir}/' (note the single quotes!). If your package is not
-# flat and you're not using automake, define top_builddir and top_srcdir
-# appropriately in the Makefiles.
+# --enable-ltdl-install to the configure arguments. Note that LIBLTDL
+# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If
+# DIRECTORY is not provided and an installed libltdl is not found, it is
+# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/'
+# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single
+# quotes!). If your package is not flat and you're not using automake,
+# define top_builddir and top_srcdir appropriately in the Makefiles.
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
@@ -8601,21 +8383,10 @@ AC_DEFUN([AC_LIBTOOL_CXX],
# ---------------
AC_DEFUN([_LT_AC_LANG_CXX],
[AC_REQUIRE([AC_PROG_CXX])
-AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+AC_REQUIRE([AC_PROG_CXXCPP])
_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
])# _LT_AC_LANG_CXX
-# _LT_AC_PROG_CXXCPP
-# ------------------
-AC_DEFUN([_LT_AC_PROG_CXXCPP],
-[
-AC_REQUIRE([AC_PROG_CXX])
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
- ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
- (test "X$CXX" != "Xg++"))) ; then
- AC_PROG_CXXCPP
-fi
-])# _LT_AC_PROG_CXXCPP
# AC_LIBTOOL_F77
# --------------
@@ -8655,7 +8426,7 @@ _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
# AC_LIBTOOL_RC
-# -------------
+# --------------
# enable support for Windows resource files
AC_DEFUN([AC_LIBTOOL_RC],
[AC_REQUIRE([LT_AC_PROG_RC])
@@ -8681,16 +8452,43 @@ objext=o
_LT_AC_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
+lt_simple_compile_test_code="int some_variable = 0;\n"
# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
+lt_simple_link_test_code='int main(){return(0);}\n'
_LT_AC_SYS_COMPILER
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
+#
+# Check for any special shared library compilation flags.
+#
+_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)=
+if test "$GCC" = no; then
+ case $host_os in
+ sco3.2v5*)
+ _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf'
+ ;;
+ esac
+fi
+if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then
+ AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries])
+ if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then :
+ else
+ AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure])
+ _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no
+ fi
+fi
+
+
+#
+# Check to make sure the static flag actually works.
+#
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works],
+ _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+ $_LT_AC_TAGVAR(lt_prog_compiler_static, $1),
+ [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
@@ -8704,9 +8502,9 @@ AC_LIBTOOL_PROG_LD_SHLIBS($1)
AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
AC_LIBTOOL_SYS_LIB_STRIP
-AC_LIBTOOL_DLOPEN_SELF
+AC_LIBTOOL_DLOPEN_SELF($1)
-# Report which library types will actually be built
+# Report which librarie types wil actually be built
AC_MSG_CHECKING([if libtool supports shared libraries])
AC_MSG_RESULT([$can_build_shared])
@@ -8715,7 +8513,7 @@ test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
-case $host_os in
+case "$host_os" in
aix3*)
test "$enable_shared" = yes && enable_static=no
if test -n "$RANLIB"; then
@@ -8724,11 +8522,48 @@ aix3*)
fi
;;
-aix4* | aix5*)
+aix4*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
- ;;
+ ;;
+ darwin* | rhapsody*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
esac
AC_MSG_RESULT([$enable_shared])
@@ -8753,7 +8588,7 @@ AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
[AC_LANG_PUSH(C++)
AC_REQUIRE([AC_PROG_CXX])
-AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+AC_REQUIRE([AC_PROG_CXXCPP])
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_AC_TAGVAR(allow_undefined_flag, $1)=
@@ -8765,7 +8600,6 @@ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
-_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
_LT_AC_TAGVAR(hardcode_automatic, $1)=no
_LT_AC_TAGVAR(module_cmds, $1)=
_LT_AC_TAGVAR(module_expsym_cmds, $1)=
@@ -8783,25 +8617,21 @@ _LT_AC_TAGVAR(postdeps, $1)=
_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
# Source file extension for C++ test sources.
-ac_ext=cpp
+ac_ext=cc
# Object file extension for compiled C++ test sources.
objext=o
_LT_AC_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
+lt_simple_compile_test_code="int some_variable = 0;\n"
# Code to be used in simple link tests
-lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_AC_SYS_COMPILER
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
# Allow CC to be a program name with arguments.
lt_save_CC=$CC
lt_save_LD=$LD
@@ -8812,18 +8642,18 @@ lt_save_path_LD=$lt_cv_path_LD
if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
else
- $as_unset lt_cv_prog_gnu_ld
+ unset lt_cv_prog_gnu_ld
fi
if test -n "${lt_cv_path_LDCXX+set}"; then
lt_cv_path_LD=$lt_cv_path_LDCXX
else
- $as_unset lt_cv_path_LD
+ unset lt_cv_path_LD
fi
test -z "${LDCXX+set}" || LD=$LDCXX
CC=${CXX-"c++"}
compiler=$CC
_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
# We don't want -fno-exception wen compiling C++ code, so set the
# no_builtin_flag separately
@@ -8841,8 +8671,8 @@ if test "$GXX" = yes; then
# Check if GNU C++ uses GNU ld as the underlying linker, since the
# archiving commands below assume that GNU ld is being used.
if test "$with_gnu_ld" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -8868,7 +8698,7 @@ if test "$GXX" = yes; then
# linker, instead of GNU ld. If possible, this setting should
# overridden to take advantage of the native linker features on
# the platform it is being used on.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $lib'
fi
# Commands to make compiler produce verbose output that lists
@@ -8898,23 +8728,8 @@ case $host_os in
exp_sym_flag='-Bexport'
no_entry_flag=""
else
- aix_use_runtimelinking=no
-
- # Test if we are trying to use run time linking or normal
- # AIX style linking. If -brtl is somewhere in LDFLAGS, we
- # need to do runtime linking.
- case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
- for ld_flag in $LDFLAGS; do
- case $ld_flag in
- *-brtl*)
- aix_use_runtimelinking=yes
- break
- ;;
- esac
- done
- ;;
- esac
-
+ # KDE requires run time linking. Make it the default.
+ aix_use_runtimelinking=yes
exp_sym_flag='-bexport'
no_entry_flag='-bnoentry'
fi
@@ -8931,7 +8746,7 @@ case $host_os in
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
if test "$GXX" = yes; then
- case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ case $host_os in aix4.[012]|aix4.[012].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
@@ -8939,7 +8754,7 @@ case $host_os in
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
- :
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
else
# We have old collect2
_LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
@@ -8950,12 +8765,8 @@ case $host_os in
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
fi
- ;;
esac
shared_flag='-shared'
- if test "$aix_use_runtimelinking" = yes; then
- shared_flag="$shared_flag "'${wl}-G'
- fi
else
# not using gcc
if test "$host_cpu" = ia64; then
@@ -8964,16 +8775,15 @@ case $host_os in
shared_flag='-G'
else
if test "$aix_use_runtimelinking" = yes; then
- shared_flag='${wl}-G'
+ shared_flag='-qmkshrobj ${wl}-G'
else
- shared_flag='${wl}-bM:SRE'
+ shared_flag='-qmkshrobj'
fi
fi
fi
- # It seems that -bexpall does not export symbols beginning with
- # underscore (_), so it is better to generate a list of symbols to export.
- _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ # Let the compiler handle the export list.
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
if test "$aix_use_runtimelinking" = yes; then
# Warning - without using the other runtime loading flags (-brtl),
# -berok will link without error, but may produce a broken library.
@@ -8982,12 +8792,13 @@ case $host_os in
_LT_AC_SYS_LIBPATH_AIX
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
else
if test "$host_cpu" = ia64; then
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
_LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
else
# Determine the default libpath from the value encoded in an empty executable.
_LT_AC_SYS_LIBPATH_AIX
@@ -8996,26 +8807,16 @@ case $host_os in
# -berok will link without error, but may produce a broken library.
_LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # -bexpall does not export symbols beginning with underscore (_)
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
# Exported symbols can be pulled into shared objects from archives
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' '
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
- # This is similar to how AIX traditionally builds its shared libraries.
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ # This is similar to how AIX traditionally builds it's shared libraries.
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
fi
fi
;;
-
- beos*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
- # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
- # support --undefined. This deserves some investigation. FIXME
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
-
chorus*)
case $cc_basename in
*)
@@ -9029,12 +8830,12 @@ case $host_os in
# _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=no
_LT_AC_TAGVAR(always_export_symbols, $1)=no
_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is; otherwise, prepend...
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
@@ -9043,81 +8844,70 @@ case $host_os in
echo EXPORTS > $output_objdir/$soname.def;
cat $export_symbols >> $output_objdir/$soname.def;
fi~
- $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ $CC -shared -nostdlib $output_objdir/$soname.def $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
else
_LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
- darwin* | rhapsody*)
- case $host_os in
- rhapsody* | darwin1.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
- else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
- ;;
- 10.*)
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
- ;;
- esac
- fi
- ;;
- esac
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- if test "$GXX" = yes ; then
- lt_int_apple_cc_single_mod=no
- output_verbose_link_cmd='echo'
- if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
- lt_int_apple_cc_single_mod=yes
- fi
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- fi
- _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- else
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- fi
- _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ darwin* | rhapsody*)
+ if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
else
- case $cc_basename in
- xlc*)
- output_verbose_link_cmd='echo'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
- _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- ;;
- *)
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup'
+ ;;
+ esac
fi
- ;;
+ ;;
+ esac
+ lt_int_apple_cc_single_mod=no
+ output_verbose_link_cmd='echo'
+ if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+ lt_int_apple_cc_single_mod=yes
+ fi
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring'
+ fi
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs'
+
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
dgux*)
case $cc_basename in
- ec++*)
+ ec++)
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
- ghcx*)
+ ghcx)
# Green Hills C++ Compiler
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
@@ -9128,14 +8918,14 @@ case $host_os in
;;
esac
;;
- freebsd[[12]]*)
+ freebsd[12]*)
# C++ shared libraries reported to be fairly broken before switch to ELF
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
freebsd-elf*)
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
;;
- freebsd* | dragonfly*)
+ freebsd* | kfreebsd*-gnu)
# FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
# conventions
_LT_AC_TAGVAR(ld_shlibs, $1)=yes
@@ -9152,12 +8942,12 @@ case $host_os in
# location of the library.
case $cc_basename in
- CC*)
+ CC)
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
- aCC*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ aCC)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
@@ -9166,11 +8956,11 @@ case $host_os in
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
;;
*)
if test "$GXX" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
else
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
@@ -9180,20 +8970,33 @@ case $host_os in
;;
hpux10*|hpux11*)
if test $with_gnu_ld = no; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- case $host_cpu in
- hppa*64*|ia64*) ;;
+ case "$host_cpu" in
+ hppa*64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ ;;
*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
;;
esac
fi
- case $host_cpu in
- hppa*64*|ia64*)
+ case "$host_cpu" in
+ hppa*64*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ ia64*)
_LT_AC_TAGVAR(hardcode_direct, $1)=no
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
;;
*)
_LT_AC_TAGVAR(hardcode_direct, $1)=yes
@@ -9204,20 +9007,17 @@ case $host_os in
esac
case $cc_basename in
- CC*)
+ CC)
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
- aCC*)
- case $host_cpu in
- hppa*64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ aCC)
+ case "$host_cpu" in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
;;
*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects'
;;
esac
# Commands to make compiler produce verbose output that lists
@@ -9233,15 +9033,12 @@ case $host_os in
*)
if test "$GXX" = yes; then
if test $with_gnu_ld = no; then
- case $host_cpu in
- hppa*64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ case "$host_cpu" in
+ ia64*|hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
;;
*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects'
;;
esac
fi
@@ -9252,25 +9049,11 @@ case $host_os in
;;
esac
;;
- interix[[3-9]]*)
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
- # Instead, shared libraries are loaded at an image base (0x10000000 by
- # default) and relocated if they conflict, which is a slow very memory
- # consuming and fragmenting process. To avoid this, we pick a random,
- # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
- # time. Moving up from 0x10000000 also allows more sbrk(2) space.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- ;;
irix5* | irix6*)
case $cc_basename in
- CC*)
+ CC)
# SGI C++
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
# Archives containing C++ object files must be created using
# "CC -ar", where "CC" is the IRIX C++ compiler. This is
@@ -9281,9 +9064,9 @@ case $host_os in
*)
if test "$GXX" = yes; then
if test "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
fi
fi
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
@@ -9292,16 +9075,16 @@ case $host_os in
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
;;
- linux* | k*bsd*-gnu)
+ linux*)
case $cc_basename in
- KCC*)
+ KCC)
# Kuck and Associates, Inc. (KAI) C++ Compiler
# KCC will only create a shared library if the output file
# ends with ".so" (or ".sl" for HP-UX), so rename the library
# to its proper name (with version) after linking.
- _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
@@ -9319,44 +9102,20 @@ case $host_os in
# "CC -Bstatic", where "CC" is the KAI C++ compiler.
_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
;;
- icpc*)
+ icpc)
# Intel C++
with_gnu_ld=yes
- # version 8.0 and above of icpc choke on multiply defined symbols
- # if we add $predep_objects and $postdep_objects, however 7.1 and
- # earlier do not add the objects themselves.
- case `$CC -V 2>&1` in
- *"Version 7."*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- ;;
- *) # Version 8.0 or newer
- tmp_idyn=
- case $host_cpu in
- ia64*) tmp_idyn=' -i_dynamic';;
- esac
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- ;;
- esac
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
;;
- pgCC*)
- # Portland Group C++ compiler
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
- ;;
- cxx*)
+ cxx)
# Compaq C++
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
runpath_var=LD_RUN_PATH
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -9372,29 +9131,6 @@ case $host_os in
# dependencies.
output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
- _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-
- # Not sure whether something based on
- # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
- # would be better.
- output_verbose_link_cmd='echo'
-
- # Archives containing C++ object files must be created using
- # "CC -xar", where "CC" is the Sun C++ compiler. This is
- # necessary to make sure instantiated templates are included
- # in the archive.
- _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
- ;;
- esac
- ;;
esac
;;
lynxos*)
@@ -9407,7 +9143,7 @@ case $host_os in
;;
mvs*)
case $cc_basename in
- cxx*)
+ cxx)
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
@@ -9417,7 +9153,7 @@ case $host_os in
;;
esac
;;
- netbsd* | netbsdelf*-gnu)
+ netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
wlarc=
@@ -9428,35 +9164,15 @@ case $host_os in
# Workaround some broken pre-1.5 toolchains
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
;;
- openbsd2*)
- # C++ shared libraries are fairly broken
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- openbsd*)
- if test -f /usr/libexec/ld.so; then
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- fi
- output_verbose_link_cmd='echo'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
osf3*)
case $cc_basename in
- KCC*)
+ KCC)
# Kuck and Associates, Inc. (KAI) C++ Compiler
# KCC will only create a shared library if the output file
# ends with ".so" (or ".sl" for HP-UX), so rename the library
# to its proper name (with version) after linking.
- _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
@@ -9466,14 +9182,14 @@ case $host_os in
_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
;;
- RCC*)
+ RCC)
# Rational C++ 2.4.1
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
- cxx*)
+ cxx)
_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
@@ -9491,7 +9207,7 @@ case $host_os in
*)
if test "$GXX" = yes && test "$with_gnu_ld" = no; then
_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
@@ -9510,13 +9226,13 @@ case $host_os in
;;
osf4* | osf5*)
case $cc_basename in
- KCC*)
+ KCC)
# Kuck and Associates, Inc. (KAI) C++ Compiler
# KCC will only create a shared library if the output file
# ends with ".so" (or ".sl" for HP-UX), so rename the library
# to its proper name (with version) after linking.
- _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
@@ -9525,17 +9241,17 @@ case $host_os in
# the KAI C++ compiler.
_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
;;
- RCC*)
+ RCC)
# Rational C++ 2.4.1
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
- cxx*)
+ cxx)
_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
echo "-hidden">> $lib.exp~
- $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+ $CC -shared$allow_undefined_flag $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~
$rm $lib.exp'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -9554,7 +9270,7 @@ case $host_os in
*)
if test "$GXX" = yes && test "$with_gnu_ld" = no; then
_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
@@ -9575,14 +9291,27 @@ case $host_os in
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
+ sco*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ case $cc_basename in
+ CC)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
sunos4*)
case $cc_basename in
- CC*)
+ CC)
# Sun C++ 4.x
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
- lcc*)
+ lcc)
# Lucid
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
@@ -9595,28 +9324,36 @@ case $host_os in
;;
solaris*)
case $cc_basename in
- CC*)
+ CC)
# Sun C++ 4.2, 5.x and Centerline C++
- _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
_LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects'
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
- $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+ $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
case $host_os in
- solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
*)
- # The compiler driver will combine and reorder linker options,
- # but understands `-z linker_flag'.
+ # The C++ compiler is used as linker so we must use $wl
+ # flag to pass the commands to the underlying system
+ # linker.
# Supported since Solaris 2.6 (maybe 2.5.1?)
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
;;
esac
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- output_verbose_link_cmd='echo'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
# Archives containing C++ object files must be created using
# "CC -xar", where "CC" is the Sun C++ compiler. This is
@@ -9624,9 +9361,9 @@ case $host_os in
# in the archive.
_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
;;
- gcx*)
+ gcx)
# Green Hills C++ Compiler
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib'
# The C++ compiler must be used to create the archive.
_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
@@ -9636,9 +9373,9 @@ case $host_os in
if test "$GXX" = yes && test "$with_gnu_ld" = no; then
_LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
if $CC --version | grep -v '^2\.7' > /dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib'
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
- $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
@@ -9647,9 +9384,9 @@ case $host_os in
else
# g++ 2.7 appears to require `-G' NOT `-shared' on this
# platform.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib'
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
- $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
@@ -9658,73 +9395,16 @@ case $host_os in
fi
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
- case $host_os in
- solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
- *)
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
- ;;
- esac
fi
;;
esac
;;
- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*)
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- runpath_var='LD_RUN_PATH'
-
- case $cc_basename in
- CC*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- ;;
- sysv5* | sco3.2v5* | sco5v6*)
- # Note: We can NOT use -z defs as we might desire, because we do not
- # link with -lc, and that would cause any symbols used from libc to
- # always be unresolved, which means just about no library would
- # ever link correctly. If we're not using GNU ld we use -z text
- # though, which does catch some bad symbols but isn't as heavy-handed
- # as -z defs.
- # For security reasons, it is highly recommended that you always
- # use absolute paths for naming shared libraries, and exclude the
- # DT_RUNPATH tag from executables and libraries. But doing so
- # requires that you compile everything twice, which is a pain.
- # So that behaviour is only enabled if SCOABSPATH is set to a
- # non-empty value in the environment. Most likely only useful for
- # creating official distributions of packages.
- # This is a hack until libtool officially supports absolute path
- # names for shared libraries.
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
- runpath_var='LD_RUN_PATH'
-
- case $cc_basename in
- CC*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
;;
tandem*)
case $cc_basename in
- NCC*)
+ NCC)
# NonStop-UX NCC 3.20
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
@@ -9761,6 +9441,8 @@ AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
AC_LIBTOOL_PROG_LD_SHLIBS($1)
AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
AC_LIBTOOL_CONFIG($1)
@@ -9778,7 +9460,7 @@ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
])# AC_LIBTOOL_LANG_CXX_CONFIG
# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
-# ------------------------------------
+# ------------------------
# Figure out "hidden" library dependencies from verbose
# compiler output when linking a shared library.
# Parse the compiler output and extract the necessary
@@ -9832,7 +9514,7 @@ if AC_TRY_EVAL(ac_compile); then
# The `*' in the case matches for architectures that use `case' in
# $output_verbose_cmd can trigger glob expansion during the loop
# eval without this substitution.
- output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+ output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`"
for p in `eval $output_verbose_link_cmd`; do
case $p in
@@ -9872,7 +9554,7 @@ if AC_TRY_EVAL(ac_compile); then
fi
;;
- *.$objext)
+ *.$objext|*.$libext)
# This assumes that the test object file only shows up
# once in the compiler output.
if test "$p" = "conftest.$objext"; then
@@ -9908,70 +9590,13 @@ fi
$rm -f confest.$objext
-# PORTME: override above test on systems where it is broken
-ifelse([$1],[CXX],
-[case $host_os in
-interix[[3-9]]*)
- # Interix 3.5 installs completely hosed .la files for C++, so rather than
- # hack all around it, let's just trust "g++" to DTRT.
- _LT_AC_TAGVAR(predep_objects,$1)=
- _LT_AC_TAGVAR(postdep_objects,$1)=
- _LT_AC_TAGVAR(postdeps,$1)=
- ;;
-
-linux*)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
- #
- # The more standards-conforming stlport4 library is
- # incompatible with the Cstd library. Avoid specifying
- # it if it's in CXXFLAGS. Ignore libCrun as
- # -library=stlport4 depends on it.
- case " $CXX $CXXFLAGS " in
- *" -library=stlport4 "*)
- solaris_use_stlport4=yes
- ;;
- esac
- if test "$solaris_use_stlport4" != yes; then
- _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
- fi
- ;;
- esac
- ;;
-
-solaris*)
- case $cc_basename in
- CC*)
- # The more standards-conforming stlport4 library is
- # incompatible with the Cstd library. Avoid specifying
- # it if it's in CXXFLAGS. Ignore libCrun as
- # -library=stlport4 depends on it.
- case " $CXX $CXXFLAGS " in
- *" -library=stlport4 "*)
- solaris_use_stlport4=yes
- ;;
- esac
-
- # Adding this requires a known-good setup of shared libraries for
- # Sun compiler versions before 5.6, else PIC objects from an old
- # archive will be linked into the output, leading to subtle bugs.
- if test "$solaris_use_stlport4" != yes; then
- _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
- fi
- ;;
- esac
- ;;
-esac
-])
-
case " $_LT_AC_TAGVAR(postdeps, $1) " in
*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
esac
])# AC_LIBTOOL_POSTDEP_PREDEP
# AC_LIBTOOL_LANG_F77_CONFIG
-# --------------------------
+# ------------------------
# Ensure that the configuration vars for the C compiler are
# suitably defined. Those variables are subsequently used by
# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
@@ -10007,31 +9632,20 @@ objext=o
_LT_AC_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
-lt_simple_compile_test_code="\
- subroutine t
- return
- end
-"
+lt_simple_compile_test_code=" subroutine t\n return\n end\n"
# Code to be used in simple link tests
-lt_simple_link_test_code="\
- program t
- end
-"
+lt_simple_link_test_code=" program t\n end\n"
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_AC_SYS_COMPILER
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
CC=${F77-"f77"}
compiler=$CC
_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
AC_MSG_CHECKING([if libtool supports shared libraries])
AC_MSG_RESULT([$can_build_shared])
@@ -10041,7 +9655,7 @@ test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
-case $host_os in
+case "$host_os" in
aix3*)
test "$enable_shared" = yes && enable_static=no
if test -n "$RANLIB"; then
@@ -10049,10 +9663,8 @@ aix3*)
postinstall_cmds='$RANLIB $lib'
fi
;;
-aix4* | aix5*)
- if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
- test "$enable_shared" = yes && enable_static=no
- fi
+aix4*)
+ test "$enable_shared" = yes && enable_static=no
;;
esac
AC_MSG_RESULT([$enable_shared])
@@ -10062,6 +9674,8 @@ AC_MSG_CHECKING([whether to build static libraries])
test "$enable_shared" = yes || enable_static=yes
AC_MSG_RESULT([$enable_static])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
_LT_AC_TAGVAR(GCC, $1)="$G77"
_LT_AC_TAGVAR(LD, $1)="$LD"
@@ -10071,6 +9685,8 @@ AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
AC_LIBTOOL_PROG_LD_SHLIBS($1)
AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+
AC_LIBTOOL_CONFIG($1)
@@ -10096,30 +9712,23 @@ objext=o
_LT_AC_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}"
+lt_simple_compile_test_code="class foo {}\n"
# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_AC_SYS_COMPILER
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
CC=${GCJ-"gcj"}
compiler=$CC
_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
# GCJ did not exist at the time GCC didn't implicitly link libc in.
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
@@ -10131,6 +9740,8 @@ AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
AC_LIBTOOL_PROG_LD_SHLIBS($1)
AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
AC_LIBTOOL_CONFIG($1)
@@ -10140,7 +9751,7 @@ CC="$lt_save_CC"
# AC_LIBTOOL_LANG_RC_CONFIG
-# -------------------------
+# --------------------------
# Ensure that the configuration vars for the Windows resource compiler are
# suitably defined. Those variables are subsequently used by
# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
@@ -10156,7 +9767,7 @@ objext=o
_LT_AC_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
# Code to be used in simple link tests
lt_simple_link_test_code="$lt_simple_compile_test_code"
@@ -10164,16 +9775,11 @@ lt_simple_link_test_code="$lt_simple_compile_test_code"
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_AC_SYS_COMPILER
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
CC=${RC-"windres"}
compiler=$CC
_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
AC_LIBTOOL_CONFIG($1)
@@ -10199,12 +9805,11 @@ if test -f "$ltmain"; then
# without removal of \ escapes.
if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
- fi
+ fi
# Now quote all the things that may contain metacharacters while being
# careful not to overquote the AC_SUBSTed values. We take copies of the
# variables and quote the copies for generation of the libtool script.
- for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
- SED SHELL STRIP \
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM SED SHELL \
libname_spec library_names_spec soname_spec extract_expsyms_cmds \
old_striplib striplib file_magic_cmd finish_cmds finish_eval \
deplibs_check_method reload_flag reload_cmds need_locks \
@@ -10245,7 +9850,6 @@ if test -f "$ltmain"; then
_LT_AC_TAGVAR(module_cmds, $1) \
_LT_AC_TAGVAR(module_expsym_cmds, $1) \
_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
- _LT_AC_TAGVAR(fix_srcfile_path, $1) \
_LT_AC_TAGVAR(exclude_expsyms, $1) \
_LT_AC_TAGVAR(include_expsyms, $1); do
@@ -10255,7 +9859,7 @@ if test -f "$ltmain"; then
_LT_AC_TAGVAR(archive_cmds, $1) | \
_LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
_LT_AC_TAGVAR(module_cmds, $1) | \
- _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
_LT_AC_TAGVAR(export_symbols_cmds, $1) | \
extract_expsyms_cmds | reload_cmds | finish_cmds | \
@@ -10292,7 +9896,7 @@ ifelse([$1], [],
# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
#
# This file is part of GNU Libtool:
@@ -10321,11 +9925,11 @@ ifelse([$1], [],
SED=$lt_SED
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="$SED -e 1s/^X//"
+Xsed="$SED -e s/^X//"
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
# The names of the tagged configurations supported by this script.
available_tags=
@@ -10356,12 +9960,6 @@ fast_install=$enable_fast_install
# The host system.
host_alias=$host_alias
host=$host
-host_os=$host_os
-
-# The build system.
-build_alias=$build_alias
-build=$build
-build_os=$build_os
# An echo program that does not interpret backslashes.
echo=$lt_echo
@@ -10373,9 +9971,6 @@ AR_FLAGS=$lt_AR_FLAGS
# A C compiler.
LTCC=$lt_LTCC
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
-
# A language-specific compiler.
CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
@@ -10395,7 +9990,7 @@ LN_S=$lt_LN_S
NM=$lt_NM
# A symbol stripping program
-STRIP=$lt_STRIP
+STRIP=$STRIP
# Used to examine libraries when file_magic_cmd begins "file"
MAGIC_CMD=$MAGIC_CMD
@@ -10426,7 +10021,7 @@ objext="$ac_objext"
libext="$libext"
# Shared library suffix (normally ".so").
-shrext_cmds='$shrext_cmds'
+shrext='$shrext'
# Executable file suffix (normally "").
exeext="$exeext"
@@ -10441,7 +10036,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len
# Does compiler simultaneously support -c and -o options?
compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
-# Must we lock files when doing compilation?
+# Must we lock files when doing compilation ?
need_locks=$lt_need_locks
# Do we need the lib prefix for modules?
@@ -10617,7 +10212,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
+fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
# Set to yes if exported symbols are required.
always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
@@ -10670,10 +10265,7 @@ else
# If there is no Makefile yet, we rely on a make rule to execute
# `config.status --recheck' to rerun these tests and create the
# libtool script then.
- ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
- if test -f "$ltmain_in"; then
- test -f Makefile && make "$ltmain"
- fi
+ test -f Makefile && make "$ltmain"
fi
])# AC_LIBTOOL_CONFIG
@@ -10700,7 +10292,6 @@ fi
# ---------------------------------
AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
[AC_REQUIRE([AC_CANONICAL_HOST])
-AC_REQUIRE([LT_AC_PROG_SED])
AC_REQUIRE([AC_PROG_NM])
AC_REQUIRE([AC_OBJEXT])
# Check for command to grab the raw symbol name followed by C symbol from nm.
@@ -10716,6 +10307,9 @@ symcode='[[BCDEGRST]]'
# Regexp to match symbols that can be accessed directly from C.
sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
# Transform an extracted symbol line into a proper C declaration
lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
@@ -10737,30 +10331,14 @@ hpux*) # Its linker distinguishes data from code symbols
lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
;;
-linux* | k*bsd*-gnu)
- if test "$host_cpu" = ia64; then
- symcode='[[ABCDGIRSTW]]'
- lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
- lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
- fi
- ;;
irix* | nonstopux*)
symcode='[[BCDEGRST]]'
;;
osf*)
symcode='[[BCDEGQRST]]'
;;
-solaris*)
- symcode='[[BDRT]]'
- ;;
-sco3.2v5*)
- symcode='[[DT]]'
- ;;
-sysv4.2uw2*)
- symcode='[[DT]]'
- ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
- symcode='[[ABDT]]'
+solaris* | sysv5*)
+ symcode='[[BDT]]'
;;
sysv4)
symcode='[[DFNSTU]]'
@@ -10778,17 +10356,14 @@ esac
# If we're using GNU nm, then use its standard symbol codes.
case `$NM -V 2>&1` in
*GNU* | *'with BFD'*)
- symcode='[[ABCDGIRSTW]]' ;;
+ symcode='[[ABCDGISTW]]' ;;
esac
# Try without a prefix undercore, then with it.
for ac_symprfx in "" "_"; do
- # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
- symxfrm="\\1 $ac_symprfx\\2 \\2"
-
# Write the raw and C identifiers.
- lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
# Check to see that the pipe works correctly.
pipe_works=no
@@ -10927,14 +10502,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
# like `-m68040'.
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
;;
- beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | os2* | pw32*)
+ mingw* | os2* | pw32*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
- # Although the cygwin gcc ignores -fPIC, still need this for old-style
- # (--disable-auto-import) libraries
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
;;
darwin* | rhapsody*)
@@ -10946,10 +10519,6 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
# DJGPP does not support shared libraries at all
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
;;
- interix[[3-9]]*)
- # Interix 3.x gcc -fpic/-fPIC options generate broken code.
- # Instead, we relocate shared libraries at runtime.
- ;;
sysv4*MP*)
if test -d /usr/nec; then
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
@@ -10958,7 +10527,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
hpux*)
# PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
# not for PA HP-UX.
- case $host_cpu in
+ case "$host_cpu" in
hppa*64*|ia64*)
;;
*)
@@ -10983,28 +10552,18 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
chorus*)
case $cc_basename in
- cxch68*)
+ cxch68)
# Green Hills C++ Compiler
# _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
;;
esac
;;
- darwin*)
- # PIC is the default on this platform
- # Common symbols not allowed in MH_DYLIB files
- case $cc_basename in
- xlc*)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- ;;
- esac
- ;;
dgux*)
case $cc_basename in
- ec++*)
+ ec++)
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
;;
- ghcx*)
+ ghcx)
# Green Hills C++ Compiler
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
@@ -11012,22 +10571,22 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
esac
;;
- freebsd* | dragonfly*)
+ freebsd* | kfreebsd*-gnu)
# FreeBSD uses GNU C++
;;
hpux9* | hpux10* | hpux11*)
case $cc_basename in
- CC*)
+ CC)
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
if test "$host_cpu" != ia64; then
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
fi
;;
- aCC*)
+ aCC)
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
- case $host_cpu in
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+ case "$host_cpu" in
hppa*64*|ia64*)
# +Z the default
;;
@@ -11040,13 +10599,9 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
esac
;;
- interix*)
- # This is c89, which is MS Visual C++ (no shared libs)
- # Anyone wants to do a port?
- ;;
irix5* | irix6* | nonstopux*)
case $cc_basename in
- CC*)
+ CC)
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
# CC pic flag -KPIC is the default.
@@ -11055,26 +10610,20 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
esac
;;
- linux* | k*bsd*-gnu)
+ linux*)
case $cc_basename in
- KCC*)
+ KCC)
# KAI C++ Compiler
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
- icpc* | ecpc*)
+ icpc)
# Intel C++
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
- ;;
- pgCC*)
- # Portland Group C++ compiler.
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
- cxx*)
+ ;;
+ cxx)
# Compaq C++
# Make sure the PIC flag is empty. It appears that all Alpha
# Linux and Compaq Tru64 Unix objects are PIC.
@@ -11082,14 +10631,6 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
*)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
- ;;
- esac
;;
esac
;;
@@ -11099,25 +10640,25 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
mvs*)
case $cc_basename in
- cxx*)
+ cxx)
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
;;
*)
;;
esac
;;
- netbsd* | netbsdelf*-gnu)
+ netbsd*)
;;
osf3* | osf4* | osf5*)
case $cc_basename in
- KCC*)
+ KCC)
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
;;
- RCC*)
+ RCC)
# Rational C++ 2.4.1
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
- cxx*)
+ cxx)
# Digital/Compaq C++
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# Make sure the PIC flag is empty. It appears that all Alpha
@@ -11131,15 +10672,24 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
psos*)
;;
+ sco*)
+ case $cc_basename in
+ CC)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
solaris*)
case $cc_basename in
- CC*)
+ CC)
# Sun C++ 4.2, 5.x and Centerline C++
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
;;
- gcx*)
+ gcx)
# Green Hills C++ Compiler
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
;;
@@ -11149,12 +10699,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
sunos4*)
case $cc_basename in
- CC*)
+ CC)
# Sun C++ 4.x
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
- lcc*)
+ lcc)
# Lucid
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
@@ -11164,7 +10714,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
tandem*)
case $cc_basename in
- NCC*)
+ NCC)
# NonStop-UX NCC 3.20
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
;;
@@ -11172,14 +10722,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
esac
;;
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- case $cc_basename in
- CC*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
- esac
+ unixware*)
;;
vxworks*)
;;
@@ -11210,15 +10753,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
;;
- beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | pw32* | os2*)
+ mingw* | pw32* | os2*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
- # Although the cygwin gcc ignores -fPIC, still need this for old-style
- # (--disable-auto-import) libraries
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
;;
@@ -11228,11 +10769,6 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
;;
- interix[[3-9]]*)
- # Interix 3.x gcc -fpic/-fPIC options generate broken code.
- # Instead, we relocate shared libraries at runtime.
- ;;
-
msdosdjgpp*)
# Just because we use GCC doesn't mean we suddenly get shared libraries
# on systems that don't support them.
@@ -11249,7 +10785,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
hpux*)
# PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
# not for PA HP-UX.
- case $host_cpu in
+ case "$host_cpu" in
hppa*64*|ia64*)
# +Z the default
;;
@@ -11275,18 +10811,8 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
fi
;;
- darwin*)
- # PIC is the default on this platform
- # Common symbols not allowed in MH_DYLIB files
- case $cc_basename in
- xlc*)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- ;;
- esac
- ;;
- mingw* | cygwin* | pw32* | os2*)
+ mingw* | pw32* | os2*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
@@ -11296,7 +10822,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
# not for PA HP-UX.
- case $host_cpu in
+ case "$host_cpu" in
hppa*64*|ia64*)
# +Z the default
;;
@@ -11319,41 +10845,18 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
- linux* | k*bsd*-gnu)
- case $cc_basename in
+ linux*)
+ case $CC in
icc* | ecc*)
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
- pgcc* | pgf77* | pgf90* | pgf95*)
- # Portland Group compilers (*not* the Pentium gcc compiler,
- # which looks to be a dead project)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
ccc*)
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# All Alpha code is PIC.
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C 5.9
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- ;;
- *Sun\ F*)
- # Sun Fortran 8.3 passes all unrecognized flags to the linker
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=''
- ;;
- esac
- ;;
esac
;;
@@ -11363,19 +10866,15 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
- rdos*)
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ sco3.2v5*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn'
;;
solaris*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- case $cc_basename in
- f77* | f90* | f95*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
- esac
;;
sunos4*)
@@ -11384,7 +10883,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
- sysv4 | sysv4.2uw2* | sysv4.3*)
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
@@ -11397,17 +10896,6 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
fi
;;
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
-
- unicos*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
- ;;
-
uts4*)
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
@@ -11435,7 +10923,7 @@ if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
fi
-case $host_os in
+case "$host_os" in
# For platforms which do not support PIC, -DPIC is meaningless:
*djgpp*)
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
@@ -11444,16 +10932,6 @@ case $host_os in
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
;;
esac
-
-#
-# Check to make sure the static flag actually works.
-#
-wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
-AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
- _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
- $lt_tmp_static_flag,
- [],
- [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
])
@@ -11461,8 +10939,7 @@ AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
# ------------------------------------
# See if the linker supports building shared libraries.
AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
ifelse([$1],[CXX],[
_LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
case $host_os in
@@ -11479,10 +10956,7 @@ ifelse([$1],[CXX],[
_LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
;;
cygwin* | mingw*)
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
- ;;
- linux* | k*bsd*-gnu)
- _LT_AC_TAGVAR(link_all_deplibs, $1)=no
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
;;
*)
_LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
@@ -11508,7 +10982,7 @@ ifelse([$1],[CXX],[
_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
_LT_AC_TAGVAR(hardcode_automatic, $1)=no
_LT_AC_TAGVAR(module_cmds, $1)=
- _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)=
_LT_AC_TAGVAR(always_export_symbols, $1)=no
_LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
# include_expsyms should be a list of space-separated symbols to be *always*
@@ -11525,8 +10999,7 @@ ifelse([$1],[CXX],[
# rely on this symbol name, it's probably fine to never include it in
# preloaded symbol tables.
extract_expsyms_cmds=
- # Just being paranoid about ensuring that cc_basename is set.
- _LT_CC_BASENAME([$compiler])
+
case $host_os in
cygwin* | mingw* | pw32*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
@@ -11536,10 +11009,6 @@ ifelse([$1],[CXX],[
with_gnu_ld=no
fi
;;
- interix*)
- # we just hope/assume this is gcc and not c89 (= MSVC++)
- with_gnu_ld=yes
- ;;
openbsd*)
with_gnu_ld=no
;;
@@ -11550,27 +11019,6 @@ ifelse([$1],[CXX],[
# If archive_cmds runs LD, not CC, wlarc should be empty
wlarc='${wl}'
- # Set some defaults for GNU ld with shared library support. These
- # are reset later if shared libraries are not supported. Putting them
- # here allows them to be overridden if necessary.
- runpath_var=LD_RUN_PATH
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
- # ancient GNU ld didn't support --whole-archive et. al.
- if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- else
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
- fi
- supports_anon_versioning=no
- case `$LD -v 2>/dev/null` in
- *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
- *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
- *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
- *\ 2.11.*) ;; # other 2.11 versions
- *) supports_anon_versioning=yes ;;
- esac
-
# See if GNU ld supports shared libraries.
case $host_os in
aix3* | aix4* | aix5*)
@@ -11608,7 +11056,7 @@ EOF
_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib'
else
_LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
@@ -11618,13 +11066,13 @@ EOF
# _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=no
_LT_AC_TAGVAR(always_export_symbols, $1)=no
_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is; otherwise, prepend...
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
@@ -11633,79 +11081,23 @@ EOF
echo EXPORTS > $output_objdir/$soname.def;
cat $export_symbols >> $output_objdir/$soname.def;
fi~
- $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
-
- interix[[3-9]]*)
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
- # Instead, shared libraries are loaded at an image base (0x10000000 by
- # default) and relocated if they conflict, which is a slow very memory
- # consuming and fragmenting process. To avoid this, we pick a random,
- # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
- # time. Moving up from 0x10000000 also allows more sbrk(2) space.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- ;;
-
- gnu* | linux* | k*bsd*-gnu)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- tmp_addflag=
- case $cc_basename,$host_cpu in
- pgcc*) # Portland Group C compiler
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
- tmp_addflag=' $pic_flag'
- ;;
- pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
- tmp_addflag=' $pic_flag -Mnomain' ;;
- ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
- tmp_addflag=' -i_dynamic' ;;
- efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
- tmp_addflag=' -i_dynamic -nofor_main' ;;
- ifc* | ifort*) # Intel Fortran compiler
- tmp_addflag=' -nofor_main' ;;
- esac
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*) # Sun C 5.9
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
- tmp_sharedflag='-G' ;;
- *Sun\ F*) # Sun Fortran 8.3
- tmp_sharedflag='-G' ;;
- *)
- tmp_sharedflag='-shared' ;;
- esac
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-
- if test $supports_anon_versioning = yes; then
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
- cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
- $echo "local: *; };" >> $output_objdir/$libname.ver~
- $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
- fi
- _LT_AC_TAGVAR(link_all_deplibs, $1)=no
+ $CC -shared $output_objdir/$soname.def $compiler_flags $libobjs $deplibs -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ld_shlibs=no
fi
;;
- netbsd* | netbsdelf*-gnu)
+ netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
fi
;;
- solaris*)
+ solaris* | sysv5*)
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
_LT_AC_TAGVAR(ld_shlibs, $1)=no
cat <<EOF 1>&2
@@ -11719,40 +11111,13 @@ EOF
EOF
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
_LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
- case `$LD -v 2>&1` in
- *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems. Therefore, libtool
-*** is disabling shared libraries support. We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
- ;;
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
-
sunos4*)
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
wlarc=
@@ -11762,19 +11127,24 @@ _LT_EOF
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
_LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
- if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
- runpath_var=
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then
+ runpath_var=LD_RUN_PATH
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
@@ -11786,7 +11156,7 @@ _LT_EOF
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
_LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ if test "$GCC" = yes && test -z "$link_static_flag"; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
_LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
@@ -11808,21 +11178,9 @@ _LT_EOF
else
_LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
fi
- aix_use_runtimelinking=no
-
- # Test if we are trying to use run time linking or normal
- # AIX style linking. If -brtl is somewhere in LDFLAGS, we
- # need to do runtime linking.
- case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
- for ld_flag in $LDFLAGS; do
- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
- aix_use_runtimelinking=yes
- break
- fi
- done
- ;;
- esac
+ # KDE requires run time linking. Make it the default.
+ aix_use_runtimelinking=yes
exp_sym_flag='-bexport'
no_entry_flag='-bnoentry'
fi
@@ -11839,7 +11197,7 @@ _LT_EOF
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
if test "$GCC" = yes; then
- case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ case $host_os in aix4.[012]|aix4.[012].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
@@ -11847,7 +11205,7 @@ _LT_EOF
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
- :
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
else
# We have old collect2
_LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
@@ -11858,12 +11216,8 @@ _LT_EOF
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
fi
- ;;
esac
shared_flag='-shared'
- if test "$aix_use_runtimelinking" = yes; then
- shared_flag="$shared_flag "'${wl}-G'
- fi
else
# not using gcc
if test "$host_cpu" = ia64; then
@@ -11871,30 +11225,30 @@ _LT_EOF
# chokes on -Wl,-G. The following line is correct:
shared_flag='-G'
else
- if test "$aix_use_runtimelinking" = yes; then
- shared_flag='${wl}-G'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='-qmkshrobj ${wl}-G'
else
- shared_flag='${wl}-bM:SRE'
- fi
+ shared_flag='-qmkshrobj'
+ fi
fi
fi
- # It seems that -bexpall does not export symbols beginning with
- # underscore (_), so it is better to generate a list of symbols to export.
- _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ # Let the compiler handle the export list.
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
if test "$aix_use_runtimelinking" = yes; then
# Warning - without using the other runtime loading flags (-brtl),
# -berok will link without error, but may produce a broken library.
_LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
# Determine the default libpath from the value encoded in an empty executable.
- _LT_AC_SYS_LIBPATH_AIX
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
else
if test "$host_cpu" = ia64; then
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
_LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
else
# Determine the default libpath from the value encoded in an empty executable.
_LT_AC_SYS_LIBPATH_AIX
@@ -11903,11 +11257,13 @@ _LT_EOF
# -berok will link without error, but may produce a broken library.
_LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # -bexpall does not export symbols beginning with underscore (_)
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
# Exported symbols can be pulled into shared objects from archives
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' '
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
- # This is similar to how AIX traditionally builds its shared libraries.
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ # This is similar to how AIX traditionally builds it's shared libraries.
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
fi
fi
;;
@@ -11920,7 +11276,7 @@ _LT_EOF
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
- bsdi[[45]]*)
+ bsdi4*)
_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
;;
@@ -11930,69 +11286,69 @@ _LT_EOF
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=no
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
- shrext_cmds=".dll"
+ shrext=".dll"
# FIXME: Setting linknames here is a bad hack.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $compiler_flags $libobjs `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
# The linker will automatically build a .lib file if we build a DLL.
_LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
# FIXME: Should let the user specify the lib program.
- _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
- _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
;;
darwin* | rhapsody*)
- case $host_os in
- rhapsody* | darwin1.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
- else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
- ;;
- 10.*)
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
- ;;
- esac
- fi
- ;;
- esac
+ if test "$GXX" = yes ; then
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ lt_int_apple_cc_single_mod=no
+ output_verbose_link_cmd='echo'
+ if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+ lt_int_apple_cc_single_mod=yes
+ fi
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring'
+ fi
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
_LT_AC_TAGVAR(hardcode_direct, $1)=no
_LT_AC_TAGVAR(hardcode_automatic, $1)=yes
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- if test "$GCC" = yes ; then
- output_verbose_link_cmd='echo'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- else
- case $cc_basename in
- xlc*)
- output_verbose_link_cmd='echo'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
- _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- ;;
- *)
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- fi
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
;;
dgux*)
@@ -12025,8 +11381,8 @@ _LT_EOF
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
- freebsd* | dragonfly*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ freebsd* | kfreebsd*-gnu)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $compiler_flags $libobjs $deplibs'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_AC_TAGVAR(hardcode_direct, $1)=yes
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -12034,7 +11390,7 @@ _LT_EOF
hpux9*)
if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $libobjs $deplibs~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
else
_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
fi
@@ -12048,62 +11404,47 @@ _LT_EOF
_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
;;
- hpux10*)
- if test "$GCC" = yes -a "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
- fi
- if test "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- fi
- ;;
-
- hpux11*)
+ hpux10* | hpux11*)
if test "$GCC" = yes -a "$with_gnu_ld" = no; then
- case $host_cpu in
- hppa*64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ case "$host_cpu" in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs'
;;
*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $libobjs $deplibs'
;;
esac
else
- case $host_cpu in
- hppa*64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ case "$host_cpu" in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
;;
*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
;;
esac
fi
if test "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- case $host_cpu in
- hppa*64*|ia64*)
+ case "$host_cpu" in
+ hppa*64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_AC_TAGVAR(hardcode_direct, $1)=no
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
+ ia64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_AC_TAGVAR(hardcode_direct, $1)=yes
_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
@@ -12117,7 +11458,7 @@ _LT_EOF
irix5* | irix6* | nonstopux*)
if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
@@ -12127,7 +11468,7 @@ _LT_EOF
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
;;
- netbsd* | netbsdelf*-gnu)
+ netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
@@ -12147,28 +11488,23 @@ _LT_EOF
;;
openbsd*)
- if test -f /usr/libexec/ld.so; then
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- else
- case $host_os in
- openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- ;;
- esac
- fi
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $compiler_flags $libobjs $deplibs'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $compiler_flags $libobjs $deplibs'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
fi
;;
@@ -12176,14 +11512,14 @@ _LT_EOF
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $compiler_flags $libobjs $deplibs$output_objdir/$libname.def'
_LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
;;
osf3*)
if test "$GCC" = yes; then
_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $libobjs $deplibs ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
@@ -12195,13 +11531,13 @@ _LT_EOF
osf4* | osf5*) # as osf3* with the addition of -msym flag
if test "$GCC" = yes; then
_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $libobjs $deplibs ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
else
_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
- $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
# Both c and cxx compiler support -rpath directly
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -12209,15 +11545,21 @@ _LT_EOF
_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
;;
+ sco3.2v5*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ;;
+
solaris*)
_LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
if test "$GCC" = yes; then
- wlarc='${wl}'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs'
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
- $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs~$rm $lib.exp'
else
- wlarc=''
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
@@ -12226,17 +11568,8 @@ _LT_EOF
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
case $host_os in
solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
- *)
- # The compiler driver will combine and reorder linker options,
- # but understands `-z linker_flag'. GCC discards it without `$wl',
- # but is careful enough not to reorder.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
- else
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
- fi
- ;;
+ *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
esac
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
;;
@@ -12245,7 +11578,7 @@ _LT_EOF
if test "x$host_vendor" = xsequent; then
# Use $CC to link under sequent, because it throws in some extra .o
# files that make .init and .fini sections work.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $compiler_flags $libobjs $deplibs'
else
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
fi
@@ -12293,45 +11626,36 @@ _LT_EOF
fi
;;
- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ sysv4.2uw2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- runpath_var='LD_RUN_PATH'
+ hardcode_runpath_var=yes
+ runpath_var=LD_RUN_PATH
+ ;;
+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text'
if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs'
else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs'
fi
+ runpath_var='LD_RUN_PATH'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
- sysv5* | sco3.2v5* | sco5v6*)
- # Note: We can NOT use -z defs as we might desire, because we do not
- # link with -lc, and that would cause any symbols used from libc to
- # always be unresolved, which means just about no library would
- # ever link correctly. If we're not using GNU ld we use -z text
- # though, which does catch some bad symbols but isn't as heavy-handed
- # as -z defs.
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ sysv5*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
runpath_var='LD_RUN_PATH'
-
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- fi
;;
uts4*)
@@ -12349,6 +11673,11 @@ _LT_EOF
AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
#
# Do we need to explicitly link libc?
#
@@ -12368,15 +11697,14 @@ x|xyes)
# to ld, don't add -lc before -lgcc.
AC_MSG_CHECKING([whether -lc should be explicitly linked in])
$rm conftest*
- echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
soname=conftest
lib=conftest
libobjs=conftest.$ac_objext
deplibs=
wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
- pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
compiler_flags=-v
linker_flags=-v
verstring=
@@ -12471,30 +11799,6 @@ AC_DEFUN([LT_AC_PROG_RC],
[AC_CHECK_TOOL(RC, windres, no)
])
-
-# Cheap backport of AS_EXECUTABLE_P and required macros
-# from Autoconf 2.59; we should not use $as_executable_p directly.
-
-# _AS_TEST_PREPARE
-# ----------------
-m4_ifndef([_AS_TEST_PREPARE],
-[m4_defun([_AS_TEST_PREPARE],
-[if test -x / >/dev/null 2>&1; then
- as_executable_p='test -x'
-else
- as_executable_p='test -f'
-fi
-])])# _AS_TEST_PREPARE
-
-# AS_EXECUTABLE_P
-# ---------------
-# Check whether a file is executable.
-m4_ifndef([AS_EXECUTABLE_P],
-[m4_defun([AS_EXECUTABLE_P],
-[AS_REQUIRE([_AS_TEST_PREPARE])dnl
-$as_executable_p $1[]dnl
-])])# AS_EXECUTABLE_P
-
############################################################
# NOTE: This macro has been submitted for inclusion into #
# GNU Autoconf as AC_PROG_SED. When it is available in #
@@ -12517,19 +11821,18 @@ do
test -z "$as_dir" && as_dir=.
for lt_ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
fi
done
done
done
-IFS=$as_save_IFS
lt_ac_max=0
lt_ac_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
# along with /bin/sed that truncates output.
for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
- test ! -f $lt_ac_sed && continue
+ test ! -f $lt_ac_sed && break
cat /dev/null > conftest.in
lt_ac_count=0
echo $ECHO_N "0123456789$ECHO_C" >conftest.in
@@ -12556,7 +11859,6 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
done
])
SED=$lt_cv_path_SED
-AC_SUBST([SED])
AC_MSG_RESULT([$SED])
])
diff --git a/aclocal.m4 b/aclocal.m4
index 0e90944..1dc39dc 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.7.9 -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -11,32 +11,12260 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+
+dnl This file is part of the KDE libraries/packages
+dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
+dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org)
+
+dnl This file is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Library General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2 of the License, or (at your option) any later version.
+
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Library General Public License for more details.
+
+dnl You should have received a copy of the GNU Library General Public License
+dnl along with this library; see the file COPYING.LIB. If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+dnl Boston, MA 02110-1301, USA.
+
+dnl IMPORTANT NOTE:
+dnl Please do not modify this file unless you expect your modifications to be
+dnl carried into every other module in the repository.
+dnl
+dnl Single-module modifications are best placed in configure.in for kdelibs
+dnl and kdebase or configure.in.in if present.
+
+# KDE_PATH_X_DIRECT
+dnl Internal subroutine of AC_PATH_X.
+dnl Set ac_x_includes and/or ac_x_libraries.
+AC_DEFUN([KDE_PATH_X_DIRECT],
+[
+AC_REQUIRE([KDE_CHECK_LIB64])
+
+if test "$ac_x_includes" = NO; then
+ # Guess where to find include files, by looking for this one X11 .h file.
+ test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
+
+ # First, try using that file with no special directory specified.
+AC_TRY_CPP([#include <$x_direct_test_include>],
+[# We can compile using X headers with no special include directory.
+ac_x_includes=],
+[# Look for the header file in a standard set of common directories.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+ for ac_dir in \
+ /usr/X11/include \
+ /usr/X11R6/include \
+ /usr/X11R5/include \
+ /usr/X11R4/include \
+ \
+ /usr/include/X11 \
+ /usr/include/X11R6 \
+ /usr/include/X11R5 \
+ /usr/include/X11R4 \
+ \
+ /usr/local/X11/include \
+ /usr/local/X11R6/include \
+ /usr/local/X11R5/include \
+ /usr/local/X11R4/include \
+ \
+ /usr/local/include/X11 \
+ /usr/local/include/X11R6 \
+ /usr/local/include/X11R5 \
+ /usr/local/include/X11R4 \
+ \
+ /usr/X386/include \
+ /usr/x386/include \
+ /usr/XFree86/include/X11 \
+ \
+ /usr/include \
+ /usr/local/include \
+ /usr/unsupported/include \
+ /usr/athena/include \
+ /usr/local/x11r5/include \
+ /usr/lpp/Xamples/include \
+ \
+ /usr/openwin/include \
+ /usr/openwin/share/include \
+ ; \
+ do
+ if test -r "$ac_dir/$x_direct_test_include"; then
+ ac_x_includes=$ac_dir
+ break
+ fi
+ done])
+fi # $ac_x_includes = NO
+
+if test "$ac_x_libraries" = NO; then
+ # Check for the libraries.
+
+ test -z "$x_direct_test_library" && x_direct_test_library=Xt
+ test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
+
+ # See if we find them without any special options.
+ # Don't add to $LIBS permanently.
+ ac_save_LIBS="$LIBS"
+ LIBS="-l$x_direct_test_library $LIBS"
+AC_TRY_LINK([#include <X11/Intrinsic.h>], [${x_direct_test_function}(1)],
+[LIBS="$ac_save_LIBS"
+# We can link X programs with no special library path.
+ac_x_libraries=],
+[LIBS="$ac_save_LIBS"
+# First see if replacing the include by lib works.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+for ac_dir in `echo "$ac_x_includes" | sed s/include/lib${kdelibsuff}/` \
+ /usr/X11/lib${kdelibsuff} \
+ /usr/X11R6/lib${kdelibsuff} \
+ /usr/X11R5/lib${kdelibsuff} \
+ /usr/X11R4/lib${kdelibsuff} \
+ \
+ /usr/lib${kdelibsuff}/X11 \
+ /usr/lib${kdelibsuff}/X11R6 \
+ /usr/lib${kdelibsuff}/X11R5 \
+ /usr/lib${kdelibsuff}/X11R4 \
+ \
+ /usr/local/X11/lib${kdelibsuff} \
+ /usr/local/X11R6/lib${kdelibsuff} \
+ /usr/local/X11R5/lib${kdelibsuff} \
+ /usr/local/X11R4/lib${kdelibsuff} \
+ \
+ /usr/local/lib${kdelibsuff}/X11 \
+ /usr/local/lib${kdelibsuff}/X11R6 \
+ /usr/local/lib${kdelibsuff}/X11R5 \
+ /usr/local/lib${kdelibsuff}/X11R4 \
+ \
+ /usr/X386/lib${kdelibsuff} \
+ /usr/x386/lib${kdelibsuff} \
+ /usr/XFree86/lib${kdelibsuff}/X11 \
+ \
+ /usr/lib${kdelibsuff} \
+ /usr/local/lib${kdelibsuff} \
+ /usr/unsupported/lib${kdelibsuff} \
+ /usr/athena/lib${kdelibsuff} \
+ /usr/local/x11r5/lib${kdelibsuff} \
+ /usr/lpp/Xamples/lib${kdelibsuff} \
+ /lib/usr/lib${kdelibsuff}/X11 \
+ \
+ /usr/openwin/lib${kdelibsuff} \
+ /usr/openwin/share/lib${kdelibsuff} \
+ ; \
+do
+dnl Don't even attempt the hair of trying to link an X program!
+ for ac_extension in a so sl; do
+ if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
+ ac_x_libraries=$ac_dir
+ break 2
+ fi
+ done
+done])
+fi # $ac_x_libraries = NO
+])
+
+
+dnl ------------------------------------------------------------------------
+dnl Find a file (or one of more files in a list of dirs)
+dnl ------------------------------------------------------------------------
+dnl
+AC_DEFUN([AC_FIND_FILE],
+[
+$3=NO
+for i in $2;
+do
+ for j in $1;
+ do
+ echo "configure: __oline__: $i/$j" >&AC_FD_CC
+ if test -r "$i/$j"; then
+ echo "taking that" >&AC_FD_CC
+ $3=$i
+ break 2
+ fi
+ done
+done
+])
+
+dnl KDE_FIND_PATH(program-name, variable-name, list-of-dirs,
+dnl if-not-found, test-parameter, prepend-path)
+dnl
+dnl Look for program-name in list-of-dirs+$PATH.
+dnl If prepend-path is set, look in $PATH+list-of-dirs instead.
+dnl If found, $variable-name is set. If not, if-not-found is evaluated.
+dnl test-parameter: if set, the program is executed with this arg,
+dnl and only a successful exit code is required.
+AC_DEFUN([KDE_FIND_PATH],
+[
+ AC_MSG_CHECKING([for $1])
+ if test -n "$$2"; then
+ kde_cv_path="$$2";
+ else
+ kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
+
+ AC_CACHE_VAL(kde_cv_path_$kde_cache,
+ [
+ kde_cv_path="NONE"
+ kde_save_IFS=$IFS
+ IFS=':'
+ dirs=""
+ for dir in $PATH; do
+ dirs="$dirs $dir"
+ done
+ if test -z "$6"; then dnl Append dirs in PATH (default)
+ dirs="$3 $dirs"
+ else dnl Prepend dirs in PATH (if 6th arg is set)
+ dirs="$dirs $3"
+ fi
+ IFS=$kde_save_IFS
+
+ for dir in $dirs; do
+ if test -x "$dir/$1"; then
+ if test -n "$5"
+ then
+ evalstr="$dir/$1 $5 2>&1 "
+ if eval $evalstr; then
+ kde_cv_path="$dir/$1"
+ break
+ fi
+ else
+ kde_cv_path="$dir/$1"
+ break
+ fi
+ fi
+ done
+
+ eval "kde_cv_path_$kde_cache=$kde_cv_path"
+
+ ])
+
+ eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
+
+ fi
+
+ if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
+ AC_MSG_RESULT(not found)
+ $4
+ else
+ AC_MSG_RESULT($kde_cv_path)
+ $2=$kde_cv_path
+
+ fi
+])
+
+AC_DEFUN([KDE_MOC_ERROR_MESSAGE],
+[
+ AC_MSG_ERROR([No Qt meta object compiler (moc) found!
+Please check whether you installed Qt correctly.
+You need to have a running moc binary.
+configure tried to run $ac_cv_path_moc and the test didn't
+succeed. If configure shouldn't have tried this one, set
+the environment variable MOC to the right one before running
+configure.
+])
+])
+
+AC_DEFUN([KDE_UIC_ERROR_MESSAGE],
+[
+ AC_MSG_WARN([No Qt ui compiler (uic) found!
+Please check whether you installed Qt correctly.
+You need to have a running uic binary.
+configure tried to run $ac_cv_path_uic and the test didn't
+succeed. If configure shouldn't have tried this one, set
+the environment variable UIC to the right one before running
+configure.
+])
+])
+
+
+AC_DEFUN([KDE_CHECK_UIC_FLAG],
+[
+ AC_MSG_CHECKING([whether uic supports -$1 ])
+ kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'`
+ AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache,
+ [
+ cat >conftest.ui <<EOT
+ <!DOCTYPE UI><UI version="3" stdsetdef="1"></UI>
+EOT
+ ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null"
+ if AC_TRY_EVAL(ac_uic_testrun); then
+ eval "kde_cv_prog_uic_$kde_cache=yes"
+ else
+ eval "kde_cv_prog_uic_$kde_cache=no"
+ fi
+ rm -f conftest*
+ ])
+
+ if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then
+ AC_MSG_RESULT([yes])
+ :
+ $3
+ else
+ AC_MSG_RESULT([no])
+ :
+ $4
+ fi
+])
+
+
+dnl ------------------------------------------------------------------------
+dnl Find the meta object compiler and the ui compiler in the PATH,
+dnl in $QTDIR/bin, and some more usual places
+dnl ------------------------------------------------------------------------
+dnl
+AC_DEFUN([AC_PATH_QT_MOC_UIC],
+[
+ AC_REQUIRE([KDE_CHECK_PERL])
+ qt_bindirs=""
+ for dir in $kde_qt_dirs; do
+ qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc"
+ done
+ qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
+ if test ! "$ac_qt_bindir" = "NO"; then
+ qt_bindirs="$ac_qt_bindir $qt_bindirs"
+ fi
+
+ KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE])
+ if test -z "$UIC_NOT_NEEDED"; then
+ KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""])
+ if test -z "$UIC_PATH" ; then
+ KDE_UIC_ERROR_MESSAGE
+ exit 1
+ else
+ UIC=$UIC_PATH
+
+ if test $kde_qtver = 3; then
+ KDE_CHECK_UIC_FLAG(L,[/nonexistent],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no)
+ KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no)
+
+ if test x$ac_uic_supports_libpath = xyes; then
+ UIC="$UIC -L \$(kde_widgetdir)"
+ fi
+ if test x$ac_uic_supports_nounload = xyes; then
+ UIC="$UIC -nounload"
+ fi
+ fi
+ fi
+ else
+ UIC="echo uic not available: "
+ fi
+
+ AC_SUBST(MOC)
+ AC_SUBST(UIC)
+
+ UIC_TR="i18n"
+ if test $kde_qtver = 3; then
+ UIC_TR="tr2i18n"
+ fi
+
+ AC_SUBST(UIC_TR)
+])
+
+AC_DEFUN([KDE_1_CHECK_PATHS],
+[
+ KDE_1_CHECK_PATH_HEADERS
+
+ KDE_TEST_RPATH=
+
+ if test -n "$USE_RPATH"; then
+
+ if test -n "$kde_libraries"; then
+ KDE_TEST_RPATH="-R $kde_libraries"
+ fi
+
+ if test -n "$qt_libraries"; then
+ KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries"
+ fi
+
+ if test -n "$x_libraries"; then
+ KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries"
+ fi
+
+ KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
+ fi
+
+AC_MSG_CHECKING([for KDE libraries installed])
+ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5'
+
+if AC_TRY_EVAL(ac_link) && test -s conftest; then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_ERROR([your system fails at linking a small KDE application!
+Check, if your compiler is installed correctly and if you have used the
+same compiler to compile Qt and kdelibs as you did use now.
+For more details about this problem, look at the end of config.log.])
+fi
+
+if eval `KDEDIR= ./conftest 2>&5`; then
+ kde_result=done
+else
+ kde_result=problems
+fi
+
+KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
+kde_have_all_paths=yes
+
+KDE_SET_PATHS($kde_result)
+
+])
+
+AC_DEFUN([KDE_SET_PATHS],
+[
+ kde_cv_all_paths="kde_have_all_paths=\"yes\" \
+ kde_htmldir=\"$kde_htmldir\" \
+ kde_appsdir=\"$kde_appsdir\" \
+ kde_icondir=\"$kde_icondir\" \
+ kde_sounddir=\"$kde_sounddir\" \
+ kde_datadir=\"$kde_datadir\" \
+ kde_locale=\"$kde_locale\" \
+ kde_cgidir=\"$kde_cgidir\" \
+ kde_confdir=\"$kde_confdir\" \
+ kde_kcfgdir=\"$kde_kcfgdir\" \
+ kde_mimedir=\"$kde_mimedir\" \
+ kde_toolbardir=\"$kde_toolbardir\" \
+ kde_wallpaperdir=\"$kde_wallpaperdir\" \
+ kde_templatesdir=\"$kde_templatesdir\" \
+ kde_bindir=\"$kde_bindir\" \
+ kde_servicesdir=\"$kde_servicesdir\" \
+ kde_servicetypesdir=\"$kde_servicetypesdir\" \
+ kde_moduledir=\"$kde_moduledir\" \
+ kde_styledir=\"$kde_styledir\" \
+ kde_widgetdir=\"$kde_widgetdir\" \
+ xdg_appsdir=\"$xdg_appsdir\" \
+ xdg_menudir=\"$xdg_menudir\" \
+ xdg_directorydir=\"$xdg_directorydir\" \
+ kde_result=$1"
+])
+
+AC_DEFUN([KDE_SET_DEFAULT_PATHS],
+[
+if test "$1" = "default"; then
+
+ if test -z "$kde_htmldir"; then
+ kde_htmldir='\${datadir}/doc/HTML'
+ fi
+ if test -z "$kde_appsdir"; then
+ kde_appsdir='\${datadir}/applnk'
+ fi
+ if test -z "$kde_icondir"; then
+ kde_icondir='\${datadir}/icons'
+ fi
+ if test -z "$kde_sounddir"; then
+ kde_sounddir='\${datadir}/sounds'
+ fi
+ if test -z "$kde_datadir"; then
+ kde_datadir='\${datadir}/apps'
+ fi
+ if test -z "$kde_locale"; then
+ kde_locale='\${datadir}/locale'
+ fi
+ if test -z "$kde_cgidir"; then
+ kde_cgidir='\${exec_prefix}/cgi-bin'
+ fi
+ if test -z "$kde_confdir"; then
+ kde_confdir='\${datadir}/config'
+ fi
+ if test -z "$kde_kcfgdir"; then
+ kde_kcfgdir='\${datadir}/config.kcfg'
+ fi
+ if test -z "$kde_mimedir"; then
+ kde_mimedir='\${datadir}/mimelnk'
+ fi
+ if test -z "$kde_toolbardir"; then
+ kde_toolbardir='\${datadir}/toolbar'
+ fi
+ if test -z "$kde_wallpaperdir"; then
+ kde_wallpaperdir='\${datadir}/wallpapers'
+ fi
+ if test -z "$kde_templatesdir"; then
+ kde_templatesdir='\${datadir}/templates'
+ fi
+ if test -z "$kde_bindir"; then
+ kde_bindir='\${exec_prefix}/bin'
+ fi
+ if test -z "$kde_servicesdir"; then
+ kde_servicesdir='\${datadir}/services'
+ fi
+ if test -z "$kde_servicetypesdir"; then
+ kde_servicetypesdir='\${datadir}/servicetypes'
+ fi
+ if test -z "$kde_moduledir"; then
+ if test "$kde_qtver" = "2"; then
+ kde_moduledir='\${libdir}/kde2'
+ else
+ kde_moduledir='\${libdir}/kde3'
+ fi
+ fi
+ if test -z "$kde_styledir"; then
+ kde_styledir='\${libdir}/kde3/plugins/styles'
+ fi
+ if test -z "$kde_widgetdir"; then
+ kde_widgetdir='\${libdir}/kde3/plugins/designer'
+ fi
+ if test -z "$xdg_appsdir"; then
+ xdg_appsdir='\${datadir}/applications/kde'
+ fi
+ if test -z "$xdg_menudir"; then
+ xdg_menudir='\${sysconfdir}/xdg/menus'
+ fi
+ if test -z "$xdg_directorydir"; then
+ xdg_directorydir='\${datadir}/desktop-directories'
+ fi
+
+ KDE_SET_PATHS(defaults)
+
+else
+
+ if test $kde_qtver = 1; then
+ AC_MSG_RESULT([compiling])
+ KDE_1_CHECK_PATHS
+ else
+ AC_MSG_ERROR([path checking not yet supported for KDE 2])
+ fi
+
+fi
+])
+
+AC_DEFUN([KDE_CHECK_PATHS_FOR_COMPLETENESS],
+[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
+ test -z "$kde_icondir" || test -z "$kde_sounddir" ||
+ test -z "$kde_datadir" || test -z "$kde_locale" ||
+ test -z "$kde_cgidir" || test -z "$kde_confdir" ||
+ test -z "$kde_kcfgdir" ||
+ test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
+ test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" ||
+ test -z "$kde_bindir" || test -z "$kde_servicesdir" ||
+ test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" ||
+ test -z "$kde_styledir" || test -z "kde_widgetdir" ||
+ test -z "$xdg_appsdir" || test -z "$xdg_menudir" || test -z "$xdg_directorydir" ||
+ test "x$kde_have_all_paths" != "xyes"; then
+ kde_have_all_paths=no
+ fi
+])
+
+AC_DEFUN([KDE_MISSING_PROG_ERROR],
+[
+ AC_MSG_ERROR([The important program $1 was not found!
+Please check whether you installed KDE correctly.
+])
+])
+
+AC_DEFUN([KDE_MISSING_ARTS_ERROR],
+[
+ AC_MSG_ERROR([The important program $1 was not found!
+Please check whether you installed aRts correctly or use
+--without-arts to compile without aRts support (this will remove functionality).
+])
+])
+
+AC_DEFUN([KDE_SET_DEFAULT_BINDIRS],
+[
+ kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin"
+ test -n "$KDEDIR" && kde_default_bindirs="$KDEDIR/bin $kde_default_bindirs"
+ if test -n "$KDEDIRS"; then
+ kde_save_IFS=$IFS
+ IFS=:
+ for dir in $KDEDIRS; do
+ kde_default_bindirs="$dir/bin $kde_default_bindirs "
+ done
+ IFS=$kde_save_IFS
+ fi
+])
+
+AC_DEFUN([KDE_SUBST_PROGRAMS],
+[
+ AC_ARG_WITH(arts,
+ AC_HELP_STRING([--without-arts],[build without aRts [default=no]]),
+ [build_arts=$withval],
+ [build_arts=yes]
+ )
+ AM_CONDITIONAL(include_ARTS, test "$build_arts" '!=' "no")
+ if test "$build_arts" = "no"; then
+ AC_DEFINE(WITHOUT_ARTS, 1, [Defined if compiling without arts])
+ fi
+
+ KDE_SET_DEFAULT_BINDIRS
+ kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_libs_prefix/bin $kde_default_bindirs"
+ KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)])
+ KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)])
+ if test "$build_arts" '!=' "no"; then
+ KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)])
+ KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)])
+ fi
+ KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs])
+
+ kde32ornewer=1
+ kde33ornewer=1
+ if test -n "$kde_qtver" && test "$kde_qtver" -lt 3; then
+ kde32ornewer=
+ kde33ornewer=
+ else
+ if test "$kde_qtver" = "3"; then
+ if test "$kde_qtsubver" -le 1; then
+ kde32ornewer=
+ fi
+ if test "$kde_qtsubver" -le 2; then
+ kde33ornewer=
+ fi
+ if test "$KDECONFIG" != "compiled"; then
+ if test `$KDECONFIG --version | grep KDE | sed 's/KDE: \(...\).*/\1/'` = 3.2; then
+ kde33ornewer=
+ fi
+ fi
+ fi
+ fi
+
+ if test -n "$kde32ornewer"; then
+ KDE_FIND_PATH(kconfig_compiler, KCONFIG_COMPILER, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kconfig_compiler)])
+ KDE_FIND_PATH(dcopidlng, DCOPIDLNG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidlng)])
+ fi
+ if test -n "$kde33ornewer"; then
+ KDE_FIND_PATH(makekdewidgets, MAKEKDEWIDGETS, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(makekdewidgets)])
+ AC_SUBST(MAKEKDEWIDGETS)
+ fi
+ KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin], [XMLLINT=""])
+
+ if test -n "$MEINPROC" -a "$MEINPROC" != "compiled"; then
+ kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share"
+ test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs"
+ AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET)
+ if test "$KDE_XSL_STYLESHEET" = "NO"; then
+ KDE_XSL_STYLESHEET=""
+ else
+ KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl"
+ fi
+ fi
+
+ DCOP_DEPENDENCIES='$(DCOPIDL)'
+ if test -n "$kde32ornewer"; then
+ KCFG_DEPENDENCIES='$(KCONFIG_COMPILER)'
+ DCOP_DEPENDENCIES='$(DCOPIDL) $(DCOPIDLNG)'
+ AC_SUBST(KCONFIG_COMPILER)
+ AC_SUBST(KCFG_DEPENDENCIES)
+ AC_SUBST(DCOPIDLNG)
+ fi
+ AC_SUBST(DCOPIDL)
+ AC_SUBST(DCOPIDL2CPP)
+ AC_SUBST(DCOP_DEPENDENCIES)
+ AC_SUBST(MCOPIDL)
+ AC_SUBST(ARTSCCONFIG)
+ AC_SUBST(MEINPROC)
+ AC_SUBST(KDE_XSL_STYLESHEET)
+ AC_SUBST(XMLLINT)
+])dnl
+
+AC_DEFUN([AC_CREATE_KFSSTND],
+[
+AC_REQUIRE([AC_CHECK_RPATH])
+
+AC_MSG_CHECKING([for KDE paths])
+kde_result=""
+kde_cached_paths=yes
+AC_CACHE_VAL(kde_cv_all_paths,
+[
+ KDE_SET_DEFAULT_PATHS($1)
+ kde_cached_paths=no
+])
+eval "$kde_cv_all_paths"
+KDE_CHECK_PATHS_FOR_COMPLETENESS
+if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then
+ # wrong values were cached, may be, we can set better ones
+ kde_result=
+ kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir=
+ kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_kcfgdir=
+ kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir=
+ kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir=
+ kde_have_all_paths=
+ kde_styledir=
+ kde_widgetdir=
+ xdg_appsdir = xdg_menudir= xdg_directorydir=
+ KDE_SET_DEFAULT_PATHS($1)
+ eval "$kde_cv_all_paths"
+ KDE_CHECK_PATHS_FOR_COMPLETENESS
+ kde_result="$kde_result (cache overridden)"
+fi
+if test "$kde_have_all_paths" = "no"; then
+ AC_MSG_ERROR([configure could not run a little KDE program to test the environment.
+Since it had compiled and linked before, it must be a strange problem on your system.
+Look at config.log for details. If you are not able to fix this, look at
+http://www.kde.org/faq/installation.html or any www.kde.org mirror.
+(If you're using an egcs version on Linux, you may update binutils!)
+])
+else
+ rm -f conftest*
+ AC_MSG_RESULT($kde_result)
+fi
+
+bindir=$kde_bindir
+
+KDE_SUBST_PROGRAMS
+
+])
+
+AC_DEFUN([AC_SUBST_KFSSTND],
+[
+AC_SUBST(kde_htmldir)
+AC_SUBST(kde_appsdir)
+AC_SUBST(kde_icondir)
+AC_SUBST(kde_sounddir)
+AC_SUBST(kde_datadir)
+AC_SUBST(kde_locale)
+AC_SUBST(kde_confdir)
+AC_SUBST(kde_kcfgdir)
+AC_SUBST(kde_mimedir)
+AC_SUBST(kde_wallpaperdir)
+AC_SUBST(kde_bindir)
+dnl X Desktop Group standards
+AC_SUBST(xdg_appsdir)
+AC_SUBST(xdg_menudir)
+AC_SUBST(xdg_directorydir)
+dnl for KDE 2
+AC_SUBST(kde_templatesdir)
+AC_SUBST(kde_servicesdir)
+AC_SUBST(kde_servicetypesdir)
+AC_SUBST(kde_moduledir)
+AC_SUBST(kdeinitdir, '$(kde_moduledir)')
+AC_SUBST(kde_styledir)
+AC_SUBST(kde_widgetdir)
+if test "$kde_qtver" = 1; then
+ kde_minidir="$kde_icondir/mini"
+else
+# for KDE 1 - this breaks KDE2 apps using minidir, but
+# that's the plan ;-/
+ kde_minidir="/dev/null"
+fi
+dnl AC_SUBST(kde_minidir)
+dnl AC_SUBST(kde_cgidir)
+dnl AC_SUBST(kde_toolbardir)
+])
+
+AC_DEFUN([KDE_MISC_TESTS],
+[
+ dnl Checks for libraries.
+ AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD
+ AC_SUBST(LIBUTIL)
+ AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD
+ AC_SUBST(LIBCOMPAT)
+ kde_have_crypt=
+ AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
+ AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
+ AC_MSG_WARN([you have no crypt in either libcrypt or libc.
+You should install libcrypt from another source or configure with PAM
+support])
+ kde_have_crypt=no
+ ]))
+ AC_SUBST(LIBCRYPT)
+ if test $kde_have_crypt = yes; then
+ AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
+ fi
+ AC_CHECK_SOCKLEN_T
+ AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
+ if test $ac_cv_lib_dnet_dnet_ntoa = no; then
+ AC_CHECK_LIB(dnet_stub, dnet_ntoa,
+ [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
+ fi
+ AC_CHECK_FUNC(inet_ntoa)
+ if test $ac_cv_func_inet_ntoa = no; then
+ AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
+ fi
+ AC_CHECK_FUNC(connect)
+ if test $ac_cv_func_connect = no; then
+ AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
+ $X_EXTRA_LIBS)
+ fi
+
+ AC_CHECK_FUNC(remove)
+ if test $ac_cv_func_remove = no; then
+ AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
+ fi
+
+ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
+ AC_CHECK_FUNC(shmat, ,
+ AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"))
+
+ # more headers that need to be explicitly included on darwin
+ AC_CHECK_HEADERS(sys/types.h stdint.h)
+
+ # sys/bitypes.h is needed for uint32_t and friends on Tru64
+ AC_CHECK_HEADERS(sys/bitypes.h)
+
+ # darwin requires a poll emulation library
+ AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll")
+
+ # for some image handling on Mac OS X
+ AC_CHECK_HEADERS(Carbon/Carbon.h)
+
+ # CoreAudio framework
+ AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [
+ AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API])
+ FRAMEWORK_COREAUDIO="-Wl,-framework,CoreAudio"
+ ])
+
+ AC_CHECK_RES_INIT
+ AC_SUBST(LIB_POLL)
+ AC_SUBST(FRAMEWORK_COREAUDIO)
+ LIBSOCKET="$X_EXTRA_LIBS"
+ AC_SUBST(LIBSOCKET)
+ AC_SUBST(X_EXTRA_LIBS)
+ AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
+ AC_SUBST(LIBUCB)
+
+ case $host in dnl this *is* LynxOS specific
+ *-*-lynxos* )
+ AC_MSG_CHECKING([LynxOS header file wrappers])
+ [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
+ AC_MSG_RESULT(disabled)
+ AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
+ ;;
+ esac
+
+ KDE_CHECK_TYPES
+ KDE_CHECK_LIBDL
+ KDE_CHECK_STRLCPY
+ KDE_CHECK_PIE_SUPPORT
+
+# darwin needs this to initialize the environment
+AC_CHECK_HEADERS(crt_externs.h)
+AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])])
+
+AH_VERBATIM(_DARWIN_ENVIRON,
+[
+#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
+# include <sys/time.h>
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+#endif
+])
+
+AH_VERBATIM(_AIX_STRINGS_H_BZERO,
+[
+/*
+ * AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
+ * that defines bzero.
+ */
+
+#if defined(_AIX)
+#include <strings.h>
+#endif
+])
+
+AC_CHECK_FUNCS([vsnprintf snprintf])
+
+AH_VERBATIM(_TRU64,[
+/*
+ * On HP-UX, the declaration of vsnprintf() is needed every time !
+ */
+
+#if !defined(HAVE_VSNPRINTF) || defined(hpux)
+#if __STDC__
+#include <stdarg.h>
+#include <stdlib.h>
+#else
+#include <varargs.h>
+#endif
+#ifdef __cplusplus
+extern "C"
+#endif
+int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
+#ifdef __cplusplus
+extern "C"
+#endif
+int snprintf(char *str, size_t n, char const *fmt, ...);
+#endif
+])
+
+])
+
+dnl ------------------------------------------------------------------------
+dnl Find the header files and libraries for X-Windows. Extended the
+dnl macro AC_PATH_X
+dnl ------------------------------------------------------------------------
+dnl
+AC_DEFUN([K_PATH_X],
+[
+AC_REQUIRE([KDE_MISC_TESTS])dnl
+AC_REQUIRE([KDE_CHECK_LIB64])
+
+AC_ARG_ENABLE(
+ embedded,
+ AC_HELP_STRING([--enable-embedded],[link to Qt-embedded, don't use X]),
+ kde_use_qt_emb=$enableval,
+ kde_use_qt_emb=no
+)
+
+AC_ARG_ENABLE(
+ qtopia,
+ AC_HELP_STRING([--enable-qtopia],[link to Qt-embedded, link to the Qtopia Environment]),
+ kde_use_qt_emb_palm=$enableval,
+ kde_use_qt_emb_palm=no
+)
+
+AC_ARG_ENABLE(
+ mac,
+ AC_HELP_STRING([--enable-mac],[link to Qt/Mac (don't use X)]),
+ kde_use_qt_mac=$enableval,
+ kde_use_qt_mac=no
+)
+
+# used to disable x11-specific stuff on special platforms
+AM_CONDITIONAL(include_x11, test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no")
+
+if test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no"; then
+
+AC_MSG_CHECKING(for X)
+
+AC_CACHE_VAL(kde_cv_have_x,
+[# One or both of the vars are not set, and there is no cached value.
+if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
+ kde_x_includes=NO
+else
+ kde_x_includes=$x_includes
+fi
+if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
+ kde_x_libraries=NO
+else
+ kde_x_libraries=$x_libraries
+fi
+
+# below we use the standard autoconf calls
+ac_x_libraries=$kde_x_libraries
+ac_x_includes=$kde_x_includes
+
+KDE_PATH_X_DIRECT
+dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries.
+dnl Unfortunately, if compiling with the N32 ABI, this is not the correct
+dnl location. The correct location is /usr/lib32 or an undefined value
+dnl (the linker is smart enough to pick the correct default library).
+dnl Things work just fine if you use just AC_PATH_X_DIRECT.
+dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to
+dnl /usr/openwin/include, which doesn't work. /usr/include does work, so
+dnl x_includes should be left alone.
+case "$host" in
+mips-sgi-irix6*)
+ ;;
+*-*-solaris*)
+ ;;
+*)
+ _AC_PATH_X_XMKMF
+ if test -z "$ac_x_includes"; then
+ ac_x_includes="."
+ fi
+ if test -z "$ac_x_libraries"; then
+ ac_x_libraries="/usr/lib${kdelibsuff}"
+ fi
+esac
+#from now on we use our own again
+
+# when the user already gave --x-includes, we ignore
+# what the standard autoconf macros told us.
+if test "$kde_x_includes" = NO; then
+ kde_x_includes=$ac_x_includes
+fi
+
+# for --x-libraries too
+if test "$kde_x_libraries" = NO; then
+ kde_x_libraries=$ac_x_libraries
+fi
+
+if test "$kde_x_includes" = NO; then
+ AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
+fi
+
+if test "$kde_x_libraries" = NO; then
+ AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
+fi
+
+# Record where we found X for the cache.
+kde_cv_have_x="have_x=yes \
+ kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries"
+])dnl
+
+eval "$kde_cv_have_x"
+
+if test "$have_x" != yes; then
+ AC_MSG_RESULT($have_x)
+ no_x=yes
+else
+ AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes])
+fi
+
+if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
+ X_INCLUDES=""
+ x_includes="."; dnl better than nothing :-
+ else
+ x_includes=$kde_x_includes
+ X_INCLUDES="-I$x_includes"
+fi
+
+if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE || test "$kde_x_libraries" = "/usr/lib"; then
+ X_LDFLAGS=""
+ x_libraries="/usr/lib"; dnl better than nothing :-
+ else
+ x_libraries=$kde_x_libraries
+ X_LDFLAGS="-L$x_libraries"
+fi
+all_includes="$X_INCLUDES"
+all_libraries="$X_LDFLAGS $LDFLAGS_AS_NEEDED $LDFLAGS_NEW_DTAGS"
+
+# Check for libraries that X11R6 Xt/Xaw programs need.
+ac_save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $X_LDFLAGS"
+# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+# check for ICE first), but we must link in the order -lSM -lICE or
+# we get undefined symbols. So assume we have SM if we have ICE.
+# These have to be linked with before -lX11, unlike the other
+# libraries we check for below, so use a different variable.
+# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
+AC_CHECK_LIB(ICE, IceConnectionNumber,
+ [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS)
+LDFLAGS="$ac_save_LDFLAGS"
+
+LIB_X11='-lX11 $(LIBSOCKET)'
+
+AC_MSG_CHECKING(for libXext)
+AC_CACHE_VAL(kde_cv_have_libXext,
+[
+kde_ldflags_safe="$LDFLAGS"
+kde_libs_safe="$LIBS"
+
+LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS"
+LIBS="-lXext -lX11 $LIBSOCKET"
+
+AC_TRY_LINK([
+#include <stdio.h>
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+#endif
+],
+[
+printf("hello Xext\n");
+],
+kde_cv_have_libXext=yes,
+kde_cv_have_libXext=no
+)
+
+LDFLAGS=$kde_ldflags_safe
+LIBS=$kde_libs_safe
+])
+
+AC_MSG_RESULT($kde_cv_have_libXext)
+
+if test "$kde_cv_have_libXext" = "no"; then
+ AC_MSG_ERROR([We need a working libXext to proceed. Since configure
+can't find it itself, we stop here assuming that make wouldn't find
+them either.])
+fi
+
+LIB_XEXT="-lXext"
+QTE_NORTTI=""
+
+elif test "$kde_use_qt_emb" = "yes"; then
+ dnl We're using QT Embedded
+ CPPFLAGS=-DQWS
+ CXXFLAGS="$CXXFLAGS -fno-rtti"
+ QTE_NORTTI="-fno-rtti -DQWS"
+ X_PRE_LIBS=""
+ LIB_X11=""
+ LIB_XEXT=""
+ LIB_XRENDER=""
+ LIBSM=""
+ X_INCLUDES=""
+ X_LDFLAGS=""
+ x_includes=""
+ x_libraries=""
+elif test "$kde_use_qt_mac" = "yes"; then
+ dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to
+ dnl be included to get the information) --Sam
+ CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp"
+ CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp"
+ X_PRE_LIBS=""
+ LIB_X11=""
+ LIB_XEXT=""
+ LIB_XRENDER=""
+ LIBSM=""
+ X_INCLUDES=""
+ X_LDFLAGS=""
+ x_includes=""
+ x_libraries=""
+fi
+AC_SUBST(X_PRE_LIBS)
+AC_SUBST(LIB_X11)
+AC_SUBST(LIB_XRENDER)
+AC_SUBST(LIBSM)
+AC_SUBST(X_INCLUDES)
+AC_SUBST(X_LDFLAGS)
+AC_SUBST(x_includes)
+AC_SUBST(x_libraries)
+AC_SUBST(QTE_NORTTI)
+AC_SUBST(LIB_XEXT)
+
+])
+
+AC_DEFUN([KDE_PRINT_QT_PROGRAM],
+[
+AC_REQUIRE([KDE_USE_QT])
+cat > conftest.$ac_ext <<EOF
+#include "confdefs.h"
+#include <qglobal.h>
+#include <qapplication.h>
+EOF
+if test "$kde_qtver" = "2"; then
+cat >> conftest.$ac_ext <<EOF
+#include <qevent.h>
+#include <qstring.h>
+#include <qstyle.h>
+EOF
+
+if test $kde_qtsubver -gt 0; then
+cat >> conftest.$ac_ext <<EOF
+#if QT_VERSION < 210
+#error 1
+#endif
+EOF
+fi
+fi
+
+if test "$kde_qtver" = "3"; then
+cat >> conftest.$ac_ext <<EOF
+#include <qcursor.h>
+#include <qstylefactory.h>
+#include <private/qucomextra_p.h>
+EOF
+fi
+
+echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
+cat >> conftest.$ac_ext <<EOF
+#error 1
+#endif
+
+int main() {
+EOF
+if test "$kde_qtver" = "2"; then
+cat >> conftest.$ac_ext <<EOF
+ QStringList *t = new QStringList();
+ Q_UNUSED(t);
+EOF
+if test $kde_qtsubver -gt 0; then
+cat >> conftest.$ac_ext <<EOF
+ QString s;
+ s.setLatin1("Elvis is alive", 14);
+EOF
+fi
+fi
+if test "$kde_qtver" = "3"; then
+cat >> conftest.$ac_ext <<EOF
+ (void)QStyleFactory::create(QString::null);
+ QCursor c(Qt::WhatsThisCursor);
+EOF
+fi
+cat >> conftest.$ac_ext <<EOF
+ return 0;
+}
+EOF
+])
+
+AC_DEFUN([KDE_USE_QT],
+[
+if test -z "$1"; then
+ # Current default Qt version: 3.3
+ kde_qtver=3
+ kde_qtsubver=3
+else
+ kde_qtsubver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'`
+ # following is the check if subversion isnt found in passed argument
+ if test "$kde_qtsubver" = "$1"; then
+ kde_qtsubver=1
+ fi
+ kde_qtver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'`
+ if test "$kde_qtver" = "1"; then
+ kde_qtsubver=42
+ fi
+fi
+
+if test -z "$2"; then
+ if test "$kde_qtver" = "2"; then
+ if test $kde_qtsubver -gt 0; then
+ kde_qt_minversion=">= Qt 2.2.2"
+ else
+ kde_qt_minversion=">= Qt 2.0.2"
+ fi
+ fi
+ if test "$kde_qtver" = "3"; then
+ if test $kde_qtsubver -gt 0; then
+ if test $kde_qtsubver -gt 1; then
+ if test $kde_qtsubver -gt 2; then
+ kde_qt_minversion=">= Qt 3.3 and < 4.0"
+ else
+ kde_qt_minversion=">= Qt 3.2 and < 4.0"
+ fi
+ else
+ kde_qt_minversion=">= Qt 3.1 (20021021) and < 4.0"
+ fi
+ else
+ kde_qt_minversion=">= Qt 3.0 and < 4.0"
+ fi
+ fi
+ if test "$kde_qtver" = "1"; then
+ kde_qt_minversion=">= 1.42 and < 2.0"
+ fi
+else
+ kde_qt_minversion="$2"
+fi
+
+if test -z "$3"; then
+ if test $kde_qtver = 3; then
+ if test $kde_qtsubver -gt 0; then
+ kde_qt_verstring="QT_VERSION >= 0x03@VER@00 && QT_VERSION < 0x040000"
+ qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'`
+ kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"`
+ else
+ kde_qt_verstring="QT_VERSION >= 300 && QT_VERSION < 0x040000"
+ fi
+ fi
+ if test $kde_qtver = 2; then
+ if test $kde_qtsubver -gt 0; then
+ kde_qt_verstring="QT_VERSION >= 222"
+ else
+ kde_qt_verstring="QT_VERSION >= 200"
+ fi
+ fi
+ if test $kde_qtver = 1; then
+ kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
+ fi
+else
+ kde_qt_verstring="$3"
+fi
+
+if test $kde_qtver = 4; then
+ kde_qt_dirs="$QTDIR /usr/lib/qt4 /usr/lib/qt /usr/share/qt4"
+fi
+if test $kde_qtver = 3; then
+ kde_qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt /usr/share/qt3"
+fi
+if test $kde_qtver = 2; then
+ kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
+fi
+if test $kde_qtver = 1; then
+ kde_qt_dirs="$QTDIR /usr/lib/qt"
+fi
+])
+
+AC_DEFUN([KDE_CHECK_QT_DIRECT],
+[
+AC_REQUIRE([KDE_USE_QT])
+AC_MSG_CHECKING([if Qt compiles without flags])
+AC_CACHE_VAL(kde_cv_qt_direct,
+[
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
+ac_LIBRARY_PATH="$LIBRARY_PATH"
+ac_cxxflags_safe="$CXXFLAGS"
+ac_ldflags_safe="$LDFLAGS"
+ac_libs_safe="$LIBS"
+
+CXXFLAGS="$CXXFLAGS -I$qt_includes"
+LDFLAGS="$LDFLAGS $X_LDFLAGS"
+if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
+LIBS="$LIBQT -lXext -lX11 $LIBSOCKET"
+else
+LIBS="$LIBQT $LIBSOCKET"
+fi
+LD_LIBRARY_PATH=
+export LD_LIBRARY_PATH
+LIBRARY_PATH=
+export LIBRARY_PATH
+
+KDE_PRINT_QT_PROGRAM
+
+if AC_TRY_EVAL(ac_link) && test -s conftest; then
+ kde_cv_qt_direct="yes"
+else
+ kde_cv_qt_direct="no"
+ echo "configure: failed program was:" >&AC_FD_CC
+ cat conftest.$ac_ext >&AC_FD_CC
+fi
+
+rm -f conftest*
+CXXFLAGS="$ac_cxxflags_safe"
+LDFLAGS="$ac_ldflags_safe"
+LIBS="$ac_libs_safe"
+
+LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
+export LD_LIBRARY_PATH
+LIBRARY_PATH="$ac_LIBRARY_PATH"
+export LIBRARY_PATH
+AC_LANG_RESTORE
+])
+
+if test "$kde_cv_qt_direct" = "yes"; then
+ AC_MSG_RESULT(yes)
+ $1
+else
+ AC_MSG_RESULT(no)
+ $2
+fi
+])
+
+dnl ------------------------------------------------------------------------
+dnl Try to find the Qt headers and libraries.
+dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
+dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
+dnl ------------------------------------------------------------------------
+dnl
+AC_DEFUN([AC_PATH_QT_1_3],
+[
+AC_REQUIRE([K_PATH_X])
+AC_REQUIRE([KDE_USE_QT])
+AC_REQUIRE([KDE_CHECK_LIB64])
+
+dnl ------------------------------------------------------------------------
+dnl Add configure flag to enable linking to MT version of Qt library.
+dnl ------------------------------------------------------------------------
+
+AC_ARG_ENABLE(
+ mt,
+ AC_HELP_STRING([--disable-mt],[link to non-threaded Qt (deprecated)]),
+ kde_use_qt_mt=$enableval,
+ [
+ if test $kde_qtver = 3; then
+ kde_use_qt_mt=yes
+ else
+ kde_use_qt_mt=no
+ fi
+ ]
+)
+
+USING_QT_MT=""
+
+dnl ------------------------------------------------------------------------
+dnl If we not get --disable-qt-mt then adjust some vars for the host.
+dnl ------------------------------------------------------------------------
+
+KDE_MT_LDFLAGS=
+KDE_MT_LIBS=
+if test "x$kde_use_qt_mt" = "xyes"; then
+ KDE_CHECK_THREADING
+ if test "x$kde_use_threading" = "xyes"; then
+ CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS"
+ KDE_MT_LDFLAGS="$USE_THREADS"
+ KDE_MT_LIBS="$LIBPTHREAD"
+ else
+ kde_use_qt_mt=no
+ fi
+fi
+AC_SUBST(KDE_MT_LDFLAGS)
+AC_SUBST(KDE_MT_LIBS)
+
+kde_qt_was_given=yes
+
+dnl ------------------------------------------------------------------------
+dnl If we haven't been told how to link to Qt, we work it out for ourselves.
+dnl ------------------------------------------------------------------------
+if test -z "$LIBQT_GLOB"; then
+ if test "x$kde_use_qt_emb" = "xyes"; then
+ LIBQT_GLOB="libqte.*"
+ else
+ LIBQT_GLOB="libqt.*"
+ fi
+fi
+
+dnl ------------------------------------------------------------
+dnl If we got --enable-embedded then adjust the Qt library name.
+dnl ------------------------------------------------------------
+if test "x$kde_use_qt_emb" = "xyes"; then
+ qtlib="qte"
+else
+ qtlib="qt"
+fi
+
+kde_int_qt="-l$qtlib"
+
+if test -z "$LIBQPE"; then
+dnl ------------------------------------------------------------
+dnl If we got --enable-palmtop then add -lqpe to the link line
+dnl ------------------------------------------------------------
+ if test "x$kde_use_qt_emb" = "xyes"; then
+ if test "x$kde_use_qt_emb_palm" = "xyes"; then
+ LIB_QPE="-lqpe"
+ else
+ LIB_QPE=""
+ fi
+ else
+ LIB_QPE=""
+ fi
+fi
+
+dnl ------------------------------------------------------------------------
+dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
+dnl ------------------------------------------------------------------------
+
+if test "x$kde_use_qt_mt" = "xyes"; then
+ LIBQT="-l$qtlib-mt"
+ kde_int_qt="-l$qtlib-mt"
+ LIBQT_GLOB="lib$qtlib-mt.*"
+ USING_QT_MT="using -mt"
+else
+ LIBQT="-l$qtlib"
+fi
+
+if test $kde_qtver != 1; then
+
+ AC_REQUIRE([AC_FIND_PNG])
+ AC_REQUIRE([AC_FIND_JPEG])
+ LIBQT="$LIBQT $LIBPNG $LIBJPEG"
+fi
+
+if test $kde_qtver = 3; then
+ AC_REQUIRE([KDE_CHECK_LIBDL])
+ LIBQT="$LIBQT $LIBDL"
+fi
+
+AC_MSG_CHECKING([for Qt])
+
+if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
+LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
+fi
+ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
+qt_libraries=""
+qt_includes=""
+AC_ARG_WITH(qt-dir,
+ AC_HELP_STRING([--with-qt-dir=DIR],[where the root of Qt is installed ]),
+ [ ac_qt_includes="$withval"/include
+ ac_qt_libraries="$withval"/lib${kdelibsuff}
+ ac_qt_bindir="$withval"/bin
+ ])
+
+AC_ARG_WITH(qt-includes,
+ AC_HELP_STRING([--with-qt-includes=DIR],[where the Qt includes are. ]),
+ [
+ ac_qt_includes="$withval"
+ ])
+
+kde_qt_libs_given=no
+
+AC_ARG_WITH(qt-libraries,
+ AC_HELP_STRING([--with-qt-libraries=DIR],[where the Qt library is installed.]),
+ [ ac_qt_libraries="$withval"
+ kde_qt_libs_given=yes
+ ])
+
+AC_CACHE_VAL(ac_cv_have_qt,
+[#try to guess Qt locations
+
+qt_incdirs=""
+for dir in $kde_qt_dirs; do
+ qt_incdirs="$qt_incdirs $dir/include $dir"
+done
+qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 /usr/include/qt3 $x_includes"
+if test ! "$ac_qt_includes" = "NO"; then
+ qt_incdirs="$ac_qt_includes $qt_incdirs"
+fi
+
+if test "$kde_qtver" != "1"; then
+ kde_qt_header=qstyle.h
+else
+ kde_qt_header=qglobal.h
+fi
+
+AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
+ac_qt_includes="$qt_incdir"
+
+qt_libdirs=""
+for dir in $kde_qt_dirs; do
+ qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir"
+done
+qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
+if test ! "$ac_qt_libraries" = "NO"; then
+ qt_libdir=$ac_qt_libraries
+else
+ qt_libdirs="$ac_qt_libraries $qt_libdirs"
+ # if the Qt was given, the chance is too big that libqt.* doesn't exist
+ qt_libdir=NONE
+ for dir in $qt_libdirs; do
+ try="ls -1 $dir/${LIBQT_GLOB}"
+ if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
+ done
+fi
+for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
+ if test -e "$a"; then
+ LIBQT="$LIBQT ${kde_int_qt}_incremental"
+ break
+ fi
+done
+
+ac_qt_libraries="$qt_libdir"
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+ac_cxxflags_safe="$CXXFLAGS"
+ac_ldflags_safe="$LDFLAGS"
+ac_libs_safe="$LIBS"
+
+CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
+LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
+LIBS="$LIBS $LIBQT $KDE_MT_LIBS"
+
+KDE_PRINT_QT_PROGRAM
+
+if AC_TRY_EVAL(ac_link) && test -s conftest; then
+ rm -f conftest*
+else
+ echo "configure: failed program was:" >&AC_FD_CC
+ cat conftest.$ac_ext >&AC_FD_CC
+ ac_qt_libraries="NO"
+fi
+rm -f conftest*
+CXXFLAGS="$ac_cxxflags_safe"
+LDFLAGS="$ac_ldflags_safe"
+LIBS="$ac_libs_safe"
+
+AC_LANG_RESTORE
+if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
+ ac_cv_have_qt="have_qt=no"
+ ac_qt_notfound=""
+ missing_qt_mt=""
+ if test "$ac_qt_includes" = NO; then
+ if test "$ac_qt_libraries" = NO; then
+ ac_qt_notfound="(headers and libraries)";
+ else
+ ac_qt_notfound="(headers)";
+ fi
+ else
+ if test "x$kde_use_qt_mt" = "xyes"; then
+ missing_qt_mt="
+Make sure that you have compiled Qt with thread support!"
+ ac_qt_notfound="(library $qtlib-mt)";
+ else
+ ac_qt_notfound="(library $qtlib)";
+ fi
+ fi
+
+ AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
+For more details about this problem, look at the end of config.log.$missing_qt_mt])
+else
+ have_qt="yes"
+fi
+])
+
+eval "$ac_cv_have_qt"
+
+if test "$have_qt" != yes; then
+ AC_MSG_RESULT([$have_qt]);
+else
+ ac_cv_have_qt="have_qt=yes \
+ ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
+ AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT])
+
+ qt_libraries="$ac_qt_libraries"
+ qt_includes="$ac_qt_includes"
+fi
+
+if test ! "$kde_qt_libs_given" = "yes" && test ! "$kde_qtver" = 3; then
+ KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
+fi
+
+AC_SUBST(qt_libraries)
+AC_SUBST(qt_includes)
+
+if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
+ QT_INCLUDES=""
+else
+ QT_INCLUDES="-I$qt_includes"
+ all_includes="$QT_INCLUDES $all_includes"
+fi
+
+if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
+ QT_LDFLAGS=""
+else
+ QT_LDFLAGS="-L$qt_libraries"
+ all_libraries="$QT_LDFLAGS $all_libraries"
+fi
+test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS"
+
+AC_SUBST(QT_INCLUDES)
+AC_SUBST(QT_LDFLAGS)
+AC_PATH_QT_MOC_UIC
+
+KDE_CHECK_QT_JPEG
+
+if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
+LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM)'
+else
+LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG)'
+fi
+test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS"
+for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
+ if test -e "$a"; then
+ LIB_QT="$LIB_QT ${kde_int_qt}_incremental"
+ break
+ fi
+done
+
+AC_SUBST(LIB_QT)
+AC_SUBST(LIB_QPE)
+
+AC_SUBST(kde_qtver)
+])
+
+AC_DEFUN([AC_PATH_QT],
+[
+AC_PATH_QT_1_3
+])
+
+AC_DEFUN([KDE_CHECK_UIC_PLUGINS],
+[
+AC_REQUIRE([AC_PATH_QT_MOC_UIC])
+
+if test x$ac_uic_supports_libpath = xyes; then
+
+AC_MSG_CHECKING([if UIC has KDE plugins available])
+AC_CACHE_VAL(kde_cv_uic_plugins,
+[
+cat > actest.ui << EOF
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>NewConnectionDialog</class>
+<widget class="QDialog">
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>testInput</cstring>
+ </property>
+ </widget>
+</widget>
+</UI>
+EOF
+
+
+
+kde_cv_uic_plugins=no
+kde_line="$UIC_PATH -L $kde_widgetdir"
+if test x$ac_uic_supports_nounload = xyes; then
+ kde_line="$kde_line -nounload"
+fi
+kde_line="$kde_line -impl actest.h actest.ui > actest.cpp"
+if AC_TRY_EVAL(kde_line); then
+ # if you're trying to debug this check and think it's incorrect,
+ # better check your installation. The check _is_ correct - your
+ # installation is not.
+ if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then
+ kde_cv_uic_plugins=yes
+ fi
+fi
+rm -f actest.ui actest.cpp
+])
+
+AC_MSG_RESULT([$kde_cv_uic_plugins])
+if test "$kde_cv_uic_plugins" != yes; then
+ AC_MSG_ERROR([
+you need to install kdelibs first.
+
+If you did install kdelibs, then the Qt version that is picked up by
+this configure is not the same version you used to compile kdelibs.
+The Qt Plugin installed by kdelibs is *ONLY* loadable if it is the
+_same Qt version_, compiled with the _same compiler_ and the same Qt
+configuration settings.
+])
+fi
+fi
+])
+
+AC_DEFUN([KDE_CHECK_FINAL],
+[
+ AC_ARG_ENABLE(final,
+ AC_HELP_STRING([--enable-final],
+ [build size optimized apps (experimental - needs lots of memory)]),
+ kde_use_final=$enableval, kde_use_final=no)
+
+ if test "x$kde_use_final" = "xyes"; then
+ KDE_USE_FINAL_TRUE=""
+ KDE_USE_FINAL_FALSE="#"
+ else
+ KDE_USE_FINAL_TRUE="#"
+ KDE_USE_FINAL_FALSE=""
+ fi
+ AC_SUBST(KDE_USE_FINAL_TRUE)
+ AC_SUBST(KDE_USE_FINAL_FALSE)
+])
+
+AC_DEFUN([KDE_CHECK_CLOSURE],
+[
+ AC_ARG_ENABLE(closure,
+ AC_HELP_STRING([--enable-closure],[delay template instantiation]),
+ kde_use_closure=$enableval, kde_use_closure=no)
+
+ KDE_NO_UNDEFINED=""
+ if test "x$kde_use_closure" = "xyes"; then
+ KDE_USE_CLOSURE_TRUE=""
+ KDE_USE_CLOSURE_FALSE="#"
+# CXXFLAGS="$CXXFLAGS $REPO"
+ else
+ KDE_USE_CLOSURE_TRUE="#"
+ KDE_USE_CLOSURE_FALSE=""
+ KDE_NO_UNDEFINED=""
+ case $host in
+ *-*-linux-gnu)
+ KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined],
+ [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined],
+ [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"],
+ [KDE_NO_UNDEFINED=""])],
+ [KDE_NO_UNDEFINED=""])
+ ;;
+ esac
+ fi
+ AC_SUBST(KDE_USE_CLOSURE_TRUE)
+ AC_SUBST(KDE_USE_CLOSURE_FALSE)
+ AC_SUBST(KDE_NO_UNDEFINED)
+])
+
+dnl Check if the linker supports --enable-new-dtags and --as-needed
+AC_DEFUN([KDE_CHECK_NEW_LDFLAGS],
+[
+ AC_ARG_ENABLE(new_ldflags,
+ AC_HELP_STRING([--enable-new-ldflags],
+ [enable the new linker flags]),
+ kde_use_new_ldflags=$enableval,
+ kde_use_new_ldflags=no)
+
+ LDFLAGS_AS_NEEDED=""
+ LDFLAGS_NEW_DTAGS=""
+ if test "x$kde_use_new_ldflags" = "xyes"; then
+ LDFLAGS_NEW_DTAGS=""
+ KDE_CHECK_COMPILER_FLAG([Wl,--enable-new-dtags],
+ [LDFLAGS_NEW_DTAGS="-Wl,--enable-new-dtags"],)
+
+ KDE_CHECK_COMPILER_FLAG([Wl,--as-needed],
+ [LDFLAGS_AS_NEEDED="-Wl,--as-needed"],)
+ fi
+ AC_SUBST(LDFLAGS_AS_NEEDED)
+ AC_SUBST(LDFLAGS_NEW_DTAGS)
+])
+
+AC_DEFUN([KDE_CHECK_NMCHECK],
+[
+ AC_ARG_ENABLE(nmcheck,AC_HELP_STRING([--enable-nmcheck],[enable automatic namespace cleanness check]),
+ kde_use_nmcheck=$enableval, kde_use_nmcheck=no)
+
+ if test "$kde_use_nmcheck" = "yes"; then
+ KDE_USE_NMCHECK_TRUE=""
+ KDE_USE_NMCHECK_FALSE="#"
+ else
+ KDE_USE_NMCHECK_TRUE="#"
+ KDE_USE_NMCHECK_FALSE=""
+ fi
+ AC_SUBST(KDE_USE_NMCHECK_TRUE)
+ AC_SUBST(KDE_USE_NMCHECK_FALSE)
+])
+
+AC_DEFUN([KDE_EXPAND_MAKEVAR], [
+savex=$exec_prefix
+test "x$exec_prefix" = xNONE && exec_prefix=$prefix
+tmp=$$2
+while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done
+exec_prefix=$savex
+])
+
+dnl ------------------------------------------------------------------------
+dnl Now, the same with KDE
+dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
+dnl and $(kde_includes) will be the kdehdrlocation (if needed)
+dnl ------------------------------------------------------------------------
+dnl
+AC_DEFUN([AC_BASE_PATH_KDE],
+[
+AC_REQUIRE([KDE_CHECK_STL])
+AC_REQUIRE([AC_PATH_QT])dnl
+AC_REQUIRE([KDE_CHECK_LIB64])
+
+AC_CHECK_RPATH
+AC_MSG_CHECKING([for KDE])
+
+if test "${prefix}" != NONE; then
+ kde_includes=${includedir}
+ KDE_EXPAND_MAKEVAR(ac_kde_includes, includedir)
+
+ kde_libraries=${libdir}
+ KDE_EXPAND_MAKEVAR(ac_kde_libraries, libdir)
+
+else
+ ac_kde_includes=
+ ac_kde_libraries=
+ kde_libraries=""
+ kde_includes=""
+fi
+
+AC_CACHE_VAL(ac_cv_have_kde,
+[#try to guess kde locations
+
+if test "$kde_qtver" = 1; then
+ kde_check_header="ksock.h"
+ kde_check_lib="libkdecore.la"
+else
+ kde_check_header="ksharedptr.h"
+ kde_check_lib="libkio.la"
+fi
+
+if test -z "$1"; then
+
+kde_incdirs="$kde_libs_prefix/include /usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes"
+test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
+kde_incdirs="$ac_kde_includes $kde_incdirs"
+AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
+ac_kde_includes="$kde_incdir"
+
+if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
+ AC_MSG_ERROR([
+in the prefix, you've chosen, are no KDE headers installed. This will fail.
+So, check this please and use another prefix!])
+fi
+
+kde_libdirs="$kde_libs_prefix/lib${kdelibsuff} /usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}"
+test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs"
+kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs"
+AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
+ac_kde_libraries="$kde_libdir"
+
+kde_widgetdir=NO
+dnl this might be somewhere else
+AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir)
+
+if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
+AC_MSG_ERROR([
+in the prefix, you've chosen, are no KDE libraries installed. This will fail.
+So, check this please and use another prefix!])
+fi
+
+if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then
+AC_MSG_ERROR([
+I can't find the designer plugins. These are required and should have been installed
+by kdelibs])
+fi
+
+if test -n "$kde_widgetdir"; then
+ kde_widgetdir="$kde_widgetdir/kde3/plugins/designer"
+fi
+
+
+if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then
+ ac_cv_have_kde="have_kde=no"
+else
+ ac_cv_have_kde="have_kde=yes \
+ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
+fi
+
+else dnl test -z $1, e.g. from kdelibs
+
+ ac_cv_have_kde="have_kde=no"
+
+fi
+])dnl
+
+eval "$ac_cv_have_kde"
+
+if test "$have_kde" != "yes"; then
+ if test "${prefix}" = NONE; then
+ ac_kde_prefix="$ac_default_prefix"
+ else
+ ac_kde_prefix="$prefix"
+ fi
+ if test "$exec_prefix" = NONE; then
+ ac_kde_exec_prefix="$ac_kde_prefix"
+ AC_MSG_RESULT([will be installed in $ac_kde_prefix])
+ else
+ ac_kde_exec_prefix="$exec_prefix"
+ AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
+ fi
+
+ kde_libraries="${libdir}"
+ kde_includes="${includedir}"
+
+else
+ ac_cv_have_kde="have_kde=yes \
+ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
+ AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
+
+ kde_libraries="$ac_kde_libraries"
+ kde_includes="$ac_kde_includes"
+fi
+AC_SUBST(kde_libraries)
+AC_SUBST(kde_includes)
+
+if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then
+ KDE_INCLUDES=""
+else
+ KDE_INCLUDES="-I$kde_includes"
+ all_includes="$KDE_INCLUDES $all_includes"
+fi
+
+KDE_DEFAULT_CXXFLAGS="-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION"
+
+KDE_LDFLAGS="-L$kde_libraries"
+if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then
+ all_libraries="$KDE_LDFLAGS $all_libraries"
+fi
+
+AC_SUBST(KDE_LDFLAGS)
+AC_SUBST(KDE_INCLUDES)
+
+AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+
+all_libraries="$all_libraries $USER_LDFLAGS"
+all_includes="$all_includes $USER_INCLUDES"
+AC_SUBST(all_includes)
+AC_SUBST(all_libraries)
+
+if test -z "$1"; then
+KDE_CHECK_UIC_PLUGINS
+fi
+
+ac_kde_libraries="$kde_libdir"
+
+AC_SUBST(AUTODIRS)
+
+
+])
+
+AC_DEFUN([KDE_CHECK_EXTRA_LIBS],
+[
+AC_MSG_CHECKING(for extra includes)
+AC_ARG_WITH(extra-includes,AC_HELP_STRING([--with-extra-includes=DIR],[adds non standard include paths]),
+ kde_use_extra_includes="$withval",
+ kde_use_extra_includes=NONE
+)
+kde_extra_includes=
+if test -n "$kde_use_extra_includes" && \
+ test "$kde_use_extra_includes" != "NONE"; then
+
+ ac_save_ifs=$IFS
+ IFS=':'
+ for dir in $kde_use_extra_includes; do
+ kde_extra_includes="$kde_extra_includes $dir"
+ USER_INCLUDES="$USER_INCLUDES -I$dir"
+ done
+ IFS=$ac_save_ifs
+ kde_use_extra_includes="added"
+else
+ kde_use_extra_includes="no"
+fi
+AC_SUBST(USER_INCLUDES)
+
+AC_MSG_RESULT($kde_use_extra_includes)
+
+kde_extra_libs=
+AC_MSG_CHECKING(for extra libs)
+AC_ARG_WITH(extra-libs,AC_HELP_STRING([--with-extra-libs=DIR],[adds non standard library paths]),
+ kde_use_extra_libs=$withval,
+ kde_use_extra_libs=NONE
+)
+if test -n "$kde_use_extra_libs" && \
+ test "$kde_use_extra_libs" != "NONE"; then
+
+ ac_save_ifs=$IFS
+ IFS=':'
+ for dir in $kde_use_extra_libs; do
+ kde_extra_libs="$kde_extra_libs $dir"
+ KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
+ USER_LDFLAGS="$USER_LDFLAGS -L$dir"
+ done
+ IFS=$ac_save_ifs
+ kde_use_extra_libs="added"
+else
+ kde_use_extra_libs="no"
+fi
+
+AC_SUBST(USER_LDFLAGS)
+
+AC_MSG_RESULT($kde_use_extra_libs)
+
+])
+
+AC_DEFUN([KDE_1_CHECK_PATH_HEADERS],
+[
+ AC_MSG_CHECKING([for KDE headers installed])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+cat > conftest.$ac_ext <<EOF
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "confdefs.h"
+#include <kapp.h>
+
+int main() {
+ printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
+ printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
+ printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
+ printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
+ printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
+ printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
+ printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
+ printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
+ printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
+ printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
+ printf("kde_wallpaperdir=\\"%s\\"\n",
+ KApplication::kde_wallpaperdir().data());
+ printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
+ printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
+ printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
+ printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
+ printf("kde_moduledir=\\"/tmp/dummy\\"\n");
+ printf("kde_styledir=\\"/tmp/dummy\\"\n");
+ printf("kde_widgetdir=\\"/tmp/dummy\\"\n");
+ printf("xdg_appsdir=\\"/tmp/dummy\\"\n");
+ printf("xdg_menudir=\\"/tmp/dummy\\"\n");
+ printf("xdg_directorydir=\\"/tmp/dummy\\"\n");
+ printf("kde_kcfgdir=\\"/tmp/dummy\\"\n");
+ return 0;
+ }
+EOF
+
+ ac_save_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$all_includes $CPPFLAGS"
+ if AC_TRY_EVAL(ac_compile); then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_ERROR([your system is not able to compile a small KDE application!
+Check, if you installed the KDE header files correctly.
+For more details about this problem, look at the end of config.log.])
+ fi
+ CPPFLAGS=$ac_save_CPPFLAGS
+
+ AC_LANG_RESTORE
+])
+
+AC_DEFUN([KDE_CHECK_KDEQTADDON],
+[
+AC_MSG_CHECKING(for kde-qt-addon)
+AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
+[
+ kde_ldflags_safe="$LDFLAGS"
+ kde_libs_safe="$LIBS"
+ kde_cxxflags_safe="$CXXFLAGS"
+
+ LIBS="-lkde-qt-addon $LIBQT $LIBS"
+ CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes"
+ LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
+
+ AC_TRY_LINK([
+ #include <qdom.h>
+ ],
+ [
+ QDomDocument doc;
+ ],
+ kde_cv_have_kdeqtaddon=yes,
+ kde_cv_have_kdeqtaddon=no
+ )
+
+ LDFLAGS=$kde_ldflags_safe
+ LIBS=$kde_libs_safe
+ CXXFLAGS=$kde_cxxflags_safe
+])
+
+AC_MSG_RESULT($kde_cv_have_kdeqtaddon)
+
+if test "$kde_cv_have_kdeqtaddon" = "no"; then
+ AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first.
+It is a separate package (and CVS module) named kde-qt-addon.])
+fi
+])
+
+AC_DEFUN([KDE_CREATE_LIBS_ALIASES],
+[
+ AC_REQUIRE([KDE_MISC_TESTS])
+ AC_REQUIRE([KDE_CHECK_LIBDL])
+ AC_REQUIRE([K_PATH_X])
+
+if test $kde_qtver = 3; then
+ case $host in
+ *cygwin*) lib_kded="-lkdeinit_kded" ;;
+ *) lib_kded="" ;;
+ esac
+ AC_SUBST(LIB_KDED, $lib_kded)
+ AC_SUBST(LIB_KDECORE, "-lkdecore")
+ AC_SUBST(LIB_KDEUI, "-lkdeui")
+ AC_SUBST(LIB_KIO, "-lkio")
+ AC_SUBST(LIB_KJS, "-lkjs")
+ AC_SUBST(LIB_SMB, "-lsmb")
+ AC_SUBST(LIB_KAB, "-lkab")
+ AC_SUBST(LIB_KABC, "-lkabc")
+ AC_SUBST(LIB_KHTML, "-lkhtml")
+ AC_SUBST(LIB_KSPELL, "-lkspell")
+ AC_SUBST(LIB_KPARTS, "-lkparts")
+ AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
+ AC_SUBST(LIB_KUTILS, "-lkutils")
+ AC_SUBST(LIB_KDEPIM, "-lkdepim")
+ AC_SUBST(LIB_KIMPROXY, "-lkimproxy")
+ AC_SUBST(LIB_KNEWSTUFF, "-lknewstuff")
+ AC_SUBST(LIB_KDNSSD, "-lkdnssd")
+ AC_SUBST(LIB_KUNITTEST, "-lkunittest")
+# these are for backward compatibility
+ AC_SUBST(LIB_KSYCOCA, "-lkio")
+ AC_SUBST(LIB_KFILE, "-lkio")
+elif test $kde_qtver = 2; then
+ AC_SUBST(LIB_KDECORE, "-lkdecore")
+ AC_SUBST(LIB_KDEUI, "-lkdeui")
+ AC_SUBST(LIB_KIO, "-lkio")
+ AC_SUBST(LIB_KSYCOCA, "-lksycoca")
+ AC_SUBST(LIB_SMB, "-lsmb")
+ AC_SUBST(LIB_KFILE, "-lkfile")
+ AC_SUBST(LIB_KAB, "-lkab")
+ AC_SUBST(LIB_KHTML, "-lkhtml")
+ AC_SUBST(LIB_KSPELL, "-lkspell")
+ AC_SUBST(LIB_KPARTS, "-lkparts")
+ AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
+else
+ AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)")
+ AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)")
+ AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)")
+ AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)")
+ AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)")
+fi
+])
+
+AC_DEFUN([AC_PATH_KDE],
+[
+ AC_BASE_PATH_KDE
+ AC_ARG_ENABLE(path-check,AC_HELP_STRING([--disable-path-check],[don't try to find out, where to install]),
+ [
+ if test "$enableval" = "no";
+ then ac_use_path_checking="default"
+ else ac_use_path_checking=""
+ fi
+ ],
+ [
+ if test "$kde_qtver" = 1;
+ then ac_use_path_checking=""
+ else ac_use_path_checking="default"
+ fi
+ ]
+ )
+
+ AC_CREATE_KFSSTND($ac_use_path_checking)
+
+ AC_SUBST_KFSSTND
+ KDE_CREATE_LIBS_ALIASES
+])
+
+dnl KDE_CHECK_FUNC_EXT(<func>, [headers], [sample-use], [C prototype], [autoheader define], [call if found])
+AC_DEFUN([KDE_CHECK_FUNC_EXT],
+[
+AC_MSG_CHECKING(for $1)
+AC_CACHE_VAL(kde_cv_func_$1,
+[
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+save_CXXFLAGS="$CXXFLAGS"
+kde_safe_LIBS="$LIBS"
+LIBS="$LIBS $X_EXTRA_LIBS"
+if test "$GXX" = "yes"; then
+CXXFLAGS="$CXXFLAGS -pedantic-errors"
+fi
+AC_TRY_COMPILE([
+$2
+],
+[
+$3
+],
+kde_cv_func_$1=yes,
+kde_cv_func_$1=no)
+CXXFLAGS="$save_CXXFLAGS"
+LIBS="$kde_safe_LIBS"
+AC_LANG_RESTORE
+])
+
+AC_MSG_RESULT($kde_cv_func_$1)
+
+AC_MSG_CHECKING([if $1 needs custom prototype])
+AC_CACHE_VAL(kde_cv_proto_$1,
+[
+if test "x$kde_cv_func_$1" = xyes; then
+ kde_cv_proto_$1=no
+else
+ case "$1" in
+ setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat)
+ kde_cv_proto_$1="yes - in libkdefakes"
+ ;;
+ *)
+ kde_cv_proto_$1=unknown
+ ;;
+ esac
+fi
+
+if test "x$kde_cv_proto_$1" = xunknown; then
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+ kde_safe_libs=$LIBS
+ LIBS="$LIBS $X_EXTRA_LIBS"
+ AC_TRY_LINK([
+$2
+
+extern "C" $4;
+],
+[
+$3
+],
+[ kde_cv_func_$1=yes
+ kde_cv_proto_$1=yes ],
+ [kde_cv_proto_$1="$1 unavailable"]
+)
+LIBS=$kde_safe_libs
+AC_LANG_RESTORE
+fi
+])
+AC_MSG_RESULT($kde_cv_proto_$1)
+
+if test "x$kde_cv_func_$1" = xyes; then
+ AC_DEFINE(HAVE_$5, 1, [Define if you have $1])
+ $6
+fi
+if test "x$kde_cv_proto_$1" = xno; then
+ AC_DEFINE(HAVE_$5_PROTO, 1,
+ [Define if you have the $1 prototype])
+fi
+
+AH_VERBATIM([_HAVE_$5_PROTO],
+[
+#if !defined(HAVE_$5_PROTO)
+#ifdef __cplusplus
+extern "C" {
+#endif
+$4;
+#ifdef __cplusplus
+}
+#endif
+#endif
+])
+])
+
+AC_DEFUN([AC_CHECK_SETENV],
+[
+ KDE_CHECK_FUNC_EXT(setenv, [
+#include <stdlib.h>
+],
+ [setenv("VAR", "VALUE", 1);],
+ [int setenv (const char *, const char *, int)],
+ [SETENV])
+])
+
+AC_DEFUN([AC_CHECK_UNSETENV],
+[
+ KDE_CHECK_FUNC_EXT(unsetenv, [
+#include <stdlib.h>
+],
+ [unsetenv("VAR");],
+ [void unsetenv (const char *)],
+ [UNSETENV])
+])
+
+AC_DEFUN([AC_CHECK_GETDOMAINNAME],
+[
+ KDE_CHECK_FUNC_EXT(getdomainname, [
+#include <stdlib.h>
+#include <unistd.h>
+#include <netdb.h>
+],
+ [
+char buffer[200];
+getdomainname(buffer, 200);
+],
+ [#include <sys/types.h>
+ int getdomainname (char *, size_t)],
+ [GETDOMAINNAME])
+])
+
+AC_DEFUN([AC_CHECK_GETHOSTNAME],
+[
+ KDE_CHECK_FUNC_EXT(gethostname, [
+#include <stdlib.h>
+#include <unistd.h>
+],
+ [
+char buffer[200];
+gethostname(buffer, 200);
+],
+ [int gethostname (char *, unsigned int)],
+ [GETHOSTNAME])
+])
+
+AC_DEFUN([AC_CHECK_USLEEP],
+[
+ KDE_CHECK_FUNC_EXT(usleep, [
+#include <unistd.h>
+],
+ [
+usleep(200);
+],
+ [int usleep (unsigned int)],
+ [USLEEP])
+])
+
+
+AC_DEFUN([AC_CHECK_RANDOM],
+[
+ KDE_CHECK_FUNC_EXT(random, [
+#include <stdlib.h>
+],
+ [
+random();
+],
+ [long int random(void)],
+ [RANDOM])
+
+ KDE_CHECK_FUNC_EXT(srandom, [
+#include <stdlib.h>
+],
+ [
+srandom(27);
+],
+ [void srandom(unsigned int)],
+ [SRANDOM])
+
+])
+
+AC_DEFUN([AC_CHECK_INITGROUPS],
+[
+ KDE_CHECK_FUNC_EXT(initgroups, [
+#include <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
+],
+ [
+char buffer[200];
+initgroups(buffer, 27);
+],
+ [int initgroups(const char *, gid_t)],
+ [INITGROUPS])
+])
+
+AC_DEFUN([AC_CHECK_MKSTEMPS],
+[
+ KDE_CHECK_FUNC_EXT(mkstemps, [
+#include <stdlib.h>
+#include <unistd.h>
+],
+ [
+mkstemps("/tmp/aaaXXXXXX", 6);
+],
+ [int mkstemps(char *, int)],
+ [MKSTEMPS])
+])
+
+AC_DEFUN([AC_CHECK_MKSTEMP],
+[
+ KDE_CHECK_FUNC_EXT(mkstemp, [
+#include <stdlib.h>
+#include <unistd.h>
+],
+ [
+mkstemp("/tmp/aaaXXXXXX");
+],
+ [int mkstemp(char *)],
+ [MKSTEMP])
+])
+
+AC_DEFUN([AC_CHECK_MKDTEMP],
+[
+ KDE_CHECK_FUNC_EXT(mkdtemp, [
+#include <stdlib.h>
+#include <unistd.h>
+],
+ [
+mkdtemp("/tmp/aaaXXXXXX");
+],
+ [char *mkdtemp(char *)],
+ [MKDTEMP])
+])
+
+
+AC_DEFUN([AC_CHECK_RES_INIT],
+[
+ AC_MSG_CHECKING([if res_init needs -lresolv])
+ kde_libs_safe="$LIBS"
+ LIBS="$LIBS $X_EXTRA_LIBS -lresolv"
+ AC_TRY_LINK(
+ [
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+ ],
+ [
+ res_init();
+ ],
+ [
+ LIBRESOLV="-lresolv"
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function])
+ ],
+ [ AC_MSG_RESULT(no) ]
+ )
+ LIBS=$kde_libs_safe
+ AC_SUBST(LIBRESOLV)
+
+ KDE_CHECK_FUNC_EXT(res_init,
+ [
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+ ],
+ [res_init()],
+ [int res_init(void)],
+ [RES_INIT])
+])
+
+AC_DEFUN([AC_CHECK_STRLCPY],
+[
+ KDE_CHECK_FUNC_EXT(strlcpy, [
+#include <string.h>
+],
+[ char buf[20];
+ strlcpy(buf, "KDE function test", sizeof(buf));
+],
+ [unsigned long strlcpy(char*, const char*, unsigned long)],
+ [STRLCPY])
+])
+
+AC_DEFUN([AC_CHECK_STRLCAT],
+[
+ KDE_CHECK_FUNC_EXT(strlcat, [
+#include <string.h>
+],
+[ char buf[20];
+ buf[0]='\0';
+ strlcat(buf, "KDE function test", sizeof(buf));
+],
+ [unsigned long strlcat(char*, const char*, unsigned long)],
+ [STRLCAT])
+])
+
+AC_DEFUN([AC_CHECK_RES_QUERY],
+[
+ KDE_CHECK_FUNC_EXT(res_query, [
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+#include <netdb.h>
+],
+[
+res_query(NULL, 0, 0, NULL, 0);
+],
+ [int res_query(const char *, int, int, unsigned char *, int)],
+ [RES_QUERY])
+])
+
+AC_DEFUN([AC_CHECK_DN_SKIPNAME],
+[
+ KDE_CHECK_FUNC_EXT(dn_skipname, [
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+],
+[
+dn_skipname (NULL, NULL);
+],
+ [int dn_skipname (unsigned char *, unsigned char *)],
+ [DN_SKIPNAME])
+])
+
+
+AC_DEFUN([AC_FIND_GIF],
+ [AC_MSG_CHECKING([for giflib])
+AC_CACHE_VAL(ac_cv_lib_gif,
+[ac_save_LIBS="$LIBS"
+if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
+LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
+else
+LIBS="$all_libraries -lgif"
+fi
+AC_TRY_LINK(dnl
+[
+#ifdef __cplusplus
+extern "C" {
+#endif
+int GifLastError(void);
+#ifdef __cplusplus
+}
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+],
+ [return GifLastError();],
+ eval "ac_cv_lib_gif=yes",
+ eval "ac_cv_lib_gif=no")
+LIBS="$ac_save_LIBS"
+])dnl
+if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
+else
+ AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
+fi
+])
+
+AC_DEFUN([KDE_FIND_JPEG_HELPER],
+[
+AC_MSG_CHECKING([for libjpeg$2])
+AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
+[
+ac_save_LIBS="$LIBS"
+LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
+AC_TRY_LINK(
+[
+#ifdef __cplusplus
+extern "C" {
+#endif
+void jpeg_CreateDecompress();
+#ifdef __cplusplus
+}
+#endif
+],
+[jpeg_CreateDecompress();],
+ eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
+ eval "ac_cv_lib_jpeg_$1=no")
+LIBS="$ac_save_LIBS"
+CFLAGS="$ac_save_CFLAGS"
+])
+
+if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
+ LIBJPEG="$ac_cv_lib_jpeg_$1"
+ AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
+else
+ AC_MSG_RESULT(no)
+ $3
+fi
+
+])
+
+AC_DEFUN([AC_FIND_JPEG],
+[
+dnl first look for libraries
+KDE_FIND_JPEG_HELPER(6b, 6b,
+ KDE_FIND_JPEG_HELPER(normal, [],
+ [
+ LIBJPEG=
+ ]
+ )
+)
+
+dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
+dnl requires system dependent includes loaded before it)
+jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes"
+AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)
+test "x$jpeg_incdir" = xNO && jpeg_incdir=
+
+dnl if headers _and_ libraries are missing, this is no error, and we
+dnl continue with a warning (the user will get no jpeg support in khtml)
+dnl if only one is missing, it means a configuration error, but we still
+dnl only warn
+if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then
+ AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
+else
+ if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then
+ AC_MSG_WARN([
+There is an installation error in jpeg support. You seem to have only one
+of either the headers _or_ the libraries installed. You may need to either
+provide correct --with-extra-... options, or the development package of
+libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/
+Disabling JPEG support.
+])
+ else
+ AC_MSG_WARN([libjpeg not found. disable JPEG support.])
+ fi
+ jpeg_incdir=
+ LIBJPEG=
+fi
+
+AC_SUBST(LIBJPEG)
+AH_VERBATIM(_AC_CHECK_JPEG,
+[/*
+ * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
+ * headers and I'm too lazy to write a configure test as long as only
+ * unixware is related
+ */
+#ifdef _UNIXWARE
+#define HAVE_BOOLEAN
+#endif
+])
+])
+
+AC_DEFUN([KDE_CHECK_QT_JPEG],
+[
+if test -n "$LIBJPEG"; then
+AC_MSG_CHECKING([if Qt needs $LIBJPEG])
+AC_CACHE_VAL(kde_cv_qt_jpeg,
+[
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+ac_save_LIBS="$LIBS"
+LIBS="$all_libraries $USER_LDFLAGS $LIBQT"
+LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`
+ac_save_CXXFLAGS="$CXXFLAGS"
+CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
+AC_TRY_LINK(
+[#include <qapplication.h>],
+ [
+ int argc;
+ char** argv;
+ QApplication app(argc, argv);],
+ eval "kde_cv_qt_jpeg=no",
+ eval "kde_cv_qt_jpeg=yes")
+LIBS="$ac_save_LIBS"
+CXXFLAGS="$ac_save_CXXFLAGS"
+AC_LANG_RESTORE
+fi
+])
+
+if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then
+ AC_MSG_RESULT(yes)
+ LIBJPEG_QT='$(LIBJPEG)'
+else
+ AC_MSG_RESULT(no)
+ LIBJPEG_QT=
+fi
+
+])
+
+AC_DEFUN([AC_FIND_ZLIB],
+[
+AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+AC_MSG_CHECKING([for libz])
+AC_CACHE_VAL(ac_cv_lib_z,
+[
+kde_save_LIBS="$LIBS"
+LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
+kde_save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
+AC_TRY_LINK(dnl
+[
+#include<zlib.h>
+],
+[
+ char buf[42];
+ gzFile f = (gzFile) 0;
+ /* this would segfault.. but we only link, don't run */
+ (void) gzgets(f, buf, sizeof(buf));
+
+ return (zlibVersion() == ZLIB_VERSION);
+],
+ eval "ac_cv_lib_z='-lz'",
+ eval "ac_cv_lib_z=no")
+LIBS="$kde_save_LIBS"
+CFLAGS="$kde_save_CFLAGS"
+])dnl
+if test ! "$ac_cv_lib_z" = no; then
+ AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
+ LIBZ="$ac_cv_lib_z"
+ AC_MSG_RESULT($ac_cv_lib_z)
+else
+ AC_MSG_ERROR(not found.
+ Possibly configure picks up an outdated version
+ installed by XFree86. Remove it from your system.
+
+ Check your installation and look into config.log)
+ LIBZ=""
+fi
+AC_SUBST(LIBZ)
+])
+
+AC_DEFUN([KDE_TRY_TIFFLIB],
+[
+AC_MSG_CHECKING([for libtiff $1])
+
+AC_CACHE_VAL(kde_cv_libtiff_$1,
+[
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+kde_save_LIBS="$LIBS"
+if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
+LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
+else
+LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm"
+fi
+kde_save_CXXFLAGS="$CXXFLAGS"
+CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
+
+AC_TRY_LINK(dnl
+[
+#include<tiffio.h>
+],
+ [return (TIFFOpen( "", "r") == 0); ],
+[
+ kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
+], [
+ kde_cv_libtiff_$1=no
+])
+
+LIBS="$kde_save_LIBS"
+CXXFLAGS="$kde_save_CXXFLAGS"
+AC_LANG_RESTORE
+])
+
+if test "$kde_cv_libtiff_$1" = "no"; then
+ AC_MSG_RESULT(no)
+ LIBTIFF=""
+ $3
+else
+ LIBTIFF="$kde_cv_libtiff_$1"
+ AC_MSG_RESULT(yes)
+ AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
+ $2
+fi
+
+])
+
+AC_DEFUN([AC_FIND_TIFF],
+[
+AC_REQUIRE([K_PATH_X])
+AC_REQUIRE([AC_FIND_ZLIB])
+AC_REQUIRE([AC_FIND_JPEG])
+AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+
+KDE_TRY_TIFFLIB(tiff, [],
+ KDE_TRY_TIFFLIB(tiff34))
+
+AC_SUBST(LIBTIFF)
+])
+
+AC_DEFUN([KDE_FIND_LIBEXR],
+[
+AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+AC_REQUIRE([AC_FIND_ZLIB])
+AC_CACHE_VAL(ac_cv_libexr,
+[
+ if test -z "$PKG_CONFIG"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ fi
+
+ AC_MSG_CHECKING([for OpenEXR libraries])
+
+ if test "$PKG_CONFIG" = "no" ; then
+ AC_MSG_RESULT(no)
+ echo "*** The pkg-config script could not be found. Make sure it is"
+ echo "*** in your path, or set the PKG_CONFIG environment variable"
+ echo "*** to the full path to pkg-config."
+ echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+ else
+ if !(`$PKG_CONFIG --exists OpenEXR`) ; then
+ AC_MSG_RESULT(no)
+ EXRSTATUS=no
+ else
+ if !(`$PKG_CONFIG --atleast-version="1.1.1" OpenEXR`) ; then
+ AC_MSG_RESULT(no)
+ EXRSTATUS=old
+ else
+ kde_save_LIBS="$LIBS"
+ LIBS="$LIBS $all_libraries $USER_LDFLAGS `pkg-config --libs OpenEXR` $LIBZ"
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ kde_save_CXXFLAGS="$CXXFLAGS"
+ EXR_FLAGS=`$PKG_CONFIG --cflags OpenEXR`
+ CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES $EXR_FLAGS"
+
+ AC_TRY_LINK(dnl
+ [
+ #include <ImfRgbaFile.h>
+ ],
+ [
+ using namespace Imf;
+ RgbaInputFile file ("dummy");
+ return 0;
+ ],
+ eval "ac_cv_libexr='`pkg-config --libs OpenEXR`'",
+ eval "ac_cv_libexr=no"
+ )
+ LIBS="$kde_save_LIBS"
+ CXXFLAGS="$kde_save_CXXFLAGS"
+ AC_LANG_RESTORE
+ ])dnl
+ if eval "test ! \"`echo $ac_cv_libexr`\" = no"; then
+ AC_DEFINE_UNQUOTED(HAVE_EXR, 1, [Define if you have OpenEXR])
+ LIB_EXR="$ac_cv_libexr"
+ AC_MSG_RESULT($ac_cv_libexr)
+ else
+ AC_MSG_RESULT(no)
+ LIB_EXR=""
+ fi
+ fi
+ fi
+ fi
+ AC_SUBST(LIB_EXR)
+ AC_SUBST(EXR_FLAGS)
+])
+
+
+
+AC_DEFUN([AC_FIND_PNG],
+[
+AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+AC_REQUIRE([AC_FIND_ZLIB])
+AC_MSG_CHECKING([for libpng])
+AC_CACHE_VAL(ac_cv_lib_png,
+[
+kde_save_LIBS="$LIBS"
+if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
+LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET"
+else
+LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm"
+fi
+kde_save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
+
+AC_TRY_LINK(dnl
+ [
+ #include<png.h>
+ ],
+ [
+ png_structp png_ptr = png_create_read_struct( /* image ptr */
+ PNG_LIBPNG_VER_STRING, 0, 0, 0 );
+ return( png_ptr != 0 );
+ ],
+ eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
+ eval "ac_cv_lib_png=no"
+)
+LIBS="$kde_save_LIBS"
+CFLAGS="$kde_save_CFLAGS"
+])dnl
+if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
+ AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
+ LIBPNG="$ac_cv_lib_png"
+ AC_SUBST(LIBPNG)
+ AC_MSG_RESULT($ac_cv_lib_png)
+else
+ AC_MSG_RESULT(no)
+ LIBPNG=""
+ AC_SUBST(LIBPNG)
+fi
+])
+
+
+AC_DEFUN([AC_FIND_JASPER],
+[
+AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+AC_REQUIRE([AC_FIND_JPEG])
+AC_MSG_CHECKING([for jasper])
+AC_CACHE_VAL(ac_cv_jasper,
+[
+kde_save_LIBS="$LIBS"
+LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm"
+kde_save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
+
+AC_TRY_LINK(dnl
+ [
+ #include<jasper/jasper.h>
+ ],
+ [
+ return( jas_init() );
+ ],
+ eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'",
+ eval "ac_cv_jasper=no"
+)
+LIBS="$kde_save_LIBS"
+CFLAGS="$kde_save_CFLAGS"
+])dnl
+if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then
+ AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper])
+ LIB_JASPER="$ac_cv_jasper"
+ AC_MSG_RESULT($ac_cv_jasper)
+else
+ AC_MSG_RESULT(no)
+ LIB_JASPER=""
+fi
+AC_SUBST(LIB_JASPER)
+])
+
+AC_DEFUN([AC_CHECK_BOOL],
+[
+ AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool])
+])
+
+AC_DEFUN([AC_CHECK_GNU_EXTENSIONS],
+[
+AC_MSG_CHECKING(if you need GNU extensions)
+AC_CACHE_VAL(ac_cv_gnu_extensions,
+[
+cat > conftest.c << EOF
+#include <features.h>
+
+#ifdef __GNU_LIBRARY__
+yes
+#endif
+EOF
+
+if (eval "$ac_cpp conftest.c") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_gnu_extensions=yes
+else
+ ac_cv_gnu_extensions=no
+fi
+])
+
+AC_MSG_RESULT($ac_cv_gnu_extensions)
+if test "$ac_cv_gnu_extensions" = "yes"; then
+ AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
+fi
+])
+
+AC_DEFUN([KDE_CHECK_COMPILER_FLAG],
+[
+AC_MSG_CHECKING([whether $CXX supports -$1])
+kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
+AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
+[
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -$1"
+ AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], [])
+ CXXFLAGS="$save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
+ AC_MSG_RESULT(yes)
+ :
+ $2
+else
+ AC_MSG_RESULT(no)
+ :
+ $3
+fi
+])
+
+AC_DEFUN([KDE_CHECK_C_COMPILER_FLAG],
+[
+AC_MSG_CHECKING([whether $CC supports -$1])
+kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
+AC_CACHE_VAL(kde_cv_prog_cc_$kde_cache,
+[
+ AC_LANG_SAVE
+ AC_LANG_C
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -$1"
+ AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cc_$kde_cache=yes"], [])
+ CFLAGS="$save_CFLAGS"
+ AC_LANG_RESTORE
+])
+if eval "test \"`echo '$kde_cv_prog_cc_'$kde_cache`\" = yes"; then
+ AC_MSG_RESULT(yes)
+ :
+ $2
+else
+ AC_MSG_RESULT(no)
+ :
+ $3
+fi
+])
+
+
+dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
+dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
+dnl it's all white-space separated
+AC_DEFUN([AC_REMOVE_FORBIDDEN],
+[ __val=$$1
+ __forbid=" $2 "
+ if test -n "$__val"; then
+ __new=""
+ ac_save_IFS=$IFS
+ IFS=" "
+ for i in $__val; do
+ case "$__forbid" in
+ *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
+ *) # Careful to not add spaces, where there were none, because otherwise
+ # libtool gets confused, if we change e.g. CXX
+ if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
+ esac
+ done
+ IFS=$ac_save_IFS
+ $1=$__new
+ fi
+])
+
+
+AC_DEFUN([KDE_CHECK_FOR_BAD_COMPILER],
+[
+ AC_MSG_CHECKING([whether $CC is blacklisted])
+
+ dnl In theory we have tu run this test against $CC and $CXX
+ dnl in C and in C++ mode, because its perfectly legal for
+ dnl the user to mix compiler versions, since C has a defined
+ dnl ABI.
+ dnl
+ dnl For now, we assume the user is not on crack.
+
+ AC_TRY_COMPILE([
+#ifdef __GNUC__
+#if __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 0
+choke me
+#endif
+#endif
+], ,
+ kde_bad_compiler=no,
+ kde_bad_compiler=yes
+)
+
+ AC_MSG_RESULT($kde_bad_compiler)
+
+if test "$kde_bad_compiler" = "yes"; then
+ AC_MSG_ERROR([
+
+This particular compiler version is blacklisted because it
+is known to miscompile KDE. Please use a newer version, or
+if that is not yet available, choose an older version.
+
+Please do not report a bug or bother us reporting this
+configure error. We know about it, and we introduced
+it by intention to avoid untraceable bugs or crashes in KDE.
+
+])
+fi
+
+])
+
+
+AC_DEFUN([KDE_CHECK_FOR_OPT_NOINLINE_MATCH],
+[
+ AC_CACHE_CHECK([whether system headers can cope with -O2 -fno-inline],
+ kde_cv_opt_noinline_match,
+ [
+ kde_cv_opt_noinline_match=irrelevant
+ dnl if we don't use both -O2 and -fno-inline, this check is moot
+ if echo "$CFLAGS" | grep -e -O2 >/dev/null 2>/dev/null \
+ && echo "$CFLAGS" | grep -e -fno-inline >/dev/null 2>/dev/null ; then
+
+ ac_cflags_save="$CFLAGS"
+ CFLAGS="$CFLAGS -D_USE_GNU"
+
+ AC_TRY_LINK([
+ #include <string.h>
+], [ const char *pt, *et;
+ et = __extension__ ({ char __a0, __a1, __a2; (__builtin_constant_p ( ";," ) && ((size_t)(const void *)(( ";," )+ 1) - (size_t)(const void *)( ";," ) == 1) ? ((__a0 =((__const char *) ( ";," ))[0], __a0 == '\0') ? ((void) ( pt ),((void *)0) ) : ((__a1 = ((__const char *) ( ";," ))[1], __a1== '\0') ? (__extension__ (__builtin_constant_p ( __a0 ) && ( __a0 ) == '\0' ? (char *) __rawmemchr ( pt , __a0) : strchr( pt , __a0 ))) : ((__a2 = ((__const char *) ( ";," ))[2], __a2 == '\0') ? __strpbrk_c2 ( pt , __a0, __a1) :(((__const char *) ( ";," ))[3] == '\0' ? __strpbrk_c3 ( pt ,__a0, __a1, __a2): strpbrk ( pt , ";," ))))) : strpbrk ( pt , ";," )); }) ;
+],
+ kde_cv_opt_noinline_match=yes,
+ kde_cv_opt_noinline_match=no
+ )
+
+ CFLAGS="$ac_cflags_save"
+ fi
+ ])
+])
+
+
+dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
+AC_DEFUN([AC_VALIDIFY_CXXFLAGS],
+[dnl
+if test "x$kde_use_qt_emb" != "xyes"; then
+ AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
+ AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
+else
+ AC_REMOVE_FORBIDDEN(CXX, [-rpath])
+ AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath])
+fi
+])
+
+AC_DEFUN([AC_CHECK_COMPILERS],
+[
+ AC_ARG_ENABLE(debug,
+ AC_HELP_STRING([--enable-debug=ARG],[enables debug symbols (yes|no|full) [default=no]]),
+ [
+ case $enableval in
+ yes)
+ kde_use_debug_code="yes"
+ kde_use_debug_define=no
+ ;;
+ full)
+ kde_use_debug_code="full"
+ kde_use_debug_define=no
+ ;;
+ *)
+ kde_use_debug_code="no"
+ kde_use_debug_define=yes
+ ;;
+ esac
+ ],
+ [kde_use_debug_code="no"
+ kde_use_debug_define=no
+ ])
+
+ dnl Just for configure --help
+ AC_ARG_ENABLE(dummyoption,
+ AC_HELP_STRING([--disable-debug],
+ [disables debug output and debug symbols [default=no]]),
+ [],[])
+
+ AC_ARG_ENABLE(strict,
+ AC_HELP_STRING([--enable-strict],
+ [compiles with strict compiler options (may not work!)]),
+ [
+ if test $enableval = "no"; then
+ kde_use_strict_options="no"
+ else
+ kde_use_strict_options="yes"
+ fi
+ ], [kde_use_strict_options="no"])
+
+ AC_ARG_ENABLE(warnings,AC_HELP_STRING([--disable-warnings],[disables compilation with -Wall and similar]),
+ [
+ if test $enableval = "no"; then
+ kde_use_warnings="no"
+ else
+ kde_use_warnings="yes"
+ fi
+ ], [kde_use_warnings="yes"])
+
+ dnl enable warnings for debug build
+ if test "$kde_use_debug_code" != "no"; then
+ kde_use_warnings=yes
+ fi
+
+ AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[creates profiling infos [default=no]]),
+ [kde_use_profiling=$enableval],
+ [kde_use_profiling="no"]
+ )
+
+ dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
+ CFLAGS=" $CFLAGS"
+
+ AC_PROG_CC
+
+ AC_PROG_CPP
+
+ if test "$GCC" = "yes"; then
+ if test "$kde_use_debug_code" != "no"; then
+ if test $kde_use_debug_code = "full"; then
+ CFLAGS="-g3 -fno-inline $CFLAGS"
+ else
+ CFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CFLAGS"
+ fi
+ else
+ CFLAGS="-O2 $CFLAGS"
+ fi
+ fi
+
+ if test "$kde_use_debug_define" = "yes"; then
+ CFLAGS="-DNDEBUG $CFLAGS"
+ fi
+
+
+ case "$host" in
+ *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";;
+ *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";;
+ esac
+
+ if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
+ LDFLAGS=""
+ fi
+
+ CXXFLAGS=" $CXXFLAGS"
+
+ AC_PROG_CXX
+
+ KDE_CHECK_FOR_BAD_COMPILER
+
+ if test "$GXX" = "yes" || test "$CXX" = "KCC"; then
+ if test "$kde_use_debug_code" != "no"; then
+ if test "$CXX" = "KCC"; then
+ CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wwrite-strings $CXXFLAGS"
+ else
+ if test "$kde_use_debug_code" = "full"; then
+ CXXFLAGS="-g3 -fno-inline $CXXFLAGS"
+ else
+ CXXFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CXXFLAGS"
+ fi
+ fi
+ KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"])
+
+ dnl convenience compiler flags
+ KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""])
+ AC_SUBST(WOVERLOADED_VIRTUAL)
+ else
+ if test "$CXX" = "KCC"; then
+ CXXFLAGS="+K3 $CXXFLAGS"
+ else
+ CXXFLAGS="-O2 $CXXFLAGS"
+ fi
+ fi
+ fi
+
+ if test "$kde_use_debug_define" = "yes"; then
+ CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS"
+ fi
+
+ if test "$kde_use_profiling" = "yes"; then
+ KDE_CHECK_COMPILER_FLAG(pg,
+ [
+ CFLAGS="-pg $CFLAGS"
+ CXXFLAGS="-pg $CXXFLAGS"
+ ])
+ fi
+
+ if test "$kde_use_warnings" = "yes"; then
+ if test "$GCC" = "yes"; then
+ CXXFLAGS="-Wall -W -Wpointer-arith $CXXFLAGS"
+ case $host in
+ *-*-linux-gnu)
+ CFLAGS="-std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS"
+ CXXFLAGS="-D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wchar-subscripts $CXXFLAGS"
+ KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"])
+ KDE_CHECK_C_COMPILER_FLAG(Wmissing-format-attribute, [CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"])
+ ;;
+ esac
+ KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"])
+ KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"])
+ dnl ### FIXME: revert for KDE 4
+ KDE_CHECK_COMPILER_FLAG(Wno-non-virtual-dtor,[CXXFLAGS="$CXXFLAGS -Wno-non-virtual-dtor"])
+ fi
+ fi
+
+ if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then
+ CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS"
+ fi
+
+ AC_ARG_ENABLE(pch,
+ AC_HELP_STRING([--enable-pch],
+ [enables precompiled header support (currently only KCC or gcc >=3.4+unsermake) [default=no]]),
+ [ kde_use_pch=$enableval ],[ kde_use_pch=no ])
+
+ HAVE_GCC_VISIBILITY=0
+ AC_SUBST([HAVE_GCC_VISIBILITY])
+
+ if test "$GXX" = "yes"; then
+ gcc_no_reorder_blocks=NO
+ KDE_CHECK_COMPILER_FLAG(fno-reorder-blocks,[gcc_no_reorder_blocks=YES])
+ if test $kde_use_debug_code != "no" && \
+ test $kde_use_debug_code != "full" && \
+ test "YES" = "$gcc_no_reorder_blocks" ; then
+ CXXFLAGS="$CXXFLAGS -fno-reorder-blocks"
+ CFLAGS="$CFLAGS -fno-reorder-blocks"
+ fi
+ KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"])
+ KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"])
+ KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"])
+ KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= )
+ ENABLE_PERMISSIVE_FLAG="-fpermissive"
+
+ if test "$kde_use_pch" = "yes"; then
+ AC_MSG_CHECKING(whether gcc supports precompiling c header files)
+ echo >conftest.h
+ if $CC -x c-header conftest.h >/dev/null 2>/dev/null; then
+ kde_gcc_supports_pch=yes
+ AC_MSG_RESULT(yes)
+ else
+ kde_gcc_supports_pch=no
+ AC_MSG_RESULT(no)
+ fi
+ if test "$kde_gcc_supports_pch" = "yes"; then
+ AC_MSG_CHECKING(whether gcc supports precompiling c++ header files)
+ if $CXX -x c++-header conftest.h >/dev/null 2>/dev/null; then
+ kde_gcc_supports_pch=yes
+ AC_MSG_RESULT(yes)
+ else
+ kde_gcc_supports_pch=no
+ AC_MSG_RESULT(no)
+ fi
+ fi
+ rm -f conftest.h conftest.h.gch
+ fi
+
+ KDE_CHECK_FOR_OPT_NOINLINE_MATCH
+ if test "x$kde_cv_opt_noinline_match" = "xno" ; then
+ CFLAGS="`echo "$CFLAGS" | sed "s/ -fno-inline//"`"
+ fi
+ fi
+ AM_CONDITIONAL(unsermake_enable_pch, test "$kde_use_pch" = "yes" && test "$kde_gcc_supports_pch" = "yes")
+ if test "$CXX" = "KCC"; then
+ dnl unfortunately we currently cannot disable exception support in KCC
+ dnl because doing so is binary incompatible and Qt by default links with exceptions :-(
+ dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"])
+ dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS= )
+
+ if test "$kde_use_pch" = "yes"; then
+ dnl TODO: support --pch-dir!
+ KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"])
+ dnl the below works (but the dir must exist), but it's
+ dnl useless for a whole package.
+ dnl The are precompiled headers for each source file, so when compiling
+ dnl from scratch, it doesn't make a difference, and they take up
+ dnl around ~5Mb _per_ sourcefile.
+ dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp,
+ dnl [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"])
+ fi
+ dnl this flag controls inlining. by default KCC inlines in optimisation mode
+ dnl all implementations that are defined inside the class {} declaration.
+ dnl because of templates-compatibility with broken gcc compilers, this
+ dnl can cause excessive inlining. This flag limits it to a sane level
+ KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"])
+ KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"])
+ KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"])
+ KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"])
+ dnl Some source files are shared between multiple executables
+ dnl (or libraries) and some of those need template instantiations.
+ dnl In that case KCC needs to compile those sources with
+ dnl --one_instantiation_per_object. To make it easy for us we compile
+ dnl _all_ objects with that flag (--one_per is a shorthand).
+ KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"])
+ fi
+ AC_SUBST(USE_EXCEPTIONS)
+ dnl obsolete macro - provided to keep things going
+ USE_RTTI=
+ AC_SUBST(USE_RTTI)
+
+ case "$host" in
+ *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;;
+ *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";;
+ *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";;
+ *-*-solaris*)
+ if test "$GXX" = yes; then
+ libstdcpp=`$CXX -print-file-name=libstdc++.so`
+ if test ! -f $libstdcpp; then
+ AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so])
+ fi
+ fi
+ ;;
+ esac
+
+ AC_VALIDIFY_CXXFLAGS
+
+ AC_PROG_CXXCPP
+
+ if test "$GCC" = yes; then
+ NOOPT_CFLAGS=-O0
+ fi
+ KDE_CHECK_COMPILER_FLAG(O0,[NOOPT_CXXFLAGS=-O0])
+
+ AC_ARG_ENABLE(coverage,
+ AC_HELP_STRING([--enable-coverage],[use gcc coverage testing]), [
+ if test "$am_cv_CC_dependencies_compiler_type" = "gcc3"; then
+ ac_coverage_compiler="-fprofile-arcs -ftest-coverage"
+ ac_coverage_linker="-lgcc"
+ elif test "$am_cv_CC_dependencies_compiler_type" = "gcc"; then
+ ac_coverage_compiler="-fprofile-arcs -ftest-coverage"
+ ac_coverage_linker=""
+ else
+ AC_MSG_ERROR([coverage with your compiler is not supported])
+ fi
+ CFLAGS="$CFLAGS $ac_coverage_compiler"
+ CXXFLAGS="$CXXFLAGS $ac_coverage_compiler"
+ LDFLAGS="$LDFLAGS $ac_coverage_linker"
+ ])
+
+ AC_SUBST(NOOPT_CXXFLAGS)
+ AC_SUBST(NOOPT_CFLAGS)
+ AC_SUBST(ENABLE_PERMISSIVE_FLAG)
+
+ KDE_CHECK_NEW_LDFLAGS
+ KDE_CHECK_FINAL
+ KDE_CHECK_CLOSURE
+ KDE_CHECK_NMCHECK
+
+ ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
+])
+
+AC_DEFUN([KDE_CHECK_VISIBILITY_GCC_BUG],
+ [
+ AC_CACHE_CHECK([for gcc -fvisibility-inlines-hidden bug], kde_cv_val_gcc_visibility_bug,
+ [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
+ safe_CXXFLAGS=$CXXFLAGS
+ safe_LDFLAGS=$LDFLAGS
+ CXXFLAGS="$CXXFLAGS -fPIC -fvisibility-inlines-hidden -O0"
+ LDFLAGS="$LDFLAGS -shared -fPIC"
+
+ AC_TRY_LINK(
+ [
+ /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664 */
+ #include <string>
+ int some_function( void ) __attribute__ ((visibility("default")));
+ int some_function( void )
+ {
+ std::string s("blafasel");
+ return 0;
+ }
+ ], [/* elvis is alive */],
+ kde_cv_val_gcc_visibility_bug=no, kde_cv_val_gcc_visibility_bug=yes)
+
+ CXXFLAGS=$safe_CXXFLAGS
+ LDFLAGS=$safe_LDFLAGS
+ AC_LANG_RESTORE
+ ]
+ )
+
+ if test x$kde_cv_val_gcc_visibility_bug = xno; then
+ CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
+ fi
+ ]
+)
+
+AC_DEFUN([KDE_ENABLE_HIDDEN_VISIBILITY],
+[
+ AC_BEFORE([AC_PATH_QT_1_3], [KDE_ENABLE_HIDDEN_VISIBILITY])
+
+ AC_MSG_CHECKING([grepping for visibility push/pop in headers])
+
+ if test "x$GXX" = "xyes"; then
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_EGREP_CPP(
+ [GCC visibility push],
+ [ #include <exception>
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ kde_stdc_visibility_patched=yes ],
+ [
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN([Your libstdc++ doesn't appear to be patched for
+ visibility support. Disabling -fvisibility=hidden])
+
+ kde_stdc_visibility_patched=no ])
+
+ AC_LANG_RESTORE
+
+ kde_have_gcc_visibility=no
+ KDE_CHECK_COMPILER_FLAG(fvisibility=hidden,
+ [
+ kde_have_gcc_visibility=yes
+ dnl the whole toolchain is just a mess, gcc is just too buggy
+ dnl to handle STL with visibility enabled. Lets reconsider
+ dnl when gcc 4.2 is out or when things get fixed in the compiler.
+ dnl Contact mueller@kde.org for details.
+ AC_ARG_ENABLE(gcc-hidden-visibility,
+ AC_HELP_STRING([--enable-gcc-hidden-visibility],[toolchain hidden visibility [default=no]]),
+ [kde_have_gcc_visibility=$enableval],
+ [kde_have_gcc_visibility=no])
+
+ AC_CACHE_CHECK([if Qt is patched for -fvisibility], kde_cv_val_qt_gcc_visibility_patched,
+ [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
+ safe_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $all_includes"
+
+ AC_TRY_COMPILE(
+ [
+#include <qglobal.h>
+#if Q_EXPORT - 0 != 0
+/* if this compiles, then Q_EXPORT is undefined */
+/* if Q_EXPORT is nonempty, this will break compilation */
+#endif
+ ], [/* elvis is alive */],
+ kde_cv_val_qt_gcc_visibility_patched=no, kde_cv_val_qt_gcc_visibility_patched=yes)
+
+ CXXFLAGS=$safe_CXXFLAGS
+ AC_LANG_RESTORE
+ ]
+ )
+
+ if test x$kde_have_gcc_visibility = "xyes" && test x$kde_stdc_visibility_patched = "xyes" && test x$kde_cv_val_qt_gcc_visibility_patched = "xyes"; then
+ CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
+ KDE_CHECK_VISIBILITY_GCC_BUG
+ HAVE_GCC_VISIBILITY=1
+ AC_DEFINE_UNQUOTED(__KDE_HAVE_GCC_VISIBILITY, "$HAVE_GCC_VISIBILITY", [define to 1 if -fvisibility is supported])
+ fi
+ ])
+ fi
+])
+
+AC_DEFUN([KDE_ADD_DEPENDENCIES],
+[
+ [A]M_DEPENDENCIES(CC)
+ [A]M_DEPENDENCIES(CXX)
+])
+
+dnl just a wrapper to clean up configure.in
+AC_DEFUN([KDE_PROG_LIBTOOL],
+[
+AC_REQUIRE([AC_CHECK_COMPILERS])
+AC_REQUIRE([AC_ENABLE_SHARED])
+AC_REQUIRE([AC_ENABLE_STATIC])
+
+AC_REQUIRE([AC_LIBTOOL_DLOPEN])
+AC_REQUIRE([KDE_CHECK_LIB64])
+
+AC_OBJEXT
+AC_EXEEXT
+
+AM_PROG_LIBTOOL
+AC_LIBTOOL_CXX
+
+LIBTOOL_SHELL="/bin/sh ./libtool"
+# LIBTOOL="$LIBTOOL --silent"
+KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)"
+AC_SUBST(KDE_PLUGIN)
+
+# This hack ensures that libtool creates shared libs for kunittest plugins. By default check_LTLIBRARIES makes static libs.
+KDE_CHECK_PLUGIN="\$(KDE_PLUGIN) -rpath \$(libdir)"
+AC_SUBST(KDE_CHECK_PLUGIN)
+
+# we patch configure quite some so we better keep that consistent for incremental runs
+AC_SUBST(AUTOCONF,'$(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure')
+])
+
+AC_DEFUN([KDE_CHECK_LIB64],
+[
+ AC_ARG_ENABLE(libsuffix,
+ AC_HELP_STRING([--enable-libsuffix],
+ [/lib directory suffix (64,32,none,auto[=default])]),
+ kdelibsuff=$enableval, kdelibsuff="auto")
+
+ if test "$kdelibsuff" = "auto"; then
+
+cat > conftest.c << EOF
+#include <stdio.h>
+int main() {
+ return 0;
+}
+EOF
+ kdelibsuff=`$CC conftest.c -o conftest.out; ldd conftest.out |sed -ne '/libc.so/{
+ s,.*/lib\([[^\/]]*\)/.*,\1,
+ p
+}'`
+ rm -rf conftest.*
+ fi
+
+ if test "$kdelibsuff" = "no" || test "$kdelibsuff" = "none"; then
+ kdelibsuff=
+ fi
+ if test -z "$kdelibsuff"; then
+ AC_MSG_RESULT([not using lib directory suffix])
+ AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories)
+ else
+ if test "$libdir" = '${exec_prefix}/lib'; then
+ libdir="$libdir${kdelibsuff}"
+ AC_SUBST([libdir], ["$libdir"]) dnl ugly hack for lib64 platforms
+ fi
+ AC_DEFINE_UNQUOTED(KDELIBSUFF, ["${kdelibsuff}"], Suffix for lib directories)
+ AC_MSG_RESULT([using lib directory suffix $kdelibsuff])
+ fi
+])
+
+AC_DEFUN([KDE_CHECK_TYPES],
+[ AC_CHECK_SIZEOF(int, 4)dnl
+ AC_CHECK_SIZEOF(short)dnl
+ AC_CHECK_SIZEOF(long, 4)dnl
+ AC_CHECK_SIZEOF(char *, 4)dnl
+])dnl
+
+dnl Not used - kept for compat only?
+AC_DEFUN([KDE_DO_IT_ALL],
+[
+AC_CANONICAL_SYSTEM
+AC_ARG_PROGRAM
+AM_INIT_AUTOMAKE($1, $2)
+AM_DISABLE_LIBRARIES
+AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
+AC_CHECK_COMPILERS
+KDE_PROG_LIBTOOL
+AM_KDE_WITH_NLS
+AC_PATH_KDE
+])
+
+AC_DEFUN([AC_CHECK_RPATH],
+[
+AC_MSG_CHECKING(for rpath)
+AC_ARG_ENABLE(rpath,
+ AC_HELP_STRING([--disable-rpath],[do not use the rpath feature of ld]),
+ USE_RPATH=$enableval, USE_RPATH=yes)
+
+if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
+
+ KDE_RPATH="-R \$(libdir)"
+
+ if test "$kde_libraries" != "$libdir"; then
+ KDE_RPATH="$KDE_RPATH -R \$(kde_libraries)"
+ fi
+
+ if test -n "$qt_libraries"; then
+ KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)"
+ fi
+ dnl $x_libraries is set to /usr/lib in case
+ if test -n "$X_LDFLAGS"; then
+ X_RPATH="-R \$(x_libraries)"
+ KDE_RPATH="$KDE_RPATH $X_RPATH"
+ fi
+ if test -n "$KDE_EXTRA_RPATH"; then
+ KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
+ fi
+fi
+AC_SUBST(KDE_EXTRA_RPATH)
+AC_SUBST(KDE_RPATH)
+AC_SUBST(X_RPATH)
+AC_MSG_RESULT($USE_RPATH)
+])
+
+dnl Check for the type of the third argument of getsockname
+AC_DEFUN([AC_CHECK_SOCKLEN_T],
+[
+ AC_MSG_CHECKING(for socklen_t)
+ AC_CACHE_VAL(kde_cv_socklen_t,
+ [
+ AC_LANG_PUSH(C++)
+ kde_cv_socklen_t=no
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ ],
+ [
+ socklen_t len;
+ getpeername(0,0,&len);
+ ],
+ [
+ kde_cv_socklen_t=yes
+ kde_cv_socklen_t_equiv=socklen_t
+ ])
+ AC_LANG_POP(C++)
+ ])
+ AC_MSG_RESULT($kde_cv_socklen_t)
+ if test $kde_cv_socklen_t = no; then
+ AC_MSG_CHECKING([for socklen_t equivalent for socket functions])
+ AC_CACHE_VAL(kde_cv_socklen_t_equiv,
+ [
+ kde_cv_socklen_t_equiv=int
+ AC_LANG_PUSH(C++)
+ for t in int size_t unsigned long "unsigned long"; do
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ ],
+ [
+ $t len;
+ getpeername(0,0,&len);
+ ],
+ [
+ kde_cv_socklen_t_equiv="$t"
+ break
+ ])
+ done
+ AC_LANG_POP(C++)
+ ])
+ AC_MSG_RESULT($kde_cv_socklen_t_equiv)
+ fi
+ AC_DEFINE_UNQUOTED(kde_socklen_t, $kde_cv_socklen_t_equiv,
+ [type to use in place of socklen_t if not defined])
+ AC_DEFINE_UNQUOTED(ksize_t, $kde_cv_socklen_t_equiv,
+ [type to use in place of socklen_t if not defined (deprecated, use kde_socklen_t)])
+])
+
+dnl This is a merge of some macros out of the gettext aclocal.m4
+dnl since we don't need anything, I took the things we need
+dnl the copyright for them is:
+dnl >
+dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+dnl This Makefile.in is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+dnl >
+dnl for this file it is relicensed under LGPL
+
+AC_DEFUN([AM_KDE_WITH_NLS],
+ [
+ dnl If we use NLS figure out what method
+
+ AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt,
+ [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+
+ if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
+ AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
+ GMSGFMT=":"
+ fi
+ MSGFMT=$GMSGFMT
+ AC_SUBST(GMSGFMT)
+ AC_SUBST(MSGFMT)
+
+ AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+
+ dnl Test whether we really found GNU xgettext.
+ if test "$XGETTEXT" != ":"; then
+ dnl If it is no GNU xgettext we define it as : so that the
+ dnl Makefiles still can work.
+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ : ;
+ else
+ AC_MSG_RESULT(
+ [found xgettext programs is not GNU xgettext; ignore it])
+ XGETTEXT=":"
+ fi
+ fi
+ AC_SUBST(XGETTEXT)
+
+ ])
+
+# Search path for a program which passes the given test.
+# Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+# serial 1
+# Stephan Kulow: I appended a _KDE against name conflicts
+
+dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
+dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE],
+[# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL(ac_cv_path_$1,
+[case "[$]$1" in
+ /*)
+ ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in ifelse([$5], , $PATH, [$5]); do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if [$3]; then
+ ac_cv_path_$1="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+ ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test -n "[$]$1"; then
+ AC_MSG_RESULT([$]$1)
+else
+ AC_MSG_RESULT(no)
+fi
+AC_SUBST($1)dnl
+])
+
+
+# Check whether LC_MESSAGES is available in <locale.h>.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+
+# serial 1
+
+AC_DEFUN([AM_LC_MESSAGES],
+ [if test $ac_cv_header_locale_h = yes; then
+ AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
+ [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+ am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
+ if test $am_cv_val_LC_MESSAGES = yes; then
+ AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
+ fi
+ fi])
+
+dnl From Jim Meyering.
+dnl FIXME: migrate into libit.
+
+AC_DEFUN([AM_FUNC_OBSTACK],
+[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
+ [AC_TRY_LINK([#include "obstack.h"],
+ [struct obstack *mem;obstack_free(mem,(char *) 0)],
+ am_cv_func_obstack=yes,
+ am_cv_func_obstack=no)])
+ if test $am_cv_func_obstack = yes; then
+ AC_DEFINE(HAVE_OBSTACK)
+ else
+ LIBOBJS="$LIBOBJS obstack.o"
+ fi
+])
+
+dnl From Jim Meyering. Use this if you use the GNU error.[ch].
+dnl FIXME: Migrate into libit
+
+AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
+[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
+ [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
+ am_cv_lib_error_at_line=yes,
+ am_cv_lib_error_at_line=no)])
+ if test $am_cv_lib_error_at_line = no; then
+ LIBOBJS="$LIBOBJS error.o"
+ fi
+ AC_SUBST(LIBOBJS)dnl
+])
+
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+
+# serial 1
+# Stephan Kulow: I put a KDE in it to avoid name conflicts
+
+AC_DEFUN([AM_KDE_GNU_GETTEXT],
+ [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+ AC_REQUIRE([AC_PROG_RANLIB])dnl
+ AC_REQUIRE([AC_HEADER_STDC])dnl
+ AC_REQUIRE([AC_TYPE_OFF_T])dnl
+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+ AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+ AC_REQUIRE([AC_FUNC_MMAP])dnl
+ AC_REQUIRE([AM_KDE_WITH_NLS])dnl
+ AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h])
+ AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \
+__argz_count __argz_stringify __argz_next])
+
+ AC_MSG_CHECKING(for stpcpy)
+ AC_CACHE_VAL(kde_cv_func_stpcpy,
+ [
+ kde_safe_cxxflags=$CXXFLAGS
+ CXXFLAGS="-Werror"
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([
+ #include <string.h>
+ ],
+ [
+ char buffer[200];
+ stpcpy(buffer, buffer);
+ ],
+ kde_cv_func_stpcpy=yes,
+ kde_cv_func_stpcpy=no)
+ AC_LANG_RESTORE
+ CXXFLAGS=$kde_safe_cxxflags
+ ])
+ AC_MSG_RESULT($kde_cv_func_stpcpy)
+ if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
+ AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
+ fi
+
+ AM_LC_MESSAGES
+
+ if test "x$CATOBJEXT" != "x"; then
+ if test "x$ALL_LINGUAS" = "x"; then
+ LINGUAS=
+ else
+ AC_MSG_CHECKING(for catalogs to be installed)
+ NEW_LINGUAS=
+ for lang in ${LINGUAS=$ALL_LINGUAS}; do
+ case "$ALL_LINGUAS" in
+ *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+ esac
+ done
+ LINGUAS=$NEW_LINGUAS
+ AC_MSG_RESULT($LINGUAS)
+ fi
+
+ dnl Construct list of names of catalog files to be constructed.
+ if test -n "$LINGUAS"; then
+ for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+ fi
+ fi
+
+ ])
+
+AC_DEFUN([AC_HAVE_XPM],
+ [AC_REQUIRE_CPP()dnl
+ AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+
+ test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
+ test -z "$XPM_INCLUDE" && XPM_INCLUDE=
+
+ AC_ARG_WITH(xpm,AC_HELP_STRING([--without-xpm],[disable color pixmap XPM tests]),
+ xpm_test=$withval, xpm_test="yes")
+ if test "x$xpm_test" = xno; then
+ ac_cv_have_xpm=no
+ else
+ AC_MSG_CHECKING(for XPM)
+ AC_CACHE_VAL(ac_cv_have_xpm,
+ [
+ ac_save_ldflags="$LDFLAGS"
+ ac_save_cflags="$CFLAGS"
+ if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
+ LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET"
+ else
+ LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET"
+ fi
+ CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES"
+ test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
+ AC_TRY_LINK([#include <X11/xpm.h>],[],
+ ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
+ LDFLAGS="$ac_save_ldflags"
+ CFLAGS="$ac_save_cflags"
+ ])dnl
+
+ if test "$ac_cv_have_xpm" = no; then
+ AC_MSG_RESULT(no)
+ XPM_LDFLAGS=""
+ XPMINC=""
+ $2
+ else
+ AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
+ if test "$XPM_LDFLAGS" = ""; then
+ XPMLIB='-lXpm $(LIB_X11)'
+ else
+ XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
+ fi
+ if test "$XPM_INCLUDE" = ""; then
+ XPMINC=""
+ else
+ XPMINC="-I$XPM_INCLUDE"
+ fi
+ AC_MSG_RESULT(yes)
+ $1
+ fi
+ fi
+ AC_SUBST(XPMINC)
+ AC_SUBST(XPMLIB)
+])
+
+AC_DEFUN([AC_HAVE_DPMS],
+ [AC_REQUIRE_CPP()dnl
+ AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+
+ test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS=
+ test -z "$DPMS_INCLUDE" && DPMS_INCLUDE=
+ DPMS_LIB=
+
+ AC_ARG_WITH(dpms,AC_HELP_STRING([--without-dpms],[disable DPMS power saving]),
+ dpms_test=$withval, dpms_test="yes")
+ if test "x$dpms_test" = xno; then
+ ac_cv_have_dpms=no
+ else
+ AC_MSG_CHECKING(for DPMS)
+ dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms.
+ dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms".
+ AC_CACHE_VAL(ac_cv_have_dpms,
+ [
+ if test "x$kde_use_qt_emb" = "xyes" || test "x$kde_use_qt_mac" = "xyes"; then
+ AC_MSG_RESULT(no)
+ ac_cv_have_dpms="no"
+ else
+ ac_save_ldflags="$LDFLAGS"
+ ac_save_cflags="$CFLAGS"
+ ac_save_libs="$LIBS"
+ LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries"
+ LIBS="-lX11 -lXext $LIBSOCKET"
+ CFLAGS="$CFLAGS $X_INCLUDES"
+ test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
+ AC_TRY_LINK([
+ #include <X11/Xproto.h>
+ #include <X11/X.h>
+ #include <X11/Xlib.h>
+ #include <X11/extensions/dpms.h>
+ int foo_test_dpms()
+ { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
+ ac_cv_have_dpms="yes", [
+ LIBS="-lXdpms $LIBS"
+ AC_TRY_LINK([
+ #include <X11/Xproto.h>
+ #include <X11/X.h>
+ #include <X11/Xlib.h>
+ #include <X11/extensions/dpms.h>
+ int foo_test_dpms()
+ { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
+ [
+ ac_cv_have_dpms="-lXdpms"
+ ],ac_cv_have_dpms="no")
+ ])
+ LDFLAGS="$ac_save_ldflags"
+ CFLAGS="$ac_save_cflags"
+ LIBS="$ac_save_libs"
+ fi
+ ])dnl
+
+ if test "$ac_cv_have_dpms" = no; then
+ AC_MSG_RESULT(no)
+ DPMS_LDFLAGS=""
+ DPMSINC=""
+ $2
+ else
+ AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support])
+ if test "$ac_cv_have_dpms" = "-lXdpms"; then
+ DPMS_LIB="-lXdpms"
+ fi
+ if test "$DPMS_LDFLAGS" = ""; then
+ DPMSLIB="$DPMS_LIB "'$(LIB_X11)'
+ else
+ DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)'
+ fi
+ if test "$DPMS_INCLUDE" = ""; then
+ DPMSINC=""
+ else
+ DPMSINC="-I$DPMS_INCLUDE"
+ fi
+ AC_MSG_RESULT(yes)
+ $1
+ fi
+ fi
+ ac_save_cflags="$CFLAGS"
+ CFLAGS="$CFLAGS $X_INCLUDES"
+ test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
+ AH_TEMPLATE(HAVE_DPMSCAPABLE_PROTO,
+ [Define if you have the DPMSCapable prototype in <X11/extensions/dpms.h>])
+ AC_CHECK_DECL(DPMSCapable,
+ AC_DEFINE(HAVE_DPMSCAPABLE_PROTO),,
+ [#include <X11/Xlib.h>
+ #include <X11/extensions/dpms.h>])
+ AH_TEMPLATE(HAVE_DPMSINFO_PROTO,
+ [Define if you have the DPMSInfo prototype in <X11/extensions/dpms.h>])
+ AC_CHECK_DECL(DPMSInfo,
+ AC_DEFINE(HAVE_DPMSINFO_PROTO),,
+ [#include <X11/Xlib.h>
+ #include <X11/extensions/dpms.h>])
+ CFLAGS="$ac_save_cflags"
+ AC_SUBST(DPMSINC)
+ AC_SUBST(DPMSLIB)
+])
+
+AC_DEFUN([AC_HAVE_GL],
+ [AC_REQUIRE_CPP()dnl
+ AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+
+ test -z "$GL_LDFLAGS" && GL_LDFLAGS=
+ test -z "$GL_INCLUDE" && GL_INCLUDE=
+
+ AC_ARG_WITH(gl,AC_HELP_STRING([--without-gl],[disable 3D GL modes]),
+ gl_test=$withval, gl_test="yes")
+ if test "x$kde_use_qt_emb" = "xyes"; then
+ # GL and Qt Embedded is a no-go for now.
+ ac_cv_have_gl=no
+ elif test "x$gl_test" = xno; then
+ ac_cv_have_gl=no
+ else
+ AC_MSG_CHECKING(for GL)
+ AC_CACHE_VAL(ac_cv_have_gl,
+ [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_ldflags=$LDFLAGS
+ ac_save_cxxflags=$CXXFLAGS
+ ac_save_libs=$LIBS
+ LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries"
+ LIBS="$LIBS -lGL -lGLU"
+ test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LIBS="$LIBS -lX11"
+ LIBS="$LIBS $LIB_XEXT -lm $LIBSOCKET"
+ CXXFLAGS="$CFLAGS $X_INCLUDES"
+ test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
+ AC_TRY_LINK([#include <GL/gl.h>
+#include <GL/glu.h>
+], [],
+ ac_cv_have_gl="yes", ac_cv_have_gl="no")
+ AC_LANG_RESTORE
+ LDFLAGS=$ac_save_ldflags
+ CXXFLAGS=$ac_save_cxxflags
+ LIBS=$ac_save_libs
+ ])dnl
+
+ if test "$ac_cv_have_gl" = "no"; then
+ AC_MSG_RESULT(no)
+ GL_LDFLAGS=""
+ GLINC=""
+ $2
+ else
+ AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)])
+ if test "$GL_LDFLAGS" = ""; then
+ GLLIB='-lGLU -lGL $(LIB_X11)'
+ else
+ GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)'
+ fi
+ if test "$GL_INCLUDE" = ""; then
+ GLINC=""
+ else
+ GLINC="-I$GL_INCLUDE"
+ fi
+ AC_MSG_RESULT($ac_cv_have_gl)
+ $1
+ fi
+ fi
+ AC_SUBST(GLINC)
+ AC_SUBST(GLLIB)
+])
+
+
+ dnl shadow password and PAM magic - maintained by ossi@kde.org
+
+AC_DEFUN([KDE_PAM], [
+ AC_REQUIRE([KDE_CHECK_LIBDL])
+
+ want_pam=
+ AC_ARG_WITH(pam,
+ AC_HELP_STRING([--with-pam[=ARG]],[enable support for PAM: ARG=[yes|no|service name]]),
+ [ if test "x$withval" = "xyes"; then
+ want_pam=yes
+ pam_service=kde
+ elif test "x$withval" = "xno"; then
+ want_pam=no
+ else
+ want_pam=yes
+ pam_service=$withval
+ fi
+ ], [ pam_service=kde ])
+
+ use_pam=
+ PAMLIBS=
+ if test "x$want_pam" != xno; then
+ AC_CHECK_LIB(pam, pam_start, [
+ AC_CHECK_HEADER(security/pam_appl.h,
+ [ pam_header=security/pam_appl.h ],
+ [ AC_CHECK_HEADER(pam/pam_appl.h,
+ [ pam_header=pam/pam_appl.h ],
+ [
+ AC_MSG_WARN([PAM detected, but no headers found!
+Make sure you have the necessary development packages installed.])
+ ]
+ )
+ ]
+ )
+ ], , $LIBDL)
+ if test -z "$pam_header"; then
+ if test "x$want_pam" = xyes; then
+ AC_MSG_ERROR([--with-pam was specified, but cannot compile with PAM!])
+ fi
+ else
+ AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)])
+ PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL"
+ use_pam=yes
+
+ dnl darwin claims to be something special
+ if test "$pam_header" = "pam/pam_appl.h"; then
+ AC_DEFINE(HAVE_PAM_PAM_APPL_H, 1, [Define if your PAM headers are in pam/ instead of security/])
+ fi
+
+ dnl test whether struct pam_message is const (Linux) or not (Sun)
+ AC_MSG_CHECKING(for const pam_message)
+ AC_EGREP_HEADER([struct pam_message], $pam_header,
+ [ AC_EGREP_HEADER([const struct pam_message], $pam_header,
+ [AC_MSG_RESULT([const: Linux-type PAM])],
+ [AC_MSG_RESULT([nonconst: Sun-type PAM])
+ AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
+ )],
+ [AC_MSG_RESULT([not found - assume const, Linux-type PAM])])
+ fi
+ fi
+
+ AC_SUBST(PAMLIBS)
+])
+
+dnl DEF_PAM_SERVICE(arg name, full name, define name)
+AC_DEFUN([DEF_PAM_SERVICE], [
+ AC_ARG_WITH($1-pam,
+ AC_HELP_STRING([--with-$1-pam=[val]],[override PAM service from --with-pam for $2]),
+ [ if test "x$use_pam" = xyes; then
+ $3_PAM_SERVICE=$withval
+ else
+ AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected.
+You may want to enforce it by using --with-pam.])
+ fi
+ ],
+ [ if test "x$use_pam" = xyes; then
+ $3_PAM_SERVICE="$pam_service"
+ fi
+ ])
+ if test -n "$$3_PAM_SERVICE"; then
+ AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE])
+ AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2])
+ fi
+ AC_SUBST($3_PAM_SERVICE)
+])
+
+AC_DEFUN([KDE_SHADOWPASSWD], [
+ AC_REQUIRE([KDE_PAM])
+
+ AC_CHECK_LIB(shadow, getspent,
+ [ LIBSHADOW="-lshadow"
+ ac_use_shadow=yes
+ ],
+ [ dnl for UnixWare
+ AC_CHECK_LIB(gen, getspent,
+ [ LIBGEN="-lgen"
+ ac_use_shadow=yes
+ ],
+ [ AC_CHECK_FUNC(getspent,
+ [ ac_use_shadow=yes ],
+ [ ac_use_shadow=no ])
+ ])
+ ])
+ AC_SUBST(LIBSHADOW)
+ AC_SUBST(LIBGEN)
+
+ AC_MSG_CHECKING([for shadow passwords])
+
+ AC_ARG_WITH(shadow,
+ AC_HELP_STRING([--with-shadow],[If you want shadow password support]),
+ [ if test "x$withval" != "xno"; then
+ use_shadow=yes
+ else
+ use_shadow=no
+ fi
+ ], [
+ use_shadow="$ac_use_shadow"
+ ])
+
+ if test "x$use_shadow" = xyes; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords])
+ else
+ AC_MSG_RESULT(no)
+ LIBSHADOW=
+ LIBGEN=
+ fi
+
+ dnl finally make the relevant binaries setuid root, if we have shadow passwds.
+ dnl this still applies, if we could use it indirectly through pam.
+ if test "x$use_shadow" = xyes ||
+ ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then
+ case $host in
+ *-*-freebsd* | *-*-netbsd* | *-*-openbsd*)
+ SETUIDFLAGS="-m 4755 -o root";;
+ *)
+ SETUIDFLAGS="-m 4755";;
+ esac
+ fi
+ AC_SUBST(SETUIDFLAGS)
+
+])
+
+AC_DEFUN([KDE_PASSWDLIBS], [
+ AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT
+ AC_REQUIRE([KDE_PAM])
+ AC_REQUIRE([KDE_SHADOWPASSWD])
+
+ if test "x$use_pam" = "xyes"; then
+ PASSWDLIBS="$PAMLIBS"
+ else
+ PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN"
+ fi
+
+ dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but
+ dnl /etc/master.passwd holds the actual passwords. /etc/master.passwd requires
+ dnl root to read, so kcheckpass needs to be root (even when using pam, since pam
+ dnl may need to read /etc/master.passwd).
+ case $host in
+ *-*-freebsd*)
+ SETUIDFLAGS="-m 4755 -o root"
+ ;;
+ *)
+ ;;
+ esac
+
+ AC_SUBST(PASSWDLIBS)
+])
+
+AC_DEFUN([KDE_CHECK_LIBDL],
+[
+AC_CHECK_LIB(dl, dlopen, [
+LIBDL="-ldl"
+ac_cv_have_dlfcn=yes
+])
+
+AC_CHECK_LIB(dld, shl_unload, [
+LIBDL="-ldld"
+ac_cv_have_shload=yes
+])
+
+AC_SUBST(LIBDL)
+])
+
+AC_DEFUN([KDE_CHECK_DLOPEN],
+[
+KDE_CHECK_LIBDL
+AC_CHECK_HEADERS(dlfcn.h dl.h)
+if test "$ac_cv_header_dlfcn_h" = "no"; then
+ ac_cv_have_dlfcn=no
+fi
+
+if test "$ac_cv_header_dl_h" = "no"; then
+ ac_cv_have_shload=no
+fi
+
+dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE
+dnl (MM)
+AC_ARG_ENABLE(dlopen,
+AC_HELP_STRING([--disable-dlopen],[link statically [default=no]]),
+enable_dlopen=$enableval,
+enable_dlopen=yes)
+
+# override the user's opinion, if we know it better ;)
+if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
+ enable_dlopen=no
+fi
+
+if test "$ac_cv_have_dlfcn" = "yes"; then
+ AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn])
+fi
+
+if test "$ac_cv_have_shload" = "yes"; then
+ AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload])
+fi
+
+if test "$enable_dlopen" = no ; then
+ test -n "$1" && eval $1
+else
+ test -n "$2" && eval $2
+fi
+
+])
+
+AC_DEFUN([KDE_CHECK_DYNAMIC_LOADING],
+[
+KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no)
+KDE_PROG_LIBTOOL
+AC_MSG_CHECKING([dynamic loading])
+eval "`egrep '^build_libtool_libs=' libtool`"
+if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
+ dynamic_loading=yes
+ AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
+else
+ dynamic_loading=no
+fi
+AC_MSG_RESULT($dynamic_loading)
+if test "$dynamic_loading" = "yes"; then
+ $1
+else
+ $2
+fi
+])
+
+AC_DEFUN([KDE_ADD_INCLUDES],
+[
+if test -z "$1"; then
+ test_include="Pix.h"
+else
+ test_include="$1"
+fi
+
+AC_MSG_CHECKING([for libg++ ($test_include)])
+
+AC_CACHE_VAL(kde_cv_libgpp_includes,
+[
+kde_cv_libgpp_includes=no
+
+ for ac_dir in \
+ \
+ /usr/include/g++ \
+ /usr/include \
+ /usr/unsupported/include \
+ /opt/include \
+ $extra_include \
+ ; \
+ do
+ if test -r "$ac_dir/$test_include"; then
+ kde_cv_libgpp_includes=$ac_dir
+ break
+ fi
+ done
+])
+
+AC_MSG_RESULT($kde_cv_libgpp_includes)
+if test "$kde_cv_libgpp_includes" != "no"; then
+ all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES"
+fi
+])
+])
+
+AC_DEFUN([KDE_CHECK_LIBPTHREAD],
+[
+ dnl This code is here specifically to handle the
+ dnl various flavors of threading library on FreeBSD
+ dnl 4-, 5-, and 6-, and the (weird) rules around it.
+ dnl There may be an environment PTHREAD_LIBS that
+ dnl specifies what to use; otherwise, search for it.
+ dnl -pthread is special cased and unsets LIBPTHREAD
+ dnl below if found.
+ LIBPTHREAD=""
+
+ if test -n "$PTHREAD_LIBS"; then
+ if test "x$PTHREAD_LIBS" = "x-pthread" ; then
+ LIBPTHREAD="PTHREAD"
+ else
+ PTHREAD_LIBS_save="$PTHREAD_LIBS"
+ PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'`
+ AC_MSG_CHECKING([for pthread_create in $PTHREAD_LIBS])
+ KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [
+ LIBPTHREAD="$PTHREAD_LIBS_save"])
+ PTHREAD_LIBS="$PTHREAD_LIBS_save"
+ fi
+ fi
+
+ dnl Is this test really needed, in the face of the Tru64 test below?
+ if test -z "$LIBPTHREAD"; then
+ AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"])
+ fi
+
+ dnl This is a special Tru64 check, see BR 76171 issue #18.
+ if test -z "$LIBPTHREAD" ; then
+ AC_MSG_CHECKING([for pthread_create in -lpthread])
+ kde_safe_libs=$LIBS
+ LIBS="$LIBS -lpthread"
+ AC_TRY_LINK([#include <pthread.h>],[(void)pthread_create(0,0,0,0);],[
+ AC_MSG_RESULT(yes)
+ LIBPTHREAD="-lpthread"],[
+ AC_MSG_RESULT(no)])
+ LIBS=$kde_safe_libs
+ fi
+
+ dnl Un-special-case for FreeBSD.
+ if test "x$LIBPTHREAD" = "xPTHREAD" ; then
+ LIBPTHREAD=""
+ fi
+
+ AC_SUBST(LIBPTHREAD)
+])
+
+AC_DEFUN([KDE_CHECK_PTHREAD_OPTION],
+[
+ USE_THREADS=""
+ if test -z "$LIBPTHREAD"; then
+ KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-D_THREAD_SAFE -pthread"])
+ fi
+
+ AH_VERBATIM(__svr_define, [
+#if defined(__SVR4) && !defined(__svr4__)
+#define __svr4__ 1
+#endif
+])
+ case $host_os in
+ solaris*)
+ KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
+ CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4"
+ ;;
+ freebsd*)
+ CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE $PTHREAD_CFLAGS"
+ ;;
+ aix*)
+ CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
+ LIBPTHREAD="$LIBPTHREAD -lc_r"
+ ;;
+ linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+ if test "$CXX" = "KCC"; then
+ CXXFLAGS="$CXXFLAGS --thread_safe"
+ NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe"
+ fi
+ ;;
+ *)
+ ;;
+ esac
+ AC_SUBST(USE_THREADS)
+ AC_SUBST(LIBPTHREAD)
+])
+
+AC_DEFUN([KDE_CHECK_THREADING],
+[
+ AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
+ AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
+ dnl default is yes if libpthread is found and no if no libpthread is available
+ if test -z "$LIBPTHREAD"; then
+ if test -z "$USE_THREADS"; then
+ kde_check_threading_default=no
+ else
+ kde_check_threading_default=yes
+ fi
+ else
+ kde_check_threading_default=yes
+ fi
+ AC_ARG_ENABLE(threading,AC_HELP_STRING([--disable-threading],[disables threading even if libpthread found]),
+ kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
+ if test "x$kde_use_threading" = "xyes"; then
+ AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
+ fi
+])
+
+AC_DEFUN([KDE_TRY_LINK_PYTHON],
+[
+if test "$kde_python_link_found" = no; then
+
+if test "$1" = normal; then
+ AC_MSG_CHECKING(if a Python application links)
+else
+ AC_MSG_CHECKING(if Python depends on $2)
+fi
+
+AC_CACHE_VAL(kde_cv_try_link_python_$1,
+[
+kde_save_cflags="$CFLAGS"
+CFLAGS="$CFLAGS $PYTHONINC"
+kde_save_libs="$LIBS"
+LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
+kde_save_ldflags="$LDFLAGS"
+LDFLAGS="$LDFLAGS $PYTHONLIB"
+
+AC_TRY_LINK(
+[
+#include <Python.h>
+],[
+ PySys_SetArgv(1, 0);
+],
+ [kde_cv_try_link_python_$1=yes],
+ [kde_cv_try_link_python_$1=no]
+)
+CFLAGS="$kde_save_cflags"
+LIBS="$kde_save_libs"
+LDFLAGS="$kde_save_ldflags"
+])
+
+if test "$kde_cv_try_link_python_$1" = "yes"; then
+ AC_MSG_RESULT(yes)
+ kde_python_link_found=yes
+ if test ! "$1" = normal; then
+ LIBPYTHON="$LIBPYTHON $2"
+ fi
+ $3
+else
+ AC_MSG_RESULT(no)
+ $4
+fi
+
+fi
+
+])
+
+AC_DEFUN([KDE_CHECK_PYTHON_DIR],
+[
+AC_MSG_CHECKING([for Python directory])
+
+AC_CACHE_VAL(kde_cv_pythondir,
+[
+ if test -z "$PYTHONDIR"; then
+ kde_cv_pythondir=/usr/local
+ else
+ kde_cv_pythondir="$PYTHONDIR"
+ fi
+])
+
+AC_ARG_WITH(pythondir,
+AC_HELP_STRING([--with-pythondir=pythondir],[use python installed in pythondir]),
+[
+ ac_python_dir=$withval
+], ac_python_dir=$kde_cv_pythondir
+)
+
+AC_MSG_RESULT($ac_python_dir)
+])
+
+AC_DEFUN([KDE_CHECK_PYTHON_INTERN],
+[
+AC_REQUIRE([KDE_CHECK_LIBDL])
+AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
+AC_REQUIRE([KDE_CHECK_PYTHON_DIR])
+
+if test -z "$1"; then
+ version="1.5"
+else
+ version="$1"
+fi
+
+AC_MSG_CHECKING([for Python$version])
+
+python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes"
+AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
+if test ! -r $python_incdir/Python.h; then
+ AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir)
+ python_incdir=$python_incdir/python$version
+ if test ! -r $python_incdir/Python.h; then
+ python_incdir=no
+ fi
+fi
+
+PYTHONINC=-I$python_incdir
+
+python_libdirs="$ac_python_dir/lib$kdelibsuff /usr/lib$kdelibsuff /usr/local /usr/lib$kdelibsuff $kde_extra_libs"
+AC_FIND_FILE(libpython$version.so, $python_libdirs, python_libdir)
+if test ! -r $python_libdir/libpython$version.so; then
+ AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
+ if test ! -r $python_libdir/libpython$version.a; then
+ AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir)
+ python_libdir=$python_libdir/python$version/config
+ if test ! -r $python_libdir/libpython$version.a; then
+ python_libdir=no
+ fi
+ fi
+fi
+
+PYTHONLIB=-L$python_libdir
+kde_orig_LIBPYTHON=$LIBPYTHON
+if test -z "$LIBPYTHON"; then
+ LIBPYTHON=-lpython$version
+fi
+
+AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir)
+python_moddir=$python_moddir/python$version
+if test ! -r $python_moddir/copy.py; then
+ python_moddir=no
+fi
+
+PYTHONMODDIR=$python_moddir
+
+AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir)
+
+if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then
+ LIBPYTHON=$kde_orig_LIBPYTHON
+ test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB=""
+ test "x$PYTHONINC" = "x-Ino" && PYTHONINC=""
+ $2
+else
+ dnl Note: this test is very weak
+ kde_python_link_found=no
+ KDE_TRY_LINK_PYTHON(normal)
+ KDE_TRY_LINK_PYTHON(m, -lm)
+ KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
+ KDE_TRY_LINK_PYTHON(tcl, -ltcl)
+ KDE_TRY_LINK_PYTHON(db2, -ldb2)
+ KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm])
+ KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil])
+ KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil])
+ KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3])
+ KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil])
+ KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm])
+ KDE_TRY_LINK_PYTHON(pthread_and_panel_curses, [$LIBPTHREAD $LIBDL -lm -lpanel -lcurses])
+ KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [],
+ [AC_MSG_WARN([it seems, Python depends on another library.
+ Please set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this
+ and contact the authors to let them know about this problem])
+ ])
+
+ LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
+ AC_SUBST(PYTHONINC)
+ AC_SUBST(PYTHONLIB)
+ AC_SUBST(LIBPYTHON)
+ AC_SUBST(PYTHONMODDIR)
+ AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python])
+fi
+
+])
+
+
+AC_DEFUN([KDE_CHECK_PYTHON],
+[
+ KDE_CHECK_PYTHON_INTERN("2.5",
+ [KDE_CHECK_PYTHON_INTERN("2.4",
+ [KDE_CHECK_PYTHON_INTERN("2.3",
+ [KDE_CHECK_PYTHON_INTERN("2.2",
+ [KDE_CHECK_PYTHON_INTERN("2.1",
+ [KDE_CHECK_PYTHON_INTERN("2.0",
+ [KDE_CHECK_PYTHON_INTERN($1, $2) ])
+ ])
+ ])
+ ])
+ ])
+ ])
+])
+
+AC_DEFUN([KDE_CHECK_STL],
+[
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`"
+
+ AC_MSG_CHECKING([if C++ programs can be compiled])
+ AC_CACHE_VAL(kde_cv_stl_works,
+ [
+ AC_TRY_COMPILE([
+#include <string>
+using namespace std;
+],[
+ string astring="Hallo Welt.";
+ astring.erase(0, 6); // now astring is "Welt"
+ return 0;
+], kde_cv_stl_works=yes,
+ kde_cv_stl_works=no)
+])
+
+ AC_MSG_RESULT($kde_cv_stl_works)
+
+ if test "$kde_cv_stl_works" = "yes"; then
+ # back compatible
+ AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI])
+ else
+ AC_MSG_ERROR([Your Installation isn't able to compile simple C++ programs.
+Check config.log for details - if you're using a Linux distribution you might miss
+a package named similar to libstdc++-dev.])
+ fi
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+
+AC_DEFUN([AC_FIND_QIMGIO],
+ [AC_REQUIRE([AC_FIND_JPEG])
+AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+AC_MSG_CHECKING([for qimgio])
+AC_CACHE_VAL(ac_cv_lib_qimgio,
+[
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+ac_save_LIBS="$LIBS"
+ac_save_CXXFLAGS="$CXXFLAGS"
+LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
+CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
+AC_TRY_RUN(dnl
+[
+#include <qimageio.h>
+#include <qstring.h>
+int main() {
+ QString t = "hallo";
+ t.fill('t');
+ qInitImageIO();
+}
+],
+ ac_cv_lib_qimgio=yes,
+ ac_cv_lib_qimgio=no,
+ ac_cv_lib_qimgio=no)
+LIBS="$ac_save_LIBS"
+CXXFLAGS="$ac_save_CXXFLAGS"
+AC_LANG_RESTORE
+])dnl
+if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
+ LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
+ AC_MSG_RESULT(yes)
+ AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
+ AC_SUBST(LIBQIMGIO)
+else
+ AC_MSG_RESULT(not found)
+fi
+])
+
+AC_DEFUN([AM_DISABLE_LIBRARIES],
+[
+ AC_PROVIDE([AM_ENABLE_STATIC])
+ AC_PROVIDE([AM_ENABLE_SHARED])
+ enable_static=no
+ enable_shared=yes
+])
+
+
+AC_DEFUN([AC_CHECK_UTMP_FILE],
+[
+ AC_MSG_CHECKING([for utmp file])
+
+ AC_CACHE_VAL(kde_cv_utmp_file,
+ [
+ kde_cv_utmp_file=no
+
+ for ac_file in \
+ \
+ /var/run/utmp \
+ /var/adm/utmp \
+ /etc/utmp \
+ ; \
+ do
+ if test -r "$ac_file"; then
+ kde_cv_utmp_file=$ac_file
+ break
+ fi
+ done
+ ])
+
+ if test "$kde_cv_utmp_file" != "no"; then
+ AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries])
+ $1
+ AC_MSG_RESULT($kde_cv_utmp_file)
+ else
+ $2
+ AC_MSG_RESULT([non found])
+ fi
+])
+
+
+AC_DEFUN([KDE_CREATE_SUBDIRSLIST],
+[
+
+DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
+TOPSUBDIRS=""
+
+if test ! -s $srcdir/subdirs; then
+ dnl Note: Makefile.common creates subdirs, so this is just a fallback
+ files=`cd $srcdir && ls -1`
+ dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
+ for i in $dirs; do
+ echo $i >> $srcdir/subdirs
+ done
+fi
+
+ac_topsubdirs=
+if test -s $srcdir/inst-apps; then
+ ac_topsubdirs="`cat $srcdir/inst-apps`"
+elif test -s $srcdir/subdirs; then
+ ac_topsubdirs="`cat $srcdir/subdirs`"
+fi
+
+for i in $ac_topsubdirs; do
+ AC_MSG_CHECKING([if $i should be compiled])
+ if test -d $srcdir/$i; then
+ install_it="yes"
+ for j in $DO_NOT_COMPILE; do
+ if test $i = $j; then
+ install_it="no"
+ fi
+ done
+ else
+ install_it="no"
+ fi
+ AC_MSG_RESULT($install_it)
+ vari=`echo $i | sed -e 's,[[-+.@]],_,g'`
+ if test $install_it = "yes"; then
+ TOPSUBDIRS="$TOPSUBDIRS $i"
+ eval "$vari""_SUBDIR_included=yes"
+ else
+ eval "$vari""_SUBDIR_included=no"
+ fi
+done
+
+AC_SUBST(TOPSUBDIRS)
+])
+
+AC_DEFUN([KDE_CHECK_NAMESPACES],
+[
+AC_MSG_CHECKING(whether C++ compiler supports namespaces)
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+AC_TRY_COMPILE([
+],
+[
+namespace Foo {
+ extern int i;
+ namespace Bar {
+ extern int i;
+ }
+}
+
+int Foo::i = 0;
+int Foo::Bar::i = 1;
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NAMESPACES)
+], [
+AC_MSG_RESULT(no)
+])
+AC_LANG_RESTORE
+])
+
+dnl ------------------------------------------------------------------------
+dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
+dnl ------------------------------------------------------------------------
+dnl
+AC_DEFUN([AC_CHECK_S_ISSOCK],
+[
+AC_MSG_CHECKING(for S_ISSOCK)
+AC_CACHE_VAL(ac_cv_have_s_issock,
+[
+AC_TRY_LINK(
+[
+#include <sys/stat.h>
+],
+[
+struct stat buff;
+int b = S_ISSOCK( buff.st_mode );
+],
+ac_cv_have_s_issock=yes,
+ac_cv_have_s_issock=no)
+])
+AC_MSG_RESULT($ac_cv_have_s_issock)
+if test "$ac_cv_have_s_issock" = "yes"; then
+ AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
+fi
+
+AH_VERBATIM(_ISSOCK,
+[
+#ifndef HAVE_S_ISSOCK
+#define HAVE_S_ISSOCK
+#define S_ISSOCK(mode) (1==0)
+#endif
+])
+
+])
+
+dnl ------------------------------------------------------------------------
+dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
+dnl ------------------------------------------------------------------------
+dnl
+AC_DEFUN([AC_CHECK_KDEMAXPATHLEN],
+[
+AC_MSG_CHECKING(for MAXPATHLEN)
+AC_CACHE_VAL(ac_cv_maxpathlen,
+[
+cat > conftest.$ac_ext <<EOF
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <sys/param.h>
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 1024
+#endif
+
+KDE_HELLO MAXPATHLEN
+
+EOF
+
+ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
+
+if AC_TRY_EVAL(ac_try) && test -s conftest.out; then
+ ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
+else
+ ac_cv_maxpathlen=1024
+fi
+
+rm conftest.*
+
+])
+AC_MSG_RESULT($ac_cv_maxpathlen)
+AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] )
+])
+
+AC_DEFUN([KDE_CHECK_HEADER],
+[
+ kde_safe_cppflags=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $all_includes"
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_CHECK_HEADER([$1], [$2], [$3], [$4])
+ AC_LANG_RESTORE
+ CPPFLAGS=$kde_safe_cppflags
+])
+
+AC_DEFUN([KDE_CHECK_HEADERS],
+[
+ AH_CHECK_HEADERS([$1])
+ AC_LANG_SAVE
+ kde_safe_cppflags=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $all_includes"
+ AC_LANG_CPLUSPLUS
+ AC_CHECK_HEADERS([$1], [$2], [$3], [$4])
+ CPPFLAGS=$kde_safe_cppflags
+ AC_LANG_RESTORE
+])
+
+AC_DEFUN([KDE_FAST_CONFIGURE],
+[
+ dnl makes configure fast (needs perl)
+ AC_ARG_ENABLE(fast-perl, AC_HELP_STRING([--disable-fast-perl],[disable fast Makefile generation (needs perl)]),
+ with_fast_perl=$enableval, with_fast_perl=yes)
+])
+
+AC_DEFUN([KDE_CONF_FILES],
+[
+ val=
+ if test -f $srcdir/configure.files ; then
+ val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files`
+ fi
+ CONF_FILES=
+ if test -n "$val" ; then
+ for i in $val ; do
+ CONF_FILES="$CONF_FILES $i"
+ done
+ fi
+ AC_SUBST(CONF_FILES)
+])dnl
+
+dnl This sets the prefix, for arts and kdelibs
+dnl Do NOT use in any other module.
+dnl It only looks at --prefix, KDEDIR and falls back to /usr/local/kde
+AC_DEFUN([KDE_SET_PREFIX_CORE],
+[
+ unset CDPATH
+ dnl make $KDEDIR the default for the installation
+ AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
+
+ if test "x$prefix" = "xNONE"; then
+ prefix=$ac_default_prefix
+ ac_configure_args="$ac_configure_args --prefix=$prefix"
+ fi
+ # And delete superfluous '/' to make compares easier
+ prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
+ exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
+
+ kde_libs_prefix='$(prefix)'
+ kde_libs_htmldir='$(kde_htmldir)'
+ AC_SUBST(kde_libs_prefix)
+ AC_SUBST(kde_libs_htmldir)
+ KDE_FAST_CONFIGURE
+ KDE_CONF_FILES
+])
+
+
+AC_DEFUN([KDE_SET_PREFIX],
+[
+ unset CDPATH
+ dnl We can't give real code to that macro, only a value.
+ dnl It only matters for --help, since we set the prefix in this function anyway.
+ AC_PREFIX_DEFAULT(${KDEDIR:-the kde prefix})
+
+ KDE_SET_DEFAULT_BINDIRS
+ if test "x$prefix" = "xNONE"; then
+ dnl no prefix given: look for kde-config in the PATH and deduce the prefix from it
+ KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend)
+ else
+ dnl prefix given: look for kde-config, preferrably in prefix, otherwise in PATH
+ kde_save_PATH="$PATH"
+ PATH="$exec_prefix/bin:$prefix/bin:$PATH"
+ KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend)
+ PATH="$kde_save_PATH"
+ fi
+
+ kde_libs_prefix=`$KDECONFIG --prefix`
+ if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
+ AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs.
+ This means it has been moved since you installed it.
+ This won't work. Please recompile kdelibs for the new prefix.
+ ])
+ fi
+ kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
+
+ AC_MSG_CHECKING([where to install])
+ if test "x$prefix" = "xNONE"; then
+ prefix=$kde_libs_prefix
+ AC_MSG_RESULT([$prefix (as returned by kde-config)])
+ else
+ dnl --prefix was given. Compare prefixes and warn (in configure.in.bot.end) if different
+ given_prefix=$prefix
+ AC_MSG_RESULT([$prefix (as requested)])
+ fi
+
+ # And delete superfluous '/' to make compares easier
+ prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
+ exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
+ given_prefix=`echo "$given_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
+
+ AC_SUBST(KDECONFIG)
+ AC_SUBST(kde_libs_prefix)
+ AC_SUBST(kde_libs_htmldir)
+
+ KDE_FAST_CONFIGURE
+ KDE_CONF_FILES
+])
+
+pushdef([AC_PROG_INSTALL],
+[
+ dnl our own version, testing for a -p flag
+ popdef([AC_PROG_INSTALL])
+ dnl as AC_PROG_INSTALL works as it works we first have
+ dnl to save if the user didn't specify INSTALL, as the
+ dnl autoconf one overwrites INSTALL and we have no chance to find
+ dnl out afterwards
+ test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL
+ test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM
+ test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT
+ AC_PROG_INSTALL
+
+ if test -z "$kde_save_INSTALL_given" ; then
+ # OK, user hasn't given any INSTALL, autoconf found one for us
+ # now we test, if it supports the -p flag
+ AC_MSG_CHECKING(for -p flag to install)
+ rm -f confinst.$$.* > /dev/null 2>&1
+ echo "Testtest" > confinst.$$.orig
+ ac_res=no
+ if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
+ if test -f confinst.$$.new ; then
+ # OK, -p seems to do no harm to install
+ INSTALL="${INSTALL} -p"
+ ac_res=yes
+ fi
+ fi
+ rm -f confinst.$$.*
+ AC_MSG_RESULT($ac_res)
+ fi
+ dnl the following tries to resolve some signs and wonders coming up
+ dnl with different autoconf/automake versions
+ dnl e.g.:
+ dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
+ dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
+ dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
+ dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
+ dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
+ dnl install-@DIR@PROGRAMS targets to explicitly use that flag
+ dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
+ dnl INSTALL_SCRIPT, which breaks with automake <= 1.4
+ dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure
+ dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from
+ dnl automake (due to broken Makefile.am or whatever) to install programs,
+ dnl and so does not see the -s flag in automake > 1.4
+ dnl to clean up that mess we:
+ dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
+ dnl which cleans KDE's program with automake > 1.4;
+ dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
+ dnl with automake<=1.4
+ dnl note that dues to this sometimes two '-s' flags are used (if KDE
+ dnl properly uses install-@DIR@PROGRAMS, but I don't care
+ dnl
+ dnl And to all this comes, that I even can't write in comments variable
+ dnl names used by automake, because it is so stupid to think I wanted to
+ dnl _use_ them, therefor I have written A_M_... instead of AM_
+ dnl hmm, I wanted to say something ... ahh yes: Arghhh.
+
+ if test -z "$kde_save_INSTALL_PROGRAM_given" ; then
+ INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
+ fi
+ if test -z "$kde_save_INSTALL_SCRIPT_given" ; then
+ INSTALL_SCRIPT='${INSTALL}'
+ fi
+])dnl
+
+AC_DEFUN([KDE_LANG_CPLUSPLUS],
+[AC_LANG_CPLUSPLUS
+ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
+pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
+])
+
+pushdef([AC_LANG_CPLUSPLUS],
+[popdef([AC_LANG_CPLUSPLUS])
+KDE_LANG_CPLUSPLUS
+])
+
+AC_DEFUN([KDE_CHECK_LONG_LONG],
+[
+AC_MSG_CHECKING(for long long)
+AC_CACHE_VAL(kde_cv_c_long_long,
+[
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_LINK([], [
+ long long foo = 0;
+ foo = foo+1;
+ ],
+ kde_cv_c_long_long=yes, kde_cv_c_long_long=no)
+ AC_LANG_RESTORE
+])
+AC_MSG_RESULT($kde_cv_c_long_long)
+if test "$kde_cv_c_long_long" = yes; then
+ AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype])
+fi
+])
+
+AC_DEFUN([KDE_CHECK_LIB],
+[
+ kde_save_LDFLAGS="$LDFLAGS"
+ dnl AC_CHECK_LIB modifies LIBS, so save it here
+ kde_save_LIBS="$LIBS"
+ LDFLAGS="$LDFLAGS $all_libraries"
+ case $host_os in
+ aix*) LDFLAGS="-brtl $LDFLAGS"
+ test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS"
+ ;;
+ esac
+ AC_CHECK_LIB($1, $2, $3, $4, $5)
+ LDFLAGS="$kde_save_LDFLAGS"
+ LIBS="$kde_save_LIBS"
+])
+
+AC_DEFUN([KDE_JAVA_PREFIX],
+[
+ dir=`dirname "$1"`
+ base=`basename "$1"`
+ list=`ls -1 $dir 2> /dev/null`
+ for entry in $list; do
+ if test -d $dir/$entry/bin; then
+ case $entry in
+ $base)
+ javadirs="$javadirs $dir/$entry/bin"
+ ;;
+ esac
+ elif test -d $dir/$entry/jre/bin; then
+ case $entry in
+ $base)
+ javadirs="$javadirs $dir/$entry/jre/bin"
+ ;;
+ esac
+ fi
+ done
+])
+
+dnl KDE_CHEC_JAVA_DIR(onlyjre)
+AC_DEFUN([KDE_CHECK_JAVA_DIR],
+[
+
+AC_ARG_WITH(java,
+AC_HELP_STRING([--with-java=javadir],[use java installed in javadir, --without-java disables]),
+[ ac_java_dir=$withval
+], ac_java_dir=""
+)
+
+AC_MSG_CHECKING([for Java])
+
+dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH
+if test "x$ac_java_dir" = "xno"; then
+ kde_java_bindir=no
+ kde_java_includedir=no
+ kde_java_libjvmdir=no
+ kde_java_libgcjdir=no
+ kde_java_libhpidir=no
+else
+ if test "x$ac_java_dir" = "x"; then
+
+
+ dnl No option set -> collect list of candidate paths
+ if test -n "$JAVA_HOME"; then
+ KDE_JAVA_PREFIX($JAVA_HOME)
+ fi
+ KDE_JAVA_PREFIX(/usr/j2se)
+ KDE_JAVA_PREFIX(/usr/lib/j2se)
+ KDE_JAVA_PREFIX(/usr/j*dk*)
+ KDE_JAVA_PREFIX(/usr/lib/j*dk*)
+ KDE_JAVA_PREFIX(/opt/j*sdk*)
+ KDE_JAVA_PREFIX(/usr/lib/java*)
+ KDE_JAVA_PREFIX(/usr/java*)
+ KDE_JAVA_PREFIX(/usr/java/j*dk*)
+ KDE_JAVA_PREFIX(/usr/java/j*re*)
+ KDE_JAVA_PREFIX(/usr/lib/SunJava2*)
+ KDE_JAVA_PREFIX(/usr/lib/SunJava*)
+ KDE_JAVA_PREFIX(/usr/lib/IBMJava2*)
+ KDE_JAVA_PREFIX(/usr/lib/IBMJava*)
+ KDE_JAVA_PREFIX(/opt/java*)
+
+ kde_cv_path="NONE"
+ kde_save_IFS=$IFS
+ IFS=':'
+ for dir in $PATH; do
+ if test -d "$dir"; then
+ javadirs="$javadirs $dir"
+ fi
+ done
+ IFS=$kde_save_IFS
+ jredirs=
+
+ dnl Now javadirs contains a list of paths that exist, all ending with bin/
+ for dir in $javadirs; do
+ dnl Check for the java executable
+ if test -x "$dir/java"; then
+ sane_path=$(cd $dir; /bin/pwd)
+ dnl And also check for a libjvm.so somewhere under there
+ dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big.
+ if test "$sane_path" != "/usr/bin"; then
+ libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
+ if test ! -f $libjvmdir/libjvm.so; then continue; fi
+ jredirs="$jredirs $dir"
+ fi
+ fi
+ done
+
+ dnl Now jredirs contains a reduced list, of paths where both java and ../**/libjvm.so was found
+ JAVAC=
+ JAVA=
+ kde_java_bindir=no
+ for dir in $jredirs; do
+ JAVA="$dir/java"
+ kde_java_bindir=$dir
+ if test -x "$dir/javac"; then
+ JAVAC="$dir/javac"
+ break
+ fi
+ done
+
+ if test -n "$JAVAC"; then
+ dnl this substitution might not work - well, we test for jni.h below
+ kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'`
+ else
+ kde_java_includedir=no
+ fi
+ else
+ dnl config option set
+ kde_java_bindir=$ac_java_dir/bin
+ if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then
+ kde_java_includedir=no
+ else
+ kde_java_includedir=$ac_java_dir/include
+ fi
+ fi
+fi
+
+dnl At this point kde_java_bindir and kde_java_includedir are either set or "no"
+if test "x$kde_java_bindir" != "xno"; then
+
+ dnl Look for libjvm.so
+ kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
+ dnl Look for libgcj.so
+ kde_java_libgcjdir=`find $kde_java_bindir/.. -name libgcj.so | sed 's,libgcj.so,,'|head -n 1`
+ dnl Look for libhpi.so and avoid green threads
+ kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1`
+
+ dnl Now check everything's fine under there
+ dnl the include dir is our flag for having the JDK
+ if test -d "$kde_java_includedir"; then
+ if test ! -x "$kde_java_bindir/javac"; then
+ AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.])
+ fi
+ if test ! -x "$kde_java_bindir/javah"; then
+ AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
+ fi
+ if test ! -x "$kde_java_bindir/jar"; then
+ AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
+ fi
+ if test ! -r "$kde_java_includedir/jni.h"; then
+ AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.])
+ fi
+
+ jni_includes="-I$kde_java_includedir"
+ dnl Strange thing, jni.h requires jni_md.h which is under genunix here..
+ dnl and under linux here..
+
+ dnl not needed for gcj
+
+ if test "x$kde_java_libgcjdir" = "x"; then
+ test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux"
+ test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris"
+ test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix"
+ fi
+
+ else
+ JAVAC=
+ jni_includes=
+ fi
+
+ if test "x$kde_java_libgcjdir" = "x"; then
+ if test ! -r "$kde_java_libjvmdir/libjvm.so"; then
+ AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.])
+ fi
+ else
+ if test ! -r "$kde_java_libgcjdir/libgcj.so"; then
+ AC_MSG_ERROR([libgcj.so not found under $kde_java_libgcjdir. Use --without-java.])
+ fi
+ fi
+
+ if test ! -x "$kde_java_bindir/java"; then
+ AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
+ fi
+
+ dnl not needed for gcj compile
+
+ if test "x$kde_java_libgcjdir" = "x"; then
+ if test ! -r "$kde_java_libhpidir/libhpi.so"; then
+ AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.])
+ fi
+ fi
+
+ if test -n "$jni_includes"; then
+ dnl Check for JNI version
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_cxxflags_safe="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $all_includes $jni_includes"
+
+ AC_TRY_COMPILE([
+ #include <jni.h>
+ ],
+ [
+ #ifndef JNI_VERSION_1_2
+ Syntax Error
+ #endif
+ ],[ kde_jni_works=yes ],
+ [ kde_jni_works=no ])
+
+ if test $kde_jni_works = no; then
+ AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h.
+ You need to have Java Development Kit (JDK) version 1.2.
+
+ Use --with-java to specify another location.
+ Use --without-java to configure without java support.
+ Or download a newer JDK and try again.
+ See e.g. http://java.sun.com/products/jdk/1.2 ])
+ fi
+
+ CXXFLAGS="$ac_cxxflags_safe"
+ AC_LANG_RESTORE
+
+ dnl All tests ok, inform and subst the variables
+
+ JAVAC=$kde_java_bindir/javac
+ JAVAH=$kde_java_bindir/javah
+ JAR=$kde_java_bindir/jar
+ AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
+ if test "x$kde_java_libgcjdir" = "x"; then
+ JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi"
+ else
+ JVMLIBS="-L$kde_java_libgcjdir -lgcj"
+ fi
+ AC_MSG_RESULT([java JDK in $kde_java_bindir])
+
+ else
+ AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
+ AC_MSG_RESULT([java JRE in $kde_java_bindir])
+ fi
+elif test -d "/Library/Java/Home"; then
+ kde_java_bindir="/Library/Java/Home/bin"
+ jni_includes="-I/Library/Java/Home/include"
+
+ JAVAC=$kde_java_bindir/javac
+ JAVAH=$kde_java_bindir/javah
+ JAR=$kde_java_bindir/jar
+ JVMLIBS="-Wl,-framework,JavaVM"
+
+ AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
+ AC_MSG_RESULT([Apple Java Framework])
+else
+ AC_MSG_RESULT([none found])
+fi
+
+AC_SUBST(JAVAC)
+AC_SUBST(JAVAH)
+AC_SUBST(JAR)
+AC_SUBST(JVMLIBS)
+AC_SUBST(jni_includes)
+
+# for backward compat
+kde_cv_java_includedir=$kde_java_includedir
+kde_cv_java_bindir=$kde_java_bindir
+])
+
+dnl this is a redefinition of autoconf 2.5x's AC_FOREACH.
+dnl When the argument list becomes big, as in KDE for AC_OUTPUT in
+dnl big packages, m4_foreach is dog-slow. So use our own version of
+dnl it. (matz@kde.org)
+m4_define([mm_foreach],
+[m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])])
+m4_define([mm_car], [[$1]])
+m4_define([mm_car2], [[$@]])
+m4_define([_mm_foreach],
+[m4_if(m4_quote($2), [], [],
+ [m4_define([$1], mm_car($2))$3[]_mm_foreach([$1],
+ mm_car2(m4_shift($2)),
+ [$3])])])
+m4_define([AC_FOREACH],
+[mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])])
+
+AC_DEFUN([KDE_NEED_FLEX],
+[
+kde_libs_safe=$LIBS
+LIBS="$LIBS $USER_LDFLAGS"
+AM_PROG_LEX
+LIBS=$kde_libs_safe
+if test -z "$LEXLIB"; then
+ AC_MSG_ERROR([You need to have flex installed.])
+fi
+AC_SUBST(LEXLIB)
+])
+
+AC_DEFUN([AC_PATH_QTOPIA],
+[
+ dnl TODO: use AC_CACHE_VAL
+
+ if test -z "$1"; then
+ qtopia_minver_maj=1
+ qtopia_minver_min=5
+ qtopia_minver_pat=0
+ else
+ qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"`
+ qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"`
+ qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"`
+ fi
+
+ qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat"
+ qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat"
+
+ AC_REQUIRE([AC_PATH_QT])
+
+ AC_MSG_CHECKING([for Qtopia])
+
+ LIB_QTOPIA="-lqpe"
+ AC_SUBST(LIB_QTOPIA)
+
+ kde_qtopia_dirs="$QPEDIR /opt/Qtopia"
+
+ ac_qtopia_incdir=NO
+
+ AC_ARG_WITH(qtopia-dir,
+ AC_HELP_STRING([--with-qtopia-dir=DIR],[where the root of Qtopia is installed]),
+ [ ac_qtopia_incdir="$withval"/include] )
+
+ qtopia_incdirs=""
+ for dir in $kde_qtopia_dirs; do
+ qtopia_incdirs="$qtopia_incdirs $dir/include"
+ done
+
+ if test ! "$ac_qtopia_incdir" = "NO"; then
+ qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs"
+ fi
+
+ qtopia_incdir=""
+ AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir)
+ ac_qtopia_incdir="$qtopia_incdir"
+
+ if test -z "$qtopia_incdir"; then
+ AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.])
+ fi
+
+ qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`;
+ qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`;
+ qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`;
+
+ qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat"
+ qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat"
+ if test "$qtopia_ver" -lt "$qtopia_minver"; then
+ AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr
+is required.])
+ fi
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
+ ac_cxxflags_safe="$CXXFLAGS"
+ ac_ldflags_safe="$LDFLAGS"
+ ac_libs_safe="$LIBS"
+
+ CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes"
+ LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
+ LIBS="$LIBS $LIB_QTOPIA $LIBQT"
+
+ cat > conftest.$ac_ext <<EOF
+#include "confdefs.h"
+#include <qpe/qpeapplication.h>
+#include <qpe/version.h>
+
+int main( int argc, char **argv )
+{
+ QPEApplication app( argc, argv );
+ return 0;
+}
+EOF
+
+ if AC_TRY_EVAL(ac_link) && test -s conftest; then
+ rm -f conftest*
+ else
+ rm -f conftest*
+ AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at
+the end of config.log])
+ fi
+
+ CXXFLAGS="$ac_cxxflags_safe"
+ LDFLAGS="$ac_ldflags_safe"
+ LIBS="$ac_libs_safe"
+
+ AC_LANG_RESTORE
+
+ QTOPIA_INCLUDES="-I$qtopia_incdir"
+ AC_SUBST(QTOPIA_INCLUDES)
+
+ AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir])
+])
+
+
+AC_DEFUN([KDE_INIT_DOXYGEN],
+[
+AC_MSG_CHECKING([for Qt docs])
+kde_qtdir=
+if test "${with_qt_dir+set}" = set; then
+ kde_qtdir="$with_qt_dir"
+fi
+
+AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR)
+AC_MSG_RESULT($QTDOCDIR)
+
+AC_SUBST(QTDOCDIR)
+
+KDE_FIND_PATH(dot, DOT, [], [])
+if test -n "$DOT"; then
+ KDE_HAVE_DOT="YES"
+else
+ KDE_HAVE_DOT="NO"
+fi
+AC_SUBST(KDE_HAVE_DOT)
+KDE_FIND_PATH(doxygen, DOXYGEN, [], [])
+AC_SUBST(DOXYGEN)
+
+DOXYGEN_PROJECT_NAME="$1"
+DOXYGEN_PROJECT_NUMBER="$2"
+AC_SUBST(DOXYGEN_PROJECT_NAME)
+AC_SUBST(DOXYGEN_PROJECT_NUMBER)
+
+KDE_HAS_DOXYGEN=no
+if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then
+ KDE_HAS_DOXYGEN=yes
+fi
+AC_SUBST(KDE_HAS_DOXYGEN)
+
+])
+
+
+AC_DEFUN([AC_FIND_BZIP2],
+[
+AC_MSG_CHECKING([for bzDecompress in libbz2])
+AC_CACHE_VAL(ac_cv_lib_bzip2,
+[
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+kde_save_LIBS="$LIBS"
+LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET"
+kde_save_CXXFLAGS="$CXXFLAGS"
+CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
+AC_TRY_LINK(dnl
+[
+#define BZ_NO_STDIO
+#include<bzlib.h>
+],
+ [ bz_stream s; (void) bzDecompress(&s); ],
+ eval "ac_cv_lib_bzip2='-lbz2'",
+ eval "ac_cv_lib_bzip2=no")
+LIBS="$kde_save_LIBS"
+CXXFLAGS="$kde_save_CXXFLAGS"
+AC_LANG_RESTORE
+])dnl
+AC_MSG_RESULT($ac_cv_lib_bzip2)
+
+if test ! "$ac_cv_lib_bzip2" = no; then
+ BZIP2DIR=bzip2
+
+ LIBBZ2="$ac_cv_lib_bzip2"
+ AC_SUBST(LIBBZ2)
+
+else
+
+ cxx_shared_flag=
+ ld_shared_flag=
+ KDE_CHECK_COMPILER_FLAG(shared, [
+ ld_shared_flag="-shared"
+ ])
+ KDE_CHECK_COMPILER_FLAG(fPIC, [
+ cxx_shared_flag="-fPIC"
+ ])
+
+ AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2])
+ AC_CACHE_VAL(ac_cv_lib_bzip2_prefix,
+ [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ kde_save_LIBS="$LIBS"
+ LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET"
+ kde_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES"
+
+ AC_TRY_LINK(dnl
+ [
+ #define BZ_NO_STDIO
+ #include<bzlib.h>
+ ],
+ [ bz_stream s; (void) BZ2_bzDecompress(&s); ],
+ eval "ac_cv_lib_bzip2_prefix='-lbz2'",
+ eval "ac_cv_lib_bzip2_prefix=no")
+ LIBS="$kde_save_LIBS"
+ CXXFLAGS="$kde_save_CXXFLAGS"
+ AC_LANG_RESTORE
+ ])dnl
+
+ AC_MSG_RESULT($ac_cv_lib_bzip2_prefix)
+
+ if test ! "$ac_cv_lib_bzip2_prefix" = no; then
+ BZIP2DIR=bzip2
+
+ LIBBZ2="$ac_cv_lib_bzip2_prefix"
+ AC_SUBST(LIBBZ2)
+
+ AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix])
+ dnl else, we just ignore this
+ fi
+
+fi
+AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR")
+])
+
+dnl ------------------------------------------------------------------------
+dnl Try to find the SSL headers and libraries.
+dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed)
+dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed)
+dnl ------------------------------------------------------------------------
+dnl
+AC_DEFUN([KDE_CHECK_SSL],
+[
+LIBSSL="-lssl -lcrypto"
+AC_REQUIRE([KDE_CHECK_LIB64])
+
+ac_ssl_includes=NO ac_ssl_libraries=NO
+ssl_libraries=""
+ssl_includes=""
+AC_ARG_WITH(ssl-dir,
+ AC_HELP_STRING([--with-ssl-dir=DIR],[where the root of OpenSSL is installed]),
+ [ ac_ssl_includes="$withval"/include
+ ac_ssl_libraries="$withval"/lib$kdelibsuff
+ ])
+
+want_ssl=yes
+AC_ARG_WITH(ssl,
+ AC_HELP_STRING([--without-ssl],[disable SSL checks]),
+ [want_ssl=$withval])
+
+if test $want_ssl = yes; then
+
+AC_MSG_CHECKING(for OpenSSL)
+
+AC_CACHE_VAL(ac_cv_have_ssl,
+[#try to guess OpenSSL locations
+
+ ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes"
+ ssl_incdirs="$ac_ssl_includes $ssl_incdirs"
+ AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir)
+ ac_ssl_includes="$ssl_incdir"
+
+ ssl_libdirs="/usr/lib$kdelibsuff /usr/local/lib$kdelibsuff /usr/ssl/lib$kdelibsuff /usr/local/ssl/lib$kdelibsuff $libdir $prefix/lib$kdelibsuff $exec_prefix/lib$kdelibsuff $kde_extra_libs"
+ if test ! "$ac_ssl_libraries" = "NO"; then
+ ssl_libdirs="$ac_ssl_libraries $ssl_libdirs"
+ fi
+
+ test=NONE
+ ssl_libdir=NONE
+ for dir in $ssl_libdirs; do
+ try="ls -1 $dir/libssl*"
+ if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
+ done
+
+ ac_ssl_libraries="$ssl_libdir"
+
+ ac_ldflags_safe="$LDFLAGS"
+ ac_libs_safe="$LIBS"
+
+ LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries"
+ LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref"
+
+ AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();,
+ ac_ssl_rsaref="yes"
+ ,
+ ac_ssl_rsaref="no"
+ )
+
+ LDFLAGS="$ac_ldflags_safe"
+ LIBS="$ac_libs_safe"
+
+ if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then
+ have_ssl=no
+ else
+ have_ssl=yes;
+ fi
+
+ ])
+
+ eval "$ac_cv_have_ssl"
+
+ AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes])
+
+ AC_MSG_CHECKING([whether OpenSSL uses rsaref])
+ AC_MSG_RESULT($ac_ssl_rsaref)
+
+ AC_MSG_CHECKING([for easter eggs])
+ AC_MSG_RESULT([none found])
+
+else
+ have_ssl=no
+fi
+
+if test "$have_ssl" = yes; then
+ AC_MSG_CHECKING(for OpenSSL version)
+ dnl Check for SSL version
+ AC_CACHE_VAL(ac_cv_ssl_version,
+ [
+
+ cat >conftest.$ac_ext <<EOF
+#include <openssl/opensslv.h>
+#include <stdio.h>
+ int main() {
+
+#ifndef OPENSSL_VERSION_NUMBER
+ printf("ssl_version=\\"error\\"\n");
+#else
+ if (OPENSSL_VERSION_NUMBER < 0x00906000)
+ printf("ssl_version=\\"old\\"\n");
+ else
+ printf("ssl_version=\\"ok\\"\n");
+#endif
+ return (0);
+ }
+EOF
+
+ ac_save_CPPFLAGS=$CPPFLAGS
+ if test "$ac_ssl_includes" != "/usr/include"; then
+ CPPFLAGS="$CPPFLAGS -I$ac_ssl_includes"
+ fi
+
+ if AC_TRY_EVAL(ac_link); then
+
+ if eval `./conftest 2>&5`; then
+ if test $ssl_version = error; then
+ AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !])
+ else
+ if test $ssl_version = old; then
+ AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.])
+ have_ssl=no
+ fi
+ fi
+ ac_cv_ssl_version="ssl_version=$ssl_version"
+ else
+ AC_MSG_ERROR([Your system couldn't run a small SSL test program.
+ Check config.log, and if you can't figure it out, send a mail to
+ David Faure <faure@kde.org>, attaching your config.log])
+ fi
+
+ else
+ AC_MSG_ERROR([Your system couldn't link a small SSL test program.
+ Check config.log, and if you can't figure it out, send a mail to
+ David Faure <faure@kde.org>, attaching your config.log])
+ fi
+ CPPFLAGS=$ac_save_CPPFLAGS
+
+ ])
+
+ eval "$ac_cv_ssl_version"
+ AC_MSG_RESULT($ssl_version)
+fi
+
+if test "$have_ssl" != yes; then
+ LIBSSL="";
+else
+ AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL])
+ ac_cv_have_ssl="have_ssl=yes \
+ ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref"
+
+
+ ssl_libraries="$ac_ssl_libraries"
+ ssl_includes="$ac_ssl_includes"
+
+ if test "$ac_ssl_rsaref" = yes; then
+ LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref"
+ fi
+
+ if test $ssl_version = "old"; then
+ AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6])
+ fi
+fi
+
+SSL_INCLUDES=
+
+if test "$ssl_includes" = "/usr/include"; then
+ if test -f /usr/kerberos/include/krb5.h; then
+ SSL_INCLUDES="-I/usr/kerberos/include"
+ fi
+elif test "$ssl_includes" != "/usr/local/include" && test -n "$ssl_includes"; then
+ SSL_INCLUDES="-I$ssl_includes"
+fi
+
+if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries" || test "$ssl_libraries" = "NONE"; then
+ SSL_LDFLAGS=""
+else
+ SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries"
+fi
+
+AC_SUBST(SSL_INCLUDES)
+AC_SUBST(SSL_LDFLAGS)
+AC_SUBST(LIBSSL)
+])
+
+AC_DEFUN([KDE_CHECK_STRLCPY],
+[
+ AC_REQUIRE([AC_CHECK_STRLCAT])
+ AC_REQUIRE([AC_CHECK_STRLCPY])
+ AC_CHECK_SIZEOF(size_t)
+ AC_CHECK_SIZEOF(unsigned long)
+
+ AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long])
+ AC_TRY_COMPILE(,[
+ #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG
+ choke me
+ #endif
+ ],AC_MSG_RESULT([yes]),[
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([
+ Apparently on your system our assumption sizeof size_t == sizeof unsigned long
+ does not apply. Please mail kde-devel@kde.org with a description of your system!
+ ])
+ ])
+])
+
+AC_DEFUN([KDE_CHECK_BINUTILS],
+[
+ AC_MSG_CHECKING([if ld supports unversioned version maps])
+
+ kde_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
+ echo "{ local: extern \"C++\" { foo }; };" > conftest.map
+ AC_TRY_LINK([int foo;],
+[
+#ifdef __INTEL_COMPILER
+icc apparently does not support libtools version-info and version-script
+at the same time. Dunno where the bug is, but until somebody figured out,
+better disable the optional version scripts.
+#endif
+
+ foo = 42;
+], kde_supports_versionmaps=yes, kde_supports_versionmaps=no)
+ LDFLAGS="$kde_save_LDFLAGS"
+ rm -f conftest.map
+ AM_CONDITIONAL(include_VERSION_SCRIPT,
+ [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"])
+
+ AC_MSG_RESULT($kde_supports_versionmaps)
+])
+
+AC_DEFUN([AM_PROG_OBJC],[
+AC_CHECK_PROGS(OBJC, gcc, gcc)
+test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH])
+if test "x${OBJCFLAGS-unset}" = xunset; then
+ OBJCFLAGS="-g -O2"
+fi
+AC_SUBST(OBJCFLAGS)
+_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)])
+])
+
+AC_DEFUN([KDE_CHECK_PERL],
+[
+ KDE_FIND_PATH(perl, PERL, [$bindir $exec_prefix/bin $prefix/bin], [
+ AC_MSG_ERROR([No Perl found in your $PATH.
+We need perl to generate some code.])
+ ])
+ AC_SUBST(PERL)
+])
+
+AC_DEFUN([KDE_CHECK_LARGEFILE],
+[
+AC_SYS_LARGEFILE
+if test "$ac_cv_sys_file_offset_bits" != no; then
+ CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
+fi
+
+if test "x$ac_cv_sys_large_files" != "xno"; then
+ CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=1"
+fi
+
+])
+
+dnl A small extension to PKG_CHECK_MODULES (defined in pkg.m4.in)
+dnl which allows to search for libs that get installed into the KDE prefix.
+dnl
+dnl Syntax: KDE_PKG_CHECK_MODULES(KSTUFF, libkexif >= 0.2 glib = 1.3.4, action-if, action-not)
+dnl defines KSTUFF_LIBS, KSTUFF_CFLAGS, see pkg-config man page
+dnl also defines KSTUFF_PKG_ERRORS on error
+AC_DEFUN([KDE_PKG_CHECK_MODULES], [
+
+ PKG_CONFIG_PATH="$prefix/lib${kdelibsuff}/pkgconfig:$PKG_CONFIG_PATH"
+ if test "$prefix" != "$kde_libs_prefix"; then
+ PKG_CONFIG_PATH="$kde_libs_prefix/lib${kdelibsuff}/pkgconfig:$PKG_CONFIG_PATH"
+ fi
+ export PKG_CONFIG_PATH
+ PKG_CHECK_MODULES([$1],[$2],[$3],[$4])
+])
+
+
+dnl Check for PIE support in the compiler and linker
+AC_DEFUN([KDE_CHECK_PIE_SUPPORT],
+[
+ AC_CACHE_CHECK([for PIE support], kde_cv_val_pie_support,
+ [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ safe_CXXFLAGS=$CXXFLAGS
+ safe_LDFLAGS=$LDFLAGS
+ CXXFLAGS="$CXXFLAGS -fPIE"
+ LDFLAGS="$LDFLAGS -pie"
+
+ AC_TRY_LINK([int foo;], [], [kde_cv_val_pie_support=yes], [kde_cv_val_pie_support=no])
+
+ CXXFLAGS=$safe_CXXFLAGS
+ LDFLAGS=$safe_LDFLAGS
+ AC_LANG_RESTORE
+ ])
+
+ AC_MSG_CHECKING(if enabling -pie/fPIE support)
+
+ AC_ARG_ENABLE(pie,
+ AC_HELP_STRING([--enable-pie],[platform supports PIE linking [default=detect]]),
+ [kde_has_pie_support=$enableval],
+ [kde_has_pie_support=detect])
+
+ if test "$kde_has_pie_support" = "detect"; then
+ kde_has_pie_support=$kde_cv_val_pie_support
+ fi
+
+ AC_MSG_RESULT([$kde_has_pie_support])
+
+ KDE_USE_FPIE=""
+ KDE_USE_PIE=""
+
+ AC_SUBST([KDE_USE_FPIE])
+ AC_SUBST([KDE_USE_PIE])
+
+ if test "$kde_has_pie_support" = "yes"; then
+ KDE_USE_FPIE="-fPIE"
+ KDE_USE_PIE="-pie"
+ fi
+])
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 47 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+ [],
+ [m4_define([AC_PROVIDE_IFELSE],
+ [m4_ifdef([AC_PROVIDE_$1],
+ [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+ AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [AC_LIBTOOL_CXX],
+ [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+ ])])
+dnl And a similar setup for Fortran 77 support
+ AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [AC_LIBTOOL_F77],
+ [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [ifdef([AC_PROG_GCJ],
+ [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([A][M_PROG_GCJ],
+ [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([LT_AC_PROG_GCJ],
+ [define([LT_AC_PROG_GCJ],
+ defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+ ;;
+ *)
+ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ AC_PATH_MAGIC
+ fi
+ ;;
+esac
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+ [AC_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+ [AC_HELP_STRING([--with-pic],
+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+ [pic_mode="$withval"],
+ [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+ [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+ [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+ ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X[$]1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+[$]*
+EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+ echo_test_string="`eval $cmd`" &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+ then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+ else
+ # Try using printf.
+ echo='printf %s\n'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "[$]0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+ ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AC_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LINUX_64_MODE="32"
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ LINUX_64_MODE="64"
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_PUSH(C)
+ AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_POP])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+ ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$3"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test ! -s conftest.err; then
+ $2=yes
+ fi
+ fi
+ $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ ifelse([$5], , :, [$5])
+else
+ ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $3"
+ printf "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&AS_MESSAGE_LOG_FD
+ else
+ $2=yes
+ fi
+ fi
+ $rm conftest*
+ LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+ ifelse([$4], , :, [$4])
+else
+ ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+ i=0
+ testring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ *)
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \
+ = "XX$testring") >/dev/null 2>&1 &&
+ new_result=`expr "X$testring" : ".*" 2>&1` &&
+ lt_cv_sys_max_cmd_len=$new_result &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ testring=$testring$testring
+ done
+ testring=
+ # Add a significant safety factor because C++ compilers can tack on massive
+ # amounts of additional arguments before passing them to the linker.
+ # It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ ;;
+ esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+ AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+ AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# --------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+ [$4]
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+
+ exit (status);
+}]
+EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_unknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# -------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ])
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+ [AC_CHECK_FUNC([dlopen],
+ [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB([svld], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+ [AC_CHECK_LIB([dld], [dld_link],
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ AC_CACHE_CHECK([whether a program can dlopen itself],
+ lt_cv_dlopen_self, [dnl
+ _LT_AC_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+ ])
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ LDFLAGS="$LDFLAGS $link_static_flag"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_AC_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+ lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
+ ])
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+ # that will create temporary files in the current directory regardless of
+ # the output directory. Thus, making CWD read-only will cause this test
+ # to fail, enabling locking or at least warning the user not to do parallel
+ # builds.
+ chmod -w .
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test ! -s out/conftest.err; then
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w .
+ $rm conftest* out/*
+ rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ AC_MSG_CHECKING([if we can lock with hard links])
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ AC_MSG_RESULT([$hard_links])
+ if test "$hard_links" = no; then
+ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+ test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \
+ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_AC_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[[01]] | aix4.[[01]].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi4*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext='$(test .$module = .yes && echo .so || echo .dylib)'
+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+ if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+ else
+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+ fi
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+kfreebsd*-gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ *) # from 3.2 on
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case "$host_cpu" in
+ ia64*)
+ shrext='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ libsuff=
+ if test "x$LINUX_64_MODE" = x64; then
+ # Some platforms are per default 64-bit, so there's no /lib64
+ if test -d /lib64 -a ! -h /lib64; then
+ libsuff=64
+ fi
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[[89]] | openbsd2.[[89]].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+sco3.2v5*)
+ version_type=osf
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_ARG_WITH([tags],
+ [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+ [include additional configurations @<:@automatic@:>@])],
+ [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+ if test ! -f "${ofile}"; then
+ AC_MSG_WARN([output file `$ofile' does not exist])
+ fi
+
+ if test -z "$LTCC"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+ if test -z "$LTCC"; then
+ AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+ else
+ AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+ fi
+ fi
+
+ # Extract list of available tagged configurations in $ofile.
+ # Note that this assumes the entire list is on one line.
+ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for tagname in $tagnames; do
+ IFS="$lt_save_ifs"
+ # Check whether tagname contains only valid characters
+ case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+ "") ;;
+ *) AC_MSG_ERROR([invalid tag name: $tagname])
+ ;;
+ esac
+
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+ then
+ AC_MSG_ERROR([tag name \"$tagname\" already exists])
+ fi
+
+ # Update the list of available tags.
+ if test -n "$tagname"; then
+ echo appending configuration tag \"$tagname\" to $ofile
+
+ case $tagname in
+ CXX)
+ if test -n "$CXX" && test "X$CXX" != "Xno"; then
+ AC_LIBTOOL_LANG_CXX_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ F77)
+ if test -n "$F77" && test "X$F77" != "Xno"; then
+ AC_LIBTOOL_LANG_F77_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ GCJ)
+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+ AC_LIBTOOL_LANG_GCJ_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ RC)
+ AC_LIBTOOL_LANG_RC_CONFIG
+ ;;
+
+ *)
+ AC_MSG_ERROR([Unsupported tag name: $tagname])
+ ;;
+ esac
+
+ # Append the new tag name to the list of available tags.
+ if test -n "$tagname" ; then
+ available_tags="$available_tags $tagname"
+ fi
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ # Now substitute the updated list of available tags.
+ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+ mv "${ofile}T" "$ofile"
+ chmod +x "$ofile"
+ else
+ rm -f "${ofile}T"
+ AC_MSG_ERROR([unable to update list of available tagged configurations.])
+ fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 dll's
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+ [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+#- set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+ [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+ [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+ [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] | ?:[\\/]*])
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="ifelse([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+ [AC_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by $CC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+ lt_cv_ld_reload_flag,
+ [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi4*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+mingw* | pw32*)
+ # win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='win32_libid'
+ ;;
+
+darwin* | rhapsody*)
+ # this will be overwritten by pass_all, but leave it in just in case
+ lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ lt_cv_file_magic_test_file=`/System/Library/Frameworks/System.framework/System`
+ ;;
+ *) # Darwin 1.3 on
+ lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+ ;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | kfreebsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case "$host_cpu" in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ irix5* | nonstopux*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1"
+ ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux*)
+ case $host_cpu in
+ alpha* | hppa* | i*86 | ia64* | m68* | mips* | powerpc* | sparc* | s390* | sh* | x86_64* )
+ lt_cv_deplibs_check_method=pass_all ;;
+ # the debian people say, arm and glibc 2.3.1 works for them with pass_all
+ arm* )
+ lt_cv_deplibs_check_method=pass_all ;;
+ *)
+ # glibc up to 2.1.1 does not perform some relocations on ARM
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+nto-qnx*)
+ lt_cv_deplibs_check_method=unknown
+ ;;
+
+openbsd*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object'
+ else
+ lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/${ac_tool_prefix}nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, cos, LIBM="-lm")
+ ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL
+# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If
+# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will
+# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case $enable_ltdl_convenience in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments. Note that LIBLTDL
+# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If
+# DIRECTORY is not provided and an installed libltdl is not found, it is
+# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/'
+# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single
+# quotes!). If your package is not flat and you're not using automake,
+# define top_builddir and top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, lt_dlinit,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ LTDLINCL=
+ fi
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+ [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+ [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+ [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# --------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+_LT_AC_SYS_COMPILER
+
#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Check for any special shared library compilation flags.
+#
+_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)=
+if test "$GCC" = no; then
+ case $host_os in
+ sco3.2v5*)
+ _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf'
+ ;;
+ esac
+fi
+if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then
+ AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries])
+ if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then :
+ else
+ AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure])
+ _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no
+ fi
+fi
+
+
+#
+# Check to make sure the static flag actually works.
+#
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works],
+ _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+ $_LT_AC_TAGVAR(lt_prog_compiler_static, $1),
+ [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+# Report which librarie types wil actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix4*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cc
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+ unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+ unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ AC_PROG_LD
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+ grep 'no-whole-archive' > /dev/null; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # KDE requires run time linking. Make it the default.
+ aix_use_runtimelinking=yes
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_AC_TAGVAR(archive_cmds, $1)=''
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GXX" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ else
+ # We have old collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ esac
+ shared_flag='-shared'
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='-qmkshrobj ${wl}-G'
+ else
+ shared_flag='-qmkshrobj'
+ fi
+ fi
+ fi
+
+ # Let the compiler handle the export list.
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # -bexpall does not export symbols beginning with underscore (_)
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' '
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds it's shared libraries.
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=no
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ darwin* | rhapsody*)
+ if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ lt_int_apple_cc_single_mod=no
+ output_verbose_link_cmd='echo'
+ if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+ lt_int_apple_cc_single_mod=yes
+ fi
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring'
+ fi
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs'
+
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ freebsd[12]*)
+ # C++ shared libraries reported to be fairly broken before switch to ELF
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ freebsd-elf*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+ freebsd* | kfreebsd*-gnu)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+ gnu*)
+ ;;
+ hpux9*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ case "$host_cpu" in
+ hppa*64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ ;;
+ *)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case "$host_cpu" in
+ hppa*64*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ *)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC)
+ case "$host_cpu" in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case "$host_cpu" in
+ ia64*|hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC)
+ # SGI C++
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+ fi
+ fi
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+ linux*)
+ case $cc_basename in
+ KCC)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc)
+ # Intel C++
+ with_gnu_ld=yes
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ cxx)
+ # Compaq C++
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ esac
+ ;;
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+ osf3*)
+ case $cc_basename in
+ KCC)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+ ;;
+ RCC)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ osf4* | osf5*)
+ case $cc_basename in
+ KCC)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+ ;;
+ RCC)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~
+ $rm $lib.exp'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ sco*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ case $cc_basename in
+ CC)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The C++ compiler is used as linker so we must use $wl
+ # flag to pass the commands to the underlying system
+ # linker.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | grep -v '^2\.7' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ fi
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ fi
+ ;;
+ esac
+ ;;
+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library. It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ # The `*' in the case matches for architectures that use `case' in
+ # $output_verbose_cmd can trigger glob expansion during the loop
+ # eval without this substitution.
+ output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`"
+
+ for p in `eval $output_verbose_link_cmd`; do
+ case $p in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" \
+ || test $p = "-R"; then
+ prev=$p
+ continue
+ else
+ prev=
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ case $p in
+ -L* | -R*)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+ _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+ fi
+ fi
+ ;;
+
+ *.$objext|*.$libext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+ _LT_AC_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+ _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code=" subroutine t\n return\n end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code=" program t\n end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+aix4*)
+ test "$enable_shared" = yes && enable_static=no
+ ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars. Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM SED SHELL \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ _LT_AC_TAGVAR(compiler, $1) \
+ _LT_AC_TAGVAR(CC, $1) \
+ _LT_AC_TAGVAR(LD, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+ _LT_AC_TAGVAR(old_archive_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+ _LT_AC_TAGVAR(predep_objects, $1) \
+ _LT_AC_TAGVAR(postdep_objects, $1) \
+ _LT_AC_TAGVAR(predeps, $1) \
+ _LT_AC_TAGVAR(postdeps, $1) \
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+ _LT_AC_TAGVAR(archive_cmds, $1) \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(postinstall_cmds, $1) \
+ _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+ _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+ _LT_AC_TAGVAR(no_undefined_flag, $1) \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+ _LT_AC_TAGVAR(hardcode_automatic, $1) \
+ _LT_AC_TAGVAR(module_cmds, $1) \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+ _LT_AC_TAGVAR(exclude_expsyms, $1) \
+ _LT_AC_TAGVAR(include_expsyms, $1); do
+
+ case $var in
+ _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(module_cmds, $1) | \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\[$]0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+ ;;
+ esac
+
+ifelse([$1], [],
+ [cfgfile="${ofile}T"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ $rm -f "$cfgfile"
+ AC_MSG_NOTICE([creating $ofile])],
+ [cfgfile="$ofile"])
+
+ cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext='$shrext'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+ case $host_os in
+ aix3*)
+ cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" || \
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+])
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ test -f Makefile && make "$ltmain"
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ lt_cv_prog_compiler_rtti_exceptions,
+ [-fno-rtti -fno-exceptions], [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDEGRST]]'
+ fi
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris* | sysv5*)
+ symcode='[[BDT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[[ABCDGISTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Write the raw and C identifiers.
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if grep ' nm_test_var$' "$nlist" >/dev/null; then
+ if grep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+ cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+ cat <<\EOF >> conftest.$ac_ext
+ {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+ cat conftest.$ac_ext >&5
+ fi
+ rm -f conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ AC_MSG_RESULT(failed)
+else
+ AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | os2* | pw32*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case "$host_cpu" in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix4* | aix5*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68)
+ # Green Hills C++ Compiler
+ # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ ghcx)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | kfreebsd*-gnu)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+ if test "$host_cpu" != ia64; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ fi
+ ;;
+ aCC)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+ case "$host_cpu" in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux*)
+ case $cc_basename in
+ KCC)
+ # KAI C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ icpc)
+ # Intel C++
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ cxx)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ ;;
+ RCC)
+ # Rational C++ 2.4.1
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ cxx)
+ # Digital/Compaq C++
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ sco*)
+ case $cc_basename in
+ CC)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ gcx)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC)
+ # Sun C++ 4.x
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ lcc)
+ # Lucid
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC)
+ # NonStop-UX NCC 3.20
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ unixware*)
+ ;;
+ vxworks*)
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+],
+[
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ enable_shared=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case "$host_cpu" in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case "$host_cpu" in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC (with -KPIC) is the default.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ newsos6)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ linux*)
+ case $CC in
+ icc* | ecc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ ccc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All Alpha code is PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ esac
+ ;;
+
+ osf3* | osf4* | osf5*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All OSF/1 code is PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ sco3.2v5*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn'
+ ;;
+
+ solaris*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sunos4*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ uts4*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+ _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+ [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+ "" | " "*) ;;
+ *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ esac],
+ [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case "$host_os" in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ case $host_os in
+ aix4* | aix5*)
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw*)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ *)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+],[
+ runpath_var=
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)=
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+ _LT_AC_TAGVAR(module_cmds, $1)=
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ _LT_AC_TAGVAR(include_expsyms, $1)=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ fi
+ ;;
+
+ amigaos*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=no
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $compiler_flags $libobjs $deplibs -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris* | sysv5*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ sunos4*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+
+ if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then
+ runpath_var=LD_RUN_PATH
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ if test "$GCC" = yes && test -z "$link_static_flag"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ fi
+
+ # KDE requires run time linking. Make it the default.
+ aix_use_runtimelinking=yes
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_AC_TAGVAR(archive_cmds, $1)=''
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ else
+ # We have old collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ esac
+ shared_flag='-shared'
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='-qmkshrobj ${wl}-G'
+ else
+ shared_flag='-qmkshrobj'
+ fi
+ fi
+ fi
+
+ # Let the compiler handle the export list.
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # -bexpall does not export symbols beginning with underscore (_)
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' '
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds it's shared libraries.
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ # see comment about different semantics on the GNU ld section
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ bsdi4*)
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=no
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $compiler_flags $libobjs `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+
+ darwin* | rhapsody*)
+ if test "$GXX" = yes ; then
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ lt_int_apple_cc_single_mod=no
+ output_verbose_link_cmd='echo'
+ if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+ lt_int_apple_cc_single_mod=yes
+ fi
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring'
+ fi
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ dgux*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ freebsd1*)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | kfreebsd*-gnu)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $compiler_flags $libobjs $deplibs'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $libobjs $deplibs~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+
+ hpux10* | hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case "$host_cpu" in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $libobjs $deplibs'
+ ;;
+ esac
+ else
+ case "$host_cpu" in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ case "$host_cpu" in
+ hppa*64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ *)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ newsos6)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ openbsd*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $compiler_flags $libobjs $deplibs'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $compiler_flags $libobjs $deplibs'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+
+ os2*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $compiler_flags $libobjs $deplibs$output_objdir/$libname.def'
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $libobjs $deplibs ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $libobjs $deplibs ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ else
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ sco3.2v5*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ;;
+
+ solaris*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs~$rm $lib.exp'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+ esac
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $compiler_flags $libobjs $deplibs'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ ;;
+ motorola)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4.3*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ fi
+ ;;
+
+ sysv4.2uw2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ hardcode_runpath_var=yes
+ runpath_var=LD_RUN_PATH
+ ;;
+
+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text'
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs'
+ fi
+ runpath_var='LD_RUN_PATH'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv5*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+ ;;
+
+ uts4*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+ # Assume -lc should be added
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $_LT_AC_TAGVAR(archive_cmds, $1) in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+ $rm conftest*
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+ then
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+ ;;
+ esac
+ fi
+ ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD], [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_SED. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && break
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+])
+SED=$lt_cv_path_SED
+AC_MSG_RESULT([$SED])
+])
+
+dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
+dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
+dnl also defines GSTUFF_PKG_ERRORS on error
+AC_DEFUN([PKG_CHECK_MODULES], [
+ succeeded=no
+
+ if test -z "$PKG_CONFIG"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ fi
+
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** The pkg-config script could not be found. Make sure it is"
+ echo "*** in your path, or set the PKG_CONFIG environment variable"
+ echo "*** to the full path to pkg-config."
+ echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+ else
+ PKG_CONFIG_MIN_VERSION=0.9.0
+ if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+ AC_MSG_CHECKING(for $2)
+
+ if $PKG_CONFIG --exists "$2" ; then
+ AC_MSG_RESULT(yes)
+ succeeded=yes
+
+ AC_MSG_CHECKING($1_CFLAGS)
+ $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
+ AC_MSG_RESULT($$1_CFLAGS)
+
+ AC_MSG_CHECKING($1_LIBS)
+ $1_LIBS=`$PKG_CONFIG --libs "$2"`
+ AC_MSG_RESULT($$1_LIBS)
+ else
+ $1_CFLAGS=""
+ $1_LIBS=""
+ ## If we have a custom action on failure, don't print errors, but
+ ## do set a variable so people can do so.
+ $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+ ifelse([$4], ,echo $$1_PKG_ERRORS,)
+ fi
+
+ AC_SUBST($1_CFLAGS)
+ AC_SUBST($1_LIBS)
+ else
+ echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig"
+ fi
+ fi
+
+ if test $succeeded = yes; then
+ ifelse([$3], , :, [$3])
+ else
+ ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
+ fi
+])
+
+
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 5
+
+AC_PREREQ(2.52)
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.])
+fi])])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# This macro actually does too much some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 10
+
+AC_PREREQ([2.54])
+
+# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
+# the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+ AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG(AMTAR, tar)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
-AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
- [AM_AUTOMAKE_VERSION([1.9.6])])
+ [AM_AUTOMAKE_VERSION([1.7.9])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright 2001, 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
-# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Check to make sure that the build environment is sane.
+#
+
+# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# -*- Autoconf -*-
+
+
+# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# AM_AUX_DIR_EXPAND
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
@@ -76,55 +12304,131 @@ AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
-AC_DEFUN([AM_AUX_DIR_EXPAND],
-[dnl Rely on autoconf to set up CDPATH properly.
-AC_PREREQ([2.50])dnl
+# Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])
+
+AC_DEFUN([AM_AUX_DIR_EXPAND], [
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
-# AM_CONDITIONAL -*- Autoconf -*-
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright 2001 Free Software Foundation, Inc.
-# serial 7
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
-# AM_CONDITIONAL(NAME, SHELL-CONDITION)
-# -------------------------------------
-# Define a conditional.
-AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
- [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
-AC_SUBST([$1_TRUE])
-AC_SUBST([$1_FALSE])
-if $2; then
- $1_TRUE=
- $1_FALSE='#'
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# AM_PROG_INSTALL_STRIP
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# -*- Autoconf -*-
+# Copyright (C) 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
else
- $1_TRUE='#'
- $1_FALSE=
+ am__leading_dot=_
fi
-AC_CONFIG_COMMANDS_PRE(
-[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
- AC_MSG_ERROR([[conditional "$1" was never defined.
-Usually this means the macro was only invoked conditionally.]])
-fi])])
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+# serial 5 -*- Autoconf -*-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
-# serial 8
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
@@ -133,6 +12437,7 @@ fi])])
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
@@ -191,9 +12496,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
- # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
- # Solaris 8's {/usr,}/bin/sh.
- touch sub/conftst$i.h
+ : > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
@@ -221,14 +12524,9 @@ AC_CACHE_CHECK([dependency style of $depcc],
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
- # or remarks (even with -Werror). So we grep stderr for any message
- # that says an option was ignored or not supported.
- # When given -MP, icc 7.0 and 7.1 complain thusly:
- # icc: Command line warning: ignoring option '-M'; no argument required
- # The diagnosis changed in icc 8.0:
- # icc: Command line remark: option '-MP' not supported
- if (grep 'ignoring option' conftest.err ||
- grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ # (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored.
+ if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
@@ -262,8 +12560,8 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
-[ --disable-dependency-tracking speeds up one-time build
- --enable-dependency-tracking do not reject slow dependency extractors])
+[ --disable-dependency-tracking Speeds up one-time builds
+ --enable-dependency-tracking Do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
@@ -272,16 +12570,26 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
-# Generate code to set up dependency tracking. -*- Autoconf -*-
+# Generate code to set up dependency tracking. -*- Autoconf -*-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
-#serial 3
+#serial 2
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
@@ -300,21 +12608,27 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
else
continue
fi
- # Extract the definition of DEPDIR, am__include, and am__quote
- # from the Makefile without running `make'.
- DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
+ # Extract the definition of DEP_FILES from the Makefile without
+ # running `make'.
+ DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
test -z "$DEPDIR" && continue
- am__include=`sed -n 's/^am__include = //p' < "$mf"`
- test -z "am__include" && continue
- am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
- U=`sed -n 's/^U = //p' < "$mf"`
- # Find all dependency output files, they are included files with
- # $(DEPDIR) in their names. We invoke sed twice because it is the
- # simplest approach to changing $(DEPDIR) to its actual value in the
- # expansion.
- for file in `sed -n "
- s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ U=`sed -n -e '/^U = / s///p' < "$mf"`
+ test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
+ # We invoke sed twice because it is the simplest approach to
+ # changing $(DEPDIR) to its actual value in the expansion.
+ for file in `sed -n -e '
+ /^DEP_FILES = .*\\\\$/ {
+ s/^DEP_FILES = //
+ :loop
+ s/\\\\$//
+ p
+ n
+ /\\\\$/ b loop
+ p
+ }
+ /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
@@ -340,206 +12654,27 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 8
-
-# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
-AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
-
-# Do all the work for Automake. -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 12
-
-# This macro actually does too much. Some checks are only needed if
-# your package does certain things. But this isn't really a big deal.
-
-# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
-# AM_INIT_AUTOMAKE([OPTIONS])
-# -----------------------------------------------
-# The call with PACKAGE and VERSION arguments is the old style
-# call (pre autoconf-2.50), which is being phased out. PACKAGE
-# and VERSION should now be passed to AC_INIT and removed from
-# the call to AM_INIT_AUTOMAKE.
-# We support both call styles for the transition. After
-# the next Automake release, Autoconf can make the AC_INIT
-# arguments mandatory, and then we can depend on a new Autoconf
-# release and drop the old call support.
-AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.58])dnl
-dnl Autoconf wants to disallow AM_ names. We explicitly allow
-dnl the ones we care about.
-m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
-AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
-AC_REQUIRE([AC_PROG_INSTALL])dnl
-# test to see if srcdir already configured
-if test "`cd $srcdir && pwd`" != "`pwd`" &&
- test -f $srcdir/config.status; then
- AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
-fi
-
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
- if (cygpath --version) >/dev/null 2>/dev/null; then
- CYGPATH_W='cygpath -w'
- else
- CYGPATH_W=echo
- fi
-fi
-AC_SUBST([CYGPATH_W])
-
-# Define the identity of the package.
-dnl Distinguish between old-style and new-style calls.
-m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
- AC_SUBST([PACKAGE], [$1])dnl
- AC_SUBST([VERSION], [$2])],
-[_AM_SET_OPTIONS([$1])dnl
- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
-
-_AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
-
-# Some tools Automake needs.
-AC_REQUIRE([AM_SANITY_CHECK])dnl
-AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
-AM_PROG_INSTALL_SH
-AM_PROG_INSTALL_STRIP
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
-# We need awk for the "check" target. The system "awk" is bad on
-# some platforms.
-AC_REQUIRE([AC_PROG_AWK])dnl
-AC_REQUIRE([AC_PROG_MAKE_SET])dnl
-AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
- [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
- [_AM_PROG_TAR([v7])])])
-_AM_IF_OPTION([no-dependencies],,
-[AC_PROVIDE_IFELSE([AC_PROG_CC],
- [_AM_DEPENDENCIES(CC)],
- [define([AC_PROG_CC],
- defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_CXX],
- [_AM_DEPENDENCIES(CXX)],
- [define([AC_PROG_CXX],
- defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
-])
-])
-
-
-# When config.status generates a header, we must update the stamp-h file.
-# This file resides in the same directory as the config header
-# that is generated. The stamp files are numbered to have different names.
+# Check to see how 'make' treats includes. -*- Autoconf -*-
-# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
-# loop where config.status creates the headers, so we can generate
-# our stamp files there.
-AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
-[# Compute $1's index in $config_headers.
-_am_stamp_count=1
-for _am_header in $config_headers :; do
- case $_am_header in
- $1 | $1:* )
- break ;;
- * )
- _am_stamp_count=`expr $_am_stamp_count + 1` ;;
- esac
-done
-echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
-# AM_PROG_INSTALL_SH
-# ------------------
-# Define $install_sh.
-AC_DEFUN([AM_PROG_INSTALL_SH],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-install_sh=${install_sh-"$am_aux_dir/install-sh"}
-AC_SUBST(install_sh)])
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
-# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
# serial 2
-# Check whether the underlying file-system supports filenames
-# with a leading dot. For instance MS-DOS doesn't.
-AC_DEFUN([AM_SET_LEADING_DOT],
-[rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
- am__leading_dot=.
-else
- am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-AC_SUBST([am__leading_dot])])
-
-# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
-# From Jim Meyering
-
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-AC_DEFUN([AM_MAINTAINER_MODE],
-[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
- dnl maintainer-mode is disabled by default
- AC_ARG_ENABLE(maintainer-mode,
-[ --enable-maintainer-mode enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer],
- USE_MAINTAINER_MODE=$enableval,
- USE_MAINTAINER_MODE=no)
- AC_MSG_RESULT([$USE_MAINTAINER_MODE])
- AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
- MAINT=$MAINTAINER_MODE_TRUE
- AC_SUBST(MAINT)dnl
-]
-)
-
-AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
-
-# Check to see how 'make' treats includes. -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 3
-
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
@@ -582,311 +12717,62 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
-# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-# AM_MISSING_PROG(NAME, PROGRAM)
-# ------------------------------
-AC_DEFUN([AM_MISSING_PROG],
-[AC_REQUIRE([AM_MISSING_HAS_RUN])
-$1=${$1-"${am_missing_run}$2"}
-AC_SUBST($1)])
+# Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
-# AM_MISSING_HAS_RUN
-# ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
-AC_DEFUN([AM_MISSING_HAS_RUN],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
- am_missing_run="$MISSING --run "
-else
- am_missing_run=
- AC_MSG_WARN([`missing' script is too old or missing])
-fi
-])
-
-# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
-#
-# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
-# created by `make install' are always world readable, even if the
-# installer happens to have an overly restrictive umask (e.g. 077).
-# This was a mistake. There are at least two reasons why we must not
-# use `-m 0755':
-# - it causes special bits like SGID to be ignored,
-# - it may be too restrictive (some setups expect 775 directories).
-#
-# Do not use -m 0755 and let people choose whatever they expect by
-# setting umask.
-#
-# We cannot accept any implementation of `mkdir' that recognizes `-p'.
-# Some implementations (such as Solaris 8's) are not thread-safe: if a
-# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
-# concurrently, both version can detect that a/ is missing, but only
-# one can create it and the other will error out. Consequently we
-# restrict ourselves to GNU make (using the --version option ensures
-# this.)
-AC_DEFUN([AM_PROG_MKDIR_P],
-[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
- # We used to keeping the `.' as first argument, in order to
- # allow $(mkdir_p) to be used without argument. As in
- # $(mkdir_p) $(somedir)
- # where $(somedir) is conditionally defined. However this is wrong
- # for two reasons:
- # 1. if the package is installed by a user who cannot write `.'
- # make install will fail,
- # 2. the above comment should most certainly read
- # $(mkdir_p) $(DESTDIR)$(somedir)
- # so it does not work when $(somedir) is undefined and
- # $(DESTDIR) is not.
- # To support the latter case, we have to write
- # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
- # so the `.' trick is pointless.
- mkdir_p='mkdir -p --'
-else
- # On NextStep and OpenStep, the `mkdir' command does not
- # recognize any option. It will interpret all options as
- # directories to create, and then abort because `.' already
- # exists.
- for d in ./-p ./--version;
- do
- test -d $d && rmdir $d
- done
- # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
- if test -f "$ac_aux_dir/mkinstalldirs"; then
- mkdir_p='$(mkinstalldirs)'
- else
- mkdir_p='$(install_sh) -d'
- fi
-fi
-AC_SUBST([mkdir_p])])
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
-# Helper functions for option handling. -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
# serial 3
-# _AM_MANGLE_OPTION(NAME)
-# -----------------------
-AC_DEFUN([_AM_MANGLE_OPTION],
-[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
-
-# _AM_SET_OPTION(NAME)
-# ------------------------------
-# Set option NAME. Presently that only means defining a flag for this option.
-AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
-
-# _AM_SET_OPTIONS(OPTIONS)
-# ----------------------------------
-# OPTIONS is a space-separated list of Automake options.
-AC_DEFUN([_AM_SET_OPTIONS],
-[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
-
-# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
-# -------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-AC_DEFUN([_AM_IF_OPTION],
-[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+AC_PREREQ(2.50)
-# Check to make sure that the build environment is sane. -*- Autoconf -*-
+# AM_PROG_LEX
+# -----------
+# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a
+# "missing" invocation, for better error output.
+AC_DEFUN([AM_PROG_LEX],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])dnl
+AC_REQUIRE([AC_PROG_LEX])dnl
+if test "$LEX" = :; then
+ LEX=${am_missing_run}flex
+fi])
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
-# serial 4
+# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
-# AM_SANITY_CHECK
-# ---------------
-AC_DEFUN([AM_SANITY_CHECK],
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
- if test "$[*]" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftest.file`
- fi
- rm -f conftest.file
- if test "$[*]" != "X $srcdir/configure conftest.file" \
- && test "$[*]" != "X conftest.file $srcdir/configure"; then
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
-alias in your environment])
- fi
-
- test "$[2]" = conftest.file
- )
-then
- # Ok.
- :
-else
- AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-AC_MSG_RESULT(yes)])
-
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_INSTALL_STRIP
-# ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
-# specify the program used to strip binaries. This is especially
-# annoying in cross-compiling environments, where the build's strip
-# is unlikely to handle the host's binaries.
-# Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
-# STRIPPROG with the value of the STRIP variable (set by the user).
-AC_DEFUN([AM_PROG_INSTALL_STRIP],
-[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'. However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
-if test "$cross_compiling" != no; then
- AC_CHECK_TOOL([STRIP], [strip], :)
-fi
-INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
-AC_SUBST([INSTALL_STRIP_PROGRAM])])
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
-# Check how to create a tarball. -*- Autoconf -*-
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
-# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+AC_PREREQ([2.52])
-# serial 2
+# serial 6
-# _AM_PROG_TAR(FORMAT)
-# --------------------
-# Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
-#
-# Substitute a variable $(am__tar) that is a command
-# writing to stdout a FORMAT-tarball containing the directory
-# $tardir.
-# tardir=directory && $(am__tar) > result.tar
-#
-# Substitute a variable $(am__untar) that extract such
-# a tarball read from stdin.
-# $(am__untar) < result.tar
-AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.
-AM_MISSING_PROG([AMTAR], [tar])
-m4_if([$1], [v7],
- [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
- [m4_case([$1], [ustar],, [pax],,
- [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
-_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
- case $_am_tool in
- gnutar)
- for _am_tar in tar gnutar gtar;
- do
- AM_RUN_LOG([$_am_tar --version]) && break
- done
- am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
- am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
- am__untar="$_am_tar -xf -"
- ;;
- plaintar)
- # Must skip GNU tar: if it does not support --format= it doesn't create
- # ustar tarball either.
- (tar --version) >/dev/null 2>&1 && continue
- am__tar='tar chf - "$$tardir"'
- am__tar_='tar chf - "$tardir"'
- am__untar='tar xf -'
- ;;
- pax)
- am__tar='pax -L -x $1 -w "$$tardir"'
- am__tar_='pax -L -x $1 -w "$tardir"'
- am__untar='pax -r'
- ;;
- cpio)
- am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
- am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
- am__untar='cpio -i -H $1 -d'
- ;;
- none)
- am__tar=false
- am__tar_=false
- am__untar=false
- ;;
- esac
-
- # If the value was cached, stop now. We just wanted to have am__tar
- # and am__untar set.
- test -n "${am_cv_prog_tar_$1}" && break
-
- # tar/untar a dummy directory, and stop if the command works
- rm -rf conftest.dir
- mkdir conftest.dir
- echo GrepMe > conftest.dir/file
- AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
- rm -rf conftest.dir
- if test -s conftest.tar; then
- AM_RUN_LOG([$am__untar <conftest.tar])
- grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
- fi
-done
-rm -rf conftest.dir
-
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
-AC_SUBST([am__tar])
-AC_SUBST([am__untar])
-]) # _AM_PROG_TAR
+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
-m4_include([acinclude.m4])
diff --git a/configure.in b/configure.in
index d3bff45..c156a6e 100644
--- a/configure.in
+++ b/configure.in
@@ -40,9 +40,7 @@ dnl Perform program name transformation
AC_ARG_PROGRAM
dnl Automake doc recommends to do this only here. (Janos)
-AM_INIT_AUTOMAKE(kaffeine, 0.8.5) dnl searches for some needed programs
-
-AM_MAINTAINER_MODE
+AM_INIT_AUTOMAKE(kaffeine-0.8.8, "3.5.7") dnl searches for some needed programs
KDE_SET_PREFIX
@@ -66,13 +64,6 @@ dnl FILE: configure.in.in
dnl =======================================================
#MIN_CONFIG(3.3)
-
-KDE_ENABLE_HIDDEN_VISIBILITY
-
-dnl PACKAGE set before
-
-AM_MAINTAINER_MODE
-
CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"
if test "$build_arts" = "yes"; then
@@ -309,7 +300,7 @@ dnl --------------------
dnl check for cdparanoia
dnl --------------------
-KDE_CHECK_HEADER([cdda_interface.h], [with_cdparanoia=yes], [with_cdparanoia=no])
+KDE_CHECK_HEADER([cdio/cdda.h], [with_cdparanoia=yes], [with_cdparanoia=no])
if test "$with_cdparanoia" != "yes" ; then
echo ""
@@ -395,6 +386,7 @@ AC_CONFIG_FILES([ kaffeine/src/input/dvb/lib/Makefile ])
AC_CONFIG_FILES([ kaffeine/src/input/dvb/lib/libdvbapi/Makefile ])
AC_CONFIG_FILES([ kaffeine/src/input/dvb/lib/libdvben50221/Makefile ])
AC_CONFIG_FILES([ kaffeine/src/input/dvb/lib/libucsi/Makefile ])
+AC_CONFIG_FILES([ kaffeine/src/input/dvb/lib/libucsi/atsc/Makefile ])
AC_CONFIG_FILES([ kaffeine/src/input/dvb/lib/libucsi/dvb/Makefile ])
AC_CONFIG_FILES([ kaffeine/src/input/dvb/lib/libucsi/mpeg/Makefile ])
AC_CONFIG_FILES([ kaffeine/src/input/dvb/plugins/Makefile ])
diff --git a/configure.in.in b/configure.in.in
index 824efd6..144aef9 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -1,11 +1,4 @@
#MIN_CONFIG(3.3)
-
-KDE_ENABLE_HIDDEN_VISIBILITY
-
-AM_INIT_AUTOMAKE(kaffeine, 0.8.5)
-
-AM_MAINTAINER_MODE
-
CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"
if test "$build_arts" = "yes"; then
diff --git a/doc/kaffeine/discwindow.png b/doc/kaffeine/discwindow.png
index 4d5c4f2..3690fc0 100644
--- a/doc/kaffeine/discwindow.png
+++ b/doc/kaffeine/discwindow.png
Binary files differ
diff --git a/doc/kaffeine/dvbbroadcast.png b/doc/kaffeine/dvbbroadcast.png
index 7b4acb2..92f1181 100644
--- a/doc/kaffeine/dvbbroadcast.png
+++ b/doc/kaffeine/dvbbroadcast.png
Binary files differ
diff --git a/doc/kaffeine/dvbclient.png b/doc/kaffeine/dvbclient.png
index 916f440..c780765 100644
--- a/doc/kaffeine/dvbclient.png
+++ b/doc/kaffeine/dvbclient.png
Binary files differ
diff --git a/doc/kaffeine/dvbconfig.png b/doc/kaffeine/dvbconfig.png
index 8a774ea..66cd07a 100644
--- a/doc/kaffeine/dvbconfig.png
+++ b/doc/kaffeine/dvbconfig.png
Binary files differ
diff --git a/doc/kaffeine/dvbepg.png b/doc/kaffeine/dvbepg.png
index 98659a6..ab16367 100644
--- a/doc/kaffeine/dvbepg.png
+++ b/doc/kaffeine/dvbepg.png
Binary files differ
diff --git a/doc/kaffeine/dvbscan.png b/doc/kaffeine/dvbscan.png
index 85fac16..5143f19 100644
--- a/doc/kaffeine/dvbscan.png
+++ b/doc/kaffeine/dvbscan.png
Binary files differ
diff --git a/doc/kaffeine/dvbtimers.png b/doc/kaffeine/dvbtimers.png
index 7a90f9d..dbfa976 100644
--- a/doc/kaffeine/dvbtimers.png
+++ b/doc/kaffeine/dvbtimers.png
Binary files differ
diff --git a/doc/kaffeine/dvbwin.png b/doc/kaffeine/dvbwin.png
index 891dfd6..2150238 100644
--- a/doc/kaffeine/dvbwin.png
+++ b/doc/kaffeine/dvbwin.png
Binary files differ
diff --git a/doc/kaffeine/gstpart.png b/doc/kaffeine/gstpart.png
index b2813c4..d3f60ca 100644
--- a/doc/kaffeine/gstpart.png
+++ b/doc/kaffeine/gstpart.png
Binary files differ
diff --git a/doc/kaffeine/kaffeinepart.png b/doc/kaffeine/kaffeinepart.png
index 0bd75d9..fe108b7 100644
--- a/doc/kaffeine/kaffeinepart.png
+++ b/doc/kaffeine/kaffeinepart.png
Binary files differ
diff --git a/doc/kaffeine/playlistwin.png b/doc/kaffeine/playlistwin.png
index f06cf46..9c6a283 100644
--- a/doc/kaffeine/playlistwin.png
+++ b/doc/kaffeine/playlistwin.png
Binary files differ
diff --git a/doc/kaffeine/startwindow.png b/doc/kaffeine/startwindow.png
index cc0f0d7..bfdfa83 100644
--- a/doc/kaffeine/startwindow.png
+++ b/doc/kaffeine/startwindow.png
Binary files differ
diff --git a/kaffeine/configure.in.in b/kaffeine/configure.in.in
index 00b5334..9c95ea0 100644
--- a/kaffeine/configure.in.in
+++ b/kaffeine/configure.in.in
@@ -220,7 +220,7 @@ dnl --------------------
dnl check for cdparanoia
dnl --------------------
-KDE_CHECK_HEADER([cdda_interface.h], [with_cdparanoia=yes], [with_cdparanoia=no])
+KDE_CHECK_HEADER([cdio/cdda.h], [with_cdparanoia=yes], [with_cdparanoia=no])
if test "$with_cdparanoia" != "yes" ; then
echo ""
diff --git a/kaffeine/images/dvbdata.tar.gz b/kaffeine/images/dvbdata.tar.gz
index e2b082f..69dcef7 100644
--- a/kaffeine/images/dvbdata.tar.gz
+++ b/kaffeine/images/dvbdata.tar.gz
Binary files differ
diff --git a/kaffeine/src/input/disc/Makefile.am b/kaffeine/src/input/disc/Makefile.am
index b9827cc..fe91515 100644
--- a/kaffeine/src/input/disc/Makefile.am
+++ b/kaffeine/src/input/disc/Makefile.am
@@ -28,7 +28,7 @@ libkaffeinedisc_la_LDFLAGS = $(KDE_RPATH) \
libkaffeinedisc_la_LIBADD = $(top_builddir)/kaffeine/src/input/libkaffeineinput.la \
$(top_builddir)/kaffeine/src/player-parts/kaffeine-part/libkaffeinepart.la \
$(top_builddir)/kaffeine/src/input/disc/plugins/libkaffeineaudioencoder.la \
- -lcdda_interface -lcdda_paranoia
+ -lcdio_cdda -lcdio_paranoia
# this is where the XML-GUI resource file goes
shellrcdir = $(kde_datadir)/kaffeine
diff --git a/kaffeine/src/input/disc/paranoia.cpp b/kaffeine/src/input/disc/paranoia.cpp
index 60e2092..fad1729 100644
--- a/kaffeine/src/input/disc/paranoia.cpp
+++ b/kaffeine/src/input/disc/paranoia.cpp
@@ -120,7 +120,7 @@ KiloConfig::~KiloConfig()
{
}
-void paranoiaCallback( long, int )
+void paranoiaCallback( long int, paranoia_cb_mode_t )
{
}
@@ -396,7 +396,7 @@ void Paranoia::run()
curpos = currentSector;
endpos = endOfTrack;
if ( normalize ) {
- len = CD_FRAMESIZE_RAW;
+ len = CDIO_CD_FRAMESIZE_RAW;
fn.open( IO_ReadWrite | IO_Truncate );
do {
buf = paranoia_read_limited( p, paranoiaCallback, 3 );
@@ -419,7 +419,7 @@ void Paranoia::run()
while ( curpos<endpos && len!=0 );
factor = 32767.0/max;
- buf = new signed short[CD_FRAMESIZE_RAW];
+ buf = new signed short[CDIO_CD_FRAMESIZE_RAW];
fn.at( 0 );
f.open( IO_ReadWrite | IO_Truncate );
currentEncoder->start( encodingList[i].remove(0,3), encodingList[0], encodingList[1], encodingList[i].left(2) );
@@ -428,7 +428,7 @@ void Paranoia::run()
f.writeBlock( encoded, len );
do {
- len = fn.readBlock( (char*)buf, CD_FRAMESIZE_RAW );
+ len = fn.readBlock( (char*)buf, CDIO_CD_FRAMESIZE_RAW );
if ( len>0 ) {
if ( max<32760 )
for ( n=0; n<len/2; ++n )
@@ -455,7 +455,7 @@ void Paranoia::run()
encoded = currentEncoder->getHeader( len );
if ( encoded )
f.writeBlock( encoded, len );
- len = CD_FRAMESIZE_RAW;
+ len = CDIO_CD_FRAMESIZE_RAW;
do {
buf = paranoia_read_limited( p, paranoiaCallback, 3 );
if ( Q_BYTE_ORDER == Q_BIG_ENDIAN ) {
@@ -514,7 +514,7 @@ QString Paranoia::trackSize( int t )
QString s, c;
long total;
- total = CD_FRAMESIZE_RAW * (cdda_track_lastsector( d, t+1 )-cdda_track_firstsector( d, t+1 ) );
+ total = CDIO_CD_FRAMESIZE_RAW * (cdda_track_lastsector( d, t+1 )-cdda_track_firstsector( d, t+1 ) );
if ( total>(1048576 ) ) s = c.setNum(total/1048576.0, 'f', 2)+" "+i18n("MB");
else if ( total>1024 ) s = c.setNum(total/1024.0, 'f', 2)+" "+i18n("KB");
else s = c.setNum(total*1.0, 'f', 2)+" "+i18n("Bytes");
@@ -532,8 +532,8 @@ QString Paranoia::trackTime( int t )
long total, time;
int m, s;
- if ( t<0 ) total = CD_FRAMESIZE_RAW * (cdda_disc_lastsector( d )-cdda_disc_firstsector( d ) );
- else total = CD_FRAMESIZE_RAW * (cdda_track_lastsector( d, t+1 )-cdda_track_firstsector( d, t+1 ) );
+ if ( t<0 ) total = CDIO_CD_FRAMESIZE_RAW * (cdda_disc_lastsector( d )-cdda_disc_firstsector( d ) );
+ else total = CDIO_CD_FRAMESIZE_RAW * (cdda_track_lastsector( d, t+1 )-cdda_track_firstsector( d, t+1 ) );
time = (8 * total) / (44100 * 2 * 16);
m = time/60;
s = time%60;
diff --git a/kaffeine/src/input/disc/paranoia.h b/kaffeine/src/input/disc/paranoia.h
index 4864b06..ae269d4 100644
--- a/kaffeine/src/input/disc/paranoia.h
+++ b/kaffeine/src/input/disc/paranoia.h
@@ -32,8 +32,8 @@
extern "C"
{
-#include <cdda_interface.h>
-#include <cdda_paranoia.h>
+#include <cdio/cdda.h>
+#include <cdio/paranoia.h>
}
class KiloConfig : public ParanoiaSettings
@@ -91,8 +91,8 @@ private:
bool setPath( QString &path, const QString &artist, const QString &album );
long nTracks;
- cdrom_drive *d;
- cdrom_paranoia *p;
+ cdrom_drive_t *d;
+ cdrom_paranoia_t *p;
long currentSector, endOfTrack;
bool isRunning;
QStringList encodingList;
diff --git a/kaffeine/src/input/disc/plugins/oggvorbis/Makefile.am b/kaffeine/src/input/disc/plugins/oggvorbis/Makefile.am
index 91b63c1..7ac8f45 100644
--- a/kaffeine/src/input/disc/plugins/oggvorbis/Makefile.am
+++ b/kaffeine/src/input/disc/plugins/oggvorbis/Makefile.am
@@ -10,7 +10,7 @@ noinst_HEADERS = koggenc.h
libkaffeineoggvorbis_la_SOURCES = koggenc.cpp oggconfig.ui
libkaffeineoggvorbis_la_LIBADD = ../libkaffeineaudioencoder.la $(LIB_OGGVORBIS)
-libkaffeineoggvorbis_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) $(LIB_QT) -lDCOP $(KDE_PLUGIN) $(LIB_KPARTS) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KIO) -avoid-version -no-undefined
+libkaffeineoggvorbis_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -avoid-version -no-undefined
# this is where the desktop file will go
partdesktopdir = $(kde_servicesdir)
diff --git a/kaffeine/src/input/dvb/Makefile.am b/kaffeine/src/input/dvb/Makefile.am
index 7b6c866..d5b1035 100644
--- a/kaffeine/src/input/dvb/Makefile.am
+++ b/kaffeine/src/input/dvb/Makefile.am
@@ -30,6 +30,8 @@ libkaffeinedvb_la_SOURCES = audioeditor.cpp \
dvbsection.h \
dvbsi.cpp \
dvbsi.h \
+ camdialog.ui \
+ cammenudialog.ui \
dvbstream.cpp \
dvbstream.h \
gdvb.h \
diff --git a/kaffeine/src/input/dvb/camdialog.ui b/kaffeine/src/input/dvb/camdialog.ui
new file mode 100644
index 0000000..b1c3032
--- /dev/null
+++ b/kaffeine/src/input/dvb/camdialog.ui
@@ -0,0 +1,149 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>CamDialog</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>CamDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>330</width>
+ <height>198</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>CAM settings</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>Maximum Concurrent Services:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>maxServiceSpin</cstring>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Application Type:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Manufacturer Code:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Menu String:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>manuCodeLab</cstring>
+ </property>
+ <property name="text">
+ <string>_</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>appManuLab</cstring>
+ </property>
+ <property name="text">
+ <string>_</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Application Manufacturer:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>menuStringLab</cstring>
+ </property>
+ <property name="text">
+ <string>_</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>appTypeLab</cstring>
+ </property>
+ <property name="text">
+ <string>_</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>camMenuBtn</cstring>
+ </property>
+ <property name="text">
+ <string>CAM Menu</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>maxServiceSpin</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kaffeine/src/input/dvb/cammenudialog.ui b/kaffeine/src/input/dvb/cammenudialog.ui
new file mode 100644
index 0000000..6eebfa4
--- /dev/null
+++ b/kaffeine/src/input/dvb/cammenudialog.ui
@@ -0,0 +1,67 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>CamMenuDialog</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>CamMenuDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>317</width>
+ <height>345</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>CAM Menu</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTextBrowser">
+ <property name="name">
+ <cstring>menuText</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Your choice (enter to validate):</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>inputLine</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>inputLine</tabstop>
+ <tabstop>menuText</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kaffeine/src/input/dvb/channeldesc.cpp b/kaffeine/src/input/dvb/channeldesc.cpp
index 5ab4acf..7d96e48 100644
--- a/kaffeine/src/input/dvb/channeldesc.cpp
+++ b/kaffeine/src/input/dvb/channeldesc.cpp
@@ -115,6 +115,8 @@ Transponder::Transponder()
coderateH=FEC_AUTO;
bandwidth=BANDWIDTH_AUTO;
snr = 0;
+ rolloff = ROLLOFF_AUTO;
+ S2 = 0;
}
Transponder::Transponder( const Transponder &trans )
@@ -134,6 +136,8 @@ Transponder::Transponder( const Transponder &trans )
coderateL=trans.coderateL;
coderateH=trans.coderateH;
bandwidth=trans.bandwidth;
+ rolloff = trans.rolloff;
+ S2 = trans.S2;
}
bool Transponder::sameAs( Transponder *trans )
diff --git a/kaffeine/src/input/dvb/channeldesc.h b/kaffeine/src/input/dvb/channeldesc.h
index f4bc1ab..ef07011 100644
--- a/kaffeine/src/input/dvb/channeldesc.h
+++ b/kaffeine/src/input/dvb/channeldesc.h
@@ -101,6 +101,8 @@ public:
fe_code_rate_t coderateH;
fe_bandwidth_t bandwidth;
int snr;
+ fe_rolloff_t rolloff;
+ char S2;
};
class ChannelDesc
diff --git a/kaffeine/src/input/dvb/channeleditor.cpp b/kaffeine/src/input/dvb/channeleditor.cpp
index 6b04fe4..18ea8ce 100644
--- a/kaffeine/src/input/dvb/channeleditor.cpp
+++ b/kaffeine/src/input/dvb/channeleditor.cpp
@@ -143,6 +143,9 @@ void ChannelEditor::accept()
else channel->tp.pol = 'h';
channel->tp.coderateH = (fe_code_rate_t)(FEC_NONE+coderateHComb->currentItem());
channel->tp.inversion = (fe_spectral_inversion_t)(INVERSION_OFF+inversionComb->currentItem());
+ channel->tp.modulation = (fe_modulation_t)(QPSK+modulationComb->currentItem());
+ channel->tp.S2 = stypeComb->currentItem();
+ channel->tp.rolloff = (fe_rolloff_t)(ROLLOFF_35+rolloffComb->currentItem() );
}
else if ( channel->tp.type==FE_QAM ) {
channel->tp.freq = freqSpin->value();
@@ -165,13 +168,7 @@ void ChannelEditor::accept()
else {
channel->tp.freq = freqSpin->value();
channel->tp.inversion = (fe_spectral_inversion_t)(INVERSION_OFF+inversionComb->currentItem());
- switch (modulationComb->currentItem()) {
- case 0: channel->tp.modulation = QAM_64; break;
- case 1: channel->tp.modulation = QAM_256; break;
- case 2: channel->tp.modulation = VSB_8; break;
- case 3: channel->tp.modulation = VSB_16; break;
- default: channel->tp.modulation = QAM_AUTO; break;
- }
+ channel->tp.modulation = (fe_modulation_t)(QPSK+modulationComb->currentItem());
}
done( Accepted );
@@ -187,10 +184,15 @@ void ChannelEditor::initS()
inversionComb->setCurrentItem( INVERSION_OFF+channel->tp.inversion );
coderateHComb->insertStringList( coderateList() );
coderateHComb->setCurrentItem( FEC_NONE+channel->tp.coderateH );
+ modulationComb->insertStringList( modulationList() );
+ modulationComb->setCurrentItem( QPSK+channel->tp.modulation );
+ stypeComb->insertStringList( stypeList() );
+ stypeComb->setCurrentItem( channel->tp.S2 );
+ rolloffComb->insertStringList( rolloffList() );
+ rolloffComb->setCurrentItem( ROLLOFF_35+channel->tp.rolloff );
transmissionComb->setEnabled( false );
coderateLComb->setEnabled( false );
bandwidthComb->setEnabled( false );
- modulationComb->setEnabled( false );
hierarchyComb->setEnabled( false );
guardComb->setEnabled( false );
}
@@ -211,6 +213,8 @@ void ChannelEditor::initC()
bandwidthComb->setEnabled( false );
hierarchyComb->setEnabled( false );
guardComb->setEnabled( false );
+ stypeComb->setEnabled( false );
+ rolloffComb->setEnabled( false );
}
void ChannelEditor::initT()
@@ -234,6 +238,8 @@ void ChannelEditor::initT()
guardComb->setCurrentItem( GUARD_INTERVAL_1_32+channel->tp.guard );
srSpin->setEnabled( false );
polGroup->setEnabled( false );
+ stypeComb->setEnabled( false );
+ rolloffComb->setEnabled( false );
}
void ChannelEditor::initA()
@@ -241,14 +247,8 @@ void ChannelEditor::initA()
freqSpin->setValue( channel->tp.freq );
inversionComb->insertStringList( inversionList() );
inversionComb->setCurrentItem( INVERSION_OFF+channel->tp.inversion );
- modulationComb->insertStringList( modulationListAtsc() );
- switch (channel->tp.modulation) {
- case QAM_64: modulationComb->setCurrentItem(0); break;
- case QAM_256: modulationComb->setCurrentItem(1); break;
- case VSB_8: modulationComb->setCurrentItem(2); break;
- case VSB_16: modulationComb->setCurrentItem(3); break;
- default: modulationComb->setCurrentItem(4); break;
- }
+ modulationComb->insertStringList( modulationList() );
+ modulationComb->setCurrentItem( QPSK+channel->tp.modulation );
srSpin->setEnabled( false );
polGroup->setEnabled( false );
transmissionComb->setEnabled( false );
@@ -257,6 +257,8 @@ void ChannelEditor::initA()
bandwidthComb->setEnabled( false );
hierarchyComb->setEnabled( false );
guardComb->setEnabled( false );
+ stypeComb->setEnabled( false );
+ rolloffComb->setEnabled( false );
}
QStringList ChannelEditor::inversionList()
@@ -271,7 +273,7 @@ QStringList ChannelEditor::coderateList()
{
QStringList list;
- list<<"NONE"<<"1/2"<<"2/3"<<"3/4"<<"4/5"<<"5/6"<<"6/7"<<"7/8"<<"8/9"<<"AUTO";
+ list<<"NONE"<<"1/2"<<"2/3"<<"3/4"<<"4/5"<<"5/6"<<"6/7"<<"7/8"<<"8/9"<<"AUTO"<<"3/5"<<"9/10";
return list;
}
@@ -279,15 +281,7 @@ QStringList ChannelEditor::modulationList()
{
QStringList list;
- list<<"QPSK"<<"QAM 16"<<"QAM 32"<<"QAM 64"<<"QAM 128"<<"QAM 256"<<"AUTO";
- return list;
-}
-
-QStringList ChannelEditor::modulationListAtsc()
-{
- QStringList list;
-
- list<<"QAM 64"<<"QAM 256"<<"VSB 8"<<"VSB 16"<<"AUTO";
+ list<<"QPSK"<<"QAM 16"<<"QAM 32"<<"QAM 64"<<"QAM 128"<<"QAM 256"<<"AUTO"<<"VSB-8"<<"VSB-16"<<"8PSK"<<"16APSK"<<"DQPSK";
return list;
}
@@ -323,6 +317,22 @@ QStringList ChannelEditor::guardList()
return list;
}
+QStringList ChannelEditor::stypeList()
+{
+ QStringList list;
+
+ list<<"DVB-S"<<"DVB-S2";
+ return list;
+}
+
+QStringList ChannelEditor::rolloffList()
+{
+ QStringList list;
+
+ list<<"35"<<"20"<<"25"<<"AUTO";
+ return list;
+}
+
ChannelEditor::~ChannelEditor()
{
}
diff --git a/kaffeine/src/input/dvb/channeleditor.h b/kaffeine/src/input/dvb/channeleditor.h
index 6a3b3f8..586b9a3 100644
--- a/kaffeine/src/input/dvb/channeleditor.h
+++ b/kaffeine/src/input/dvb/channeleditor.h
@@ -53,11 +53,12 @@ private:
QStringList inversionList();
QStringList coderateList();
QStringList modulationList();
- QStringList modulationListAtsc();
QStringList transmissionList();
QStringList bandwidthList();
QStringList hierarchyList();
QStringList guardList();
+ QStringList stypeList();
+ QStringList rolloffList();
ChannelDesc *channel;
QPtrList<ChannelDesc> *chandesc;
diff --git a/kaffeine/src/input/dvb/channeleditorui.ui b/kaffeine/src/input/dvb/channeleditorui.ui
index 5b75f18..09bdad1 100644
--- a/kaffeine/src/input/dvb/channeleditorui.ui
+++ b/kaffeine/src/input/dvb/channeleditorui.ui
@@ -9,7 +9,7 @@
<x>0</x>
<y>0</y>
<width>477</width>
- <height>533</height>
+ <height>541</height>
</rect>
</property>
<property name="caption">
@@ -19,7 +19,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="Line" row="1" column="0">
+ <widget class="Line" row="0" column="1">
<property name="name">
<cstring>line2</cstring>
</property>
@@ -35,7 +35,7 @@
</widget>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
- <cstring>layout9</cstring>
+ <cstring>layout7</cstring>
</property>
<vbox>
<property name="name">
@@ -432,22 +432,6 @@
<cstring>transmissionComb</cstring>
</property>
</widget>
- <widget class="QLabel" row="3" column="0">
- <property name="name">
- <cstring>textLabel11</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>4</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Bandwidth:</string>
- </property>
- </widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>textLabel10</cstring>
@@ -480,11 +464,6 @@
<string>Transmission:</string>
</property>
</widget>
- <widget class="QComboBox" row="3" column="1">
- <property name="name">
- <cstring>bandwidthComb</cstring>
- </property>
- </widget>
<widget class="QComboBox" row="2" column="1">
<property name="name">
<cstring>coderateHComb</cstring>
@@ -511,11 +490,6 @@
<string>FEC low:</string>
</property>
</widget>
- <widget class="QComboBox" row="3" column="3">
- <property name="name">
- <cstring>guardComb</cstring>
- </property>
- </widget>
<widget class="QLabel" row="3" column="2">
<property name="name">
<cstring>textLabel7</cstring>
@@ -595,6 +569,58 @@
<string>Inversion:</string>
</property>
</widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel11</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Bandwidth:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="3" column="1">
+ <property name="name">
+ <cstring>bandwidthComb</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="4" column="1">
+ <property name="name">
+ <cstring>stypeComb</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="4" column="3">
+ <property name="name">
+ <cstring>rolloffComb</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="2">
+ <property name="name">
+ <cstring>textLabel2_4</cstring>
+ </property>
+ <property name="text">
+ <string>Roll off:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="3" column="3">
+ <property name="name">
+ <cstring>guardComb</cstring>
+ </property>
+ </widget>
</grid>
</widget>
<spacer>
@@ -610,7 +636,7 @@
<property name="sizeHint">
<size>
<width>20</width>
- <height>98</height>
+ <height>166</height>
</size>
</property>
</spacer>
diff --git a/kaffeine/src/input/dvb/dvbcam.cpp b/kaffeine/src/input/dvb/dvbcam.cpp
index 1cb5b86..e525f6d 100644
--- a/kaffeine/src/input/dvb/dvbcam.cpp
+++ b/kaffeine/src/input/dvb/dvbcam.cpp
@@ -1,6 +1,7 @@
/*
* dvbcam.cpp
*
+ * Copyright (C) 2008 Christophe Thommeret <hftom@free.fr>
* Copyright (C) 2006 Christoph Pfister <christophpfister@gmail.com>
*
* code based on ca_zap (LGPL)
@@ -29,173 +30,48 @@
#include <sys/poll.h>
#include <linux/dvb/ca.h>
-#include <libdvbapi/dvbca.h>
-#include <libdvbapi/dvbdemux.h>
-#include <libdvben50221/en50221_app_ai.h>
-#include <libdvben50221/en50221_app_ca.h>
-#include <libdvben50221/en50221_app_rm.h>
-#include <libdvben50221/en50221_app_tags.h>
-#include <libdvben50221/en50221_session.h>
-#include <libucsi/mpeg/section.h>
-
+#include <qapplication.h>
#include <qthread.h>
#include <qstring.h>
+#include <qspinbox.h>
+#include <qlabel.h>
+#include <qtextbrowser.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
#include "dvbcam.h"
-class DvbCamCamHandler
-{
-public:
- virtual ~DvbCamCamHandler();
-
- bool init();
-
- virtual void poll() = 0;
- virtual bool registerCam(int ca_fd, uint8_t slot) = 0;
-
- bool sendPmt(char *pmt_buffer, int size);
-
-protected:
- DvbCamCamHandler();
-
- static int infoCallback(void *arg, uint8_t slot_id, uint16_t session_number, uint32_t ca_id_count, uint16_t *ca_ids);
-
- virtual bool sub_init() = 0;
-
- void *AiResource;
- void *CaResource;
- en50221_app_send_functions SendFuncs;
-
- volatile int SessionNumber;
-};
-
-class DvbCamCamThread : protected QThread
-{
-public:
- DvbCamCamThread(int adapter, int ca_device, int ci_type);
- ~DvbCamCamThread();
-
- void start();
- void stop();
- void wait();
-
- bool processPmt(int demux_fd);
-
-private:
- void run();
-
- int Adapter;
- int CaDevice;
- int ciType;
-
- DvbCamCamHandler *CamHandler;
-
- char PmtBuffer[4096]; // we imply that processPmt is only once called
-
- volatile int PmtSize; // PmtSize <= 0 means PmtBuffer invalid
- volatile bool Stopped;
-};
-
-class DvbCamPmtThread : protected QThread
-{
-public:
- DvbCamPmtThread(DvbCamCamThread *cam_thread, int adapter, int demux_device, int service_id);
- ~DvbCamPmtThread();
-
- void start();
- void stop();
- void wait();
-
-private:
- int createSectionFilter(uint16_t pid, uint8_t table_id);
- int processPat(int demux_fd);
- void run();
+#define TIMER_EVENT_MMI_OPEN 500
+#define TIMER_EVENT_MMI_CLOSE 501
+#define TIMER_EVENT_CAM_READY 502
- DvbCamCamThread *CamThread;
- int Adapter;
- int DemuxDevice;
- int ServiceId;
- volatile bool Stopped;
-};
-class DvbCamCamHandlerLLCI : public DvbCamCamHandler
-{
-public:
- DvbCamCamHandlerLLCI();
- ~DvbCamCamHandlerLLCI();
-
-private:
- struct SlResource
- {
- en50221_app_public_resource_id resid;
- uint32_t binary_resource_id;
- en50221_sl_resource_callback callback;
- void *arg;
- };
-
- static int llci_rm_enq_callback(void *arg, uint8_t slot_id, uint16_t session_number);
- static int llci_rm_reply_callback(void *arg, uint8_t slot_id, uint16_t session_number, uint32_t resource_id_count, uint32_t *resource_ids);
- static int llci_rm_changed_callback(void *arg, uint8_t slot_id, uint16_t session_number);
- static int llci_lookup_callback(void *arg, uint8_t slot_id, uint32_t requested_resource_id, en50221_sl_resource_callback *callback_out, void **arg_out, uint32_t *connected_resource_id);
- static int llci_session_callback(void *arg, int reason, uint8_t slot_id, uint16_t session_number, uint32_t resource_id);
-
- void poll();
- bool registerCam(int ca_fd, uint8_t slot);
- bool sub_init();
-
- void *RmResource;
- void *SessionLayer;
- void *TransportLayer;
-
- SlResource Resources[3];
-};
-
-class DvbCamCamHandlerHLCI : public DvbCamCamHandler
-{
-public:
- DvbCamCamHandlerHLCI();
- ~DvbCamCamHandlerHLCI();
-
-private:
- static int hlci_send_data(void *arg, uint16_t session_number, uint8_t *data, uint16_t data_length);
- static int hlci_send_datav(void *arg, uint16_t session_number, iovec *vector, int iov_count);
-
- void poll();
- bool registerCam(int ca_fd, uint8_t slot);
- bool sub_init();
-};
-
-// class DvbCam
-
-DvbCam::DvbCam(int adapter, int ca_device, int demux_device, int ci_type)
+DvbCam::DvbCam(int adapter, int ca_device, int demux_device, int ci_type, int maxService)
{
Adapter = adapter;
CaDevice = ca_device;
DemuxDevice = demux_device;
ciType = ci_type;
+ CamMaxService = maxService;
+ fprintf(stderr, "DvbCam: CamMaxService = %d\n", CamMaxService);
- isRunning = false;
+ stdcam = NULL;
+ menuDialog = NULL;
- CamThread = NULL;
- PmtThread = NULL;
-
- // at that time, we do reset in cam_thread
- /*if ( ciType!=CA_CI ) { //do not reset HLCI
- int ca_fd = dvbca_open( Adapter, CaDevice );
- if(ca_fd < 0) // should not happen
- fprintf(stderr, "CamThread: [error] opening ca device failed\n");
- else {
- if(dvbca_reset(ca_fd, 0))
- fprintf(stderr, "CamThread: [error] resetting cam slot failed\n");
- close(ca_fd);
- }
- }*/
+ sidList.setAutoDelete( true );
+
+ isRunning = true;
+ start();
}
DvbCam::~DvbCam()
{
- stop();
+ isRunning = false;
+ wait();
+ sidMutex.lock();
+ sidList.clear();
+ sidMutex.unlock();
}
int DvbCam::probe( int adapter, int ca_device )
@@ -251,676 +127,786 @@ int DvbCam::probe( int adapter, int ca_device )
return -1;
}
-void DvbCam::restart(int service_id)
+bool DvbCam::canPlay( ChannelDesc *chan )
{
- stop();
-
- isRunning = true;
- sid = service_id;
-
- CamThread = new DvbCamCamThread(Adapter, CaDevice, ciType);
- CamThread->start();
+ int i, n=0;
- PmtThread = new DvbCamPmtThread(CamThread, Adapter, DemuxDevice, service_id);
- PmtThread->start();
-}
-
-void DvbCam::stop()
-{
- if(PmtThread != NULL) {
- PmtThread->stop();
- }
- if(CamThread != NULL) {
- CamThread->stop();
- }
- if(PmtThread != NULL) {
- PmtThread->wait();
- delete PmtThread;
- PmtThread = NULL;
- }
- if(CamThread != NULL) {
- CamThread->wait();
- delete CamThread; // be careful about deletion: PmtThread uses CamThread internally
- CamThread = NULL;
+ QMutexLocker locker( &sidMutex );
+ for ( i=0; i<sidList.count(); ++i ) {
+ if ( sidList.at(i)->getState()<CamService::Remove )
+ n++;
+ if ( sidList.at(i)->getChannel().name==chan->name )
+ return true;
}
- isRunning = false;
-}
-
-// class DvbCamCamThread
-
-DvbCamCamThread::DvbCamCamThread(int adapter, int ca_device, int ci_type)
-{
- Adapter = adapter;
- CaDevice = ca_device;
- ciType = ci_type;
-
- CamHandler = NULL;
-}
-
-DvbCamCamThread::~DvbCamCamThread()
-{
- wait(); // should never be necessary
+ return ( n<CamMaxService );
}
-void DvbCamCamThread::start()
+void DvbCam::startService( ChannelDesc *chan )
{
- PmtSize = 0;
- Stopped = false;
- QThread::start();
-}
-
-void DvbCamCamThread::stop()
-{
- Stopped = true;
+ int i;
+ QMutexLocker locker( &sidMutex );
+ for ( i=0; i<sidList.count(); ++i ) {
+ if ( sidList.at(i)->getChannel().name==chan->name ) {
+ sidList.at(i)->restart();
+ return;
+ }
+ }
+ sidList.append( new CamService( Adapter, DemuxDevice, chan, CamMaxService ) );
}
-void DvbCamCamThread::wait()
+void DvbCam::stopService( ChannelDesc *chan )
{
- QThread::wait();
+ int i;
+ QMutexLocker locker( &sidMutex );
+ for ( i=0; i<sidList.count(); ++i ) {
+ if ( sidList.at(i)->getChannel().name==chan->name ) {
+ sidList.at(i)->setState( CamService::Remove );
+ return;
+ }
+ }
}
-bool DvbCamCamThread::processPmt(int demux_fd)
+void DvbCam::resendPmts()
{
- // read section
- char si_buf[4096];
- int size = read(demux_fd, si_buf, sizeof(si_buf));
- if(size <= 0) {
- return false;
- }
-
- // parse section
- section *parsed_section = section_codec(reinterpret_cast<unsigned char *> (si_buf), size);
- if(parsed_section == NULL) {
- return false;
- }
-
- // parse section_ext
- section_ext *parsed_section_ext = section_ext_decode(parsed_section, 1); // crc check on
- if(parsed_section_ext == NULL) {
- return false;
- }
-
- // parse pmt
- mpeg_pmt_section *parsed_pmt = mpeg_pmt_section_codec(parsed_section_ext);
- if(parsed_pmt == NULL) {
- return false;
- }
-
- // translate it into a cam pmt
- PmtSize = en50221_ca_format_pmt(parsed_pmt, reinterpret_cast<unsigned char *> (PmtBuffer), sizeof(PmtBuffer), 0, CA_LIST_MANAGEMENT_ONLY, CA_PMT_CMD_ID_OK_DESCRAMBLING);
- if(PmtSize <= 0) {
- return false;
+ int i;
+ QMutexLocker locker( &sidMutex );
+ for ( i=0; i<sidList.count(); ++i ) {
+ if ( sidList.at(i)->getState()==CamService::Added ) {
+ sidList.at(i)->setState( CamService::Ready );
+ }
}
-
- // the DvbCamCamThread will send it to the cam
- return true;
}
-void DvbCamCamThread::run()
+void DvbCam::run()
{
+ int i, reset_loop, query_loop, state_loop;
+ bool cam_ready = false;
+
fprintf(stderr, "CamThread: started\n");
int ca_fd = dvbca_open(Adapter, CaDevice);
- if(ca_fd < 0) {
- fprintf(stderr, "CamThread: [error] opening ca device failed\n");
+ if ( ca_fd<0 ) {
+ fprintf( stderr, "CamThread: [error] opening ca device failed\n" );
return;
}
- fprintf(stderr, "CamThread: just using the first cam slot\n");
+ //fprintf(stderr, "CamThread: just using the first cam slot\n");
- if ( ciType!=CA_CI ) { // do not reset HLCI
- if(dvbca_reset(ca_fd, 0)) {
- fprintf(stderr, "CamThread: [error] resetting cam slot failed\n");
- close(ca_fd);
- return;
+ reset_loop=0;
+ while ( isRunning && reset_loop++<6 && !cam_ready ) {
+ if ( ciType!=CA_CI ) { // do not reset HLCI
+ if ( dvbca_reset(ca_fd, 0) ) {
+ fprintf( stderr, "CamThread: [error] resetting cam slot failed\n" );
+ //close( ca_fd );
+ //ca_fd = -1;
+ //return;
+ usleep(1000000);
+ continue;
+ }
+ fprintf( stderr, "CamThread: reset cam slot\n" );
}
- }
- while(!Stopped) {
- bool cam_ready = false;
- switch(dvbca_get_cam_state(ca_fd, 0)) {
- case DVBCA_CAMSTATE_MISSING: {
- /*fprintf(stderr, "CamThread: [error] no cam detected\n");
- close(ca_fd);
- return; */ // FIXME: find a more reliable solution
- break;
- }
- case DVBCA_CAMSTATE_READY: {
- fprintf(stderr, "CamThread: cam 0 is ready\n");
- cam_ready = true;
- break;
- }
- case DVBCA_CAMSTATE_INITIALISING: {
- if ( ciType==CA_CI ) { // workaround needed for hlci
- fprintf(stderr, "CamThread: cam 0 is ready [hlci workaround]\n");
+ state_loop=0;
+ query_loop=0;
+ while ( isRunning && state_loop++<30 ) {
+ switch( dvbca_get_cam_state(ca_fd, 0) ) {
+ case DVBCA_CAMSTATE_MISSING: {
+ //fprintf(stderr, "CamThread: [error] no cam detected\n");
+ //close(ca_fd);
+ //return; // FIXME: find a more reliable solution
+ break;
+ }
+ case DVBCA_CAMSTATE_READY: {
+ fprintf( stderr, "CamThread: cam 0 is ready\n" );
cam_ready = true;
+ break;
+ }
+ case DVBCA_CAMSTATE_INITIALISING: {
+ fprintf( stderr, "CamThread: cam is initialising\n" );
+ if ( ciType==CA_CI ) { // workaround needed for hlci
+ fprintf(stderr, "CamThread: cam 0 is ready [hlci workaround]\n");
+ cam_ready = true;
+ }
+ break;
+ }
+ default: {
+ if ( ++query_loop>3 ) {
+ fprintf(stderr, "CamThread: [error] querying the cam state failed\n");
+ close(ca_fd);
+ ca_fd = -1;
+ return;
+ }
}
- break;
}
- default: {
- fprintf(stderr, "CamThread: [error] querying the cam state failed\n");
- close(ca_fd);
- return;
+ if(cam_ready) {
+ break;
}
+ usleep(100000); // 100 ms
}
- if(cam_ready) {
- break;
- }
- usleep(100000); // 100 ms
}
- if(!Stopped) {
+ if ( isRunning ) {
switch(dvbca_get_interface_type(ca_fd, 0)) {
case DVBCA_INTERFACE_LINK: {
fprintf(stderr, "CamThread: LLCI cam slot detected\n");
- CamHandler = new DvbCamCamHandlerLLCI();
break;
}
case DVBCA_INTERFACE_HLCI: {
fprintf(stderr, "CamThread: HLCI cam slot detected\n");
- CamHandler = new DvbCamCamHandlerHLCI();
break;
}
default: {
fprintf(stderr, "CamThread: [error] unknown cam slot type\n");
close(ca_fd);
+ ca_fd = -1;
return;
}
}
}
- if(!Stopped) {
- if(!CamHandler->init()) {
- fprintf(stderr, "CamThread: [error] cam slot initialization failed\n");
- delete CamHandler;
- CamHandler = NULL;
- close(ca_fd);
- return;
- }
- }
+ close(ca_fd);
+ ca_fd = -1;
- if(!Stopped) {
- if(!CamHandler->registerCam(ca_fd, 0)) {
- fprintf(stderr, "CamThread: [error] registering cam 0 failed\n");
- delete CamHandler;
- CamHandler = NULL;
- close(ca_fd);
+ if ( isRunning ) {
+ if ( !init() ) {
+ fprintf(stderr, "CamThread: [error] cam slot initialisation failed\n");
return;
}
}
+ fprintf(stderr, "CamThread: cam slot initialised\n");
- while(!Stopped) {
- CamHandler->poll();
- if(PmtSize > 0) {
- if(CamHandler->sendPmt(PmtBuffer, PmtSize)) {
- fprintf(stderr, "CamThread: pmt sent to cam\n");
- PmtSize = 0;
+ CamService *cs;
+ while ( isRunning ) {
+ if ( stdcam->stdcam->poll( stdcam->stdcam )!=EN50221_STDCAM_CAM_OK ) {
+ usleep( 100000 );
+ continue;
+ }
+ sidMutex.lock();
+ for ( i=0; i<sidList.count(); ++i ) {
+ cs = sidList.at(i);
+ if ( cs->getState()==CamService::Remove ) {
+ if ( sendPmt( cs->caPmt, cs->caPmtSize ) ) {
+ fprintf( stderr, "CamThread: %s removed from camlist\n", cs->getChannel().name.ascii() );
+ sidList.remove( cs );
+ --i;
+ }
+ else
+ fprintf( stderr, "CamThread: %s failed removing from camlist\n", cs->getChannel().name.ascii() );
+ stdcam->stdcam->poll( stdcam->stdcam );
+ usleep(100000);
+ }
+ else if ( cs->getState()==CamService::Destroy ) {
+ fprintf( stderr, "CamThread: %s service deleted\n", cs->getChannel().name.ascii() );
+ sidList.remove( cs );
+ --i;
}
}
+ for ( i=0; i<sidList.count(); ++i ) {
+ cs = sidList.at(i);
+ if ( cs->getState()==CamService::Ready ) {
+ if ( sendPmt( cs->caPmt, cs->caPmtSize ) ) {
+ cs->setState( CamService::Added );
+ fprintf( stderr, "CamThread: %s pmt sent to cam\n", cs->getChannel().name.ascii() );
+ }
+ else
+ fprintf( stderr, "CamThread: %s pmt failed sending to cam\n", cs->getChannel().name.ascii() );
+ stdcam->stdcam->poll( stdcam->stdcam );
+ usleep(100000);
+ }
+ }
+ sidMutex.unlock();
+ usleep( 10000 ); //sleep a bit
}
fprintf(stderr, "CamThread: stopping requested\n");
- delete CamHandler;
- CamHandler = NULL;
- close(ca_fd);
+ if ( stdcam ) {
+ if (stdcam->stdcam->destroy)
+ stdcam->stdcam->destroy(stdcam->stdcam, 1);
+ en50221_sl_destroy( SessionLayer );
+ en50221_tl_destroy( TransportLayer );
+ delete stdcam;
+ }
fprintf(stderr, "CamThread: stopped\n");
return;
}
-// class DvbCamPmtThread
-
-DvbCamPmtThread::DvbCamPmtThread(DvbCamCamThread *cam_thread, int adapter, int demux_device, int service_id)
+bool DvbCam::init()
{
- CamThread = cam_thread;
- Adapter = adapter;
- DemuxDevice = demux_device;
- ServiceId = service_id;
+ TransportLayer = en50221_tl_create(1, 16);
+ if ( TransportLayer==NULL ) {
+ fprintf(stderr, "Failed to create transport layer\n");
+ return false;
+ }
+ SessionLayer = en50221_sl_create(TransportLayer, 16);
+ if ( SessionLayer==NULL ) {
+ fprintf(stderr, "Failed to create session layer\n");
+ en50221_tl_destroy( TransportLayer );
+ return false;
+ }
+ en50221_stdcam *sc = en50221_stdcam_create( Adapter, 0, TransportLayer, SessionLayer );
+ if ( sc==NULL ) {
+ en50221_sl_destroy( SessionLayer );
+ en50221_tl_destroy( TransportLayer );
+ fprintf(stderr, "Failed to create stdcam\n");
+ return false;
+ }
+
+ stdcam = new StandardCam( sc, this );
+
+ // hook up the AI callbacks
+ if ( stdcam->stdcam->ai_resource ) {
+ en50221_app_ai_register_callback( stdcam->stdcam->ai_resource, aiCallback, stdcam );
+ }
+
+ // hook up the CA callbacks
+ if ( stdcam->stdcam->ca_resource ) {
+ en50221_app_ca_register_info_callback( stdcam->stdcam->ca_resource, infoCallback, stdcam );
+ }
+
+ // hook up the MMI callbacks
+ if ( stdcam->stdcam->mmi_resource ) {
+ en50221_app_mmi_register_close_callback( stdcam->stdcam->mmi_resource, mmi_close_callback, stdcam );
+ en50221_app_mmi_register_display_control_callback( stdcam->stdcam->mmi_resource, mmi_display_control_callback, stdcam );
+ en50221_app_mmi_register_enq_callback( stdcam->stdcam->mmi_resource, mmi_enq_callback, stdcam );
+ en50221_app_mmi_register_menu_callback( stdcam->stdcam->mmi_resource, mmi_menu_callback, stdcam );
+ en50221_app_mmi_register_list_callback( stdcam->stdcam->mmi_resource, mmi_menu_callback, stdcam );
+ } else {
+ fprintf(stderr, "CAM Menus are not supported by this interface hardware\n");
+ }
+
+ return true;
}
-DvbCamPmtThread::~DvbCamPmtThread()
+bool DvbCam::sendPmt( unsigned char *pmt_buffer, int size )
{
- wait(); // should never be necessary
+ if ( !stdcam )
+ return false;
+ if ( en50221_app_ca_pmt( stdcam->stdcam->ca_resource, stdcam->stdcam->ca_session_number, pmt_buffer, size) )
+ return false;
+
+ return true;
}
-void DvbCamPmtThread::start()
+int DvbCam::infoCallback(void *arg, uint8_t slot_id, uint16_t session_number, uint32_t ca_id_count, uint16_t *ca_ids)
{
- Stopped = false;
- QThread::start();
+ StandardCam *std = (StandardCam*)arg;
+ (void)slot_id;
+ (void)session_number;
+
+ fprintf(stderr, "CAM supports the following ca system ids:\n");
+ uint32_t i;
+ for ( i=0; i<ca_id_count; i++ ) {
+ fprintf( stderr, " 0x%04x\n", ca_ids[i]);
+ }
+
+ QApplication::postEvent( std->dvbcam, new QTimerEvent(TIMER_EVENT_CAM_READY ) );
+
+ return 0;
}
-void DvbCamPmtThread::stop()
+int DvbCam::aiCallback(void *arg, uint8_t slot_id, uint16_t session_number, uint8_t application_type, uint16_t application_manufacturer, uint16_t manufacturer_code, uint8_t menu_string_length, uint8_t *menu_string)
{
- Stopped = true;
+ StandardCam *std = (StandardCam*)arg;
+ (void)slot_id;
+ (void)session_number;
+
+ fprintf(stderr, "CAM Application type: %02x\n", application_type);
+ std->dvbcam->setAppType( QString("0x%1").arg(application_type, 0, 16 ) );
+ fprintf(stderr, "CAM Application manufacturer: %04x\n", application_manufacturer);
+ std->dvbcam->setAppManu( QString("0x%1").arg(application_manufacturer, 0, 16 ) );
+ fprintf(stderr, "CAM Manufacturer code: %04x\n", manufacturer_code);
+ std->dvbcam->setManuCode( QString("0x%1").arg(manufacturer_code, 0, 16 ) );
+ fprintf(stderr, "CAM Menu string: %.*s\n", menu_string_length, menu_string);
+ QString s = (const char*)menu_string;
+ s.truncate( menu_string_length );
+ std->dvbcam->setMenuString( s );
+ return 0;
}
-void DvbCamPmtThread::wait()
+int DvbCam::mmi_close_callback(void *arg, uint8_t slot_id, uint16_t session_number, uint8_t cmd_id, uint8_t delay)
{
- QThread::wait();
+ fprintf( stderr,"mmi_close_callback, delay=%d\n",delay);
+ StandardCam *std = (StandardCam*)arg;
+ (void) slot_id;
+ (void) session_number;
+ (void) cmd_id;
+ (void) delay;
+
+ // note: not entirely correct as its supposed to delay if asked
+ std->mmi_state = MMI_STATE_CLOSED;
+ QApplication::postEvent( std->dvbcam, new QTimerEvent(TIMER_EVENT_MMI_CLOSE ) );
+ return 0;
}
-int DvbCamPmtThread::createSectionFilter(uint16_t pid, uint8_t table_id)
+int DvbCam::mmi_display_control_callback(void *arg, uint8_t slot_id, uint16_t session_number, uint8_t cmd_id, uint8_t mmi_mode)
{
- // open the demuxer
- int demux_fd = dvbdemux_open_demux(Adapter, DemuxDevice, 0);
- if(demux_fd < 0) {
- return -1;
+ fprintf( stderr,"mmi_display_control_callback\n");
+ struct en50221_app_mmi_display_reply_details reply;
+ StandardCam *std = (StandardCam*)arg;
+ (void) slot_id;
+
+ // don't support any commands but set mode
+ if ( cmd_id!=MMI_DISPLAY_CONTROL_CMD_ID_SET_MMI_MODE ) {
+ en50221_app_mmi_display_reply( std->stdcam->mmi_resource, session_number, MMI_DISPLAY_REPLY_ID_UNKNOWN_CMD_ID, &reply );
+ return 0;
}
- // create a section filter
- uint8_t filter[18] = {table_id};
- uint8_t mask[18] = {0xff};
- if(dvbdemux_set_section_filter(demux_fd, pid, filter, mask, 1, 1)) { // crc check on
- close(demux_fd);
- return -1;
+ // we only support high level mode
+ if ( mmi_mode!=MMI_MODE_HIGH_LEVEL ) {
+ en50221_app_mmi_display_reply( std->stdcam->mmi_resource, session_number, MMI_DISPLAY_REPLY_ID_UNKNOWN_MMI_MODE, &reply );
+ return 0;
}
- return demux_fd;
+ // ack the high level open
+ reply.u.mode_ack.mmi_mode = mmi_mode;
+ en50221_app_mmi_display_reply( std->stdcam->mmi_resource, session_number, MMI_DISPLAY_REPLY_ID_MMI_MODE_ACK, &reply );
+ std->mmi_state = MMI_STATE_OPEN;
+ return 0;
}
-int DvbCamPmtThread::processPat(int demux_fd)
+int DvbCam::mmi_enq_callback(void *arg, uint8_t slot_id, uint16_t session_number, uint8_t blind_answer, uint8_t expected_answer_length,
+ uint8_t *text, uint32_t text_size)
{
- // read section
- char si_buf[4096];
- int size = read(demux_fd, si_buf, sizeof(si_buf));
- if(size < 0) {
- return -1;
- }
+ fprintf( stderr,"mmi_enq_callback\n");
+ StandardCam *std = (StandardCam*)arg;
+ (void) slot_id;
+ (void) session_number;
- // parse section
- section *parsed_section = section_codec(reinterpret_cast<unsigned char *> (si_buf), size);
- if(parsed_section == NULL) {
- return -1;
- }
+ QString s;
- // parse section_ext
- section_ext *parsed_section_ext = section_ext_decode(parsed_section, 1); // crc check on
- if(parsed_section_ext == NULL) {
- return -1;
- }
+ QMutexLocker locker( &std->mutex );
- // parse pat
- mpeg_pat_section *parsed_pat = mpeg_pat_section_codec(parsed_section_ext);
- if(parsed_pat == NULL) {
- return -1;
- }
+ std->menuList.clear();
+ fprintf(stderr, "%.*s: ", text_size, text);
+ s = (const char*)text;
+ s.truncate( text_size );
+ std->menuList.append( s );
+ fflush(stdout);
- // try and find the requested program
- mpeg_pat_program *cur_program;
- mpeg_pat_section_programs_for_each(parsed_pat, cur_program) {
- if(cur_program->program_number == ServiceId) {
- return cur_program->pid;
- }
- }
+ std->mmi_enq_blind = blind_answer;
+ std->mmi_enq_length = expected_answer_length;
+ std->mmi_state = MMI_STATE_ENQ;
+ std->menuType = MMI_MENU;
- fprintf(stderr, "PmtThread: [warning] the requested service id couldn't be found\n");
-
- return -1;
+ return 0;
}
-void DvbCamPmtThread::run()
+int DvbCam::mmi_menu_callback(void *arg, uint8_t slot_id, uint16_t session_number, struct en50221_app_mmi_text *title,
+ struct en50221_app_mmi_text *sub_title, struct en50221_app_mmi_text *bottom, uint32_t item_count,
+ struct en50221_app_mmi_text *items, uint32_t item_raw_length, uint8_t *items_raw)
{
- fprintf(stderr, "PmtThread: started\n");
+ fprintf( stderr,"mmi_menu_callback, session=%d\n",session_number);
+ StandardCam *std = (StandardCam*)arg;
+ (void) slot_id;
+ (void) session_number;
+ (void) item_raw_length;
+ (void) items_raw;
- int demux_fd = createSectionFilter(TRANSPORT_PAT_PID, stag_mpeg_program_association);
- if(demux_fd < 0) {
- fprintf(stderr, "PmtThread: [error] opening demux device failed\n");
- return;
- }
+ QString s;
- pollfd poll_desc;
- poll_desc.fd = demux_fd;
- poll_desc.events = POLLIN | POLLPRI;
- while(!Stopped) {
- int ret = poll(&poll_desc, 1, 100); // 100 ms
- if(ret < 0) {
- fprintf(stderr, "PmtThread: [error] polling demux device failed\n");
- close(demux_fd);
- return;
- }
- if((ret > 0) && (poll_desc.revents != 0) && ((poll_desc.revents & ~(POLLIN | POLLPRI)) == 0)) {
- int processed_pat = processPat(demux_fd);
- if(processed_pat >= 0) {
- close(demux_fd);
- demux_fd = createSectionFilter(processed_pat, stag_mpeg_program_map);
- if(demux_fd < 0) {
- fprintf(stderr, "PmtThread: [error] opening demux device failed\n");
- return;
- }
- poll_desc.fd = demux_fd;
- break;
- }
- }
- }
+ QMutexLocker locker( &std->mutex );
+ std->menuList.clear();
- while(!Stopped) {
- int ret = poll(&poll_desc, 1, 100); // 100 ms
- if(ret < 0) {
- fprintf(stderr, "PmtThread: [error] polling demux device failed\n");
- close(demux_fd);
- return;
- }
- if((ret > 0) && (poll_desc.revents != 0) && ((poll_desc.revents & ~(POLLIN | POLLPRI)) == 0)) {
- if(CamThread->processPmt(demux_fd)) {
- fprintf(stderr, "PmtThread: new pmt received\n");
- close(demux_fd);
- fprintf(stderr, "PmtThread: stopped\n");
- return;
- }
- }
+ fprintf(stderr, "------------------------------\n");
+
+ if (title->text_length) {
+ fprintf(stderr, "%.*s\n", title->text_length, title->text);
+ s = (const char*)title->text;
+ s.truncate( title->text_length );
+ std->menuList.append( s );
+ }
+ if (sub_title->text_length) {
+ fprintf(stderr, "%.*s\n", sub_title->text_length, sub_title->text);
+ s = (const char*)sub_title->text;
+ s.truncate( sub_title->text_length );
+ std->menuList.append( s );
}
- fprintf(stderr, "PmtThread: stopping requested\n");
+ uint32_t i;
+ fprintf(stderr, "0. Quit menu\n");
+ std->menuList.append( "0. Quit menu" );
+ for(i=0; i< item_count; i++) {
+ fprintf(stderr, "%i. %.*s\n", i+1, items[i].text_length, items[i].text);
+ s = (const char*)items[i].text;
+ s.truncate( items[i].text_length );
+ std->menuList.append( QString("%1. %2").arg(i+1).arg(s) );
- close(demux_fd);
+ }
- fprintf(stderr, "PmtThread: stopped\n");
- return;
-}
+ if (bottom->text_length) {
+ fprintf(stderr, "%.*s\n", bottom->text_length, bottom->text);
+ s = (const char*)bottom->text;
+ s.truncate( bottom->text_length );
+ std->menuList.append( s );
+ }
+ fflush(stdout);
-// class DvbCamCamHandler
+ std->mmi_state = MMI_STATE_MENU;
+ std->menuType = MMI_MENU;
-DvbCamCamHandler::DvbCamCamHandler()
-{
- AiResource = NULL;
- CaResource = NULL;
+ QApplication::postEvent( std->dvbcam, new QTimerEvent(TIMER_EVENT_MMI_OPEN ) );
- SessionNumber = -1;
+ return 0;
}
-DvbCamCamHandler::~DvbCamCamHandler()
+void DvbCam::timerEvent( QTimerEvent *e )
{
- if(CaResource != NULL) {
- en50221_app_ca_destroy(CaResource);
- CaResource = NULL;
- }
- if(AiResource != NULL) {
- en50221_app_ai_destroy(AiResource);
- AiResource = NULL;
+ switch ( e->timerId() ) {
+ case TIMER_EVENT_MMI_OPEN:
+ showMMI();
+ break;
+ case TIMER_EVENT_MMI_CLOSE:
+ closeMMI();
+ break;
+ case TIMER_EVENT_CAM_READY:
+ resendPmts();
+ break;
}
}
-bool DvbCamCamHandler::init()
+void DvbCam::showMMI()
{
- AiResource = en50221_app_ai_create(&SendFuncs);
- CaResource = en50221_app_ca_create(&SendFuncs);
-
- if(CaResource != NULL) {
- en50221_app_ca_register_info_callback(CaResource, infoCallback, this);
+ if ( !menuDialog && stdcam ) {
+ menuDialog = new MCamMenuDialog( stdcam );
+ connect( menuDialog, SIGNAL(enteredResponse(QString)), this, SLOT(mmiResponse(QString)) );
+ menuDialog->exec();
+ closeMMI();
}
-
- return sub_init();
}
-bool DvbCamCamHandler::sendPmt(char *pmt_buffer, int size)
+void DvbCam::closeMMI()
{
- if((CaResource != NULL) && (SessionNumber >= 0)) {
- if(!en50221_app_ca_pmt(CaResource, SessionNumber, reinterpret_cast<unsigned char *> (pmt_buffer), size)) {
- return true;
+ if ( menuDialog ) {
+ delete menuDialog;
+ menuDialog = 0;
+ if ( stdcam && stdcam->stdcam->mmi_resource ) {
+ en50221_app_mmi_close( stdcam->stdcam->mmi_resource, stdcam->stdcam->mmi_session_number, MMI_CLOSE_MMI_CMD_ID_IMMEDIATE, 0 );
+ stdcam->mmi_state = MMI_STATE_CLOSED;
}
}
-
- return false;
}
-int DvbCamCamHandler::infoCallback(void *arg, uint8_t /*slot_id*/, uint16_t session_number, uint32_t /*ca_id_count*/, uint16_t */*ca_ids*/)
+int DvbCam::showCamDialog()
{
- (static_cast<DvbCamCamHandler *> (arg))->SessionNumber = session_number;
- return 0;
-}
-// class DvbCamCamHandlerLLCI
-
-#define MAX_CARDS 1
-#define MAX_TC 16
-#define MAX_SESSIONS 16
+ CamDialog dlg;
+ dlg.maxServiceSpin->setValue( getCamMaxService() );
+ dlg.appTypeLab->setText( getAppType() );
+ dlg.appManuLab->setText( getAppManu() );
+ dlg.manuCodeLab->setText( getManuCode() );
+ dlg.menuStringLab->setText( getMenuString() );
+ connect( dlg.camMenuBtn, SIGNAL(clicked()), this, SLOT(enterMenu()) );
+ dlg.exec();
+ CamMaxService = dlg.maxServiceSpin->value();
+ return CamMaxService;
+}
-DvbCamCamHandlerLLCI::DvbCamCamHandlerLLCI()
+void DvbCam::enterMenu()
{
- RmResource = NULL;
- SessionLayer = NULL;
- TransportLayer = NULL;
+ if ( stdcam && stdcam->stdcam->ai_resource )
+ en50221_app_ai_entermenu( stdcam->stdcam->ai_resource, stdcam->stdcam->ai_session_number );
}
-DvbCamCamHandlerLLCI::~DvbCamCamHandlerLLCI()
+void DvbCam::mmiResponse( QString s )
{
- if(SessionLayer != NULL) {
- en50221_sl_destroy(SessionLayer);
- SessionLayer = NULL;
- }
- if(TransportLayer != NULL) {
- en50221_tl_destroy(TransportLayer);
- TransportLayer = NULL;
- }
- if(RmResource != NULL) {
- en50221_app_rm_destroy(RmResource);
- RmResource = NULL;
+ QString res = s.stripWhiteSpace();
+
+ switch( stdcam->mmi_state ) {
+ case MMI_STATE_CLOSED:
+ case MMI_STATE_OPEN: {
+ en50221_app_ai_entermenu(stdcam->stdcam->ai_resource, stdcam->stdcam->ai_session_number);
+ fprintf(stderr,"en50221_app_ai_entermenu 2\n");
+ break;
+ }
+ case MMI_STATE_ENQ: {
+ if ( res.isEmpty() ) {
+ en50221_app_mmi_answ( stdcam->stdcam->mmi_resource, stdcam->stdcam->mmi_session_number, MMI_ANSW_ID_CANCEL, NULL, 0);
+ }
+ else {
+ en50221_app_mmi_answ( stdcam->stdcam->mmi_resource, stdcam->stdcam->mmi_session_number, MMI_ANSW_ID_ANSWER, (uint8_t*)res.ascii(), res.length() );
+ }
+ stdcam->mmi_state = MMI_STATE_OPEN;
+ break;
+ }
+ case MMI_STATE_MENU: {
+ en50221_app_mmi_menu_answ( stdcam->stdcam->mmi_resource, stdcam->stdcam->mmi_session_number, res.toInt() );
+ stdcam->mmi_state = MMI_STATE_OPEN;
+ break;
+ }
}
}
-int DvbCamCamHandlerLLCI::llci_rm_enq_callback(void *arg, uint8_t /*slot_id*/, uint16_t session_number)
+
+
+
+MCamMenuDialog::MCamMenuDialog( StandardCam *sc )
{
- uint32_t resource_ids[] = {EN50221_APP_RM_RESOURCEID, EN50221_APP_AI_RESOURCEID, EN50221_APP_CA_RESOURCEID};
- en50221_app_rm_reply(arg, session_number, sizeof(resource_ids) / 4, resource_ids);
- return 0;
+ stdcam = sc;
+ connect( inputLine, SIGNAL(returnPressed()), this, SLOT(validateClicked()) );
+ connect( &readTimer, SIGNAL(timeout()), this, SLOT(setMenu()) );
+ readTimer.start( 500 );
}
-int DvbCamCamHandlerLLCI::llci_rm_reply_callback(void *arg, uint8_t /*slot_id*/, uint16_t session_number, uint32_t /*resource_id_count*/, uint32_t */*resource_ids*/)
+void MCamMenuDialog::setMenu()
{
- en50221_app_rm_changed(arg, session_number);
- return 0;
+ if ( !stdcam )
+ return;
+ QMutexLocker locker( &stdcam->mutex );
+ if ( stdcam->menuType==MMI_MENU )
+ menuText->setText( stdcam->menuList.join("\n") );
}
-int DvbCamCamHandlerLLCI::llci_rm_changed_callback(void *arg, uint8_t /*slot_id*/, uint16_t session_number)
+void MCamMenuDialog::validateClicked()
{
- en50221_app_rm_enq(arg, session_number);
- return 0;
+ emit enteredResponse( inputLine->text() );
+ inputLine->clear();
}
-int DvbCamCamHandlerLLCI::llci_lookup_callback(void *arg, uint8_t /*slot_id*/, uint32_t requested_resource_id, en50221_sl_resource_callback *callback_out, void **arg_out, uint32_t *connected_resource_id)
+
+
+
+
+// class CamService
+CamService::CamService( int adapter, int demux_device, ChannelDesc *chan, int maxService )
{
- // decode the resource id
- en50221_app_public_resource_id resid;
- if(!en50221_app_decode_public_resource_id(&resid, requested_resource_id)) {
- return -1;
- }
+ Adapter = adapter;
+ DemuxDevice = demux_device;
+ CamMaxService = maxService;
+ channel = *chan;
+ parsedPmt = NULL;
+ state = NotReady;
+ isRunning = true;
+ start();
+}
- // try and find an instance of the resource
- const SlResource *Resources = (static_cast<DvbCamCamHandlerLLCI *> (arg))->Resources;
- int i;
- for(i = 0; i < 3; ++i) {
- if((resid.resource_class == Resources[i].resid.resource_class) && (resid.resource_type == Resources[i].resid.resource_type)) {
- *callback_out = Resources[i].callback;
- *arg_out = Resources[i].arg;
- *connected_resource_id = Resources[i].binary_resource_id;
- return 0;
- }
- }
- return -1;
+CamService::~CamService()
+{
+ stop();
}
-int DvbCamCamHandlerLLCI::llci_session_callback(void *arg, int reason, uint8_t /*slot_id*/, uint16_t session_number, uint32_t resource_id)
+void CamService::restart()
{
- if(reason == S_SCALLBACK_REASON_CAMCONNECTED) {
- if(resource_id == EN50221_APP_RM_RESOURCEID) {
- void *RmResource = (static_cast<DvbCamCamHandlerLLCI *> (arg))->Resources[0].arg;
- en50221_app_rm_enq(RmResource, session_number);
- }
- else if(resource_id == EN50221_APP_AI_RESOURCEID) {
- void *AiResource = (static_cast<DvbCamCamHandlerLLCI *> (arg))->Resources[1].arg;
- en50221_app_ai_enquiry(AiResource, session_number);
- }
- else if(resource_id == EN50221_APP_CA_RESOURCEID) {
- void *CaResource = (static_cast<DvbCamCamHandlerLLCI *> (arg))->Resources[2].arg;
- en50221_app_ca_info_enq(CaResource, session_number);
- }
- }
- return 0;
+ setState( NotReady );
}
-void DvbCamCamHandlerLLCI::poll()
+void CamService::stop()
{
- if(en50221_tl_poll(TransportLayer)) {
- fprintf(stderr, "CamThread: [warning] polling the stack failed\n");
- usleep(10000); // wait 10 ms to not block
- }
+ isRunning = false;
+ wait();
}
-bool DvbCamCamHandlerLLCI::registerCam(int ca_fd, uint8_t slot)
+int CamService::createSectionFilter(uint16_t pid, uint8_t table_id)
{
- // register the slot
- int slot_id = en50221_tl_register_slot(TransportLayer, ca_fd, slot, 1000, 100);
- if(slot_id < 0) {
- return false;
+ // open the demuxer
+ int demux_fd = dvbdemux_open_demux(Adapter, DemuxDevice, 0);
+ if(demux_fd < 0) {
+ return -1;
}
- // create a new connection on the slot
- if(en50221_tl_new_tc(TransportLayer, slot_id) < 0) {
- return false;
+ // create a section filter
+ uint8_t filter[18] = {table_id};
+ uint8_t mask[18] = {0xff};
+ if(dvbdemux_set_section_filter(demux_fd, pid, filter, mask, 1, 1)) { // crc check on
+ close(demux_fd);
+ return -1;
}
- return true;
+ return demux_fd;
}
-bool DvbCamCamHandlerLLCI::sub_init()
+int CamService::processPat(int demux_fd)
{
- // create transport layer
- TransportLayer = en50221_tl_create(MAX_CARDS, MAX_TC);
- if(TransportLayer == NULL) {
- return false;
- }
+ // read section
+ unsigned char si_buf[4096];
+ int size = read( demux_fd, si_buf, sizeof(si_buf) );
+ if ( size<0 )
+ return -1;
- // create session layer
- SessionLayer = en50221_sl_create(TransportLayer, MAX_SESSIONS);
- if(SessionLayer == NULL) {
- en50221_tl_destroy(TransportLayer);
- TransportLayer = NULL;
- return false;
- }
+ // parse section
+ section *parsed_section = section_codec( si_buf, size );
+ if ( parsed_section==NULL )
+ return -1;
- // create sendfuncs
- SendFuncs.arg = SessionLayer;
- SendFuncs.send_data = en50221_sl_send_data;
- SendFuncs.send_datav = en50221_sl_send_datav;
-
- // create the resource manager resource
- RmResource = en50221_app_rm_create(&SendFuncs);
- en50221_app_decode_public_resource_id(&Resources[0].resid, EN50221_APP_RM_RESOURCEID);
- Resources[0].binary_resource_id = EN50221_APP_RM_RESOURCEID;
- Resources[0].callback = en50221_app_rm_message;
- Resources[0].arg = RmResource;
- en50221_app_rm_register_enq_callback(RmResource, llci_rm_enq_callback, RmResource);
- en50221_app_rm_register_reply_callback(RmResource, llci_rm_reply_callback, RmResource);
- en50221_app_rm_register_changed_callback(RmResource, llci_rm_changed_callback, RmResource);
-
- // integrate the application information resource
- en50221_app_decode_public_resource_id(&Resources[1].resid, EN50221_APP_AI_RESOURCEID);
- Resources[1].binary_resource_id = EN50221_APP_AI_RESOURCEID;
- Resources[1].callback = en50221_app_ai_message;
- Resources[1].arg = AiResource;
-
- // integrate the ca resource
- en50221_app_decode_public_resource_id(&Resources[2].resid, EN50221_APP_CA_RESOURCEID);
- Resources[2].binary_resource_id = EN50221_APP_CA_RESOURCEID;
- Resources[2].callback = en50221_app_ca_message;
- Resources[2].arg = CaResource;
-
- // register session layer callbacks
- en50221_sl_register_lookup_callback(SessionLayer, llci_lookup_callback, this);
- en50221_sl_register_session_callback(SessionLayer, llci_session_callback, this);
+ // parse section_ext
+ section_ext *parsed_section_ext = section_ext_decode( parsed_section, 1 ); // crc check on
+ if ( parsed_section_ext==NULL )
+ return -1;
- return true;
-}
+ // parse pat
+ mpeg_pat_section *parsed_pat = mpeg_pat_section_codec( parsed_section_ext );
+ if ( parsed_pat==NULL )
+ return -1;
-// class DvbCamCamHandlerHLCI
+ // try and find the requested program
+ mpeg_pat_program *cur_program;
+ mpeg_pat_section_programs_for_each( parsed_pat, cur_program ) {
+ if ( cur_program->program_number==channel.sid )
+ return cur_program->pid;
+ }
-DvbCamCamHandlerHLCI::DvbCamCamHandlerHLCI()
-{
-}
+ fprintf( stderr, "CamService (%s): [warning] channel couldn't be found in PAT\n", channel.name.ascii() );
-DvbCamCamHandlerHLCI::~DvbCamCamHandlerHLCI()
-{
+ return -1;
}
-int DvbCamCamHandlerHLCI::hlci_send_data(void *arg, uint16_t /*session_number*/, uint8_t *data, uint16_t data_length)
+int CamService::processPmt( int demux_fd )
{
- return dvbca_hlci_write(static_cast<int> (reinterpret_cast<intptr_t> (arg)), data, data_length);
-}
+ // read section
+ memset( pmtBuffer, 0, sizeof(pmtBuffer) );
+ int size = read( demux_fd, pmtBuffer, sizeof(pmtBuffer) );
+ if ( size<=0 )
+ return -1;
-int DvbCamCamHandlerHLCI::hlci_send_datav(void *arg, uint16_t /*session_number*/, iovec *vector, int iov_count)
-{
- // calculate the total length of the data to send
- uint32_t data_size = 0;
- for(int i = 0; i < iov_count; ++i) {
- data_size += vector[i].iov_len;
- }
+ // parse section
+ section *parsed_section = section_codec( pmtBuffer, size );
+ if ( parsed_section==NULL )
+ return -1;
- // allocate memory for it
- uint8_t *buf = new uint8_t[data_size];
+ // parse section_ext
+ section_ext *parsed_section_ext = section_ext_decode( parsed_section, 1 ); // crc check on
+ if ( parsed_section_ext==NULL )
+ return -1;
- // merge the iovecs
- uint8_t *pos = buf;
- for(int i = 0; i < iov_count; ++i) {
- memcpy(pos, vector[i].iov_base, vector[i].iov_len);
- pos += vector[i].iov_len;
- }
+ // parse pmt
+ struct mpeg_pmt_section *pmt = mpeg_pmt_section_codec( parsed_section_ext );
+ if ( pmt==NULL )
+ return -1;
- // send it
- int status = dvbca_hlci_write(static_cast<int> (reinterpret_cast<intptr_t> (arg)), buf, data_size);
- delete buf;
- return status;
+ parsedPmt = pmt;
+ return parsedPmt->head.version_number;
}
-void DvbCamCamHandlerHLCI::poll()
+void CamService::setState( PmtState st )
{
- // we do nothing here for the moment
- usleep(100000); // 100 ms
+ QMutexLocker locker( &mutex );
+ switch ( st ) {
+ case Ready: {
+ int listmgnt;
+ if ( CamMaxService==1 )
+ listmgnt = CA_LIST_MANAGEMENT_ONLY;
+ else
+ listmgnt = CA_LIST_MANAGEMENT_ADD;
+ if ( state>Ready )
+ listmgnt = CA_LIST_MANAGEMENT_UPDATE;
+ if ( setCaPmt( listmgnt, CA_PMT_CMD_ID_OK_DESCRAMBLING ) )
+ state = st;
+ break;
+ }
+ case Remove: {
+ if ( state!=Added )
+ state = Destroy;
+ else if ( setCaPmt( CA_LIST_MANAGEMENT_UPDATE, CA_PMT_CMD_ID_NOT_SELECTED ) )
+ state = st;
+ break;
+ }
+ default: {
+ state = st;
+ }
+ }
}
-bool DvbCamCamHandlerHLCI::registerCam(int ca_fd, uint8_t /*slot*/)
+int CamService::getState()
{
- SendFuncs.arg = reinterpret_cast<void *> (ca_fd);
-
- // get application information
- if(en50221_app_ai_enquiry(AiResource, 0)) {
- fprintf(stderr, "CamThread: [DEBUG #1]\n");
- return false;
- }
-
- uint8_t buf[256];
- int size = dvbca_hlci_read(ca_fd, TAG_APP_INFO, buf, sizeof(buf));
- if(size <= 0) {
- fprintf(stderr, "CamThread: [DEBUG #2]\n");
- return false;
- }
+ QMutexLocker locker( &mutex );
+ return state;
+}
- if(en50221_app_ai_message(AiResource, 0, 0, EN50221_APP_AI_RESOURCEID, buf, size)) {
- fprintf(stderr, "CamThread: [DEBUG #3]\n");
+bool CamService::setCaPmt( int list_management, int cmd_id )
+{
+ if ( !parsedPmt )
return false;
- }
- // FIXME: try to change this soon
- buf[0] = TAG_CA_INFO >> 16;
- buf[1] = TAG_CA_INFO >> 8;
- buf[2] = TAG_CA_INFO;
- buf[3] = 0;
- if(en50221_app_ca_message(CaResource, 0, 0, EN50221_APP_CA_RESOURCEID, buf, 4)) {
- fprintf(stderr, "CamThread: [DEBUG #4]\n");
+ caPmtSize = en50221_ca_format_pmt( parsedPmt, caPmt, sizeof(caPmt), 0, list_management, cmd_id );
+ if ( caPmtSize<=0 )
return false;
- }
-
- fprintf(stderr, "CamThread: [DEBUG #5]\n");
return true;
}
-bool DvbCamCamHandlerHLCI::sub_init()
+void CamService::run()
{
- // create sendfuncs
- SendFuncs.arg = NULL;
- SendFuncs.send_data = hlci_send_data;
- SendFuncs.send_datav = hlci_send_datav;
+ int i, pmtVersion=-1;
+ int demux_fd=-1;
- return true;
+ fprintf( stderr, "CamService (%s): started\n", channel.name.ascii() );
+
+ while ( isRunning ) {
+loopLabel:
+ demux_fd = createSectionFilter( TRANSPORT_PAT_PID, stag_mpeg_program_association );
+ if ( demux_fd<0 ) {
+ fprintf( stderr, "CamService (%s): [error] opening demux device failed\n", channel.name.ascii() );
+ demux_fd = -1;
+ usleep( 100000 );
+ goto loopLabel;
+ }
+
+ pollfd poll_desc;
+ poll_desc.fd = demux_fd;
+ poll_desc.events = POLLIN | POLLPRI;
+ while ( isRunning ) {
+ int ret = poll( &poll_desc, 1, 1000 );
+ if ( ret<0 ) {
+ fprintf( stderr, "CamService (%s): [error] polling demux device failed\n", channel.name.ascii() );
+ close( demux_fd );
+ demux_fd = -1;
+ usleep( 100000 );
+ goto loopLabel;
+ }
+ if ( ret>0 ) {
+ int processed_pat = processPat( demux_fd );
+ if ( processed_pat>=0 ) {
+ close( demux_fd );
+ demux_fd = -1;
+ demux_fd = createSectionFilter( processed_pat, stag_mpeg_program_map );
+ if ( demux_fd<0 ) {
+ fprintf( stderr, "CamService (%s): [error] opening demux device failed\n", channel.name.ascii() );
+ demux_fd = -1;
+ usleep( 100000 );
+ goto loopLabel;
+ }
+ poll_desc.fd = demux_fd;
+ break;
+ }
+ else
+ usleep( 10000 );
+ }
+ else
+ usleep( 10000 );
+ }
+
+ while ( isRunning ) {
+ int ret = poll( &poll_desc, 1, 1000 );
+ if ( ret<0 ) {
+ fprintf( stderr, "CamService (%s): [error] polling demux device failed\n", channel.name.ascii() );
+ close( demux_fd );
+ demux_fd = -1;
+ usleep( 100000 );
+ goto loopLabel;
+ }
+ if ( ret>0 ) {
+ //fprintf( stderr, "CamService (%s): parsing pmt\n", channel.name.ascii() );
+ i = processPmt( demux_fd );
+ if ( i==-1 )
+ usleep( 10000 );
+ else {
+ if ( i!=pmtVersion || getState()<Ready ) {
+ fprintf( stderr, "CamService (%s): new pmt received\n", channel.name.ascii() );
+ setState( Ready );
+ pmtVersion = i;
+ }
+ i = 200;
+ while ( i-- && isRunning )
+ usleep( 10000 );
+ }
+ }
+ else
+ usleep( 10000 );
+ }
+ }
+
+ if ( demux_fd != -1 )
+ close( demux_fd );
+ fprintf( stderr, "CamService (%s): stopped\n", channel.name.ascii() );
}
diff --git a/kaffeine/src/input/dvb/dvbcam.h b/kaffeine/src/input/dvb/dvbcam.h
index 47a4012..ec9bf45 100644
--- a/kaffeine/src/input/dvb/dvbcam.h
+++ b/kaffeine/src/input/dvb/dvbcam.h
@@ -1,6 +1,7 @@
/*
* dvbcam.h
*
+ * Copyright (C) 2008 Christophe Thommeret <hftom@free.fr>
* Copyright (C) 2006 Christoph Pfister <christophpfister@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -21,32 +22,182 @@
#ifndef DVBCAM_H
#define DVBCAM_H
-class DvbCamCamThread;
-class DvbCamPmtThread;
+#include <libdvbapi/dvbca.h>
+#include <libdvbapi/dvbdemux.h>
+#include <libdvben50221/en50221_app_ai.h>
+#include <libdvben50221/en50221_app_ca.h>
+#include <libdvben50221/en50221_app_mmi.h>
+#include <libdvben50221/en50221_app_rm.h>
+#include <libdvben50221/en50221_app_tags.h>
+#include <libdvben50221/en50221_session.h>
+#include <libdvben50221/en50221_stdcam.h>
+#include <libucsi/mpeg/section.h>
-class DvbCam
+#include <qthread.h>
+#include <qmutex.h>
+#include <qptrlist.h>
+
+#include "channeldesc.h"
+#include "camdialog.h"
+#include "cammenudialog.h"
+
+#define MMI_STATE_CLOSED 0
+#define MMI_STATE_OPEN 1
+#define MMI_STATE_ENQ 2
+#define MMI_STATE_MENU 3
+
+#define MMI_NO_MENU 0
+#define MMI_MENU 1
+
+
+
+class CamService : protected QThread
{
public:
- DvbCam(int adapter, int ca_device, int demux_device, int ci_type);
- ~DvbCam();
+ enum PmtState{ NotReady=0, Ready, Added, Remove, Destroy };
+ CamService( int adapter, int demux_device, ChannelDesc *chan, int maxService );
+ ~CamService();
+ void setState( PmtState st );
+ int getState();
+ const ChannelDesc& getChannel() { return channel; }
+ void restart();
- void restart(int service_id);
+ unsigned char caPmt[4096];
+ int caPmtSize;
+
+protected:
+ void run();
+
+private:
+ int createSectionFilter( uint16_t pid, uint8_t table_id );
+ int processPat( int demux_fd );
+ int processPmt( int demux_fd );
+ bool setCaPmt( int list_management, int cmd_id );
void stop();
- bool running() { return isRunning; }
- int serviceId() { return sid; }
+ int Adapter;
+ int DemuxDevice;
+ ChannelDesc channel;
+ unsigned char pmtBuffer[4096];
+ struct mpeg_pmt_section *parsedPmt;
+ PmtState state;
+ bool isRunning;
+ QMutex mutex;
+ int CamMaxService;
+};
+
+
+
+class DvbCam;
+
+class StandardCam
+{
+public:
+ StandardCam( en50221_stdcam *sc, DvbCam *dc ) {
+ stdcam=sc;
+ dvbcam=dc;
+ mmi_state=MMI_STATE_CLOSED;
+ menuType=MMI_NO_MENU;
+ }
+
+ en50221_stdcam *stdcam;
+ DvbCam *dvbcam;
+ int mmi_state;
+ int mmi_enq_blind;
+ int mmi_enq_length;
+
+ int menuType;
+ QStringList menuList;
+
+ QMutex mutex;
+};
+
+
+
+class MCamMenuDialog : public CamMenuDialog
+{
+ Q_OBJECT
+public:
+ MCamMenuDialog( StandardCam *sc );
+private:
+ StandardCam *stdcam;
+ QTimer readTimer;
+private slots:
+ void setMenu();
+ void validateClicked();
+signals:
+ void enteredResponse( QString );
+};
+
+
+
+class DvbCam : public QObject, public QThread
+{
+ Q_OBJECT
+public:
+ DvbCam(int adapter, int ca_device, int demux_device, int ci_type, int maxService);
+ ~DvbCam();
+ void startService( ChannelDesc *chan );
+ void stopService( ChannelDesc *chan );
+ bool canPlay( ChannelDesc *chan );
static int probe( int adapter, int ca_device );
+ void setAppType( QString s ) { appType=s; }
+ void setAppManu( QString s ) { appManu=s; }
+ void setManuCode( QString s ) { manuCode=s; }
+ void setMenuString( QString s ) { menuString=s; }
+ QString getAppType() { return appType; }
+ QString getAppManu() { return appManu; }
+ QString getManuCode() { return manuCode; }
+ QString getMenuString() { return menuString; }
+ int getCamMaxService() { return CamMaxService; }
+
+ int showCamDialog();
+
+protected:
+ void run();
+ void timerEvent( QTimerEvent *e );
+
+private slots:
+ void mmiResponse( QString s );
+ void showMMI();
+ void closeMMI();
+ void enterMenu();
+
private:
+ bool init();
+ bool sendPmt( unsigned char *pmt_buffer, int size );
+ void resendPmts();
+
+ static int infoCallback(void *arg, uint8_t slot_id, uint16_t session_number, uint32_t ca_id_count, uint16_t *ca_ids);
+ static int aiCallback(void *arg, uint8_t slot_id, uint16_t session_number, uint8_t application_type,
+ uint16_t application_manufacturer, uint16_t manufacturer_code, uint8_t menu_string_length, uint8_t *menu_string);
+ static int mmi_close_callback(void *arg, uint8_t slot_id, uint16_t session_number, uint8_t cmd_id, uint8_t delay);
+ static int mmi_display_control_callback(void *arg, uint8_t slot_id, uint16_t session_number, uint8_t cmd_id, uint8_t mmi_mode);
+ static int mmi_enq_callback(void *arg, uint8_t slot_id, uint16_t session_number, uint8_t blind_answer, uint8_t expected_answer_length,
+ uint8_t *text, uint32_t text_size);
+ static int mmi_menu_callback(void *arg, uint8_t slot_id, uint16_t session_number, struct en50221_app_mmi_text *title,
+ struct en50221_app_mmi_text *sub_title, struct en50221_app_mmi_text *bottom, uint32_t item_count,
+ struct en50221_app_mmi_text *items, uint32_t item_raw_length, uint8_t *items_raw);
+
int Adapter;
int CaDevice;
int DemuxDevice;
- bool isRunning;
- int sid;
int ciType;
+ int CamMaxService;
+
+ bool isRunning;
+
+ QPtrList<CamService> sidList;
+ QMutex sidMutex;
+
+ QString appType, appManu, manuCode, menuString;
+
+ StandardCam *stdcam;
+ en50221_session_layer *SessionLayer;
+ en50221_transport_layer *TransportLayer;
- DvbCamCamThread *CamThread;
- DvbCamPmtThread *PmtThread;
+ MCamMenuDialog *menuDialog;
};
#endif /* DVBCAM_H */
diff --git a/kaffeine/src/input/dvb/dvbconfig.cpp b/kaffeine/src/input/dvb/dvbconfig.cpp
index 746d745..90e0489 100644
--- a/kaffeine/src/input/dvb/dvbconfig.cpp
+++ b/kaffeine/src/input/dvb/dvbconfig.cpp
@@ -38,6 +38,7 @@
#include "dvbconfig.h"
#include "kaffeinedvbplugin.h"
+#include "dvbpanel.h"
@@ -72,6 +73,21 @@ void MPushButton::isClicked()
+MCAMButton::MCAMButton( QWidget *parent, int devNum ) : QPushButton( i18n("CAM"), parent )
+{
+ deviceNumber = devNum;
+ connect( this, SIGNAL(clicked()), this, SLOT(isClicked()) );
+}
+
+
+
+void MCAMButton::isClicked()
+{
+ emit clicked( deviceNumber );
+}
+
+
+
MComboBox::MComboBox( QWidget *parent, int devNum, int lnbNum ) : QComboBox( parent )
{
deviceNumber = devNum;
@@ -109,6 +125,12 @@ Device::Device( int anum, int tnum, fe_type_t t, const QString &n, bool as )
source = "";
canAutoscan= as;
tuningTimeout = 1500;
+ hasCAM = false;
+ camMaxService = 1;
+ secMini = 0;
+ secTwice = 0;
+ priority = 10;
+ doS2 = 0;
}
@@ -134,6 +156,7 @@ DVBconfig::DVBconfig( const QString &dvbConf )
sizeFile = 0;
categories.setAutoDelete( true );
devList.setAutoDelete( true );
+ readFirst();
startup();
readConfig();
}
@@ -187,6 +210,7 @@ void DVBconfig::startup()
int i=0, j=0, res, fdFrontend=0;
struct dvb_frontend_info info;
bool as;
+ QTime t1;
QStringList list, flist;
QString s, t;
@@ -200,6 +224,11 @@ void DVBconfig::startup()
for ( j=0; j<(int)flist.count(); j++ ) {
s = list[i];
t = flist[j];
+ if ( devList.count()==MAX_DEVICES )
+ break;
+ if ( !probeMfe && t!="frontend0" )
+ continue;
+ t1 = QTime::currentTime();
fdFrontend = open( QString("/dev/dvb/%1/%2").arg( s ).arg( t ).ascii(), O_RDWR);
if ( fdFrontend>0 ) {
if ( !(res = ioctl( fdFrontend, FE_GET_INFO, &info ) < 0) ) {
@@ -212,13 +241,14 @@ void DVBconfig::startup()
as = true;
else
as = false;
- fprintf(stderr,"/dev/dvb/%s/%s : opened ( %s )\n", s.ascii(), t.ascii(), info.name );
+ fprintf(stderr,"/dev/dvb/%s/%s : opened ( %s ) (%dms)\n", s.ascii(), t.ascii(), info.name, t1.msecsTo(QTime::currentTime()) );
devList.append( new Device( s.replace("adapter","").toInt(), t.replace("frontend","").toInt(), info.type, info.name, as ) );
}
close( fdFrontend );
}
- else
- perror( QString("/dev/dvb/%1/%2").arg( s ).arg( t ).ascii() );
+ else {
+ perror( QString("/dev/dvb/%1/%2 %3/%4").arg( s ).arg( t ).arg( errno ).arg( -EBUSY ).ascii() );
+ }
}
}
@@ -292,9 +322,9 @@ bool DVBconfig::localData()
bool DVBconfig::haveData()
{
- if ( !QDir( dvbConfigDir+"dvb-s" ).exists() || !QDir( dvbConfigDir+"dvb-c" ).exists() || !QDir( dvbConfigDir+"dvb-t" ).exists() ) {
+ if ( !QDir( dvbConfigDir+"dvb-s" ).exists() || !QDir( dvbConfigDir+"dvb-c" ).exists() || !QDir( dvbConfigDir+"dvb-t" ).exists() || !QDir( dvbConfigDir+"atsc" ).exists()) {
loadDvbData(0);
- if ( !QDir( dvbConfigDir+"dvb-s" ).exists() || !QDir( dvbConfigDir+"dvb-c" ).exists() || !QDir( dvbConfigDir+"dvb-t" ).exists() ) {
+ if ( !QDir( dvbConfigDir+"dvb-s" ).exists() || !QDir( dvbConfigDir+"dvb-c" ).exists() || !QDir( dvbConfigDir+"dvb-t" ).exists() || !QDir( dvbConfigDir+"atsc" ).exists() ) {
if ( !localData() )
return false;
}
@@ -313,6 +343,7 @@ QStringList DVBconfig::getSourcesList( fe_type_t type )
case FE_QPSK : s = "dvb-s"; break;
case FE_QAM : s = "dvb-c"; break;
case FE_OFDM : s = "dvb-t"; break;
+ case FE_ATSC : s = "atsc"; break;
default : return list;
}
list = QDir( dvbConfigDir+s ).entryList( QDir::Files, QDir::Name );
@@ -383,6 +414,14 @@ void DVBconfig::saveDvbChanOrder( int s, int col )
+void DVBconfig::readFirst()
+{
+ config->setGroup( "DVB Options" );
+ probeMfe = config->readNumEntry( "ProbeMFE", 1 );
+}
+
+
+
void DVBconfig::readConfig()
{
QSize size;
@@ -413,6 +452,8 @@ void DVBconfig::readConfig()
for ( i=0; i<(int)devList.count(); i++ ) {
devList.at(i)->source = config->readEntry( QString("DVB%1").arg(i), "" );
devList.at(i)->tuningTimeout = config->readNumEntry( QString("DVB%1_TIMEOUT").arg(i), 1500 );
+ devList.at(i)->camMaxService = config->readNumEntry( QString("DVB%1_CAM_MAX").arg(i), 1 );
+ devList.at(i)->priority = config->readNumEntry( QString("DVB%1_PRIORITY").arg(i), 10 );
if ( devList.at(i)->type!=FE_QPSK )
continue;
devList.at(i)->numLnb = config->readNumEntry( QString("DVB%1_NLNB").arg(i), 1 );
@@ -426,6 +467,9 @@ void DVBconfig::readConfig()
devList.at(i)->lnb[j].speed13v = config->readDoubleNumEntry( QString("DVB%1_LNB%2_speed13v").arg(i).arg(j), 2.5 );
devList.at(i)->lnb[j].speed18v = config->readDoubleNumEntry( QString("DVB%1_LNB%2_speed18v").arg(i).arg(j), 1.5 );
}
+ devList.at(i)->secMini = config->readNumEntry( QString("DVB%1_SEC_MINI").arg(i), 0 );
+ devList.at(i)->secTwice = config->readNumEntry( QString("DVB%1_SEC_TWICE").arg(i), 0 );
+ devList.at(i)->doS2 = config->readNumEntry( QString("DVB%1_DOS2").arg(i), 0 );
}
j = config->readNumEntry( "NumCategories", 0 );
for ( i=0; i<j; i++ )
@@ -442,6 +486,9 @@ void DVBconfig::readConfig()
devList.at(i)->usalsLatitude = usalsLatitude;
devList.at(i)->usalsLongitude = usalsLongitude;
}
+ ringBufSize = config->readNumEntry( "RingBufSize", 2 );
+ if ( ringBufSize<2 )
+ ringBufSize = 2;
}
@@ -463,9 +510,12 @@ void DVBconfig::saveConfig()
config->writeEntry( "BroadcastAddress", broadcastAddress );
config->writeEntry( "BroadcastPort", broadcastPort );
config->writeEntry( "SenderPort", senderPort );
+ config->writeEntry( "ProbeMFE", probeMfe );
for ( i=0; i<(int)devList.count(); i++ ) {
config->writeEntry( QString("DVB%1").arg(i), devList.at(i)->source );
config->writeEntry( QString("DVB%1_TIMEOUT").arg(i), devList.at(i)->tuningTimeout );
+ config->writeEntry( QString("DVB%1_PRIORITY").arg(i), devList.at(i)->priority );
+ config->writeEntry( QString("DVB%1_CAM_MAX").arg(i), devList.at(i)->camMaxService );
if ( devList.at(i)->type!=FE_QPSK )
continue;
config->writeEntry( QString("DVB%1_NLNB").arg(i), devList.at(i)->numLnb );
@@ -479,6 +529,9 @@ void DVBconfig::saveConfig()
config->writeEntry( QString("DVB%1_LNB%2_speed13v").arg(i).arg(j), devList.at(i)->lnb[j].speed13v );
config->writeEntry( QString("DVB%1_LNB%2_speed18v").arg(i).arg(j), devList.at(i)->lnb[j].speed18v );
}
+ config->writeEntry( QString("DVB%1_SEC_MINI").arg(i), devList.at(i)->secMini );
+ config->writeEntry( QString("DVB%1_SEC_TWICE").arg(i), devList.at(i)->secTwice );
+ config->writeEntry( QString("DVB%1_DOS2").arg(i), devList.at(i)->doS2 );
}
config->writeEntry( "NumCategories", categories.count() );
for ( i=0; i<(int)categories.count(); i++ ) {
@@ -494,6 +547,7 @@ void DVBconfig::saveConfig()
config->writeEntry( "UsalsLatitude", usalsLatitude );
config->writeEntry( "UsalsLongitude", usalsLongitude );
config->writeEntry( "SizeFile", sizeFile );
+ config->writeEntry( "RingBufSize", ringBufSize );
config->sync();
}
@@ -511,7 +565,7 @@ bool DVBconfig::firstRun()
-DvbConfigDialog::DvbConfigDialog( DVBconfig *dc, QWidget *parent, KaffeineDvbPlugin *p ) :
+DvbConfigDialog::DvbConfigDialog( DvbPanel *pan, DVBconfig *dc, QWidget *parent, KaffeineDvbPlugin *p ) :
KDialogBase ( IconList, i18n("DVB Settings"), Ok|Cancel, Ok, parent, "dvbConfigDialog", true, true )
{
QLabel *lab;
@@ -529,7 +583,7 @@ DvbConfigDialog::DvbConfigDialog( DVBconfig *dc, QWidget *parent, KaffeineDvbPlu
QSpinBox *spin;
KPushButton *usals;
QWidget *swidg;
- QStringList rotorList; rotorList<<i18n("No rotor")<<i18n("USALS rotor")<<i18n("Positions rotor");
+ QStringList rotorList; rotorList<<i18n("No rotor")<<i18n("USALS rotor")<<i18n("Positions rotor")<<i18n("External positionner");
dvbConfig = dc;
timeoutSpin.setAutoDelete( true );
@@ -558,7 +612,22 @@ DvbConfigDialog::DvbConfigDialog( DVBconfig *dc, QWidget *parent, KaffeineDvbPlu
case FE_ATSC : dvbType->setText( i18n("Atsc") ); break;
default : dvbType->setText( i18n("Unknown") );
}
- grid->addMultiCellWidget( dvbType, gridLine, gridLine, 1, 3 );
+ if ( dvbConfig->devList.at(i)->hasCAM ) {
+ grid->addWidget( dvbType, gridLine, 1 );
+ MCAMButton *camb = new MCAMButton( gb, i );
+ connect( camb, SIGNAL(clicked(int)), pan, SLOT(camClicked(int)) );
+ grid->addWidget( camb, gridLine, 2 );
+ }
+ else
+ grid->addMultiCellWidget( dvbType, gridLine, gridLine, 1, 3 );
+ ++gridLine;
+
+ lab = new QLabel( i18n("Tuner priority (0=Don't use):"), gb );
+ grid->addWidget( lab, gridLine, 0 );
+ spin = new QSpinBox( 0, 99, 1, gb );
+ spin->setValue( dvbConfig->devList.at(i)->priority );
+ priority.append( spin );
+ grid->addWidget( spin, gridLine, 1 );
++gridLine;
lab = new QLabel( i18n("Tuner timeout :"), gb );
@@ -572,6 +641,11 @@ DvbConfigDialog::DvbConfigDialog( DVBconfig *dc, QWidget *parent, KaffeineDvbPlu
++gridLine;
if ( dvbConfig->devList.at(i)->type==FE_QPSK ) {
+ doS2[i] = new QCheckBox( i18n("S2 capable device"), gb );
+ doS2[i]->setChecked( dvbConfig->devList.at(i)->doS2 );
+ grid->addWidget( doS2[i], gridLine, 0 );
+ ++gridLine;
+
lab = new QLabel( i18n("Number of LNBs:"), gb );
grid->addWidget( lab, gridLine, 0 );
satNumber[i] = new MSpinBox( gb, i );
@@ -583,6 +657,16 @@ DvbConfigDialog::DvbConfigDialog( DVBconfig *dc, QWidget *parent, KaffeineDvbPlu
grid->addWidget( usals, gridLine, 2 );
++gridLine;
+
+ secMini[i] = new QCheckBox( i18n("Mini DiSEqC (A-B)."), gb );
+ secMini[i]->setChecked( dvbConfig->devList.at(i)->secMini );
+ secMini[i]->setEnabled( false );
+ grid->addWidget( secMini[i], gridLine, 1 );
+ secTwice[i] = new QCheckBox( i18n("Send DiSEqC commands twice."), gb );
+ secTwice[i]->setChecked( dvbConfig->devList.at(i)->secTwice );
+ grid->addWidget( secTwice[i], gridLine, 0 );
+
+ ++gridLine;
lnb0[i] = new MPushButton( gb, i, 0 );
lnb0[i]->setGuiItem( KGuiItem(i18n("LNB 1 settings..."), icon->loadIconSet("hwinfo", KIcon::Small) ) );
@@ -853,9 +937,19 @@ DvbConfigDialog::DvbConfigDialog( DVBconfig *dc, QWidget *parent, KaffeineDvbPlu
vb = new QVBoxLayout( page, 6, 6 );
gb = new QGroupBox( "", page );
grid = new QGridLayout( gb, 1, 1, 20, 6 );
+
+ probeMfe = new QCheckBox( i18n("Probe Multiple-Frontends (Restart required)."), gb );
+ probeMfe->setChecked( dvbConfig->probeMfe );
+ grid->addWidget( probeMfe, 0, 0 );
+
+ lab = new QLabel( i18n("LiveShow ringbuffer size (MB) :"), gb );
+ grid->addWidget( lab, 1, 0 );
+ ringBufSize = new QSpinBox( 2, 99, 1, gb );
+ ringBufSize->setValue( dvbConfig->ringBufSize );
+ grid->addWidget( ringBufSize, 1, 1 );
lab = new QLabel( i18n("Default charset (restart needed):"), gb );
- grid->addWidget( lab, 0, 0 );
+ grid->addWidget( lab, 2, 0 );
charsetComb = new QComboBox( gb );
charsetComb->insertItem( "ISO8859-1" );
charsetComb->insertItem( "ISO6937" );
@@ -863,19 +957,19 @@ DvbConfigDialog::DvbConfigDialog( DVBconfig *dc, QWidget *parent, KaffeineDvbPlu
charsetComb->setCurrentItem( 0 );
else if ( dvbConfig->defaultCharset=="ISO6937" )
charsetComb->setCurrentItem( 1 );
- grid->addWidget( charsetComb, 0, 1 );
+ grid->addWidget( charsetComb, 2, 1 );
lab = new QLabel( i18n("Update scan data:"), gb );
- grid->addWidget( lab, 1, 0 );
+ grid->addWidget( lab, 3, 0 );
updateBtn = new KPushButton( gb );
updateBtn->setGuiItem( KGuiItem(i18n("Download"), icon->loadIconSet("khtml_kget", KIcon::Small) ) );
- grid->addWidget( updateBtn, 1, 1 );
+ grid->addWidget( updateBtn, 3, 1 );
lab = new QLabel( i18n("Dump epg's events to \n~/kaffeine_dvb_events.tx:"), gb );
- grid->addWidget( lab, 2, 0 );
+ grid->addWidget( lab, 4, 0 );
dumpBtn = new KPushButton( gb );
dumpBtn->setGuiItem( KGuiItem(i18n("Dump"), icon->loadIconSet("filesave", KIcon::Small) ) );
- grid->addWidget( dumpBtn, 2, 1 );
+ grid->addWidget( dumpBtn, 4, 1 );
vb->addWidget( gb );
vb->addItem( new QSpacerItem( 20, 20, QSizePolicy::Ignored, QSizePolicy::Ignored ) );
@@ -1039,6 +1133,8 @@ void DvbConfigDialog::satNumberChanged( int value, int devNum )
rotor1[devNum]->setEnabled( value > 1 );
rotor2[devNum]->setEnabled( value > 2 );
rotor3[devNum]->setEnabled( value > 3 );
+
+ secMini[devNum]->setEnabled( value==2 );
}
@@ -1103,6 +1199,9 @@ void DvbConfigDialog::accept()
switch (dvbConfig->devList.at(i)->type) {
case FE_QPSK: {
dvbConfig->devList.at(i)->numLnb = satNumber[i]->value();
+ dvbConfig->devList.at(i)->secMini = secMini[i]->isChecked();
+ dvbConfig->devList.at(i)->secTwice = secTwice[i]->isChecked();
+ dvbConfig->devList.at(i)->doS2 = doS2[i]->isChecked();
if ( dvbConfig->devList.at(i)->lnb[3].rotorType==0 ) {
dvbConfig->devList.at(i)->lnb[3].source.clear();
dvbConfig->devList.at(i)->lnb[3].source.append(sat3[i]->currentText());
@@ -1140,6 +1239,7 @@ void DvbConfigDialog::accept()
}
dvbConfig->devList.at(i)->source = s;
dvbConfig->devList.at(i)->tuningTimeout = timeoutSpin.at(i)->value();
+ dvbConfig->devList.at(i)->priority = priority.at(i)->value();
}
dvbConfig->recordDir = recordDirLe->text();
@@ -1157,6 +1257,8 @@ void DvbConfigDialog::accept()
dvbConfig->broadcastAddress = broadcastLe->text().stripWhiteSpace();
dvbConfig->broadcastPort = bportSpin->value();
dvbConfig->senderPort = sportSpin->value();
+ dvbConfig->probeMfe = probeMfe->isChecked();
+ dvbConfig->ringBufSize = ringBufSize->value();
dvbConfig->saveConfig();
done( Accepted );
}
@@ -1403,22 +1505,24 @@ RotorConfig::RotorConfig( Device *d, DVBconfig *c, int lnb, QWidget *parent ) :
vb->addWidget( resetBtn );
vb->addItem( new QSpacerItem( 20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed ) );
- grid = new QGridLayout( 0, 1, 1 );
- lab = new QLabel( i18n("13V rotor speed:"), page );
- grid->addWidget( lab, 0, 0 );
- speed13 = new QLineEdit( page );
- speed13->setText( QString().setNum( dev->lnb[lnbNum].speed13v ) );
- grid->addWidget( speed13, 0, 1 );
- lab = new QLabel( i18n("sec./ °"), page );
- grid->addWidget( lab, 0, 2 );
- lab = new QLabel( i18n("18V rotor speed:"), page );
- grid->addWidget( lab, 1, 0 );
- speed18 = new QLineEdit( page );
- speed18->setText( QString().setNum( dev->lnb[lnbNum].speed18v ) );
- grid->addWidget( speed18, 1, 1 );
- lab = new QLabel( i18n("sec./ °"), page );
- grid->addWidget( lab, 1, 2 );
- vb->addLayout( grid );
+ if ( dev->lnb[lnbNum].rotorType!=3 ) {
+ grid = new QGridLayout( 0, 1, 1 );
+ lab = new QLabel( i18n("13V rotor speed:"), page );
+ grid->addWidget( lab, 0, 0 );
+ speed13 = new QLineEdit( page );
+ speed13->setText( QString().setNum( dev->lnb[lnbNum].speed13v ) );
+ grid->addWidget( speed13, 0, 1 );
+ lab = new QLabel( i18n("sec./ °"), page );
+ grid->addWidget( lab, 0, 2 );
+ lab = new QLabel( i18n("18V rotor speed:"), page );
+ grid->addWidget( lab, 1, 0 );
+ speed18 = new QLineEdit( page );
+ speed18->setText( QString().setNum( dev->lnb[lnbNum].speed18v ) );
+ grid->addWidget( speed18, 1, 1 );
+ lab = new QLabel( i18n("sec./ °"), page );
+ grid->addWidget( lab, 1, 2 );
+ vb->addLayout( grid );
+ }
vb->addItem( new QSpacerItem( 20, 20, QSizePolicy::Ignored, QSizePolicy::Ignored ) );
@@ -1462,8 +1566,14 @@ void RotorConfig::accept()
{
QListViewItem *it;
- dev->lnb[lnbNum].speed18v = speed18->text().toDouble();
- dev->lnb[lnbNum].speed13v = speed13->text().toDouble();
+ if ( dev->lnb[lnbNum].rotorType!=3 ) {
+ dev->lnb[lnbNum].speed18v = speed18->text().toDouble();
+ dev->lnb[lnbNum].speed13v = speed13->text().toDouble();
+ }
+ else {
+ dev->lnb[lnbNum].speed18v = 0;
+ dev->lnb[lnbNum].speed13v = 0;
+ }
dev->lnb[lnbNum].source.clear();
dev->lnb[lnbNum].position.clear();
for ( it=listView->firstChild(); it; it=it->nextSibling() ) {
diff --git a/kaffeine/src/input/dvb/dvbconfig.h b/kaffeine/src/input/dvb/dvbconfig.h
index f52b9cc..04f2bf1 100644
--- a/kaffeine/src/input/dvb/dvbconfig.h
+++ b/kaffeine/src/input/dvb/dvbconfig.h
@@ -28,6 +28,7 @@
#include <qtoolbutton.h>
#include <qbuttongroup.h>
#include <qlistview.h>
+#include <qcheckbox.h>
#include <kdialogbase.h>
#include <kpushbutton.h>
@@ -37,6 +38,8 @@
#include <linux/dvb/frontend.h>
+#define MAX_DEVICES 8
+
using namespace KIO;
class MSpinBox : public QSpinBox
@@ -70,6 +73,21 @@ private:
+class MCAMButton : public QPushButton
+{
+ Q_OBJECT
+public:
+ MCAMButton( QWidget *parent, int devNum );
+private slots:
+ void isClicked();
+signals:
+ void clicked( int devnum );
+private:
+ int deviceNumber;
+};
+
+
+
class MComboBox : public QComboBox
{
Q_OBJECT
@@ -116,6 +134,12 @@ public:
bool canAutoscan;
int tuningTimeout;
double usalsLatitude, usalsLongitude;
+ bool hasCAM;
+ int camMaxService;
+ int secMini;
+ int secTwice;
+ int priority;
+ int doS2;
};
@@ -138,6 +162,7 @@ public:
DVBconfig( const QString &dvbConf );
~DVBconfig();
+ void readFirst();
void readConfig();
void saveConfig();
int readDvbChanOrder();
@@ -168,6 +193,8 @@ public:
QValueList<int> splitSizes;
QString defaultCharset;
double usalsLatitude, usalsLongitude;
+ int probeMfe;
+ int ringBufSize;
private:
@@ -183,6 +210,7 @@ private slots:
class KaffeineDvbPlugin;
+class DvbPanel;
class DvbConfigDialog : public KDialogBase
{
@@ -190,34 +218,39 @@ class DvbConfigDialog : public KDialogBase
public:
- DvbConfigDialog( DVBconfig *dc, QWidget *parent, KaffeineDvbPlugin *p );
+ DvbConfigDialog( DvbPanel *pan, DVBconfig *dc, QWidget *parent, KaffeineDvbPlugin *p );
~DvbConfigDialog();
void setSource( QComboBox *box, QString s );
QLineEdit *recordDirLe, *shiftDirLe, *broadcastLe, *filenameFormatLe;
QSpinBox *beginSpin, *endSpin, *instantDurationSpin, *bportSpin, *sportSpin, *sizeFileSpin;
- MSpinBox *satNumber[8];
- QComboBox *sat0[8];
- QComboBox *sat1[8];
- QComboBox *sat2[8];
- QComboBox *sat3[8];
- MPushButton *src0[8];
- MPushButton *src1[8];
- MPushButton *src2[8];
- MPushButton *src3[8];
- MComboBox *rotor0[8];
- MComboBox *rotor1[8];
- MComboBox *rotor2[8];
- MComboBox *rotor3[8];
- MPushButton *lnb0[8];
- MPushButton *lnb1[8];
- MPushButton *lnb2[8];
- MPushButton *lnb3[8];
+ MSpinBox *satNumber[MAX_DEVICES];
+ QCheckBox *secMini[MAX_DEVICES], *secTwice[MAX_DEVICES];
+ QCheckBox *doS2[MAX_DEVICES];
+ QComboBox *sat0[MAX_DEVICES];
+ QComboBox *sat1[MAX_DEVICES];
+ QComboBox *sat2[MAX_DEVICES];
+ QComboBox *sat3[MAX_DEVICES];
+ MPushButton *src0[MAX_DEVICES];
+ MPushButton *src1[MAX_DEVICES];
+ MPushButton *src2[MAX_DEVICES];
+ MPushButton *src3[MAX_DEVICES];
+ MComboBox *rotor0[MAX_DEVICES];
+ MComboBox *rotor1[MAX_DEVICES];
+ MComboBox *rotor2[MAX_DEVICES];
+ MComboBox *rotor3[MAX_DEVICES];
+ MPushButton *lnb0[MAX_DEVICES];
+ MPushButton *lnb1[MAX_DEVICES];
+ MPushButton *lnb2[MAX_DEVICES];
+ MPushButton *lnb3[MAX_DEVICES];
KPushButton *updateBtn, *dumpBtn;
QToolButton *recordDirBtn, *shiftDirBtn, *helpNameBtn;
DVBconfig *dvbConfig;
QComboBox *charsetComb;
QPtrList<QSpinBox> timeoutSpin;
+ QPtrList<QSpinBox> priority;
+ QCheckBox *probeMfe;
+ QSpinBox *ringBufSize;
private slots:
diff --git a/kaffeine/src/input/dvb/dvbout.cpp b/kaffeine/src/input/dvb/dvbout.cpp
index 0ede057..c398707 100644
--- a/kaffeine/src/input/dvb/dvbout.cpp
+++ b/kaffeine/src/input/dvb/dvbout.cpp
@@ -136,19 +136,23 @@ void DVBout::writePmt()
tspmt[0x0a] = 0xc1;
// section # and last section #
tspmt[0x0b] = tspmt[0x0c] = 0x00;
- // PCR PID
- tspmt[0x0d] = channel.vpid>>8; tspmt[0x0e] = channel.vpid&0xff;
+ if ( channel.vpid ) {
+ // PCR PID
+ tspmt[0x0d] = channel.vpid>>8; tspmt[0x0e] = channel.vpid&0xff;
+ }
+ else if ( channel.napid )
+ tspmt[0x0d] = channel.apid[0].pid>>8; tspmt[0x0e] = channel.apid[0].pid&0xff;
// program_info_length == 0
tspmt[0x0f] = 0xf0; tspmt[0x10] = 0x00;
- // Program Map / Video PID
- tspmt[0x11] = channel.vType; // video stream type
- tspmt[0x12] = channel.vpid>>8; tspmt[0x13] = channel.vpid&0xff;
- tspmt[0x14] = 0xf0; tspmt[0x15] = 0x09; // es info length
- // useless info
- tspmt[0x16] = 0x07; tspmt[0x17] = 0x04; tspmt[0x18] = 0x08; tspmt[0x19] = 0x80;
- tspmt[0x1a] = 0x24; tspmt[0x1b] = 0x02; tspmt[0x1c] = 0x11; tspmt[0x1d] = 0x01;
- tspmt[0x1e] = 0xfe;
- off = 0x1e;
+ if ( channel.vpid ) {
+ // Program Map / Video PID
+ tspmt[0x11] = channel.vType; // video stream type
+ tspmt[0x12] = channel.vpid>>8; tspmt[0x13] = channel.vpid&0xff;
+ tspmt[0x14] = 0xf0; tspmt[0x15] = 0x00; // es info length
+ off = 0x15;
+ }
+ else
+ off = 0x10;
// audio pids
i = 0;
for ( i=0; i<channel.napid && i<MAX_AUDIO; i++ ) {
@@ -258,20 +262,19 @@ bool DVBout::doPause( const QString &name ) // called from dvbstream::run()
liveFile.writeBlock( (char*)tspmt, TS_SIZE );
mutex.lock();
haveLive = false;
- mutex.unlock();
- if ( !wait(100) ) {
+ if ( !wait(1000) ) {
terminate();
wait();
}
- mutex.lock();
- haveLive = true;
if ( close( fdPipe )<0 )
perror("close out pipe: ");
else
fprintf(stderr,"out pipe closed\n");
fdPipe = 0;
- mutex.unlock();
+ if ( wDist>0 )
+ liveFile.writeBlock( (char*)(wBuf+(wRead*TS_SIZE*NTS)), TS_SIZE*NTS*wDist );
timeShifting = true;
+ mutex.unlock();
//emit shifting( timeShifting );
}
return true;
@@ -286,7 +289,7 @@ void DVBout::setPatPmt()
-bool DVBout::goLive( const QString &name )
+bool DVBout::goLive( const QString &name, int ringBufSize )
{
if ( fdPipe ) return false;
@@ -299,7 +302,8 @@ bool DVBout::goLive( const QString &name )
writePmt();
if ( !pids.contains(8192) )
patpmt = wpatpmt = true;
- wBuf = new unsigned char[TS_SIZE*NTS*100];
+ wbufSize = ringBufSize*1024*1024/(TS_SIZE*NTS);
+ wBuf = new unsigned char[TS_SIZE*NTS*wbufSize];
if ( !wBuf ) fprintf( stderr, "\nNO WBUF !!!\n\n" );
wRead = wWrite = wDist = 0;
start();
@@ -326,7 +330,7 @@ void DVBout::stopLive()
emit shifting( timeShifting );
}
mutex.unlock();
- if ( !wait(500) ) {
+ if ( !wait(1000) ) {
terminate();
wait();
}
@@ -469,14 +473,16 @@ void DVBout::process( unsigned char *buf, int size )
beginLive = !beginLive;
start();
}
- if ( wDist<95 ) {
+ if ( wDist<wbufSize ) {
memcpy( wBuf+(wWrite*TS_SIZE*NTS), thBuf, TS_SIZE*NTS );
wpatpmt = patpmt;
++wDist;
++wWrite;
- if ( wWrite>99 )
+ if ( wWrite==wbufSize )
wWrite = 0;
- //fprintf(stderr,"WDIST = %d\n",wDist);
+ }
+ else {
+ fprintf(stderr,"Live ringbuffer full!! (%d)\n",wDist);
}
}
else if ( timeShifting ) {
@@ -531,7 +537,7 @@ void DVBout::run()
{
if ( haveLive && fdPipe ) {
while ( haveLive && fdPipe ) {
- if ( wDist>0 ) {
+ if ( wDist>5 ) {
if ( wpatpmt ) {
write( fdPipe, tspat, TS_SIZE );
write( fdPipe, tspmt, TS_SIZE );
@@ -540,11 +546,12 @@ void DVBout::run()
write( fdPipe, wBuf+(wRead*TS_SIZE*NTS), TS_SIZE*NTS );
--wDist;
++wRead;
- if ( wRead>99 )
+ if ( wRead==wbufSize )
wRead = 0;
}
- else
+ else {
usleep( 100 );
+ }
}
return;
}
diff --git a/kaffeine/src/input/dvb/dvbout.h b/kaffeine/src/input/dvb/dvbout.h
index bc97b47..a037c7d 100644
--- a/kaffeine/src/input/dvb/dvbout.h
+++ b/kaffeine/src/input/dvb/dvbout.h
@@ -44,7 +44,7 @@ public:
DVBout( ChannelDesc chan, int anum, int tnum, KaffeineDvbPlugin *p );
~DVBout();
void process( unsigned char *buf, int size );
- bool goLive( const QString &name );
+ bool goLive( const QString &name, int ringBufSize );
void preStopLive();
void stopLive();
bool goBroadcast( Ts2Rtp *r );
@@ -102,6 +102,7 @@ private:
int fileNumber;
QString fileName;
long long int fileMaxSize;
+ int wbufSize;
signals:
diff --git a/kaffeine/src/input/dvb/dvbpanel.cpp b/kaffeine/src/input/dvb/dvbpanel.cpp
index 4d70760..1b62aec 100644
--- a/kaffeine/src/input/dvb/dvbpanel.cpp
+++ b/kaffeine/src/input/dvb/dvbpanel.cpp
@@ -45,7 +45,6 @@
#include <kxmlguifactory.h>
#include <kparts/componentfactory.h>
-#include "kaffeineinput.h"
#include "kaffeinedvbplugin.h"
#include "dvbpanel.h"
#include "channeldesc.h"
@@ -56,6 +55,12 @@
#define CHANICONSIZE 28
+#define MODE_FREE 0
+#define MODE_LIVE 100
+#define MODE_BROADCAST 200
+#define MODE_RECORD 300
+#define MODE_CANTDO 400
+
DIconViewItem::DIconViewItem( DvbPanel *pan, QIconView *parent, const QString &text, const QPixmap &icon )
@@ -1091,7 +1096,7 @@ void DvbPanel::setConfig()
void DvbPanel::showConfigDialog()
{
- int ret;
+ int i, ret;
loop:
if ( !dvbConfig->haveData() ) {
@@ -1104,7 +1109,9 @@ loop:
return;
}
- DvbConfigDialog dlg( dvbConfig, mainWidget, plug );
+ for ( i=0; i<(int)dvb.count(); i++ )
+ dvb.at(i)->probeCam();
+ DvbConfigDialog dlg( this, dvbConfig, mainWidget, plug );
connect( dlg.dumpBtn, SIGNAL(clicked()), this, SLOT(dumpEvents()) );
ret = dlg.exec();
disconnect( dlg.dumpBtn, SIGNAL(clicked()), this, SLOT(dumpEvents()) );
@@ -1112,6 +1119,14 @@ loop:
return;
rtp->setSocket( dvbConfig->broadcastAddress, dvbConfig->broadcastPort, dvbConfig->senderPort );
cleaner->setPaths( dvbConfig->shiftDir, dvbConfig->recordDir );
+ fillChannelList();
+}
+
+
+
+void DvbPanel::camClicked( int devNum )
+{
+ dvb.at(devNum)->showCamDialog();
}
@@ -1124,6 +1139,8 @@ QPtrList<Transponder> DvbPanel::getSourcesStatus()
Transponder t;
for ( i=0; i<(int)dvb.count(); i++ ) {
+ if ( !dvb.at(i)->getPriority() ) // priority==0==don't use
+ continue;
list = dvb.at(i)->getSources();
for ( j=0; j<(int)list.count(); j++ ) {
if ( dvb.at(i)->hasRec() || dvb.at(i)->hasBroadcast() )
@@ -1176,7 +1193,7 @@ void DvbPanel::fillChannelList( ChannelDesc *ch )
}
else if ( currentCategory!="All" && chan->category!=currentCategory )
continue;
- it = new KListViewItem( channelsCb, QString().sprintf("%04d", chan->num), chan->name, chan->tp.source );
+ it = new KListViewItem( channelsCb, QString().sprintf("%05d", chan->num), chan->name, chan->tp.source );
if ( ch && ch==chan )
visible = it;
it->setDragEnabled( true );
@@ -1211,15 +1228,15 @@ void DvbPanel::fillChannelList( ChannelDesc *ch )
DvbStream* DvbPanel::getWorkingDvb( int mode, ChannelDesc *chan )
{
int i, ret;
- QValueList<int> working; // notTuned=0, hasLive=1, hasBroadcast=2, hasRec=3, can'tDoChannel=4
+ QValueList<int> working; // free=0, hasLive=100, hasBroadcast=200, hasRec=300, can'tDoChannel=400
for ( i=0; i<(int)dvb.count(); i++ )
- working.append( 0 );
+ working.append( 100-dvb.at(i)->getPriority() );
// fill in working status
for ( i=0; i<(int)dvb.count(); i++ ) {
- if ( !dvb.at(i)->canSource( chan ) ) {
- working[i] = 4;
+ if ( !dvb.at(i)->canSource( chan ) || working[i]==100 ) {
+ working[i] = MODE_CANTDO;
continue;
}
if ( dvb.at(i)->isTuned() ) {
@@ -1227,14 +1244,18 @@ DvbStream* DvbPanel::getWorkingDvb( int mode, ChannelDesc *chan )
return dvb.at(i); // use that one since it's already tuned on the good mplex
}
else if ( dvb.at(i)->hasRec() )
- working[i] = 3;
+ working[i] += MODE_RECORD;
else if ( dvb.at(i)->hasBroadcast() )
- working[i] = 2;
- else
- working[i] = 1;
+ working[i] += MODE_BROADCAST;
+ else {
+ if ( mode==MODE_LIVE )
+ working[i] += MODE_FREE;
+ else
+ working[i] += MODE_LIVE;
+ }
}
else
- working[i] = 0;
+ working[i] += MODE_FREE;
}
ret = 0;
// search for least working card
@@ -1272,7 +1293,7 @@ void DvbPanel::setBroadcast()
return;
}
- d = getWorkingDvb( 2, list.at(0) );
+ d = getWorkingDvb( MODE_BROADCAST, list.at(0) );
if ( d )
ret = d->canStartBroadcast( live, list.at(0) );
@@ -1316,7 +1337,7 @@ void DvbPanel::checkTimers()
}
if ( !chan )
continue;
- d = getWorkingDvb( 3, chan );
+ d = getWorkingDvb( MODE_RECORD, chan );
live = false;
if ( d )
ret = d->canStartTimer( live, chan );
@@ -1826,7 +1847,7 @@ void DvbPanel::playLastChannel()
QTimer::singleShot( 2000, this, SLOT(playLastChannel()) );
return;
}
- d = getWorkingDvb( 2, list.at(0) );
+ d = getWorkingDvb( MODE_BROADCAST, list.at(0) );
if ( d )
ret = d->canStartBroadcast( live, list.at(0) );
else
@@ -1880,7 +1901,7 @@ void DvbPanel::next()
QListViewItem* nextItem;
- QListViewItem* playingItem = channelsCb->findItem( QString().sprintf("%04d", dvbConfig->lastChannel), 0 );
+ QListViewItem* playingItem = channelsCb->findItem( QString().sprintf("%05d", dvbConfig->lastChannel), 0 );
if ( !playingItem == 0 ) // yes, it's in the current category
{
@@ -1906,7 +1927,7 @@ void DvbPanel::previous()
QListViewItem* prevItem;
- QListViewItem* playingItem = channelsCb->findItem( QString().sprintf("%04d", dvbConfig->lastChannel), 0 );
+ QListViewItem* playingItem = channelsCb->findItem( QString().sprintf("%05d", dvbConfig->lastChannel), 0 );
if ( !playingItem == 0 ) // yes, it's in the current category
{
@@ -1927,19 +1948,14 @@ void DvbPanel::previous()
void DvbPanel::dvbZap( ChannelDesc *chan )
{
int i;
- DvbStream *d=0;
+ DvbStream *d;
if ( currentFifo.isEmpty() || isTuning )
return;
isTuning = true;
emit setTimeShiftFilename( "" );
- for ( i=0; i<(int)dvb.count(); i++ ) {
- if ( dvb.at(i)->getCurrentTransponder()==chan->tp ) {
- d = dvb.at(i);
- break;
- }
- }
+ d = getWorkingDvb( MODE_LIVE, chan );
for ( i=0; i<(int)dvb.count(); i++ ) {
if ( dvb.at(i)->hasLive() ) {
dvb.at(i)->preStopLive();
@@ -1973,40 +1989,20 @@ void DvbPanel::finalZap( DvbStream *d, ChannelDesc *chan )
{
QString s, t;
int i;
- DvbStream *d1=d, *d2=0;
emit setCurrentPlugin( this );
fprintf( stderr, "Tuning to: %s / autocount: %lu\n", chan->name.latin1(), autocount );
QTime tm;
tm.start();
- if ( !d1 ) {
- for ( i=0; i<(int)dvb.count(); i++ ) {
- if ( !dvb.at(i)->canSource( chan ) )
- continue;
- if ( dvb.at(i)->isTuned() ) {
- if ( dvb.at(i)->getCurrentTransponder()==chan->tp ) {
- d1 = dvb.at(i);
- break;
- }
- else d2 = dvb.at(i);
- }
- else {
- d1 = dvb.at(i);
- break;
- }
- }
- if ( !d1 && d2 )
- d1 = d2;
- }
- if ( !d1 ) {
+ if ( !d ) {
emit dvbStop();
isTuning = false;
return;
}
- int ret = d1->goLive( chan, currentFifo );
+ int ret = d->goLive( chan, currentFifo, dvbConfig->ringBufSize );
switch ( ret ) {
case DvbStream::ErrIsRecording :
@@ -2045,7 +2041,7 @@ void DvbPanel::finalZap( DvbStream *d, ChannelDesc *chan )
resetSearch();
}
- if ( d1->liveIsRecording() )
+ if ( d->liveIsRecording() )
recordBtn->setOn( true );
else
recordBtn->setOn( false );
@@ -2255,6 +2251,8 @@ bool DvbPanel::getChannelList()
case 67 : chan->tp.coderateH = FEC_6_7; break;
case 78 : chan->tp.coderateH = FEC_7_8; break;
case 89 : chan->tp.coderateH = FEC_8_9; break;
+ case 35 : chan->tp.coderateH = FEC_3_5; break;
+ case 910 : chan->tp.coderateH = FEC_9_10; break;
case -1 : chan->tp.coderateH = FEC_AUTO;
}
s = s.right( s.length()-pos-1 );
@@ -2275,6 +2273,9 @@ bool DvbPanel::getChannelList()
case 256 : chan->tp.modulation = QAM_256; break;
case 108 : chan->tp.modulation = VSB_8; break;
case 116 : chan->tp.modulation = VSB_16; break;
+ case 1000 : chan->tp.modulation = PSK_8; break;
+ case 1001 : chan->tp.modulation = APSK_16; break;
+ case 1003 : chan->tp.modulation = DQPSK; break;
case -1 : chan->tp.modulation = QAM_AUTO;
}
s = s.right( s.length()-pos-1 );
@@ -2289,6 +2290,8 @@ bool DvbPanel::getChannelList()
case 67 : chan->tp.coderateL = FEC_6_7; break;
case 78 : chan->tp.coderateL = FEC_7_8; break;
case 89 : chan->tp.coderateL = FEC_8_9; break;
+ case 35 : chan->tp.coderateH = FEC_3_5; break;
+ case 910 : chan->tp.coderateH = FEC_9_10; break;
case -1 : chan->tp.coderateL = FEC_AUTO;
}
s = s.right( s.length()-pos-1 );
@@ -2356,6 +2359,17 @@ bool DvbPanel::getChannelList()
s = s.right( s.length()-pos-1 );
pos = s.find("|");
chan->tp.nid = s.left(pos).toUShort();
+ s = s.right( s.length()-pos-1 );
+ pos = s.find("|");
+ switch ( s.left(pos).toInt() ) {
+ case 20 : chan->tp.rolloff = ROLLOFF_20; break;
+ case 25 : chan->tp.rolloff = ROLLOFF_25; break;
+ case 35 : chan->tp.rolloff = ROLLOFF_35; break;
+ case -1 : chan->tp.rolloff = ROLLOFF_AUTO;
+ }
+ s = s.right( s.length()-pos-1 );
+ pos = s.find("|");
+ chan->tp.S2 = s.left(pos).toInt();
if ( chan->tp.source.isEmpty() ) {
delete chan;
@@ -2363,7 +2377,7 @@ bool DvbPanel::getChannelList()
}
chan->pix.load( dvbConfig->dvbConfigIconsDir+chan->name );
- it = new KListViewItem( channelsCb, QString().sprintf("%04d", chan->num), chan->name, chan->tp.source );
+ it = new KListViewItem( channelsCb, QString().sprintf("%05d", chan->num), chan->name, chan->tp.source );
it->setDragEnabled( true );
if ( !chan->pix.isNull() )
it->setPixmap( 1, chan->pix );
@@ -2467,6 +2481,8 @@ bool DvbPanel::saveChannelList()
case FEC_6_7 : tt<< "67|"; break;
case FEC_7_8 : tt<< "78|"; break;
case FEC_8_9 : tt<< "89|"; break;
+ case FEC_3_5 : tt<< "35|"; break;
+ case FEC_9_10 : tt<< "910|"; break;
case FEC_AUTO : tt<< "-1|";
}
switch ( chan->tp.inversion ) {
@@ -2483,6 +2499,9 @@ bool DvbPanel::saveChannelList()
case QAM_256 : tt<< "256|"; break;
case VSB_8 : tt<< "108|"; break;
case VSB_16 : tt<< "116|"; break;
+ case PSK_8 : tt<< "1000|"; break;
+ case APSK_16 : tt<< "1001|"; break;
+ case DQPSK : tt<< "1003|"; break;
case QAM_AUTO : tt<< "-1|";
}
switch ( chan->tp.coderateL ) {
@@ -2495,6 +2514,8 @@ bool DvbPanel::saveChannelList()
case FEC_6_7 : tt<< "67|"; break;
case FEC_7_8 : tt<< "78|"; break;
case FEC_8_9 : tt<< "89|"; break;
+ case FEC_3_5 : tt<< "35|"; break;
+ case FEC_9_10 : tt<< "910|"; break;
case FEC_AUTO : tt<< "-1|";
}
switch ( chan->tp.bandwidth ) {
@@ -2533,7 +2554,15 @@ bool DvbPanel::saveChannelList()
}
tt<< "|";
tt<< chan->category+"|";
- tt<< s.setNum(chan->tp.nid)+"|\n";
+ tt<< s.setNum(chan->tp.nid)+"|";
+ switch ( chan->tp.rolloff ) {
+ case ROLLOFF_20 : tt<< "20|"; break;
+ case ROLLOFF_25 : tt<< "25|"; break;
+ case ROLLOFF_35 : tt<< "35|"; break;
+ case ROLLOFF_AUTO : tt<< "-1|";
+ }
+ tt<< s.setNum(chan->tp.S2)+"|";
+ tt<< "\n";
}
ret = true;
f.close();
diff --git a/kaffeine/src/input/dvb/dvbpanel.h b/kaffeine/src/input/dvb/dvbpanel.h
index 5545040..444e641 100644
--- a/kaffeine/src/input/dvb/dvbpanel.h
+++ b/kaffeine/src/input/dvb/dvbpanel.h
@@ -42,13 +42,13 @@
#include "ts2rtp.h"
#include "cleaner.h"
#include "dvbevents.h"
+#include "kaffeineinput.h"
class ChannelDesc;
class DvbStream;
class DvbPanel;
-class KaffeineInput;
class KaffeineDvbPlugin;
@@ -153,6 +153,7 @@ public slots:
void dvbNewTimer( QString name, QString channel, QString datetime, QString duration );
int getSNR( int device );
void diskStatus();
+ void camClicked( int devNum );
private:
diff --git a/kaffeine/src/input/dvb/dvbsi.cpp b/kaffeine/src/input/dvb/dvbsi.cpp
index 395d796..db29091 100644
--- a/kaffeine/src/input/dvb/dvbsi.cpp
+++ b/kaffeine/src/input/dvb/dvbsi.cpp
@@ -2,6 +2,7 @@
* dvbsi.cpp
*
* Copyright (C) 2003-2007 Christophe Thommeret <hftom@free.fr>
+ * Copyright (C) 2008 Devin Heitmueller <devin.heitmueller@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,7 +31,22 @@
#define TIMER_EVENT_SCAN_END 100
+// These values are taken from ATSC A/65C Sec 5
+#define PSIP_BASE_PID 0x1ffb
+// This shouldn't be necessary, but at least the HVR-950 doesn't seem to
+// find them in the time specified in the spec (needs more investigation)
+#define CYCLE_TIME_FUDGEFACTOR 1000
+
+// These values are taken from ATSC A/65C Sec 7.1
+// (all values in ms)
+#define PSIP_MAX_CYCLE_TIME_MGT 150 + CYCLE_TIME_FUDGEFACTOR
+#define PSIP_MAX_CYCLE_TIME_VCT 400 + CYCLE_TIME_FUDGEFACTOR
+
+// These values are taken from ATSC A/65C Sec 4.1
+#define PSIP_TABLE_TYPE_MGT 0xc7
+#define PSIP_TABLE_TYPE_TVCT 0xc8
+#define PSIP_TABLE_TYPE_CVCT 0xc9
NitSection::NitSection( QPtrList<Transponder> *tp, bool *end, bool *ok, int anum, int tnum ) : KaffeineDVBsection( anum, tnum )
{
@@ -158,6 +174,9 @@ bool NitSection::tableNIT( unsigned char* buf )
fprintf(stderr," Found frequency list.\n");
freqListDesc( buf, trans );
break;
+ case 0x79 :
+ S2satelliteDesc( buf, trans );
+ break;
default :
break;
}
@@ -211,18 +230,53 @@ void NitSection::satelliteDesc( unsigned char* buf, Transponder *trans )
trans->pol = 'v';
else
trans->pol = 'h';
+ switch ( getBits(buf,70,2) ) {
+ case 0 : trans->modulation = QAM_AUTO; break;
+ case 1 : trans->modulation = QPSK; break;
+ case 2 : trans->modulation = PSK_8; break;
+ case 3 : trans->modulation = QAM_16; break;
+ }
s = t.setNum( getBits(buf,72,28), 16 );
trans->sr = s.toInt();
trans->sr /=10;
switch ( getBits(buf,100,4) ) {
+ case 0 : trans->coderateH = FEC_AUTO; break;
case 1 : trans->coderateH = FEC_1_2; break;
case 2 : trans->coderateH = FEC_2_3; break;
case 3 : trans->coderateH = FEC_3_4; break;
case 4 : trans->coderateH = FEC_5_6; break;
case 5 : trans->coderateH = FEC_7_8; break;
case 6 : trans->coderateH = FEC_8_9; break;
- case 7 : trans->coderateH = FEC_NONE; break;
+ case 7 : trans->coderateH = FEC_3_5; break;
+ case 8 : trans->coderateH = FEC_4_5; break;
+ case 9 : trans->coderateH = FEC_9_10; break;
+ case 15 : trans->coderateH = FEC_NONE; break;
}
+ if ( getBits(buf,69,1) ) {
+ fprintf(stderr,"!!!!!!!!!!!!!!!!!! Found S2 MODULATION SYSTEM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+ trans->S2 = 1;
+ switch ( getBits(buf,67,2) ) {
+ case 0 : trans->rolloff = ROLLOFF_35; break;
+ case 1 : trans->rolloff = ROLLOFF_25; break;
+ case 2 : trans->rolloff = ROLLOFF_20; break;
+ }
+ }
+}
+
+
+
+void NitSection::S2satelliteDesc( unsigned char* buf, Transponder *trans )
+{
+ fprintf(stderr,"!!!!!!!!!!!!!!!!!! Found S2 DESCRIPTOR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+ int scrambling_sequence_selector = getBits(buf,16,1);
+ int multiple_input_stream_flag = getBits(buf,17,1);
+ int backwards_compatibility_indicator = getBits(buf,18,1);
+ int scrambling_sequence_index = 0;
+ if ( scrambling_sequence_selector )
+ scrambling_sequence_index = getBits(buf,30,18);
+ int input_stream_identifier = 0;
+ if ( multiple_input_stream_flag )
+ input_stream_identifier = getBits(buf,48,8);
}
@@ -246,13 +300,17 @@ void NitSection::cableDesc( unsigned char* buf, Transponder *trans )
trans->sr = s.toInt();
trans->sr /=10;
switch ( getBits(buf,100,4) ) {
+ case 0 : trans->coderateH = FEC_AUTO; break;
case 1 : trans->coderateH = FEC_1_2; break;
case 2 : trans->coderateH = FEC_2_3; break;
case 3 : trans->coderateH = FEC_3_4; break;
case 4 : trans->coderateH = FEC_5_6; break;
case 5 : trans->coderateH = FEC_7_8; break;
case 6 : trans->coderateH = FEC_8_9; break;
- case 7 : trans->coderateH = FEC_NONE; break;
+ case 7 : trans->coderateH = FEC_3_5; break;
+ case 8 : trans->coderateH = FEC_4_5; break;
+ case 9 : trans->coderateH = FEC_9_10; break;
+ case 15 : trans->coderateH = FEC_NONE; break;
}
}
@@ -456,6 +514,7 @@ bool DVBsi::tablePMT( unsigned char* buf )
while ( length>4 ) {
audio=ac3=false;
+ lang="";
type = getBits(buf,0,8);
pid = getBits(buf,11,13);
if ( type==1/*mpeg1*/ || type==2/*mpeg2*/ || type==16/*mpeg4*/ || type==27/*h264*/ ) {
@@ -466,6 +525,11 @@ bool DVBsi::tablePMT( unsigned char* buf )
if ( type==3 || type==4 ) {
audio = true;
}
+ if (type == 0x81) {
+ // AC3 was added in ATSC A/52B (See A3.1 "Stream Type")
+ audio = true;
+ ac3 = true;
+ }
loop = getBits(buf,28,12);
buf +=5;
length -=(5+loop);
@@ -499,6 +563,7 @@ bool DVBsi::tablePMT( unsigned char* buf )
}
break;
case 0x6a :
+ case 0x81 :
audio = true;
ac3 = true;
break;
@@ -637,7 +702,204 @@ bool DVBsi::getSection( int pid, int tid, int timeout, int sid )
return true;
}
+bool DVBsi::parseMGT( int pid, int tid, int timeout, int sid )
+{
+ unsigned char buf[4096];
+ int n=0;
+ int skip=0;
+ bool vct_found = false;
+
+ fprintf(stderr, "parseMGT called for 0x%02x 0x%02x\n", pid, tid);
+ if ( !setFilter( pid, tid, timeout ) )
+ return false;
+
+ if ( poll(pf,1,timeout)>0 ){
+ if ( pf[0].revents & POLLIN ){
+ n = read( fdDemux, buf, 4096 );
+ skip = 0;
+ }
+ else
+ skip++;
+ }
+ else
+ skip++;
+
+ if ( skip || n<4 ) {
+ fprintf(stderr,"\nInvalid section length or timeout: pid=%d\n\n", pid);
+ stopFilter();
+ return false;
+ }
+
+ // Parse the Master Guide Table Section
+ unsigned int protocol_version = getBits(buf,64,8);
+ unsigned int tables_defined = getBits(buf,72,16);
+ fprintf(stderr, "protocol_version = %d\n", protocol_version);
+ fprintf(stderr, "tables_defined = %d\n", tables_defined);
+
+ // Now let's go through the table entries....
+ unsigned char *t_entry = &buf[88/8];
+ for (unsigned int t = 0; t < tables_defined; t++) {
+ unsigned int table_type;
+ unsigned int table_pid;
+ unsigned int table_version_number;
+ unsigned int table_number_bytes;
+ unsigned int table_number_des_length;
+ table_type = getBits(t_entry, 0, 16);
+ table_pid = getBits(t_entry, 19, 13);
+ table_version_number = getBits(t_entry, 35, 5);
+ table_number_bytes = getBits(t_entry, 40, 32);
+ table_number_des_length = getBits(t_entry, 76, 12);
+ fprintf(stderr,
+ "MGT entry type=0x%04x pid=0x%04x ver=%d sz=%d\n",
+ table_type, table_pid, table_version_number,
+ table_number_bytes);
+
+ if (table_type == 0x0000 || table_type == 0x0001) {
+ // TVCT table found
+ vct_table = PSIP_TABLE_TYPE_TVCT;
+ vct_found = true;
+ } else if (table_type == 0x0002 ||
+ table_type == 0x0003) {
+ // CVCT table found
+ vct_table = PSIP_TABLE_TYPE_CVCT;
+ vct_found = true;
+ }
+ t_entry += (11 + table_number_des_length);
+ }
+
+ stopFilter();
+ return vct_found;
+}
+
+bool DVBsi::parseVCT( int pid, int tid, int timeout, int sid )
+{
+ unsigned char buf[4096];
+ int n=0;
+ int skip=0;
+
+ fprintf(stderr, "parseVCT called for 0x%02x 0x%02x\n", pid, tid);
+ if ( !setFilter( pid, tid, timeout ) )
+ return false;
+
+ if ( poll(pf,1,timeout)>0 ){
+ if ( pf[0].revents & POLLIN ){
+ n = read( fdDemux, buf, 4096 );
+ skip = 0;
+ }
+ else
+ skip++;
+ }
+ else
+ skip++;
+
+ if ( skip || n<4 ) {
+ fprintf(stderr,"\nInvalid section length or timeout: pid=%d\n\n", pid);
+ stopFilter();
+ return false;
+ }
+
+ // Parse the Virtual Channel Table Section
+ unsigned int protocol_version = getBits(buf,64,8);
+ unsigned int num_channels = getBits(buf,72,8);
+ fprintf(stderr, "protocol_version = %d\n", protocol_version);
+ fprintf(stderr, "num_channels = %d\n", num_channels);
+
+ // Now let's go through the table entries....
+ unsigned char *t_entry = &buf[80/8];
+ for (unsigned int t = 0; t < num_channels; t++) {
+ char short_name[8];
+ unsigned int major_channel_num;
+ unsigned int minor_channel_num;
+ unsigned int modulation_mode;
+ unsigned int channel_tsid;
+ unsigned int program_number;
+ unsigned int access_controlled;
+ unsigned int hidden;
+ unsigned int service_type;
+ unsigned int source_id;
+ unsigned int reserved;
+ unsigned int descriptors_length;
+
+ // Short name
+ // Yes, I need a real UCS-2 to UTF-8 conversion here...
+ memset(short_name, 0, sizeof(short_name));
+ snprintf(short_name, sizeof(short_name), "%c%c%c%c%c%c%c",
+ t_entry[1],t_entry[3],t_entry[5],t_entry[7],
+ t_entry[9],t_entry[11],t_entry[13]);
+ reserved = getBits(t_entry, 112, 4);
+ major_channel_num = getBits(t_entry, 116, 10);
+ minor_channel_num = getBits(t_entry, 126, 10);
+ modulation_mode = getBits(t_entry, 136, 8);
+ channel_tsid = getBits(t_entry, 176, 16);
+ program_number = getBits(t_entry, 192, 16);
+ access_controlled = getBits(t_entry, 210, 1);
+ hidden = getBits(t_entry, 211, 1);
+ service_type = getBits(t_entry, 218, 6);
+ source_id = getBits(t_entry, 224, 16);
+ reserved = getBits(t_entry, 240, 6);
+ descriptors_length = getBits(t_entry, 246, 10);
+
+ fprintf(stderr, "short name=%s\n", short_name);
+ fprintf(stderr, "reserved=0x%04x\n", reserved);
+ fprintf(stderr, "major=%d\n", major_channel_num);
+ fprintf(stderr, "minor=%d\n", minor_channel_num);
+ fprintf(stderr, "modulation mode=0x%02x\n", modulation_mode);
+ fprintf(stderr, "channel_tsid=0x%04x\n", channel_tsid);
+ fprintf(stderr, "program_number=0x%04x\n", program_number);
+ fprintf(stderr, "access_controlled=0x%01x\n", access_controlled);
+ fprintf(stderr, "hidden=0x%01x\n", hidden);
+ fprintf(stderr, "service_type=0x%02x\n", service_type);
+ fprintf(stderr, "source_id=0x%04x\n", source_id);
+ fprintf(stderr, "des length=%d\n", descriptors_length);
+
+ ChannelDesc *desc = new ChannelDesc();
+ desc->tp.tsid = channel_tsid;
+ desc->name = QString("%1-%2 %3").arg(major_channel_num).arg(minor_channel_num).arg(short_name);
+ desc->sid = program_number;
+ if (access_controlled == 1)
+ desc->fta = 1;
+ else
+ desc->fta = 0; // 0 for free
+
+ // Algorithm taken from ATSC A/65C Sec 4.2
+ // However, the algorithm doesn't appear correct, as it
+ // truncates out data. For example, both 68-1 and 4-1 would
+ // yield the same one_part_number
+ desc->num = (major_channel_num << 10) + minor_channel_num;
+ fprintf(stderr, "channel num=%d\n", desc->num);
+
+ // ATSC A/65C Sec 6.3.1 Table 6.7
+ if (service_type == 0x01) {
+ // Analog television (not supported)
+ } else if (service_type == 0x02) {
+ // ATSC Video
+ desc->type = 1;
+ } else if (service_type == 0x03) {
+ // ATSC Audio
+ desc->type = 2;
+ } else if (service_type == 0x02) {
+ // ATSC Data only service (not supported)
+ } else if (service_type > 0x05 && service_type < 0x3f) {
+ // Reserved (not supported)
+ } else {
+ // Unknown
+ }
+
+ // Now add the new channel to the list (if supported)
+ if ((desc->type == 1 || desc->type == 2) && hidden == 0) {
+ channels.append( desc );
+ } else {
+ fprintf(stderr, "Not adding channel\n");
+ delete desc;
+ }
+
+ // Advance to the next entry
+ t_entry += (32 + descriptors_length);
+ }
+ stopFilter();
+ return true;
+}
void DVBsi::stop()
{
@@ -701,7 +963,24 @@ void DVBsi::timerEvent( QTimerEvent *e )
}
}
+// See ATSC standard A/65c for info on PSIP and what all these acronyms are...
+bool DVBsi::handle_atsc_transponder() {
+ // Loop through the MGT to get the list of PIDS for virtual channels
+ if (parseMGT(PSIP_BASE_PID, PSIP_TABLE_TYPE_MGT,
+ PSIP_MAX_CYCLE_TIME_MGT) == false) {
+ // We couldn't find the MGT
+ fprintf(stderr, "Could not find MGT in stream. Cannot continue\n");
+ return false;
+ };
+ // Now look at the TVCT for info on the individual channels found
+ if (parseVCT(PSIP_BASE_PID, vct_table,
+ PSIP_MAX_CYCLE_TIME_VCT) == false) {
+ fprintf(stderr, "Could not parse VCT in stream. Cannot continue\n");
+ return false;
+ }
+ return true;
+}
void DVBsi::run()
{
@@ -744,12 +1023,22 @@ void DVBsi::run()
indexChannels = j;
fprintf(stderr,"Transponders: %d/%d\n", i+1, transponders.count() );
- if ( scanMode ) {
- nitEnded = false;
- ns = new NitSection( &transponders, &nitEnded, &ok, adapter, tuner ); //NIT
+ fprintf(stderr,"scanMode=%d\n", scanMode);
+ if ( chan.tp.type == FE_ATSC ) {
+ // Separate out the ATSC scanning so that we
+ // don't interfere with existing DVB support
+ if (!handle_atsc_transponder())
+ continue;
+ }
+ else {
+ printf("it's dvb %d!\n", chan.tp.type);
+ if ( scanMode ) {
+ nitEnded = false;
+ ns = new NitSection( &transponders, &nitEnded, &ok, adapter, tuner ); //NIT
+ }
+
+ getSection( 0x11, 0x42 ); //SDT
}
- if ( !getSection( 0x11, 0x42 ) ) //SDT
- continue;
if ( !isRunning ) {
out();
return;
@@ -822,7 +1111,7 @@ void DVBsi::run()
}
-
+// !!!! only there for debugging !!!!!!!!!!
bool DVBsi::listChannels()
{
QString s,t;
diff --git a/kaffeine/src/input/dvb/dvbsi.h b/kaffeine/src/input/dvb/dvbsi.h
index df1f6e7..1146f85 100644
--- a/kaffeine/src/input/dvb/dvbsi.h
+++ b/kaffeine/src/input/dvb/dvbsi.h
@@ -36,6 +36,7 @@ public:
bool getSection( int pid, int tid, int timeout=5000 );
bool tableNIT( unsigned char* buf );
void satelliteDesc( unsigned char* buf, Transponder *trans );
+ void S2satelliteDesc( unsigned char* buf, Transponder *trans );
void cableDesc( unsigned char* buf, Transponder *trans );
void terrestrialDesc( unsigned char* buf, Transponder *trans );
void freqListDesc( unsigned char* buf, Transponder *trans );
@@ -66,6 +67,11 @@ public:
bool tablePMT( unsigned char* buf );
void serviceDesc( unsigned char* buf, ChannelDesc *desc );
+ // ATSC related methods
+ virtual bool handle_atsc_transponder();
+ virtual bool parseMGT( int pid, int tid, int timeout=5000, int sid=0 );
+ virtual bool parseVCT( int pid, int tid, int timeout=5000, int sid=0 );
+
QPtrList<ChannelDesc> channels;
QPtrList<Transponder> transponders;
DvbStream *dvb;
@@ -90,6 +96,9 @@ private:
int scanMode;
NitSection *ns;
+ /* ATSC related */
+ int vct_table;
+
signals:
void end( bool );
diff --git a/kaffeine/src/input/dvb/dvbstream.cpp b/kaffeine/src/input/dvb/dvbstream.cpp
index 302c0d0..77bee5c 100644
--- a/kaffeine/src/input/dvb/dvbstream.cpp
+++ b/kaffeine/src/input/dvb/dvbstream.cpp
@@ -43,6 +43,7 @@
#include <klocale.h>
#include <kapplication.h>
+#include <kmessagebox.h>
#include "dvbstream.h"
#include "dvbevents.h"
@@ -100,13 +101,23 @@ void DvbStream::probeCam()
int ci_type=0;
if ( camProbed )
return;
- if ( (ci_type=DvbCam::probe( dvbDevice->adapter, 0 ))>0 )
- cam = new DvbCam( dvbDevice->adapter, 0, dvbDevice->tuner, ci_type );
+ if ( (ci_type=DvbCam::probe( dvbDevice->adapter, 0 ))>0 ) {
+ cam = new DvbCam( dvbDevice->adapter, 0, dvbDevice->tuner, ci_type, dvbDevice->camMaxService );
+ dvbDevice->hasCAM = true;
+ }
camProbed = true;
}
+void DvbStream::showCamDialog()
+{
+ if ( cam )
+ dvbDevice->camMaxService = cam->showCamDialog();
+}
+
+
+
QStringList DvbStream::getSources( bool all )
{
if ( !all ) {
@@ -143,6 +154,8 @@ bool DvbStream::canSource( ChannelDesc *chan )
else
return false;
}
+ if ( chan->tp.S2 && !dvbDevice->doS2 )
+ return false;
int i;
for ( i=0; i<dvbDevice->numLnb; i++ ) {
if ( dvbDevice->lnb[i].source.contains(chan->tp.source) )
@@ -153,6 +166,13 @@ bool DvbStream::canSource( ChannelDesc *chan )
+int DvbStream::getPriority()
+{
+ return dvbDevice->priority;
+}
+
+
+
int DvbStream::getSatPos( const QString &src )
{
int i;
@@ -174,7 +194,7 @@ bool DvbStream::openFe()
fprintf(stderr,"openFe: fdFrontend != 0\n");
return false;
}
- fdFrontend = open( frontendName.ascii(), O_RDWR );
+ fdFrontend = open( frontendName.ascii(), O_RDWR /*| O_NONBLOCK*/ );
if ( fdFrontend<0 ) {
perror("openFe:");
fdFrontend = 0;
@@ -308,7 +328,6 @@ bool DvbStream::tuneDvb( ChannelDesc *chan, bool dvr )
{
unsigned long lof=0;
int res, hiband=0;
- struct dvb_frontend_parameters feparams;
struct dvb_frontend_info fe_info;
fe_status_t status;
unsigned long freq=chan->tp.freq;
@@ -317,6 +336,14 @@ bool DvbStream::tuneDvb( ChannelDesc *chan, bool dvr )
int rotorMove = 0;
int loop=0, i;
+ struct dtv_property cmdargs[20];
+ struct dtv_properties cmdseq;
+ int inversion;
+ int bandwidth;
+
+ if ( chan->tp.S2 && !dvbDevice->doS2 )
+ return false;
+
closeFe();
if ( !openFe() )
return false;
@@ -333,18 +360,45 @@ bool DvbStream::tuneDvb( ChannelDesc *chan, bool dvr )
freq*=1000;
srate*=1000;
+ QTime t1 = QTime::currentTime();
+
+ if ( chan->tp.inversion==INVERSION_AUTO ) {
+ if ( fe_info.caps & FE_CAN_INVERSION_AUTO )
+ inversion = chan->tp.inversion;
+ else {
+ fprintf(stderr,"Can NOT inversion_auto\n");
+ inversion = INVERSION_OFF;
+ }
+ }
+ else
+ inversion=chan->tp.inversion;
+
switch( fe_info.type ) {
case FE_OFDM : {
+ QString s = fe_info.name;
+ //if ( s.contains("TerraTec/qanu USB2.0 Highspeed DVB-T Receiver") ) // cinergyT2 hack
+ // freq+=167000;
if (freq < 1000000)
freq*=1000UL;
- feparams.frequency=freq;
- feparams.u.ofdm.bandwidth=chan->tp.bandwidth;
- feparams.u.ofdm.code_rate_HP=chan->tp.coderateH;
- feparams.u.ofdm.code_rate_LP=chan->tp.coderateL;
- feparams.u.ofdm.constellation=chan->tp.modulation;
- feparams.u.ofdm.transmission_mode=chan->tp.transmission;
- feparams.u.ofdm.guard_interval=chan->tp.guard;
- feparams.u.ofdm.hierarchy_information=chan->tp.hierarchy;
+ cmdargs[0].cmd = DTV_DELIVERY_SYSTEM; cmdargs[0].u.data = SYS_DVBT;
+ cmdargs[1].cmd = DTV_FREQUENCY; cmdargs[1].u.data = freq;
+ cmdargs[2].cmd = DTV_MODULATION; cmdargs[2].u.data = chan->tp.modulation;
+ cmdargs[3].cmd = DTV_CODE_RATE_HP; cmdargs[3].u.data = chan->tp.coderateH;
+ cmdargs[4].cmd = DTV_CODE_RATE_LP; cmdargs[4].u.data = chan->tp.coderateL;
+ cmdargs[5].cmd = DTV_GUARD_INTERVAL; cmdargs[5].u.data = chan->tp.guard;
+ cmdargs[6].cmd = DTV_TRANSMISSION_MODE; cmdargs[6].u.data = chan->tp.transmission;
+ cmdargs[7].cmd = DTV_HIERARCHY; cmdargs[7].u.data = chan->tp.hierarchy;
+ if ( chan->tp.bandwidth==BANDWIDTH_8_MHZ )
+ bandwidth = 8000000;
+ else if ( chan->tp.bandwidth==BANDWIDTH_7_MHZ )
+ bandwidth = 7000000;
+ else if ( chan->tp.bandwidth==BANDWIDTH_6_MHZ )
+ bandwidth = 6000000;
+ cmdargs[8].cmd = DTV_BANDWIDTH_HZ; cmdargs[8].u.data = bandwidth;
+ cmdargs[9].cmd = DTV_INVERSION; cmdargs[9].u.data = inversion;
+ cmdargs[10].cmd = DTV_TUNE;
+ cmdseq.num = 11;
+ cmdseq.props = cmdargs;
fprintf(stderr,"tuning DVB-T to %lu Hz\n", freq);
fprintf(stderr,"inv:%d bw:%d fecH:%d fecL:%d mod:%d tm:%d gi:%d hier:%d\n", chan->tp.inversion,
chan->tp.bandwidth, chan->tp.coderateH, chan->tp.coderateL, chan->tp.modulation,
@@ -352,11 +406,16 @@ bool DvbStream::tuneDvb( ChannelDesc *chan, bool dvr )
break;
}
case FE_QAM : {
+ cmdargs[0].cmd = DTV_DELIVERY_SYSTEM; cmdargs[0].u.data = SYS_DVBC_ANNEX_AC;
+ cmdargs[1].cmd = DTV_FREQUENCY; cmdargs[1].u.data = freq;
+ cmdargs[2].cmd = DTV_MODULATION; cmdargs[2].u.data = chan->tp.modulation;
+ cmdargs[3].cmd = DTV_SYMBOL_RATE; cmdargs[3].u.data = srate;
+ cmdargs[4].cmd = DTV_INNER_FEC; cmdargs[4].u.data = chan->tp.coderateH;
+ cmdargs[5].cmd = DTV_INVERSION; cmdargs[5].u.data = inversion;
+ cmdargs[6].cmd = DTV_TUNE;
+ cmdseq.num = 7;
+ cmdseq.props = cmdargs;
fprintf(stderr,"tuning DVB-C to %lu\n", freq);
- feparams.frequency=freq;
- feparams.u.qam.symbol_rate = srate;
- feparams.u.qam.fec_inner = chan->tp.coderateH;
- feparams.u.qam.modulation = chan->tp.modulation;
fprintf(stderr,"inv:%d sr:%lu fecH:%d mod:%d\n", chan->tp.inversion,
srate, chan->tp.coderateH, chan->tp.modulation );
break;
@@ -384,51 +443,78 @@ bool DvbStream::tuneDvb( ChannelDesc *chan, bool dvr )
lof = (dvbDevice->lnb[lnbPos].loFreq*1000);
}
if ( freq<lof )
- feparams.frequency = ( lof-freq );
+ freq = ( lof-freq );
else
- feparams.frequency = ( freq-lof );
+ freq = ( freq-lof );
}
- else
- feparams.frequency=freq;
-
- feparams.u.qpsk.symbol_rate=srate;
- feparams.u.qpsk.fec_inner=chan->tp.coderateH;
- fprintf(stderr,"inv:%d fecH:%d\n", chan->tp.inversion, chan->tp.coderateH );
+ fprintf(stderr,"inv:%d fecH:%d mod:%d\n", chan->tp.inversion, chan->tp.coderateH, chan->tp.modulation );
if ( setDiseqc( lnbPos, chan, hiband, rotorMove, dvr )!=0 ) {
closeFe();
return false;
}
+ fprintf( stderr, "Diseqc settings time = %d ms\n", t1.msecsTo( QTime::currentTime() ) );
+ t1 = QTime::currentTime();
+ if ( chan->tp.S2 ) {
+ fprintf(stderr,"\nTHIS IS DVB-S2 >>>>>>>>>>>>>>>>>>>\n");
+ cmdargs[0].cmd = DTV_DELIVERY_SYSTEM; cmdargs[0].u.data = SYS_DVBS2;
+ cmdargs[1].cmd = DTV_FREQUENCY; cmdargs[1].u.data = freq;
+ cmdargs[2].cmd = DTV_MODULATION; cmdargs[2].u.data = chan->tp.modulation;
+ cmdargs[3].cmd = DTV_SYMBOL_RATE; cmdargs[3].u.data = srate;
+ cmdargs[4].cmd = DTV_INNER_FEC; cmdargs[4].u.data = chan->tp.coderateH;
+ cmdargs[5].cmd = DTV_PILOT; cmdargs[5].u.data = PILOT_AUTO;
+ cmdargs[6].cmd = DTV_ROLLOFF; cmdargs[6].u.data = chan->tp.rolloff;
+ cmdargs[7].cmd = DTV_INVERSION; cmdargs[7].u.data = inversion;
+ cmdargs[8].cmd = DTV_TUNE;
+ cmdseq.num = 9;
+ cmdseq.props = cmdargs;
+ }
+ else {
+ cmdargs[0].cmd = DTV_DELIVERY_SYSTEM; cmdargs[0].u.data = SYS_DVBS;
+ cmdargs[1].cmd = DTV_FREQUENCY; cmdargs[1].u.data = freq;
+ cmdargs[2].cmd = DTV_MODULATION; cmdargs[2].u.data = chan->tp.modulation;
+ if ( chan->tp.modulation==QAM_AUTO )
+ cmdargs[2].u.data = QPSK;
+ cmdargs[3].cmd = DTV_SYMBOL_RATE; cmdargs[3].u.data = srate;
+ cmdargs[4].cmd = DTV_INNER_FEC; cmdargs[4].u.data = chan->tp.coderateH;
+ cmdargs[5].cmd = DTV_INVERSION; cmdargs[5].u.data = inversion;
+ cmdargs[6].cmd = DTV_TUNE;
+ cmdseq.num = 7;
+ cmdseq.props = cmdargs;
+ }
break;
}
case FE_ATSC : {
+ cmdargs[0].cmd = DTV_DELIVERY_SYSTEM; cmdargs[0].u.data = SYS_ATSC;
+ cmdargs[1].cmd = DTV_FREQUENCY; cmdargs[1].u.data = freq;
+ cmdargs[2].cmd = DTV_MODULATION; cmdargs[2].u.data = chan->tp.modulation;
+ cmdargs[3].cmd = DTV_INVERSION; cmdargs[3].u.data = inversion;
+ cmdargs[4].cmd = DTV_TUNE;
+ cmdseq.num = 5;
+ cmdseq.props = cmdargs;
fprintf(stderr,"tuning ATSC to %lu\n", freq);
- feparams.frequency=freq;
- feparams.u.vsb.modulation = chan->tp.modulation;
fprintf(stderr,"inv:%d mod:%d\n", chan->tp.inversion, chan->tp.modulation );
break;
}
}
- if ( chan->tp.inversion==INVERSION_AUTO ) {
- if ( fe_info.caps & FE_CAN_INVERSION_AUTO )
- feparams.inversion=chan->tp.inversion;
- else {
- fprintf(stderr,"Can NOT inversion_auto\n");
- feparams.inversion=INVERSION_OFF;
- }
- }
- else
- feparams.inversion=chan->tp.inversion;
- if ( rotorMove )
+ if ( rotorMove ) {
+ if ( ioctl( fdFrontend, FE_SET_PROPERTY, &cmdseq )<0 ) {
+ perror("ERROR tuning\n");
+ closeFe();
+ return false;
+ }
+ moveRotor( lnbPos, chan, hiband, dvr );
loop = 2;
+ }
while ( loop>-1 ) {
- if (ioctl(fdFrontend,FE_SET_FRONTEND,&feparams) < 0) {
- perror("ERROR tuning \n");
+ if ( ioctl( fdFrontend, FE_SET_PROPERTY, &cmdseq )<0 ) {
+ perror("ERROR tuning\n");
closeFe();
return false;
}
- for ( i=0; i<(dvbDevice->tuningTimeout/100); i++ ) {
+ QTime lockTime = QTime::currentTime();
+ do {
usleep( 100000 );
fprintf( stderr, "." );
if ( ioctl( fdFrontend, FE_READ_STATUS, &status )==-1 ) {
@@ -440,7 +526,7 @@ bool DvbStream::tuneDvb( ChannelDesc *chan, bool dvr )
loop = 0;
break;
}
- }
+ } while ( lockTime.msecsTo( QTime::currentTime() )<=dvbDevice->tuningTimeout );
fprintf(stderr,"\n");
--loop;
}
@@ -451,6 +537,8 @@ bool DvbStream::tuneDvb( ChannelDesc *chan, bool dvr )
return false;
}
+ fprintf( stderr, "Tuning time = %d ms\n", t1.msecsTo( QTime::currentTime() ) );
+
if ( rotorMove )
dvbDevice->lnb[lnbPos].currentSource = chan->tp.source;
@@ -496,6 +584,23 @@ int DvbStream::setDiseqc( int switchPos, ChannelDesc *chan, int hiband, int &rot
int i;
int voltage18 = ( (chan->tp.pol=='H')||(chan->tp.pol=='h') );
int ci = 4 * switchPos + 2 * hiband + (voltage18 ? 1 : 0);
+ bool secMini = false;
+ bool hasRotor = false;
+ bool hasSwitch = true;
+
+ if ( dvbDevice->numLnb<2 )
+ hasSwitch = false;
+
+ if ( dvbDevice->lnb[switchPos].rotorType!=0 && dvbDevice->lnb[switchPos].rotorType!=3 )
+ hasRotor = true;
+
+ if ( dvbDevice->numLnb==2 && dvbDevice->secMini )
+ secMini = true;
+
+ if ( dvbDevice->secTwice )
+ diseqcTwice = 2;
+ else
+ diseqcTwice = 1;
fprintf( stderr, "DiSEqC: switch pos %i, %sV, %sband (index %d)\n", switchPos, voltage18 ? "18" : "13", hiband ? "hi" : "lo", ci );
if ( ci < 0 || ci >= (int)(sizeof(switchCmd)/sizeof(struct dvb_diseqc_master_cmd)) )
@@ -507,85 +612,108 @@ int DvbStream::setDiseqc( int switchPos, ChannelDesc *chan, int hiband, int &rot
if ( ioctl(fdFrontend, FE_SET_VOLTAGE, ci%2 ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13) )
perror("FE_SET_VOLTAGE failed");
- fprintf( stderr, "DiSEqC: %02x %02x %02x %02x %02x %02x\n", switchCmd[ci].msg[0], switchCmd[ci].msg[1], switchCmd[ci].msg[2], switchCmd[ci].msg[3], switchCmd[ci].msg[4], switchCmd[ci].msg[5] );
- for ( i=0; i<2; ++i ) {
- usleep(15*1000);
- if ( ioctl(fdFrontend, FE_DISEQC_SEND_MASTER_CMD, &switchCmd[ci]) )
- perror("FE_DISEQC_SEND_MASTER_CMD failed");
- }
-
- QString msg;
- if ( dvbDevice->lnb[switchPos].rotorType!=0 && chan->tp.source!=dvbDevice->lnb[switchPos].currentSource ) {
- int i, index=-1;
- double angle=0.0, oldAngle=0.0;
- fprintf( stderr, "Driving rotor to %s\n", chan->tp.source.ascii() );
- for ( i=0; i<(int)dvbDevice->lnb[switchPos].source.count(); i++ ) {
- if ( dvbDevice->lnb[switchPos].source[i]==chan->tp.source ) {
- index = i;
- break;
+ if ( hasSwitch ) {
+ if ( !secMini ) {
+ fprintf( stderr, "DiSEqC: %02x %02x %02x %02x %02x %02x\n", switchCmd[ci].msg[0], switchCmd[ci].msg[1], switchCmd[ci].msg[2], switchCmd[ci].msg[3], switchCmd[ci].msg[4], switchCmd[ci].msg[5] );
+ for ( i=0; i<diseqcTwice; ++i ) {
+ usleep(15*1000);
+ if ( ioctl(fdFrontend, FE_DISEQC_SEND_MASTER_CMD, &switchCmd[ci]) )
+ perror("FE_DISEQC_SEND_MASTER_CMD failed");
}
}
- angle = getSourceAngle( chan->tp.source );
- if ( dvbDevice->lnb[switchPos].rotorType==1 ) {
- fprintf( stderr, "Rotor: gotoX=%f\n", angle );
- gotoX( angle );
- }
- else {
- int pos = dvbDevice->lnb[switchPos].position[index];
- fprintf( stderr, "Rotor: gotoN=%d\n", pos );
- rotorCommand( 9, pos );
- }
- if ( dvbDevice->lnb[switchPos].currentSource.isEmpty() ) {
- rotor = 10;
- msg = i18n("Moving rotor from unknown position...");
- }
else {
- oldAngle = getSourceAngle( dvbDevice->lnb[switchPos].currentSource );
- fprintf( stderr, "old rotor pos: %f °\n", oldAngle );
- fprintf( stderr, "new rotor pos: %f °\n", angle );
- angle = fabs(angle-oldAngle);
- fprintf( stderr, "Rotation angle: %f °\n", angle );
- if ( voltage18 )
- rotor = (int)(angle*dvbDevice->lnb[switchPos].speed18v)+1;
- else
- rotor = (int)(angle*dvbDevice->lnb[switchPos].speed13v)+1;
- msg = i18n("Moving rotor...");
+ fprintf( stderr, "DiSEqC: mini_diseqc\n" );
+ for ( i=0; i<diseqcTwice; ++i ) {
+ usleep(15*1000);
+ if ( ioctl(fdFrontend, FE_DISEQC_SEND_BURST, (ci/4)%2 ? SEC_MINI_B : SEC_MINI_A) )
+ perror("FE_DISEQC_SEND_BURST failed");
+ }
}
- fprintf( stderr, "Rotation time: %d sec.\n", rotor );
}
- if ( rotor ) {
- int j;
- if ( !dvr ) {
- for ( j=0; j<(rotor*2); j++ ) {
- usleep( 500000 );
- }
+ if ( hasRotor && chan->tp.source!=dvbDevice->lnb[switchPos].currentSource ) {
+ rotor = 1;
+ return 0;
+ }
+
+ if ( (ci/2)%2 ) {
+ usleep(15*1000);
+ if ( ioctl(fdFrontend, FE_SET_TONE, SEC_TONE_ON) )
+ perror("FE_SET_TONE failed");
+ }
+
+ return 0;
+}
+
+
+
+void DvbStream::moveRotor( int switchPos, ChannelDesc *chan, int hiband, bool dvr )
+{
+ int i, j, index=-1;
+ double angle=0.0, oldAngle=0.0;
+ int rotor=0;
+ int voltage18 = ( (chan->tp.pol=='H')||(chan->tp.pol=='h') );
+ int ci = 4 * switchPos + 2 * hiband + (voltage18 ? 1 : 0);
+ QString msg;
+
+ fprintf( stderr, "Driving rotor to %s\n", chan->tp.source.ascii() );
+ for ( i=0; i<(int)dvbDevice->lnb[switchPos].source.count(); i++ ) {
+ if ( dvbDevice->lnb[switchPos].source[i]==chan->tp.source ) {
+ index = i;
+ break;
}
- else {
- QProgressDialog progress( msg, i18n("Cancel"), rotor*2, 0, "progress", true );
- for ( j=0; j<(rotor*2); j++ ) {
- progress.setProgress( j );
- qApp->processEvents();
- if ( progress.wasCanceled() )
- break;
- usleep( 500000 );
- }
- progress.setProgress( rotor*2 );
+ }
+ angle = getSourceAngle( chan->tp.source );
+ if ( dvbDevice->lnb[switchPos].rotorType==1 ) {
+ fprintf( stderr, "Rotor: gotoX=%f\n", angle );
+ gotoX( angle );
+ }
+ else {
+ int pos = dvbDevice->lnb[switchPos].position[index];
+ fprintf( stderr, "Rotor: gotoN=%d\n", pos );
+ rotorCommand( 9, pos );
+ }
+ if ( dvbDevice->lnb[switchPos].currentSource.isEmpty() ) {
+ rotor = 10;
+ msg = i18n("Moving rotor from unknown position...");
+ }
+ else {
+ oldAngle = getSourceAngle( dvbDevice->lnb[switchPos].currentSource );
+ fprintf( stderr, "old rotor pos: %f °\n", oldAngle );
+ fprintf( stderr, "new rotor pos: %f °\n", angle );
+ angle = fabs(angle-oldAngle);
+ fprintf( stderr, "Rotation angle: %f °\n", angle );
+ if ( voltage18 )
+ rotor = (int)(angle*dvbDevice->lnb[switchPos].speed18v)+1;
+ else
+ rotor = (int)(angle*dvbDevice->lnb[switchPos].speed13v)+1;
+ msg = i18n("Moving rotor...");
+ }
+ fprintf( stderr, "Rotation time: %d sec.\n", rotor );
+
+ if ( !dvr ) {
+ for ( j=0; j<(rotor*2); j++ ) {
+ usleep( 500000 );
+ }
+ }
+ else {
+ QProgressDialog progress( msg, i18n("Cancel"), rotor*2, 0, "progress", true );
+ for ( j=0; j<(rotor*2); j++ ) {
+ progress.setProgress( j );
qApp->processEvents();
+ if ( progress.wasCanceled() )
+ break;
+ usleep( 500000 );
}
+ progress.setProgress( rotor*2 );
+ qApp->processEvents();
}
- for ( i=0; i<2; ++i ) {
+ if ( (ci/2)%2 ) {
usleep(15*1000);
- if ( ioctl(fdFrontend, FE_DISEQC_SEND_BURST, (ci/4)%2 ? SEC_MINI_B : SEC_MINI_A) )
- perror("FE_DISEQC_SEND_BURST failed");
+ if ( ioctl(fdFrontend, FE_SET_TONE, SEC_TONE_ON) )
+ perror("FE_SET_TONE failed");
}
-
- usleep(15*1000);
- if ( ioctl(fdFrontend, FE_SET_TONE, (ci/2)%2 ? SEC_TONE_ON : SEC_TONE_OFF) )
- perror("FE_SET_TONE failed");
-
- return 0;
}
@@ -681,7 +809,7 @@ void DvbStream::rotorCommand( int cmd, int n1, int n2, int n3 )
};
int i;
- for ( i=0; i<2; ++i ) {
+ for ( i=0; i<diseqcTwice; ++i ) {
usleep(15*1000);
if ( ioctl( fdFrontend, FE_DISEQC_SEND_MASTER_CMD, &cmds[cmd] ) )
perror("Rotor : FE_DISEQC_SEND_MASTER_CMD failed");
@@ -803,28 +931,33 @@ bool DvbStream::hasVideo()
void DvbStream::run()
{
- unsigned char buf[188];
+ int READSIZE = 188*20;
+ int BUFSIZE = 188*100;
+ int WSIZE = 188*64;
+ unsigned char buf[READSIZE];
+ unsigned char thBuf[BUFSIZE];
int n, i, thWrite=0;
- int WSIZE=188*8;
DVBout *o=0;
signal( SIGPIPE, SIG_IGN );
while ( isRunning ) {
if ( poll( &pfd, 1, 100 ) ) {
- n = read( fdDvr, buf, 188 );
- if ( n==188 ) {
+ n = read( fdDvr, buf, READSIZE );
+ if ( n && !(n%188) ) {
+ //fprintf( stderr, "DVR0: read : %d\n", n );
memcpy( thBuf+thWrite, buf, n );
thWrite+=n;
- if ( thWrite==WSIZE ) {
+ if ( thWrite>=WSIZE ) {
for ( i=0; i<(int)out.count(); i++ )
- out.at(i)->process( thBuf, WSIZE );
+ out.at(i)->process( thBuf, thWrite );
thWrite = 0;
}
}
+ else
+ fprintf( stderr, "DVR0: read failed : %d\n", n );
+
}
- else
- usleep(1000);
if ( waitPause>0 ) {
o = 0;
@@ -917,19 +1050,11 @@ void DvbStream::recordEnded( DVBout *o, RecTimer* t, bool kill )
if ( kill ) {
removePids( o );
+ if ( cam )
+ cam->stopService( &(o->channel) );
removeOut( o );
if ( out.count()==0 )
stop();
- else if ( cam ) {
- for ( i=0; i<(int)out.count(); i++ ) {
- if ( out.at(i)->channel.fta ) {
- i=-1;
- break;
- }
- }
- if ( i!=-1 )
- cam->stop();
- }
}
recordingState();
if ( t )
@@ -986,6 +1111,8 @@ void DvbStream::stopBroadcast()
}
for ( i=0; i<(int)p.count(); i++ ) {
removePids( p.at(i) );
+ if ( cam )
+ cam->stopService( &(p.at(i)->channel) );
removeOut( p.at(i) );
}
if ( out.count()==0 )
@@ -1002,7 +1129,7 @@ int DvbStream::canStartBroadcast( bool &live, ChannelDesc *chan )
for ( i=0; i<(int)out.count(); i++ ) {
if ( (chan->tp!=out.at(i)->channel.tp) && out.at(i)->hasRec() )
return ErrIsRecording;
- if ( cam && out.at(i)->hasRec() && out.at(i)->channel.fta && chan->fta && out.at(i)->channel.sid!=chan->sid )
+ if ( chan->fta && cam && !cam->canPlay( chan ) )
return ErrCamUsed;
if ( out.at(i)->hasLive() && chan->tp!=out.at(i)->channel.tp )
live = true;
@@ -1070,6 +1197,8 @@ bool DvbStream::startBroadcast( QPtrList<ChannelDesc> *list, Ts2Rtp *rtp )
else {
broadcastList.append( new ChannelDesc( *list->at(i) ) );
no++;
+ if ( list->at(i)->fta && cam )
+ cam->startService( list->at(i) );
}
}
}
@@ -1102,15 +1231,11 @@ int DvbStream::canStartTimer( bool &live, ChannelDesc *chan )
return ErrIsRecording;
if ( (o->channel.name==chan->name) && o->hasRec() )
return ErrIsRecording;
- if ( (chan->tp==o->channel.tp) && o->hasRec() ) {
- if ( chan->fta && cam && o->channel.fta )
- return ErrCamUsed;
- }
+ if ( chan->fta && cam && !cam->canPlay( chan ) )
+ return ErrCamUsed;
if ( o->hasLive() ) {
if ( chan->tp!=o->channel.tp )
live = true;
- else if ( cam && chan->fta && o->channel.fta )
- live = true;
}
}
return ret;
@@ -1194,8 +1319,8 @@ bool DvbStream::startTimer( ChannelDesc *chan, QString path, int maxsize, RecTim
}
fprintf(stderr,"NOUT: %d\n", out.count() );
- if ( chan->fta && cam && ( ((cam->running() && chan->sid!=cam->serviceId()) || !cam->running()) ) )
- cam->restart( chan->sid );
+ if ( chan->fta && cam )
+ cam->startService( chan );
startReading();
@@ -1205,7 +1330,7 @@ bool DvbStream::startTimer( ChannelDesc *chan, QString path, int maxsize, RecTim
-int DvbStream::goLive( ChannelDesc *chan, const QString &pipeName )
+int DvbStream::goLive( ChannelDesc *chan, const QString &pipeName, int ringBufSize )
{
int i;
bool stop=false;
@@ -1216,10 +1341,8 @@ int DvbStream::goLive( ChannelDesc *chan, const QString &pipeName )
return ErrIsRecording;
if ( (chan->tp!=out.at(i)->channel.tp) && out.at(i)->hasBroadcast() )
return ErrIsBroadcasting;
- if ( (chan->tp==out.at(i)->channel.tp) && (out.at(i)->hasBroadcast() || out.at(i)->hasRec())) {
- if ( chan->fta && cam && cam->running() && (cam->serviceId()!=chan->sid) )
- return ErrCamUsed;
- }
+ if ( chan->fta && cam && !cam->canPlay( chan ) )
+ return ErrCamUsed;
if ( out.at(i)->channel.name==chan->name )
o = out.at(i);
}
@@ -1259,11 +1382,11 @@ int DvbStream::goLive( ChannelDesc *chan, const QString &pipeName )
else
i = 0;
- o->goLive( pipeName );
+ o->goLive( pipeName, ringBufSize );
fprintf(stderr,"NOUT: %d\n", out.count() );
- if ( chan->fta && cam && !cam->running() )
- cam->restart( chan->sid );
+ if ( chan->fta && cam )
+ cam->startService( chan );
startReading();
return i;
@@ -1307,17 +1430,12 @@ void DvbStream::stopLive( ChannelDesc *chan )
}
for ( i=0; i<(int)p.count(); i++ ) {
removePids( p.at(i) );
+ if ( cam )
+ cam->stopService( &(p.at(i)->channel) );
removeOut( p.at(i) );
}
fprintf(stderr,"Live stopped\n");
- if ( cam ) {
- for ( i=0; i<(int)out.count(); i++ ) {
- if ( out.at(i)->channel.fta )
- camUsed = true;
- }
- }
- if ( cam && !camUsed )
- cam->stop();
+
if ( out.count()==0 && chan->tp!=currentTransponder )
stop();
}
@@ -1343,8 +1461,6 @@ void DvbStream::stop()
wait();
fprintf(stderr,"dvbstream::run() terminated\n");
}
- if ( cam )
- cam->stop();
dvbEvents->stop();
stopFrontend();
}
@@ -1381,7 +1497,6 @@ DvbStream::~DvbStream()
{
stop();
if ( cam ) {
- cam->stop();
delete cam;
}
delete dvbEvents;
diff --git a/kaffeine/src/input/dvb/dvbstream.h b/kaffeine/src/input/dvb/dvbstream.h
index a5deb52..fe85f04 100644
--- a/kaffeine/src/input/dvb/dvbstream.h
+++ b/kaffeine/src/input/dvb/dvbstream.h
@@ -62,10 +62,11 @@ public :
void setPlug( KaffeineDvbPlugin *p );
QStringList getSources( bool all=false );
bool canSource( ChannelDesc *chan );
+ int getPriority();
bool tuneDvb( ChannelDesc *chan, bool dvr=true );
void stopFrontend();
virtual void run();
- int goLive( ChannelDesc *chan, const QString &pipeName );
+ int goLive( ChannelDesc *chan, const QString &pipeName, int ringBufSize );
void preStopLive();
void stopLive( ChannelDesc *chan );
void stop();
@@ -89,8 +90,9 @@ public :
bool hasLive();
bool liveIsRecording();
int getSNR();
+ void probeCam();
+ void showCamDialog();
- unsigned char thBuf[188*10];
struct pollfd pfd;
DVBevents *dvbEvents;
@@ -109,6 +111,7 @@ protected:
private :
int setDiseqc( int switchPos, ChannelDesc *chan, int hiband, int &rotor, bool dvr );
+ void moveRotor( int switchPos, ChannelDesc *chan, int hiband, bool dvr );
void rotorCommand( int cmd, int n1=0, int n2=0, int n3=0 );
void gotoX( double azimuth );
double getAzimuth( double angle );
@@ -119,7 +122,6 @@ private :
void removeOut( DVBout *o );
void recordingState();
void startReading();
- void probeCam();
bool openFe();
bool closeFe();
void connectStatus( bool con );
@@ -143,6 +145,7 @@ private :
QString timeShiftFileName;
DvbCam *cam;
bool camProbed;
+ int diseqcTwice;
KaffeineDvbPlugin *plug;
signals:
diff --git a/kaffeine/src/input/dvb/lib/libdvbapi/Makefile.am b/kaffeine/src/input/dvb/lib/libdvbapi/Makefile.am
index 59f288b..9963cd4 100644
--- a/kaffeine/src/input/dvb/lib/libdvbapi/Makefile.am
+++ b/kaffeine/src/input/dvb/lib/libdvbapi/Makefile.am
@@ -2,10 +2,11 @@ noinst_LTLIBRARIES = libdvbapi.la
INCLUDES = -I$(top_srcdir)/kaffeine/src/input/dvb/lib
-libdvbapi_la_SOURCES = diseqc.c \
+libdvbapi_la_SOURCES = dvbaudio.c \
dvbca.c \
dvbdemux.c \
dvbfe.c \
- dvbnet.c
+ dvbnet.c \
+ dvbvideo.c
CFLAGS = -g -O2 -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -fPIC
diff --git a/kaffeine/src/input/dvb/lib/libdvbapi/dvbaudio.c b/kaffeine/src/input/dvb/lib/libdvbapi/dvbaudio.c
new file mode 100644
index 0000000..72b4d70
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libdvbapi/dvbaudio.c
@@ -0,0 +1,50 @@
+/*
+ * libdvbnet - a DVB network support library
+ *
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/param.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <linux/dvb/audio.h>
+#include <errno.h>
+#include "dvbaudio.h"
+
+int dvbaudio_open(int adapter, int audiodeviceid)
+{
+ char filename[PATH_MAX+1];
+ int fd;
+
+ sprintf(filename, "/dev/dvb/adapter%i/audio%i", adapter, audiodeviceid);
+ if ((fd = open(filename, O_RDWR)) < 0) {
+ // if that failed, try a flat /dev structure
+ sprintf(filename, "/dev/dvb%i.audio%i", adapter, audiodeviceid);
+ fd = open(filename, O_RDWR);
+ }
+
+ return fd;
+}
+
+int dvbaudio_set_bypass(int fd, int bypass)
+{
+ return ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass);
+}
diff --git a/kaffeine/src/input/dvb/lib/libdvbapi/dvbaudio.h b/kaffeine/src/input/dvb/lib/libdvbapi/dvbaudio.h
new file mode 100644
index 0000000..36f6a55
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libdvbapi/dvbaudio.h
@@ -0,0 +1,55 @@
+/*
+ * libdvbnet - a DVB network support library
+ *
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef LIBDVBAUDIO_H
+#define LIBDVBAUDIO_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdint.h>
+
+/**
+ * Open a DVB audio device.
+ *
+ * @param adapter DVB adapter ID.
+ * @param audiodeviceid Id of audio device of that adapter to open.
+ * @return A unix file descriptor on success, or -1 on failure.
+ */
+extern int dvbaudio_open(int adapter, int audiodeviceid);
+
+/**
+ * Control audio bypass - i.e. output decoded audio, or the raw bitstream (e.g. AC3).
+ *
+ * @param fd Audio device opened with dvbaudio_open().
+ * @param bypass 1=> enable bypass, 0=> disable.
+ * @return 0 on success, nonzero on failure.
+ */
+extern int dvbaudio_set_bypass(int fd, int bypass);
+
+// FIXME: this is a stub library
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // LIBDVBAUDIO_H
diff --git a/kaffeine/src/input/dvb/lib/libdvbapi/dvbdemux.c b/kaffeine/src/input/dvb/lib/libdvbapi/dvbdemux.c
index aebad34..a882af6 100644
--- a/kaffeine/src/input/dvb/lib/libdvbapi/dvbdemux.c
+++ b/kaffeine/src/input/dvb/lib/libdvbapi/dvbdemux.c
@@ -128,6 +128,12 @@ int dvbdemux_set_pes_filter(int fd, int pid,
filter.output = DMX_OUT_TS_TAP;
break;
+#ifdef DMX_OUT_TSDEMUX_TAP
+ case DVBDEMUX_OUTPUT_TS_DEMUX:
+ filter.output = DMX_OUT_TSDEMUX_TAP;
+ break;
+#endif
+
default:
return -EINVAL;
}
@@ -201,6 +207,12 @@ int dvbdemux_set_pid_filter(int fd, int pid,
filter.output = DMX_OUT_TS_TAP;
break;
+#ifdef DMX_OUT_TSDEMUX_TAP
+ case DVBDEMUX_OUTPUT_TS_DEMUX:
+ filter.output = DMX_OUT_TSDEMUX_TAP;
+ break;
+#endif
+
default:
return -EINVAL;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvbapi/dvbdemux.h b/kaffeine/src/input/dvb/lib/libdvbapi/dvbdemux.h
index 3fe4a4b..808ee80 100644
--- a/kaffeine/src/input/dvb/lib/libdvbapi/dvbdemux.h
+++ b/kaffeine/src/input/dvb/lib/libdvbapi/dvbdemux.h
@@ -55,6 +55,7 @@ extern "C"
#define DVBDEMUX_OUTPUT_DECODER 0
#define DVBDEMUX_OUTPUT_DEMUX 1
#define DVBDEMUX_OUTPUT_DVR 2
+#define DVBDEMUX_OUTPUT_TS_DEMUX 3
/**
* PES types.
@@ -65,6 +66,7 @@ extern "C"
#define DVBDEMUX_PESTYPE_SUBTITLE 3
#define DVBDEMUX_PESTYPE_PCR 4
+
/**
* Open a demux device. Can be called multiple times. These let you setup a
* single filter per FD. It can can also be read() from if you use a section
@@ -78,8 +80,8 @@ extern "C"
extern int dvbdemux_open_demux(int adapter, int demuxdevice, int nonblocking);
/**
- * Open a DVR device. May be opened for writing once, or multiple times in readonly
- * mode. It is used to either write() transport stream data to be demuxed
+ * Open a DVR device. May be opened for writing or reading once.
+ * It is used to either write() transport stream data to be demuxed
* (if input == DVBDEMUX_INPUT_DVR), or to read() a stream of demuxed data
* (if output == DVBDEMUX_OUTPUT_DVR).
*
diff --git a/kaffeine/src/input/dvb/lib/libdvbapi/dvbfe.c b/kaffeine/src/input/dvb/lib/libdvbapi/dvbfe.c
index fc6ecf4..98104c9 100644
--- a/kaffeine/src/input/dvb/lib/libdvbapi/dvbfe.c
+++ b/kaffeine/src/input/dvb/lib/libdvbapi/dvbfe.c
@@ -2,6 +2,7 @@
* libdvbfe - a DVB frontend library
*
* Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2005 Manu Abraham <abraham.manu@gmail.com>
* Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
*
* This library is free software; you can redistribute it and/or
@@ -26,14 +27,16 @@
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/time.h>
+#include <sys/poll.h>
#include <fcntl.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <linux/dvb/frontend.h>
+#include <libdvbmisc/dvbmisc.h>
#include "dvbfe.h"
-#define GET_INFO_MIN_DELAY_US 100000
+int verbose = 0;
static int dvbfe_spectral_inversion_to_kapi[][2] =
{
@@ -128,6 +131,7 @@ static int dvbfe_dvbt_hierarchy_to_kapi[][2] =
{ -1, -1 }
};
+
static int lookupval(int val, int reverse, int table[][2])
{
int i =0;
@@ -149,19 +153,16 @@ static int lookupval(int val, int reverse, int table[][2])
}
-struct dvbfe_handle_prv {
+struct dvbfe_handle {
int fd;
- dvbfe_type_t type;
+ enum dvbfe_type type;
char *name;
- struct timeval nextinfotime;
- struct dvbfe_info cachedinfo;
- int cachedreturnval;
};
-dvbfe_handle_t dvbfe_open(int adapter, int frontend, int readonly)
+struct dvbfe_handle *dvbfe_open(int adapter, int frontend, int readonly)
{
char filename[PATH_MAX+1];
- struct dvbfe_handle_prv *fehandle;
+ struct dvbfe_handle *fehandle;
int fd;
struct dvb_frontend_info info;
@@ -188,8 +189,8 @@ dvbfe_handle_t dvbfe_open(int adapter, int frontend, int readonly)
}
// setup structure
- fehandle = (struct dvbfe_handle_prv*) malloc(sizeof(struct dvbfe_handle_prv));
- memset(fehandle, 0, sizeof(struct dvbfe_handle_prv));
+ fehandle = (struct dvbfe_handle*) malloc(sizeof(struct dvbfe_handle));
+ memset(fehandle, 0, sizeof(struct dvbfe_handle));
fehandle->fd = fd;
switch(info.type) {
case FE_QPSK:
@@ -214,99 +215,118 @@ dvbfe_handle_t dvbfe_open(int adapter, int frontend, int readonly)
return fehandle;
}
-void dvbfe_close(dvbfe_handle_t _fehandle)
+void dvbfe_close(struct dvbfe_handle *fehandle)
{
- struct dvbfe_handle_prv *fehandle = (struct dvbfe_handle_prv*) _fehandle;
-
close(fehandle->fd);
free(fehandle->name);
free(fehandle);
}
-int dvbfe_get_info(dvbfe_handle_t _fehandle, dvbfe_info_mask_t querymask, struct dvbfe_info *result)
+extern int dvbfe_get_info(struct dvbfe_handle *fehandle,
+ enum dvbfe_info_mask querymask,
+ struct dvbfe_info *result,
+ enum dvbfe_info_querytype querytype,
+ int timeout)
{
int returnval = 0;
- fe_status_t status;
- struct dvb_frontend_parameters kparams;
- struct dvbfe_handle_prv *fehandle = (struct dvbfe_handle_prv*) _fehandle;
- struct timeval curtime;
-
- // limit how often this is called to reduce bus traffic
- gettimeofday(&curtime, NULL);
- if ((curtime.tv_sec < fehandle->nextinfotime.tv_sec) ||
- ((curtime.tv_sec == fehandle->nextinfotime.tv_sec) && (curtime.tv_usec < fehandle->nextinfotime.tv_usec))) {
- memcpy(result, &fehandle->cachedinfo, sizeof(struct dvbfe_info));
- return fehandle->cachedreturnval;
- }
+ struct dvb_frontend_event kevent;
+ int ok = 0;
- // retrieve the requested values
- memset(result, 0, sizeof(result));
- result->type = fehandle->type;
result->name = fehandle->name;
- if (querymask & DVBFE_INFO_LOCKSTATUS) {
- if (!ioctl(fehandle->fd, FE_READ_STATUS, &status)) {
- returnval |= DVBFE_INFO_LOCKSTATUS;
- if (status & FE_HAS_SIGNAL)
- result->signal = 1;
-
- if (status & FE_HAS_CARRIER)
- result->carrier = 1;
+ result->type = fehandle->type;
- if (status & FE_HAS_VITERBI)
- result->viterbi = 1;
+ switch(querytype) {
+ case DVBFE_INFO_QUERYTYPE_IMMEDIATE:
+ if (querymask & DVBFE_INFO_LOCKSTATUS) {
+ if (!ioctl(fehandle->fd, FE_READ_STATUS, &kevent.status)) {
+ returnval |= DVBFE_INFO_LOCKSTATUS;
+ }
+ }
+ if (querymask & DVBFE_INFO_FEPARAMS) {
+ if (!ioctl(fehandle->fd, FE_GET_FRONTEND, &kevent.parameters)) {
+ returnval |= DVBFE_INFO_FEPARAMS;
+ }
+ }
+ break;
- if (status & FE_HAS_SYNC)
- result->sync = 1;
+ case DVBFE_INFO_QUERYTYPE_LOCKCHANGE:
+ {
+ struct pollfd pollfd;
+ pollfd.fd = fehandle->fd;
+ pollfd.events = POLLIN | POLLERR;
+
+ ok = 1;
+ if (poll(&pollfd, 1, timeout) < 0)
+ ok = 0;
+ if (pollfd.revents & POLLERR)
+ ok = 0;
+ if (!(pollfd.revents & POLLIN))
+ ok = 0;
+ }
- if (status & FE_HAS_LOCK)
- result->lock = 1;
+ if (ok &&
+ ((querymask & DVBFE_INFO_LOCKSTATUS) ||
+ (querymask & DVBFE_INFO_FEPARAMS))) {
+ if (!ioctl(fehandle->fd, FE_GET_EVENT, &kevent)) {
+ if (querymask & DVBFE_INFO_LOCKSTATUS)
+ returnval |= DVBFE_INFO_LOCKSTATUS;
+ if (querymask & DVBFE_INFO_FEPARAMS)
+ returnval |= DVBFE_INFO_FEPARAMS;
+ }
}
+ break;
}
- if (querymask & DVBFE_INFO_FEPARAMS) {
- if (!ioctl(fehandle->fd, FE_GET_FRONTEND, &kparams)) {
- returnval |= DVBFE_INFO_FEPARAMS;
- result->feparams.frequency = kparams.frequency;
- result->feparams.inversion = lookupval(kparams.inversion, 1, dvbfe_spectral_inversion_to_kapi);
- switch(fehandle->type) {
- case FE_QPSK:
- result->feparams.u.dvbs.symbol_rate = kparams.u.qpsk.symbol_rate;
- result->feparams.u.dvbs.fec_inner =
- lookupval(kparams.u.qpsk.fec_inner, 1, dvbfe_code_rate_to_kapi);
- break;
- case FE_QAM:
- result->feparams.u.dvbc.symbol_rate = kparams.u.qam.symbol_rate;
- result->feparams.u.dvbc.fec_inner =
- lookupval(kparams.u.qam.fec_inner, 1, dvbfe_code_rate_to_kapi);
- result->feparams.u.dvbc.modulation =
- lookupval(kparams.u.qam.modulation, 1, dvbfe_dvbc_mod_to_kapi);
- break;
+ if (returnval & DVBFE_INFO_LOCKSTATUS) {
+ result->signal = kevent.status & FE_HAS_SIGNAL ? 1 : 0;
+ result->carrier = kevent.status & FE_HAS_CARRIER ? 1 : 0;
+ result->viterbi = kevent.status & FE_HAS_VITERBI ? 1 : 0;
+ result->sync = kevent.status & FE_HAS_SYNC ? 1 : 0;
+ result->lock = kevent.status & FE_HAS_LOCK ? 1 : 0;
+ }
- case FE_OFDM:
- result->feparams.u.dvbt.bandwidth =
- lookupval(kparams.u.ofdm.bandwidth, 1, dvbfe_dvbt_bandwidth_to_kapi);
- result->feparams.u.dvbt.code_rate_HP =
- lookupval(kparams.u.ofdm.code_rate_HP, 1, dvbfe_code_rate_to_kapi);
- result->feparams.u.dvbt.code_rate_LP =
- lookupval(kparams.u.ofdm.code_rate_LP, 1, dvbfe_code_rate_to_kapi);
- result->feparams.u.dvbt.constellation =
- lookupval(kparams.u.ofdm.constellation, 1, dvbfe_dvbt_const_to_kapi);
- result->feparams.u.dvbt.transmission_mode =
- lookupval(kparams.u.ofdm.transmission_mode, 1, dvbfe_dvbt_transmit_mode_to_kapi);
- result->feparams.u.dvbt.guard_interval =
- lookupval(kparams.u.ofdm.guard_interval, 1, dvbfe_dvbt_guard_interval_to_kapi);
- result->feparams.u.dvbt.hierarchy_information =
- lookupval(kparams.u.ofdm.hierarchy_information, 1, dvbfe_dvbt_hierarchy_to_kapi);
- break;
+ if (returnval & DVBFE_INFO_FEPARAMS) {
+ result->feparams.frequency = kevent.parameters.frequency;
+ result->feparams.inversion = lookupval(kevent.parameters.inversion, 1, dvbfe_spectral_inversion_to_kapi);
+ switch(fehandle->type) {
+ case FE_QPSK:
+ result->feparams.u.dvbs.symbol_rate = kevent.parameters.u.qpsk.symbol_rate;
+ result->feparams.u.dvbs.fec_inner =
+ lookupval(kevent.parameters.u.qpsk.fec_inner, 1, dvbfe_code_rate_to_kapi);
+ break;
- case FE_ATSC:
- result->feparams.u.atsc.modulation =
- lookupval(kparams.u.vsb.modulation, 1, dvbfe_atsc_mod_to_kapi);
- break;
- }
- }
+ case FE_QAM:
+ result->feparams.u.dvbc.symbol_rate = kevent.parameters.u.qam.symbol_rate;
+ result->feparams.u.dvbc.fec_inner =
+ lookupval(kevent.parameters.u.qam.fec_inner, 1, dvbfe_code_rate_to_kapi);
+ result->feparams.u.dvbc.modulation =
+ lookupval(kevent.parameters.u.qam.modulation, 1, dvbfe_dvbc_mod_to_kapi);
+ break;
+
+ case FE_OFDM:
+ result->feparams.u.dvbt.bandwidth =
+ lookupval(kevent.parameters.u.ofdm.bandwidth, 1, dvbfe_dvbt_bandwidth_to_kapi);
+ result->feparams.u.dvbt.code_rate_HP =
+ lookupval(kevent.parameters.u.ofdm.code_rate_HP, 1, dvbfe_code_rate_to_kapi);
+ result->feparams.u.dvbt.code_rate_LP =
+ lookupval(kevent.parameters.u.ofdm.code_rate_LP, 1, dvbfe_code_rate_to_kapi);
+ result->feparams.u.dvbt.constellation =
+ lookupval(kevent.parameters.u.ofdm.constellation, 1, dvbfe_dvbt_const_to_kapi);
+ result->feparams.u.dvbt.transmission_mode =
+ lookupval(kevent.parameters.u.ofdm.transmission_mode, 1, dvbfe_dvbt_transmit_mode_to_kapi);
+ result->feparams.u.dvbt.guard_interval =
+ lookupval(kevent.parameters.u.ofdm.guard_interval, 1, dvbfe_dvbt_guard_interval_to_kapi);
+ result->feparams.u.dvbt.hierarchy_information =
+ lookupval(kevent.parameters.u.ofdm.hierarchy_information, 1, dvbfe_dvbt_hierarchy_to_kapi);
+ break;
+ case FE_ATSC:
+ result->feparams.u.atsc.modulation =
+ lookupval(kevent.parameters.u.vsb.modulation, 1, dvbfe_atsc_mod_to_kapi);
+ break;
+ }
}
+
if (querymask & DVBFE_INFO_BER) {
if (!ioctl(fehandle->fd, FE_READ_BER, &result->ber))
returnval |= DVBFE_INFO_BER;
@@ -324,24 +344,15 @@ int dvbfe_get_info(dvbfe_handle_t _fehandle, dvbfe_info_mask_t querymask, struct
returnval |= DVBFE_INFO_UNCORRECTED_BLOCKS;
}
- // setup for next poll
- gettimeofday(&fehandle->nextinfotime, NULL);
- fehandle->nextinfotime.tv_usec += GET_INFO_MIN_DELAY_US;
- if (fehandle->nextinfotime.tv_usec >= 1000000) {
- fehandle->nextinfotime.tv_usec -= 1000000;
- fehandle->nextinfotime.tv_sec++;
- }
- memcpy(&fehandle->cachedinfo, result, sizeof(struct dvbfe_info));
- fehandle->cachedreturnval = returnval;
-
// done
return returnval;
}
-int dvbfe_set(dvbfe_handle_t _fehandle, struct dvbfe_parameters *params, int timeout)
+int dvbfe_set(struct dvbfe_handle *fehandle,
+ struct dvbfe_parameters *params,
+ int timeout)
{
struct dvb_frontend_parameters kparams;
- struct dvbfe_handle_prv *fehandle = (struct dvbfe_handle_prv*) _fehandle;
int res;
struct timeval endtime;
fe_status_t status;
@@ -428,320 +439,123 @@ int dvbfe_set(dvbfe_handle_t _fehandle, struct dvbfe_parameters *params, int tim
return -ETIMEDOUT;
}
-void dvbfe_poll(dvbfe_handle_t fehandle)
+int dvbfe_get_pollfd(struct dvbfe_handle *handle)
{
- // no implementation required yet
+ return handle->fd;
}
+int dvbfe_set_22k_tone(struct dvbfe_handle *fehandle, enum dvbfe_sec_tone_mode tone)
+{
+ int ret = 0;
+ switch (tone) {
+ case DVBFE_SEC_TONE_OFF:
+ ret = ioctl(fehandle->fd, FE_SET_TONE, SEC_TONE_OFF);
+ break;
+ case DVBFE_SEC_TONE_ON:
+ ret = ioctl(fehandle->fd, FE_SET_TONE, SEC_TONE_ON);
+ break;
+ default:
+ print(verbose, ERROR, 1, "Invalid command !");
+ break;
+ }
+ if (ret == -1)
+ print(verbose, ERROR, 1, "IOCTL failed !");
+ return ret;
+}
-
-
-
-int dvbfe_diseqc_command(dvbfe_handle_t _fehandle, char *command)
+int dvbfe_set_tone_data_burst(struct dvbfe_handle *fehandle, enum dvbfe_sec_mini_cmd minicmd)
{
- int i = 0;
- int waittime;
- int status;
- struct dvb_diseqc_master_cmd master_cmd;
- unsigned int tmpcmd[6];
- struct dvbfe_handle_prv *fehandle = (struct dvbfe_handle_prv*) _fehandle;
- char value_s[20];
- int value_i;
- int addr;
-
- while(command[i]) {
- /* kill whitespace */
- if (isspace(command[i])) {
- i++;
- continue;
- }
+ int ret = 0;
- switch(command[i]) {
- case 't':
- if ((status = ioctl(fehandle->fd, FE_SET_TONE, SEC_TONE_OFF)) != 0)
- return status;
- break;
-
- case 'T':
- if ((status = ioctl(fehandle->fd, FE_SET_TONE, SEC_TONE_ON)) != 0)
- return status;
- break;
-
- case '_':
- if ((status = ioctl(fehandle->fd, FE_SET_VOLTAGE, SEC_VOLTAGE_OFF)) != 0)
- return status;
- break;
+ switch (minicmd) {
+ case DVBFE_SEC_MINI_A:
+ ret = ioctl(fehandle->fd, FE_DISEQC_SEND_BURST, SEC_MINI_A);
+ break;
+ case DVBFE_SEC_MINI_B:
+ ret = ioctl(fehandle->fd, FE_DISEQC_SEND_BURST, SEC_MINI_B);
+ break;
+ default:
+ print(verbose, ERROR, 1, "Invalid command");
+ break;
+ }
+ if (ret == -1)
+ print(verbose, ERROR, 1, "IOCTL failed");
- case 'v':
- if ((status = ioctl(fehandle->fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13)) != 0)
- return status;
- break;
+ return ret;
+}
- case 'V':
- if ((status = ioctl(fehandle->fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18)) != 0)
- return status;
- break;
+int dvbfe_set_voltage(struct dvbfe_handle *fehandle, enum dvbfe_sec_voltage voltage)
+{
+ int ret = 0;
- case 'A':
- if ((status = ioctl(fehandle->fd, FE_DISEQC_SEND_BURST, SEC_MINI_A)) != 0)
- return status;
- break;
+ switch (voltage) {
+ case DVBFE_SEC_VOLTAGE_OFF:
+ ret = ioctl(fehandle->fd, FE_SET_VOLTAGE, SEC_VOLTAGE_OFF);
+ break;
+ case DVBFE_SEC_VOLTAGE_13:
+ ret = ioctl(fehandle->fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13);
+ break;
+ case DVBFE_SEC_VOLTAGE_18:
+ ret = ioctl(fehandle->fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18);
+ break;
+ default:
+ print(verbose, ERROR, 1, "Invalid command");
+ break;
+ }
+ if (ret == -1)
+ print(verbose, ERROR, 1, "IOCTL failed");
- case 'B':
- if ((status = ioctl(fehandle->fd, FE_DISEQC_SEND_BURST, SEC_MINI_B)) != 0)
- return status;
- break;
+ return ret;
+}
- case '+':
- ioctl(fehandle->fd, FE_ENABLE_HIGH_LNB_VOLTAGE, 1);
- /* don't care if this one is not supported */
- break;
+int dvbfe_set_high_lnb_voltage(struct dvbfe_handle *fehandle, int on)
+{
+ switch (on) {
+ case 0:
+ ioctl(fehandle->fd, FE_ENABLE_HIGH_LNB_VOLTAGE, 0);
+ break;
+ default:
+ ioctl(fehandle->fd, FE_ENABLE_HIGH_LNB_VOLTAGE, 1);
+ break;
+ }
+ return 0;
+}
- case '-':
- ioctl(fehandle->fd, FE_ENABLE_HIGH_LNB_VOLTAGE, 0);
- /* don't care if this one is not supported */
- break;
+int dvbfe_do_dishnetworks_legacy_command(struct dvbfe_handle *fehandle, unsigned int cmd)
+{
+ int ret = 0;
- case 'W':
- waittime = atoi(command + i + 1);
- if (waittime == 0) {
- return -EINVAL;
- }
- usleep(waittime * 1000);
- while(command[i] && !isspace(command[i]))
- i++;
- break;
+ ret = ioctl(fehandle->fd, FE_DISHNETWORK_SEND_LEGACY_CMD, cmd);
+ if (ret == -1)
+ print(verbose, ERROR, 1, "IOCTL failed");
- case '.': // extended command
- {
- i++;
-
- if (!strncmp(command+i, "D(", 2)) {
- i += 2;
-
- master_cmd.msg_len =
- sscanf(command+i, "%x %x %x %x %x %x",
- tmpcmd, tmpcmd+1, tmpcmd+2, tmpcmd+3, tmpcmd+4, tmpcmd+5);
- if (master_cmd.msg_len == 0)
- return -EINVAL;
- master_cmd.msg[0] = tmpcmd[0];
- master_cmd.msg[1] = tmpcmd[1];
- master_cmd.msg[2] = tmpcmd[2];
- master_cmd.msg[3] = tmpcmd[3];
- master_cmd.msg[4] = tmpcmd[4];
- master_cmd.msg[5] = tmpcmd[5];
-
- if ((status = ioctl(fehandle->fd, FE_DISEQC_SEND_MASTER_CMD, &master_cmd)) != 0)
- return status;
- } else if (!strncmp(command+i, "Dband(", 6)) {
- if (sscanf(command+i+6, "%i %2s", &addr, value_s) != 2)
- return -EINVAL;
- if (!strncmp(value_s, "lo", 2)) {
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x20;
- master_cmd.msg_len = 3;
- } else if (!strncmp(value_s, "hi", 2)) {
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x24;
- master_cmd.msg_len = 3;
- } else {
- return -EINVAL;
- }
- if ((status = ioctl(fehandle->fd, FE_DISEQC_SEND_MASTER_CMD, &master_cmd)) != 0)
- return status;
-
- } else if ((!strncmp(command+i, "Dpolarisation(", 14) ||
- (!strncmp(command+i, "Dpolarization(", 14)))) {
- if (sscanf(command+i+14, "%i %1s", &addr, value_s) != 2)
- return -EINVAL;
- switch(*value_s) {
- case 'H':
- case 'L':
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x25;
- master_cmd.msg_len = 3;
- break;
-
- case 'V':
- case 'R':
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x21;
- master_cmd.msg_len = 3;
- break;
-
- default:
- return -EINVAL;
- }
- if ((status = ioctl(fehandle->fd, FE_DISEQC_SEND_MASTER_CMD, &master_cmd)) != 0)
- return status;
-
- } else if (!strncmp(command+i, "Dsatellite_position(", 20)) {
- if (sscanf(command+i+20, "%i %1s", &addr, value_s) != 2)
- return -EINVAL;
- switch(*value_s) {
- case 'A':
- case 'C':
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x22;
- master_cmd.msg_len = 3;
- break;
-
- case 'B':
- case 'D':
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x26;
- master_cmd.msg_len = 3;
- break;
-
- default:
- return -EINVAL;
- }
- if ((status = ioctl(fehandle->fd, FE_DISEQC_SEND_MASTER_CMD, &master_cmd)) != 0)
- return status;
-
- } else if (!strncmp(command+i, "Dswitch_option(", 15)) {
- if (sscanf(command+i+15, "%i %1s", &addr, value_s) != 2)
- return -EINVAL;
- switch(*value_s) {
- case 'A':
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x23;
- master_cmd.msg_len = 3;
- break;
-
- case 'B':
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x27;
- master_cmd.msg_len = 3;
- break;
-
- default:
- return -EINVAL;
- }
- if ((status = ioctl(fehandle->fd, FE_DISEQC_SEND_MASTER_CMD, &master_cmd)) != 0)
- return status;
-
- } else if (!strncmp(command+i, "Dport_pins(", 11)) {
- int mask;
- if (sscanf(command+i+11, "%i %i %i", &addr, &mask, &value_i) != 3)
- return -EINVAL;
-
- if (mask & 0x0f) {
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x38;
- master_cmd.msg[3] = ((mask & 0x0f) << 4) | (value_i & 0x0f);
- master_cmd.msg_len = 4;
-
- if ((status = ioctl(fehandle->fd, FE_DISEQC_SEND_MASTER_CMD, &master_cmd)) != 0)
- return status;
- }
- if (mask & 0xf0) {
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x39;
- master_cmd.msg[3] = (mask & 0xf0) | ((value_i & 0xf0) >> 4);
- master_cmd.msg_len = 4;
-
- if ((status = ioctl(fehandle->fd, FE_DISEQC_SEND_MASTER_CMD, &master_cmd)) != 0)
- return status;
- }
-
- } else if (!strncmp(command+i, "Dgoto_preset(", 13)) {
- if (sscanf(command+i+13, "%i %i", &addr, &value_i) != 2)
- return -EINVAL;
-
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x3b;
- master_cmd.msg[3] = value_i;
- master_cmd.msg_len = 4;
-
- if ((status = ioctl(fehandle->fd, FE_DISEQC_SEND_MASTER_CMD, &master_cmd)) != 0)
- return status;
-
- } else if (!strncmp(command+i, "Dgoto_angle(", 12)) {
- int integer = 0;
- int fraction = 0;
- char *tmp;
-
- if (sscanf(command+i+12, "%i %s", &addr, value_s) != 2)
- return -EINVAL;
-
- // parse the integer and fractional parts using fixed point
- integer = atoi(value_s);
- tmp = strchr(value_s, '.');
- if (tmp != NULL) {
- tmp++;
- tmp[3] = 0;
- fraction = ((atoi(tmp) * 16000) / 1000000) & 0xf;
- }
-
- // generate the command
- master_cmd.msg[0] = 0xe0;
- master_cmd.msg[1] = addr;
- master_cmd.msg[2] = 0x6e;
- if (integer < -256) {
- return -EINVAL;
- } else if (integer < 0) {
- integer = -integer;
- master_cmd.msg[3] = 0xf0;
- } else if (integer < 256) {
- master_cmd.msg[3] = 0x00;
- } else if (integer < 512) {
- integer -= 256;
- master_cmd.msg[3] = 0x10;
- } else {
- return -EINVAL;
- }
- master_cmd.msg[3] |= ((integer / 16) & 0x0f);
- integer = integer % 16;
- master_cmd.msg[4] |= ((integer & 0x0f) << 4) | fraction;
- master_cmd.msg_len = 5;
-
- if ((status = ioctl(fehandle->fd, FE_DISEQC_SEND_MASTER_CMD, &master_cmd)) != 0)
- return status;
-
- } else if (!strncmp(command+i, "dishnetworks(", 13)) {
- if (sscanf(command+i+13, "%i", tmpcmd) != 1)
- return -EINVAL;
-
- if ((status = ioctl(fehandle->fd, FE_DISHNETWORK_SEND_LEGACY_CMD, tmpcmd)) != 0)
- return status;
- }
+ return ret;
+}
- /* skip to the end... */
- while(command[i] && (command[i] != ')'))
- i++;
- break;
- }
+int dvbfe_do_diseqc_command(struct dvbfe_handle *fehandle, uint8_t *data, uint8_t len)
+{
+ int ret = 0;
+ struct dvb_diseqc_master_cmd diseqc_message;
+ if (len > 6)
+ return -EINVAL;
- default:
- return -EINVAL;
- }
+ diseqc_message.msg_len = len;
+ memcpy(diseqc_message.msg, data, len);
- i++;
- }
+ ret = ioctl(fehandle->fd, FE_DISEQC_SEND_MASTER_CMD, &diseqc_message);
+ if (ret == -1)
+ print(verbose, ERROR, 1, "IOCTL failed");
- return 0;
+ return ret;
}
-int dvbfe_diseqc_read(dvbfe_handle_t _fehandle, int timeout, unsigned char *buf, unsigned int len)
+int dvbfe_diseqc_read(struct dvbfe_handle *fehandle, int timeout, unsigned char *buf, unsigned int len)
{
struct dvb_diseqc_slave_reply reply;
int result;
- struct dvbfe_handle_prv *fehandle = (struct dvbfe_handle_prv*) _fehandle;
if (len > 4)
len = 4;
diff --git a/kaffeine/src/input/dvb/lib/libdvbapi/dvbfe.h b/kaffeine/src/input/dvb/lib/libdvbapi/dvbfe.h
index 9eb03b7..69cb05b 100644
--- a/kaffeine/src/input/dvb/lib/libdvbapi/dvbfe.h
+++ b/kaffeine/src/input/dvb/lib/libdvbapi/dvbfe.h
@@ -2,6 +2,7 @@
* libdvbfe - a DVB frontend library
*
* Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2005 Manu Abraham <abraham.manu@gmail.com>
* Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
*
* This library is free software; you can redistribute it and/or
@@ -32,27 +33,20 @@ extern "C"
/**
* The types of frontend we support.
*/
-typedef enum dvbfe_type {
+enum dvbfe_type {
DVBFE_TYPE_DVBS,
DVBFE_TYPE_DVBC,
DVBFE_TYPE_DVBT,
DVBFE_TYPE_ATSC,
-} dvbfe_type_t;
-
-typedef enum dvbfe_polarization {
- DVBFE_POLARIZATION_H,
- DVBFE_POLARIZATION_V,
- DVBFE_POLARIZATION_L,
- DVBFE_POLARIZATION_R,
-} dvbfe_polarization_t;
+};
-typedef enum dvbfe_spectral_inversion {
+enum dvbfe_spectral_inversion {
DVBFE_INVERSION_OFF,
DVBFE_INVERSION_ON,
DVBFE_INVERSION_AUTO
-} dvbfe_spectral_inversion_t;
+};
-typedef enum dvbfe_code_rate {
+enum dvbfe_code_rate {
DVBFE_FEC_NONE,
DVBFE_FEC_1_2,
DVBFE_FEC_2_3,
@@ -63,9 +57,9 @@ typedef enum dvbfe_code_rate {
DVBFE_FEC_7_8,
DVBFE_FEC_8_9,
DVBFE_FEC_AUTO
-} dvbfe_code_rate_t;
+};
-typedef enum dvbfe_dvbt_const {
+enum dvbfe_dvbt_const {
DVBFE_DVBT_CONST_QPSK,
DVBFE_DVBT_CONST_QAM_16,
DVBFE_DVBT_CONST_QAM_32,
@@ -73,106 +67,121 @@ typedef enum dvbfe_dvbt_const {
DVBFE_DVBT_CONST_QAM_128,
DVBFE_DVBT_CONST_QAM_256,
DVBFE_DVBT_CONST_AUTO
-} dvbfe_dvbt_const_t;
+};
-typedef enum dvbfe_dvbc_mod {
+enum dvbfe_dvbc_mod {
DVBFE_DVBC_MOD_QAM_16,
DVBFE_DVBC_MOD_QAM_32,
DVBFE_DVBC_MOD_QAM_64,
DVBFE_DVBC_MOD_QAM_128,
DVBFE_DVBC_MOD_QAM_256,
DVBFE_DVBC_MOD_AUTO,
-} dvbfe_dvbc_mod_t;
+};
-typedef enum dvbfe_atsc_mod {
+enum dvbfe_atsc_mod {
DVBFE_ATSC_MOD_QAM_64,
DVBFE_ATSC_MOD_QAM_256,
DVBFE_ATSC_MOD_VSB_8,
DVBFE_ATSC_MOD_VSB_16,
DVBFE_ATSC_MOD_AUTO
-} dvbfe_atsc_mod_t;
+};
-typedef enum dvbfe_dvbt_transmit_mode {
+enum dvbfe_dvbt_transmit_mode {
DVBFE_DVBT_TRANSMISSION_MODE_2K,
DVBFE_DVBT_TRANSMISSION_MODE_8K,
DVBFE_DVBT_TRANSMISSION_MODE_AUTO
-} dvbfe_dvbt_transmit_mode_t;
+};
-typedef enum dvbfe_dvbt_bandwidth {
+enum dvbfe_dvbt_bandwidth {
DVBFE_DVBT_BANDWIDTH_8_MHZ,
DVBFE_DVBT_BANDWIDTH_7_MHZ,
DVBFE_DVBT_BANDWIDTH_6_MHZ,
DVBFE_DVBT_BANDWIDTH_AUTO
-} dvbfe_dvbt_bandwidth_t;
+};
-typedef enum dvbfe_dvbt_guard_interval {
+enum dvbfe_dvbt_guard_interval {
DVBFE_DVBT_GUARD_INTERVAL_1_32,
DVBFE_DVBT_GUARD_INTERVAL_1_16,
DVBFE_DVBT_GUARD_INTERVAL_1_8,
DVBFE_DVBT_GUARD_INTERVAL_1_4,
DVBFE_DVBT_GUARD_INTERVAL_AUTO
-} dvbfe_dvbt_guard_interval_t;
+};
-typedef enum dvbfe_dvbt_hierarchy {
+enum dvbfe_dvbt_hierarchy {
DVBFE_DVBT_HIERARCHY_NONE,
DVBFE_DVBT_HIERARCHY_1,
DVBFE_DVBT_HIERARCHY_2,
DVBFE_DVBT_HIERARCHY_4,
DVBFE_DVBT_HIERARCHY_AUTO
-} dvbfe_dvbt_hierarchy_t;
+};
/**
* Structure used to store and communicate frontend parameters.
*/
struct dvbfe_parameters {
uint32_t frequency;
- dvbfe_spectral_inversion_t inversion;
+ enum dvbfe_spectral_inversion inversion;
union {
struct {
uint32_t symbol_rate;
- dvbfe_code_rate_t fec_inner;
- dvbfe_polarization_t polarization;
+ enum dvbfe_code_rate fec_inner;
} dvbs;
struct {
uint32_t symbol_rate;
- dvbfe_code_rate_t fec_inner;
- dvbfe_dvbc_mod_t modulation;
+ enum dvbfe_code_rate fec_inner;
+ enum dvbfe_dvbc_mod modulation;
} dvbc;
struct {
- dvbfe_dvbt_bandwidth_t bandwidth;
- dvbfe_code_rate_t code_rate_HP;
- dvbfe_code_rate_t code_rate_LP;
- dvbfe_dvbt_const_t constellation;
- dvbfe_dvbt_transmit_mode_t transmission_mode;
- dvbfe_dvbt_guard_interval_t guard_interval;
- dvbfe_dvbt_hierarchy_t hierarchy_information;
+ enum dvbfe_dvbt_bandwidth bandwidth;
+ enum dvbfe_code_rate code_rate_HP;
+ enum dvbfe_code_rate code_rate_LP;
+ enum dvbfe_dvbt_const constellation;
+ enum dvbfe_dvbt_transmit_mode transmission_mode;
+ enum dvbfe_dvbt_guard_interval guard_interval;
+ enum dvbfe_dvbt_hierarchy hierarchy_information;
} dvbt;
struct {
- dvbfe_atsc_mod_t modulation;
+ enum dvbfe_atsc_mod modulation;
} atsc;
} u;
};
+enum dvbfe_sec_voltage {
+ DVBFE_SEC_VOLTAGE_13,
+ DVBFE_SEC_VOLTAGE_18,
+ DVBFE_SEC_VOLTAGE_OFF
+};
+
+enum dvbfe_sec_tone_mode {
+ DVBFE_SEC_TONE_ON,
+ DVBFE_SEC_TONE_OFF
+};
+
+enum dvbfe_sec_mini_cmd {
+ DVBFE_SEC_MINI_A,
+ DVBFE_SEC_MINI_B
+};
+
/**
* Mask of values used in the dvbfe_get_info() call.
*/
-typedef enum dvbfe_info_mask {
+enum dvbfe_info_mask {
DVBFE_INFO_LOCKSTATUS = 0x01,
DVBFE_INFO_FEPARAMS = 0x02,
DVBFE_INFO_BER = 0x04,
DVBFE_INFO_SIGNAL_STRENGTH = 0x08,
DVBFE_INFO_SNR = 0x10,
DVBFE_INFO_UNCORRECTED_BLOCKS = 0x20,
-} dvbfe_info_mask_t;
+};
/**
* Structure containing values used by the dvbfe_get_info() call.
*/
struct dvbfe_info {
- dvbfe_type_t type; /* always retrieved */
+ enum dvbfe_type type; /* always retrieved */
const char *name; /* always retrieved */
unsigned int signal : 1; /* } DVBFE_INFO_LOCKSTATUS */
unsigned int carrier : 1; /* } */
@@ -187,9 +196,23 @@ struct dvbfe_info {
};
/**
+ * Possible types of query used in dvbfe_get_info.
+ *
+ * DVBFE_INFO_QUERYTYPE_IMMEDIATE - interrogate frontend for most up to date values.
+ * DVBFE_INFO_QUERYTYPE_LOCKCHANGE - return details from queued lock status
+ * change events, or wait for one to occur
+ * if none are queued.
+ */
+enum dvbfe_info_querytype {
+ DVBFE_INFO_QUERYTYPE_IMMEDIATE,
+ DVBFE_INFO_QUERYTYPE_LOCKCHANGE,
+};
+
+
+/**
* Frontend handle datatype.
*/
-typedef void *dvbfe_handle_t;
+struct dvbfe_handle;
/**
* Open a DVB frontend.
@@ -199,18 +222,21 @@ typedef void *dvbfe_handle_t;
* @param readonly If 1, frontend will be opened in readonly mode only.
* @return A handle on success, or NULL on failure.
*/
-extern dvbfe_handle_t dvbfe_open(int adapter, int frontend, int readonly);
+extern struct dvbfe_handle *dvbfe_open(int adapter, int frontend, int readonly);
/**
* Close a DVB frontend.
*
* @param fehandle Handle opened with dvbfe_open().
*/
-extern void dvbfe_close(dvbfe_handle_t handle);
+extern void dvbfe_close(struct dvbfe_handle *handle);
/**
* Set the frontend tuning parameters.
*
+ * Note: this function provides only the basic tuning operation; you might want to
+ * investigate dvbfe_set_sec() in sec.h for a unified device tuning operation.
+ *
* @param fehandle Handle opened with dvbfe_open().
* @param params Params to set.
* @param timeout <0 => wait forever for lock. 0=>return immediately, >0=>
@@ -218,14 +244,9 @@ extern void dvbfe_close(dvbfe_handle_t handle);
* @return 0 on locked (or if timeout==0 and everything else worked), or
* nonzero on failure (including no lock).
*/
-extern int dvbfe_set(dvbfe_handle_t fehandle, struct dvbfe_parameters *params, int timeout);
-
-/**
- * Call this function regularly from a loop to maintain the frontend lock.
- *
- * @param fehandle Handle opened with dvbfe_open().
- */
-extern void dvbfe_poll(dvbfe_handle_t fehandle);
+extern int dvbfe_set(struct dvbfe_handle *fehandle,
+ struct dvbfe_parameters *params,
+ int timeout);
/**
* Retrieve information about the frontend.
@@ -233,62 +254,66 @@ extern void dvbfe_poll(dvbfe_handle_t fehandle);
* @param fehandle Handle opened with dvbfe_open().
* @param querymask ORed bitmask of desired DVBFE_INFO_* values.
* @param result Where to put the retrieved results.
+ * @param querytype Type of query requested.
+ * @param timeout Timeout in ms to use if querytype==lockchange (0=>no timeout, <0=> wait forever).
* @return ORed bitmask of DVBFE_INFO_* indicating which values were read successfully.
*/
-extern int dvbfe_get_info(dvbfe_handle_t fehandle, dvbfe_info_mask_t querymask, struct dvbfe_info *result);
+extern int dvbfe_get_info(struct dvbfe_handle *fehandle,
+ enum dvbfe_info_mask querymask,
+ struct dvbfe_info *result,
+ enum dvbfe_info_querytype querytype,
+ int timeout);
/**
- * Execute a DISEQC command string.
- *
- * A diseqc command consists of a sequence of the following codes, separated by
- * whitespace:
- * Simple commands:
- * t - turn 22kHz tone off.
- * T - turn 22kHz tone on.
- * _ - set voltage to 0v (i.e. off).
- * v - set voltage to 13v.
- * V - set voltage to 18v.
- * + - Enable high LNB voltage.
- * - - Disable high LNB voltage.
- * A - send DISEQC mini command A.
- * B - send DISEQC mini command B.
- * Wii - Delay for ii milliseconds.
- *
- * Extended commands:
- * .dishnetworks(<value>) - Send a dish networks legacy command <value>
- * .D(<value> ...) - Send a raw diseqc master command. The command may be up
- * to 6 bytes long.
- * .Dband(<addr> <lo|hi>) - Set frequency band hi or lo.
- * .Dpolarisation(<addr> <V|H|L|R>) - Set polarisation.
- * .Dsatellite_position(<addr> <A|B>) - Set "satellite position" input switch.
- * .Dswitch_option(<addr> <A|B>) - Set "switch option" input switch.
- * .Dport_pins(<addr> <mask> <value>) - Set all input switches. Mask and value
- * are hex-ascii 8 bit bytes. Only bits with a corresponding '1' in mask
- * will be changed.
- * .Dgoto_preset(<addr> <index>) - Set a positioner to a preset index (integer)
- * .Dgoto_angle(<addr> <angle>) - Set a positioner to a given angle
- * (e.g. 49.6). The angle may range between -180 to 496. It may include a
- * fractional part.
- *
- * All integer values use standard notation - no prefix=>decimal, 0x=>hex etc.
- *
- * Set <addr> to 0 if you just have a simple DISEQC setup (e.g. one switch). See
- * the DISEQC specification at http://www.eutelsat.org/ for full information.
- *
- * Comments begin with '#' - any characters after this will be ignored
- * to the end of the line.
- *
- * Examples:
- * S-19.2E 11700000 V 9750000 t v W15 .D(E0 10 38 F0) W15 A W15 t
- * S-19.2E 99999999 V 10600000 t v W15 .D(E0 10 38 F1) W15 A W15 T
- * S-19.2E 11700000 H 9750000 t V W15 .D(E0 10 38 F2) W15 A W15 t
- * S-19.2E 99999999 H 10600000 t V W15 .D(E0 10 38 F3) W15 A W15 T
+ * Get a file descriptor for polling for lock status changes.
*
* @param fehandle Handle opened with dvbfe_open().
- * @param command Command to execute.
- * @return 0 on success, nonzero on failure.
+ * @return FD for polling.
+ */
+extern int dvbfe_get_pollfd(struct dvbfe_handle *handle);
+
+/**
+ * Tone/Data Burst control
+ * @param fehandle Handle opened with dvbfe_open().
+ * @param tone, SEC_TONE_ON/SEC_TONE_OFF
+ */
+extern int dvbfe_set_22k_tone(struct dvbfe_handle *handle, enum dvbfe_sec_tone_mode tone);
+
+/**
+ * 22khz Tone control
+ * @param fehandle Handle opened with dvbfe_open().
+ * @param adapter, minicmd, SEC_MINI_A/SEC_MINI_B
+ */
+extern int dvbfe_set_tone_data_burst(struct dvbfe_handle *handle, enum dvbfe_sec_mini_cmd minicmd);
+
+/**
+ * Voltage control
+ * @param fehandle Handle opened with dvbfe_open().
+ * @param polarization, SEC_VOLTAGE_13/SEC_VOLTAGE_18/SEC_VOLTAGE_OFF
+ */
+extern int dvbfe_set_voltage(struct dvbfe_handle *handle, enum dvbfe_sec_voltage voltage);
+
+/**
+ * High LNB voltage control (increases voltage by 1v to compensate for long cables)
+ * @param fehandle Handle opened with dvbfe_open().
+ * @param on 1 to enable, 0 to disable.
+ */
+extern int dvbfe_set_high_lnb_voltage(struct dvbfe_handle *fehandle, int on);
+
+/**
+ * Send a legacy Dish Networks command
+ * @param fehandle Handle opened with dvbfe_open().
+ * @param cmd, the command to send
+ */
+extern int dvbfe_do_dishnetworks_legacy_command(struct dvbfe_handle *handle, unsigned int cmd);
+
+/**
+ * Send a DiSEqC Command
+ * @param fehandle Handle opened with dvbfe_open().
+ * @param data, a pointer to am array containing the data to be sent.
+ * @param len Length of data in bytes, max 6 bytes.
*/
-extern int dvbfe_diseqc_command(dvbfe_handle_t fehandle, char *command);
+extern int dvbfe_do_diseqc_command(struct dvbfe_handle *handle, uint8_t *data, uint8_t len);
/**
* Read a DISEQC response from the frontend.
@@ -299,7 +324,7 @@ extern int dvbfe_diseqc_command(dvbfe_handle_t fehandle, char *command);
* @param len Number of bytes in buffer.
* @return >= 0 on success (number of received bytes), <0 on failure.
*/
-extern int dvbfe_diseqc_read(dvbfe_handle_t fehandle, int timeout, unsigned char *buf, unsigned int len);
+extern int dvbfe_diseqc_read(struct dvbfe_handle *fehandle, int timeout, unsigned char *buf, unsigned int len);
#ifdef __cplusplus
}
diff --git a/kaffeine/src/input/dvb/lib/libdvbapi/dvbnet.c b/kaffeine/src/input/dvb/lib/libdvbapi/dvbnet.c
index d6ee632..f0f08f9 100644
--- a/kaffeine/src/input/dvb/lib/libdvbapi/dvbnet.c
+++ b/kaffeine/src/input/dvb/lib/libdvbapi/dvbnet.c
@@ -44,9 +44,10 @@ int dvbnet_open(int adapter, int netdeviceid)
return fd;
}
-int dvbnet_add_interface(int fd, uint16_t pid, int encapsulation)
+int dvbnet_add_interface(int fd, uint16_t pid, enum dvbnet_encap encapsulation)
{
struct dvb_net_if params;
+ int status;
memset(&params, 0, sizeof(params));
params.pid = pid;
@@ -63,10 +64,14 @@ int dvbnet_add_interface(int fd, uint16_t pid, int encapsulation)
default:
return -EINVAL;
}
- return ioctl(fd, NET_ADD_IF, &params);
+
+ status = ioctl(fd, NET_ADD_IF, &params);
+ if (status < 0)
+ return status;
+ return params.if_num;
}
-int dvbnet_get_interface(int fd, int ifnum, uint16_t *pid, int *encapsulation)
+int dvbnet_get_interface(int fd, int ifnum, uint16_t *pid, enum dvbnet_encap *encapsulation)
{
struct dvb_net_if info;
int res;
diff --git a/kaffeine/src/input/dvb/lib/libdvbapi/dvbnet.h b/kaffeine/src/input/dvb/lib/libdvbapi/dvbnet.h
index 426e540..287919f 100644
--- a/kaffeine/src/input/dvb/lib/libdvbapi/dvbnet.h
+++ b/kaffeine/src/input/dvb/lib/libdvbapi/dvbnet.h
@@ -31,10 +31,10 @@ extern "C"
/**
* Possible encapsulations of data.
*/
-typedef enum dvbnet_encap {
+enum dvbnet_encap {
DVBNET_ENCAP_MPE,
DVBNET_ENCAP_ULE,
-} dvbnet_encap_t;
+};
/**
* The maximum allowed number of dvb network devices per adapter netdevice.
@@ -56,9 +56,9 @@ extern int dvbnet_open(int adapter, int netdeviceid);
* @param fd FD opened with libdvbnet_open().
* @param pid PID of the stream containing the network data.
* @param encapsulation Encapsulation type of the stream (one of DVBNET_ENCAP_*).
- * @return 0 on success, nonzero on failure.
+ * @return Index of new interface on success, < 0 on failure.
*/
-extern int dvbnet_add_interface(int fd, uint16_t pid, int encapsulation);
+extern int dvbnet_add_interface(int fd, uint16_t pid, enum dvbnet_encap encapsulation);
/**
* Get details of a DVBNET interface.
@@ -69,7 +69,7 @@ extern int dvbnet_add_interface(int fd, uint16_t pid, int encapsulation);
* @param encapsulation The encapsulation of the interface (DVBNET_ENCAP_*).
* @return 0 on success, nonzero on failure.
*/
-extern int dvbnet_get_interface(int fd, int ifnum, uint16_t *pid, int *encapsulation);
+extern int dvbnet_get_interface(int fd, int ifnum, uint16_t *pid, enum dvbnet_encap *encapsulation);
/**
* Remove a DVBNET interface.
diff --git a/kaffeine/src/input/dvb/lib/libdvbapi/dvbvideo.c b/kaffeine/src/input/dvb/lib/libdvbapi/dvbvideo.c
new file mode 100644
index 0000000..f1ffbe8
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libdvbapi/dvbvideo.c
@@ -0,0 +1,46 @@
+/*
+ * libdvbnet - a DVB network support library
+ *
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/param.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <linux/types.h>
+#include <linux/dvb/video.h>
+#include <errno.h>
+#include "dvbvideo.h"
+
+int dvbvideo_open(int adapter, int videodeviceid)
+{
+ char filename[PATH_MAX+1];
+ int fd;
+
+ sprintf(filename, "/dev/dvb/adapter%i/video%i", adapter, videodeviceid);
+ if ((fd = open(filename, O_RDWR)) < 0) {
+ // if that failed, try a flat /dev structure
+ sprintf(filename, "/dev/dvb%i.video%i", adapter, videodeviceid);
+ fd = open(filename, O_RDWR);
+ }
+
+ return fd;
+}
diff --git a/kaffeine/src/input/dvb/lib/libdvbapi/dvbvideo.h b/kaffeine/src/input/dvb/lib/libdvbapi/dvbvideo.h
new file mode 100644
index 0000000..cc49914
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libdvbapi/dvbvideo.h
@@ -0,0 +1,46 @@
+/*
+ * libdvbnet - a DVB network support library
+ *
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef LIBDVBVIDEO_H
+#define LIBDVBVIDEO_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdint.h>
+
+/**
+ * Open a DVB video device.
+ *
+ * @param adapter DVB adapter ID.
+ * @param videodeviceid Id of video device of that adapter to open.
+ * @return A unix file descriptor on success, or -1 on failure.
+ */
+extern int dvbvideo_open(int adapter, int videodeviceid);
+
+// FIXME: this is a stub library
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // LIBDVBVIDEO_H
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/Makefile.am b/kaffeine/src/input/dvb/lib/libdvben50221/Makefile.am
index 7c9764a..6942c02 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/Makefile.am
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/Makefile.am
@@ -16,6 +16,9 @@ libdvben50221_la_SOURCES = asn_1.c \
en50221_app_teletext.c \
en50221_app_utils.c \
en50221_session.c \
- en50221_transport.c
+ en50221_transport.c \
+ en50221_stdcam.c \
+ en50221_stdcam_llci.c \
+ en50221_stdcam_hlci.c
CFLAGS = -g -O2 -DLOG_LEVEL=1 -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -fPIC
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/asn_1.c b/kaffeine/src/input/dvb/lib/libdvben50221/asn_1.c
index 0c6ff5c..803eb60 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/asn_1.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/asn_1.c
@@ -2,8 +2,8 @@
ASN.1 routines, implementation for libdvben50221
an implementation for the High Level Common Interface
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
- Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
+ Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -17,65 +17,67 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include "asn_1.h"
-int asn_1_decode(uint16_t *length, uint8_t *asn_1_array, uint32_t asn_1_array_len)
+int asn_1_decode(uint16_t * length, uint8_t * asn_1_array,
+ uint32_t asn_1_array_len)
{
uint8_t length_field;
- if (asn_1_array_len < 1)
- return -1;
+ if (asn_1_array_len < 1)
+ return -1;
length_field = asn_1_array[0];
- if (length_field < 0x80) {
+ if (length_field < 0x80) {
// there is only one word
*length = length_field & 0x7f;
- return 1;
- } else if (length_field == 0x81) {
- if (asn_1_array_len < 2)
- return -1;
-
- *length = asn_1_array[1];
- return 2;
- } else if (length_field == 0x82) {
- if (asn_1_array_len < 3)
- return -1;
-
- *length = (asn_1_array[1] << 8) | asn_1_array[2];
- return 3;
- }
-
- return -1;
+ return 1;
+ } else if (length_field == 0x81) {
+ if (asn_1_array_len < 2)
+ return -1;
+
+ *length = asn_1_array[1];
+ return 2;
+ } else if (length_field == 0x82) {
+ if (asn_1_array_len < 3)
+ return -1;
+
+ *length = (asn_1_array[1] << 8) | asn_1_array[2];
+ return 3;
+ }
+
+ return -1;
}
-int asn_1_encode(uint16_t length, uint8_t *asn_1_array, uint32_t asn_1_array_len)
+int asn_1_encode(uint16_t length, uint8_t * asn_1_array,
+ uint32_t asn_1_array_len)
{
- if (length < 0x80) {
- if (asn_1_array_len < 1)
- return -1;
+ if (length < 0x80) {
+ if (asn_1_array_len < 1)
+ return -1;
- asn_1_array[0] = length & 0x7f;
- return 1;
+ asn_1_array[0] = length & 0x7f;
+ return 1;
} else if (length < 0x100) {
- if (asn_1_array_len < 2)
- return -1;
-
- asn_1_array[0] = 0x81;
- asn_1_array[1] = length;
- return 2;
- } else {
- if (asn_1_array_len < 3)
- return -1;
-
- asn_1_array[0] = 0x82;
- asn_1_array[1] = length >> 8;
- asn_1_array[2] = length;
- return 3;
+ if (asn_1_array_len < 2)
+ return -1;
+
+ asn_1_array[0] = 0x81;
+ asn_1_array[1] = length;
+ return 2;
+ } else {
+ if (asn_1_array_len < 3)
+ return -1;
+
+ asn_1_array[0] = 0x82;
+ asn_1_array[1] = length >> 8;
+ asn_1_array[2] = length;
+ return 3;
}
- // never reached
+ // never reached
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/asn_1.h b/kaffeine/src/input/dvb/lib/libdvben50221/asn_1.h
index bae6da8..c8774db 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/asn_1.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/asn_1.h
@@ -2,8 +2,8 @@
ASN.1 routines, implementation for libdvben50221
an implementation for the High Level Common Interface
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
- Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
+ Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -17,25 +17,25 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __ASN_1_H__
#define __ASN_1_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
#include <stdint.h>
-int asn_1_decode(uint16_t *length, uint8_t *asn_1_array, uint32_t asn_1_array_len);
-int asn_1_encode(uint16_t length, uint8_t *asn_1_array, uint32_t asn_1_array_len);
+int asn_1_decode(uint16_t * length, uint8_t * asn_1_array,
+ uint32_t asn_1_array_len);
+int asn_1_encode(uint16_t length, uint8_t * asn_1_array,
+ uint32_t asn_1_array_len);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ai.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ai.c
index e3e73ab..b7ded66 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ai.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ai.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
@@ -28,106 +28,107 @@
#include "en50221_app_tags.h"
#include "asn_1.h"
-struct en50221_app_ai_private {
- struct en50221_app_send_functions *funcs;
+struct en50221_app_ai {
+ struct en50221_app_send_functions *funcs;
- en50221_app_ai_callback callback;
- void *callback_arg;
+ en50221_app_ai_callback callback;
+ void *callback_arg;
- pthread_mutex_t lock;
+ pthread_mutex_t lock;
};
-static int en50221_app_ai_parse_app_info(struct en50221_app_ai_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
+static int en50221_app_ai_parse_app_info(struct en50221_app_ai *ai,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
-en50221_app_ai en50221_app_ai_create(struct en50221_app_send_functions *funcs)
+struct en50221_app_ai *en50221_app_ai_create(struct en50221_app_send_functions *funcs)
{
- struct en50221_app_ai_private *private = NULL;
+ struct en50221_app_ai *ai = NULL;
- // create structure and set it up
- private = malloc(sizeof(struct en50221_app_ai_private));
- if (private == NULL) {
- return NULL;
- }
- private->funcs = funcs;
- private->callback = NULL;
+ // create structure and set it up
+ ai = malloc(sizeof(struct en50221_app_ai));
+ if (ai == NULL) {
+ return NULL;
+ }
+ ai->funcs = funcs;
+ ai->callback = NULL;
- pthread_mutex_init(&private->lock, NULL);
+ pthread_mutex_init(&ai->lock, NULL);
- // done
- return private;
+ // done
+ return ai;
}
-void en50221_app_ai_destroy(en50221_app_ai ai)
+void en50221_app_ai_destroy(struct en50221_app_ai *ai)
{
- struct en50221_app_ai_private *private = (struct en50221_app_ai_private *) ai;
-
- pthread_mutex_destroy(&private->lock);
- free(private);
+ pthread_mutex_destroy(&ai->lock);
+ free(ai);
}
-void en50221_app_ai_register_callback(en50221_app_ai ai, en50221_app_ai_callback callback, void *arg)
+void en50221_app_ai_register_callback(struct en50221_app_ai *ai,
+ en50221_app_ai_callback callback,
+ void *arg)
{
- struct en50221_app_ai_private *private = (struct en50221_app_ai_private *) ai;
-
- pthread_mutex_lock(&private->lock);
- private->callback = callback;
- private->callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&ai->lock);
+ ai->callback = callback;
+ ai->callback_arg = arg;
+ pthread_mutex_unlock(&ai->lock);
}
-int en50221_app_ai_enquiry(en50221_app_ai ai, uint16_t session_number)
+int en50221_app_ai_enquiry(struct en50221_app_ai *ai,
+ uint16_t session_number)
{
- struct en50221_app_ai_private *private = (struct en50221_app_ai_private *) ai;
- uint8_t data[4];
+ uint8_t data[4];
- data[0] = (TAG_APP_INFO_ENQUIRY >> 16) & 0xFF;
- data[1] = (TAG_APP_INFO_ENQUIRY >> 8) & 0xFF;
- data[2] = TAG_APP_INFO_ENQUIRY & 0xFF;
- data[3] = 0;
+ data[0] = (TAG_APP_INFO_ENQUIRY >> 16) & 0xFF;
+ data[1] = (TAG_APP_INFO_ENQUIRY >> 8) & 0xFF;
+ data[2] = TAG_APP_INFO_ENQUIRY & 0xFF;
+ data[3] = 0;
- return private->funcs->send_data(private->funcs->arg, session_number, data, 4);
+ return ai->funcs->send_data(ai->funcs->arg, session_number, data, 4);
}
-int en50221_app_ai_entermenu(en50221_app_ai ai, uint16_t session_number)
+int en50221_app_ai_entermenu(struct en50221_app_ai *ai,
+ uint16_t session_number)
{
- struct en50221_app_ai_private *private = (struct en50221_app_ai_private *) ai;
- uint8_t data[4];
+ uint8_t data[4];
- data[0] = (TAG_ENTER_MENU >> 16) & 0xFF;
- data[1] = (TAG_ENTER_MENU >> 8) & 0xFF;
- data[2] = TAG_ENTER_MENU & 0xFF;
- data[3] = 0;
+ data[0] = (TAG_ENTER_MENU >> 16) & 0xFF;
+ data[1] = (TAG_ENTER_MENU >> 8) & 0xFF;
+ data[2] = TAG_ENTER_MENU & 0xFF;
+ data[3] = 0;
- return private->funcs->send_data(private->funcs->arg, session_number, data, 4);
+ return ai->funcs->send_data(ai->funcs->arg, session_number, data, 4);
}
-int en50221_app_ai_message(en50221_app_ai ai,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length)
+int en50221_app_ai_message(struct en50221_app_ai *ai,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data, uint32_t data_length)
{
- struct en50221_app_ai_private *private = (struct en50221_app_ai_private *) ai;
- (void) resource_id;
-
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
-
- switch(tag)
- {
- case TAG_APP_INFO:
- return en50221_app_ai_parse_app_info(private, slot_id, session_number, data+3, data_length-3);
- }
-
- print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
- return -1;
+ (void) resource_id;
+
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+
+ switch (tag) {
+ case TAG_APP_INFO:
+ return en50221_app_ai_parse_app_info(ai, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ }
+
+ print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
+ return -1;
}
@@ -136,50 +137,55 @@ int en50221_app_ai_message(en50221_app_ai ai,
-static int en50221_app_ai_parse_app_info(struct en50221_app_ai_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_ai_parse_app_info(struct en50221_app_ai *ai,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // parse the length field
- int length_field_len;
- uint16_t asn_data_length;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %02x\n", slot_id);
- return -1;
- }
-
- // check it
- if (asn_data_length < 6) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (asn_data_length > (data_length - length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t *app_info = data + length_field_len;
-
- // parse the fields
- uint8_t application_type = app_info[0];
- uint16_t application_manufacturer = (app_info[1] << 8) | app_info[2];
- uint16_t manufacturer_code = (app_info[3] << 8) | app_info[4];
- uint8_t menu_string_length = app_info[5];
- uint8_t *menu_string = app_info + 6;
-
- // check the menu_string_length
- if (menu_string_length > (asn_data_length-6)) {
- print(LOG_LEVEL, ERROR, 1, "Received bad menu string length - adjusting\n");
- menu_string_length = asn_data_length-6;
- }
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_ai_callback cb = private->callback;
- void *cb_arg = private->callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, application_type,
- application_manufacturer, manufacturer_code, menu_string_length, menu_string);
- }
- return 0;
+ // parse the length field
+ int length_field_len;
+ uint16_t asn_data_length;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %02x\n",
+ slot_id);
+ return -1;
+ }
+ // check it
+ if (asn_data_length < 6) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t *app_info = data + length_field_len;
+
+ // parse the fields
+ uint8_t application_type = app_info[0];
+ uint16_t application_manufacturer = (app_info[1] << 8) | app_info[2];
+ uint16_t manufacturer_code = (app_info[3] << 8) | app_info[4];
+ uint8_t menu_string_length = app_info[5];
+ uint8_t *menu_string = app_info + 6;
+
+ // check the menu_string_length
+ if (menu_string_length > (asn_data_length - 6)) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received bad menu string length - adjusting\n");
+ menu_string_length = asn_data_length - 6;
+ }
+ // tell the app
+ pthread_mutex_lock(&ai->lock);
+ en50221_app_ai_callback cb = ai->callback;
+ void *cb_arg = ai->callback_arg;
+ pthread_mutex_unlock(&ai->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number,
+ application_type, application_manufacturer,
+ manufacturer_code, menu_string_length,
+ menu_string);
+ }
+ return 0;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ai.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ai.h
index 32d6e07..18b5cd2 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ai.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ai.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APPLICATION_AI_H__
#define __EN50221_APPLICATION_AI_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -52,15 +51,19 @@ extern "C"
* @param menu_string The menu string itself.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_ai_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t application_type, uint16_t application_manufacturer,
- uint16_t manufacturer_code, uint8_t menu_string_length,
- uint8_t *menu_string);
+typedef int (*en50221_app_ai_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t application_type,
+ uint16_t application_manufacturer,
+ uint16_t manufacturer_code,
+ uint8_t menu_string_length,
+ uint8_t * menu_string);
/**
* Opaque type representing an application information resource.
*/
-typedef void *en50221_app_ai;
+struct en50221_app_ai;
/**
* Create an instance of an application information resource.
@@ -68,14 +71,14 @@ typedef void *en50221_app_ai;
* @param funcs Send functions to use.
* @return Instance, or NULL on failure.
*/
-extern en50221_app_ai en50221_app_ai_create(struct en50221_app_send_functions *funcs);
+extern struct en50221_app_ai *en50221_app_ai_create(struct en50221_app_send_functions *funcs);
/**
* Destroy an instance of an application information resource.
*
* @param ai Instance to destroy.
*/
-extern void en50221_app_ai_destroy(en50221_app_ai ai);
+extern void en50221_app_ai_destroy(struct en50221_app_ai *ai);
/**
* Register a callback for reception of application_info objects.
@@ -84,7 +87,9 @@ extern void en50221_app_ai_destroy(en50221_app_ai ai);
* @param callback Callback function.
* @param arg Private argument passed during calls to the callback.
*/
-extern void en50221_app_ai_register_callback(en50221_app_ai ai, en50221_app_ai_callback, void *arg);
+extern void en50221_app_ai_register_callback(struct en50221_app_ai *ai,
+ en50221_app_ai_callback,
+ void *arg);
/**
* send a enquiry for the app_info provided by a module
@@ -93,7 +98,8 @@ extern void en50221_app_ai_register_callback(en50221_app_ai ai, en50221_app_ai_c
* @param session_number Session to send on.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_ai_enquiry(en50221_app_ai ai, uint16_t session_number);
+extern int en50221_app_ai_enquiry(struct en50221_app_ai *ai,
+ uint16_t session_number);
/**
* send a enter_menu tag, this will make the application
@@ -103,7 +109,8 @@ extern int en50221_app_ai_enquiry(en50221_app_ai ai, uint16_t session_number);
* @param session_number Session to send on.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_ai_entermenu(en50221_app_ai ai, uint16_t session_number);
+extern int en50221_app_ai_entermenu(struct en50221_app_ai *ai,
+ uint16_t session_number);
/**
* Pass data received for this resource into it for parsing.
@@ -116,14 +123,14 @@ extern int en50221_app_ai_entermenu(en50221_app_ai ai, uint16_t session_number);
* @param data_length Length of data in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_ai_message(en50221_app_ai ai,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_app_ai_message(struct en50221_app_ai *ai,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t *data,
+ uint32_t data_length);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_auth.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_auth.c
index 8826c3b..a8902c1 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_auth.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_auth.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
@@ -28,152 +28,153 @@
#include "en50221_app_tags.h"
#include "asn_1.h"
-struct en50221_app_auth_private {
- struct en50221_app_send_functions *funcs;
+struct en50221_app_auth {
+ struct en50221_app_send_functions *funcs;
- en50221_app_auth_request_callback callback;
- void *callback_arg;
+ en50221_app_auth_request_callback callback;
+ void *callback_arg;
- pthread_mutex_t lock;
+ pthread_mutex_t lock;
};
-static int en50221_app_auth_parse_request(struct en50221_app_auth_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
+static int en50221_app_auth_parse_request(struct en50221_app_auth *private,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
-en50221_app_auth en50221_app_auth_create(struct en50221_app_send_functions *funcs)
+struct en50221_app_auth *en50221_app_auth_create(struct en50221_app_send_functions *funcs)
{
- struct en50221_app_auth_private *private = NULL;
+ struct en50221_app_auth *auth = NULL;
- // create structure and set it up
- private = malloc(sizeof(struct en50221_app_auth_private));
- if (private == NULL) {
- return NULL;
- }
- private->funcs = funcs;
- private->callback = NULL;
+ // create structure and set it up
+ auth = malloc(sizeof(struct en50221_app_auth));
+ if (auth == NULL) {
+ return NULL;
+ }
+ auth->funcs = funcs;
+ auth->callback = NULL;
- pthread_mutex_init(&private->lock, NULL);
+ pthread_mutex_init(&auth->lock, NULL);
- // done
- return private;
+ // done
+ return auth;
}
-void en50221_app_auth_destroy(en50221_app_auth auth)
+void en50221_app_auth_destroy(struct en50221_app_auth *auth)
{
- struct en50221_app_auth_private *private = (struct en50221_app_auth_private *) auth;
-
- pthread_mutex_destroy(&private->lock);
- free(private);
+ pthread_mutex_destroy(&auth->lock);
+ free(auth);
}
-void en50221_app_auth_register_request_callback(en50221_app_auth auth,
- en50221_app_auth_request_callback callback, void *arg)
+void en50221_app_auth_register_request_callback(struct en50221_app_auth *auth,
+ en50221_app_auth_request_callback callback, void *arg)
{
- struct en50221_app_auth_private *private = (struct en50221_app_auth_private *) auth;
-
- pthread_mutex_lock(&private->lock);
- private->callback = callback;
- private->callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&auth->lock);
+ auth->callback = callback;
+ auth->callback_arg = arg;
+ pthread_mutex_unlock(&auth->lock);
}
-int en50221_app_auth_send(en50221_app_auth auth,
- uint16_t session_number,
- uint16_t auth_protocol_id, uint8_t *auth_data,
- uint32_t auth_data_length)
+int en50221_app_auth_send(struct en50221_app_auth *auth,
+ uint16_t session_number,
+ uint16_t auth_protocol_id, uint8_t * auth_data,
+ uint32_t auth_data_length)
{
- struct en50221_app_auth_private *private = (struct en50221_app_auth_private *) auth;
- uint8_t buf[10];
-
- // the header
- buf[0] = (TAG_AUTH_RESP >> 16) & 0xFF;
- buf[1] = (TAG_AUTH_RESP >> 8) & 0xFF;
- buf[2] = TAG_AUTH_RESP & 0xFF;
-
- // encode the length field
- int length_field_len;
- if ((length_field_len = asn_1_encode(auth_data_length+2, buf+3, 3)) < 0) {
- return -1;
- }
-
- // the phase_id
- buf[3+length_field_len] = auth_protocol_id>>8;
- buf[3+length_field_len+1] = auth_protocol_id;
-
- // build the iovecs
- struct iovec iov[2];
- iov[0].iov_base = buf;
- iov[0].iov_len = 3+length_field_len+2;
- iov[1].iov_base = auth_data;
- iov[1].iov_len = auth_data_length;
-
- // sendit
- return private->funcs->send_datav(private->funcs->arg, session_number, iov, 2);
+ uint8_t buf[10];
+
+ // the header
+ buf[0] = (TAG_AUTH_RESP >> 16) & 0xFF;
+ buf[1] = (TAG_AUTH_RESP >> 8) & 0xFF;
+ buf[2] = TAG_AUTH_RESP & 0xFF;
+
+ // encode the length field
+ int length_field_len;
+ if ((length_field_len = asn_1_encode(auth_data_length + 2, buf + 3, 3)) < 0) {
+ return -1;
+ }
+ // the phase_id
+ buf[3 + length_field_len] = auth_protocol_id >> 8;
+ buf[3 + length_field_len + 1] = auth_protocol_id;
+
+ // build the iovecs
+ struct iovec iov[2];
+ iov[0].iov_base = buf;
+ iov[0].iov_len = 3 + length_field_len + 2;
+ iov[1].iov_base = auth_data;
+ iov[1].iov_len = auth_data_length;
+
+ // sendit
+ return auth->funcs->send_datav(auth->funcs->arg, session_number,
+ iov, 2);
}
-int en50221_app_auth_message(en50221_app_auth auth,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length)
+int en50221_app_auth_message(struct en50221_app_auth *auth,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data, uint32_t data_length)
{
- struct en50221_app_auth_private *private = (struct en50221_app_auth_private *) auth;
- (void) resource_id;
-
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
-
- switch(tag)
- {
- case TAG_AUTH_REQ:
- return en50221_app_auth_parse_request(private, slot_id, session_number, data+3, data_length-3);
- }
-
- print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
- return -1;
+ (void) resource_id;
+
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+
+ switch (tag) {
+ case TAG_AUTH_REQ:
+ return en50221_app_auth_parse_request(auth, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ }
+
+ print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
+ return -1;
}
-static int en50221_app_auth_parse_request(struct en50221_app_auth_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_auth_parse_request(struct en50221_app_auth *auth,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length < 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t *auth_data = data + length_field_len;
-
- // process it
- uint16_t auth_protocol_id = (auth_data[0]<<8) | auth_data[1];
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_auth_request_callback cb = private->callback;
- void *cb_arg = private->callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, auth_protocol_id, auth_data+2, asn_data_length-2);
- }
- return 0;
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ // check it
+ if (asn_data_length < 2) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t *auth_data = data + length_field_len;
+
+ // process it
+ uint16_t auth_protocol_id = (auth_data[0] << 8) | auth_data[1];
+
+ // tell the app
+ pthread_mutex_lock(&auth->lock);
+ en50221_app_auth_request_callback cb = auth->callback;
+ void *cb_arg = auth->callback_arg;
+ pthread_mutex_unlock(&auth->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number,
+ auth_protocol_id, auth_data + 2,
+ asn_data_length - 2);
+ }
+ return 0;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_auth.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_auth.h
index c275089..2b1d2e7 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_auth.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_auth.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APPLICATION_auth_H__
#define __EN50221_APPLICATION_auth_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -46,14 +45,17 @@ extern "C"
* @param auth_data_lenghth Number of bytes.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_auth_request_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint16_t auth_protcol_id, uint8_t *auth_data,
- uint32_t auth_data_length);
+typedef int (*en50221_app_auth_request_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint16_t auth_protcol_id,
+ uint8_t *auth_data,
+ uint32_t auth_data_length);
/**
* Opaque type representing a auth resource.
*/
-typedef void *en50221_app_auth;
+struct en50221_app_auth;
/**
* Create an instance of the auth resource.
@@ -61,14 +63,14 @@ typedef void *en50221_app_auth;
* @param funcs Send functions to use.
* @return Instance, or NULL on failure.
*/
-extern en50221_app_auth en50221_app_auth_create(struct en50221_app_send_functions *funcs);
+extern struct en50221_app_auth *en50221_app_auth_create(struct en50221_app_send_functions *funcs);
/**
* Destroy an instance of the auth resource.
*
* @param auth Instance to destroy.
*/
-extern void en50221_app_auth_destroy(en50221_app_auth auth);
+extern void en50221_app_auth_destroy(struct en50221_app_auth *auth);
/**
* Register the callback for when we receive a request.
@@ -77,8 +79,9 @@ extern void en50221_app_auth_destroy(en50221_app_auth auth);
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_auth_register_request_callback(en50221_app_auth auth,
- en50221_app_auth_request_callback callback, void *arg);
+extern void en50221_app_auth_register_request_callback(struct en50221_app_auth *auth,
+ en50221_app_auth_request_callback callback,
+ void *arg);
/**
* Send an auth response to the CAM.
@@ -90,10 +93,11 @@ extern void en50221_app_auth_register_request_callback(en50221_app_auth auth,
* @param auth_data_length Number of bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_auth_send(en50221_app_auth auth,
- uint16_t session_number,
- uint16_t auth_protocol_id, uint8_t *auth_data,
- uint32_t auth_data_length);
+extern int en50221_app_auth_send(struct en50221_app_auth *auth,
+ uint16_t session_number,
+ uint16_t auth_protocol_id,
+ uint8_t *auth_data,
+ uint32_t auth_data_length);
/**
* Pass data received for this resource into it for parsing.
@@ -106,14 +110,14 @@ extern int en50221_app_auth_send(en50221_app_auth auth,
* @param data_length Length of data in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_auth_message(en50221_app_auth auth,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_app_auth_message(struct en50221_app_auth *auth,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t *data,
+ uint32_t data_length);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ca.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ca.c
index 0bdf74f..22d4499 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ca.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ca.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
@@ -34,272 +34,277 @@
#define TAG_CA_PMT 0x9f8032
#define TAG_CA_PMT_REPLY 0x9f8033
-struct en50221_app_ca_private {
- struct en50221_app_send_functions *funcs;
+struct en50221_app_ca {
+ struct en50221_app_send_functions *funcs;
- en50221_app_ca_info_callback ca_info_callback;
- void *ca_info_callback_arg;
+ en50221_app_ca_info_callback ca_info_callback;
+ void *ca_info_callback_arg;
- en50221_app_ca_pmt_reply_callback ca_pmt_reply_callback;
- void *ca_pmt_reply_callback_arg;
+ en50221_app_ca_pmt_reply_callback ca_pmt_reply_callback;
+ void *ca_pmt_reply_callback_arg;
- pthread_mutex_t lock;
+ pthread_mutex_t lock;
};
struct ca_pmt_descriptor {
- uint8_t *descriptor;
- uint16_t length;
+ uint8_t *descriptor;
+ uint16_t length;
- struct ca_pmt_descriptor *next;
+ struct ca_pmt_descriptor *next;
};
struct ca_pmt_stream {
- uint8_t stream_type;
- uint16_t pid;
- struct ca_pmt_descriptor *descriptors;
- uint32_t descriptors_length;
- uint32_t descriptors_count;
+ uint8_t stream_type;
+ uint16_t pid;
+ struct ca_pmt_descriptor *descriptors;
+ uint32_t descriptors_length;
+ uint32_t descriptors_count;
- struct ca_pmt_stream *next;
+ struct ca_pmt_stream *next;
};
-static int en50221_ca_extract_pmt_descriptors(struct mpeg_pmt_section *pmt, struct ca_pmt_descriptor **outdescriptors);
-static int en50221_ca_extract_streams(struct mpeg_pmt_section *pmt, struct ca_pmt_stream **outstreams);
+static int en50221_ca_extract_pmt_descriptors(struct mpeg_pmt_section *pmt,
+ struct ca_pmt_descriptor **outdescriptors);
+static int en50221_ca_extract_streams(struct mpeg_pmt_section *pmt,
+ struct ca_pmt_stream **outstreams);
static void en50221_ca_try_move_pmt_descriptors(struct ca_pmt_descriptor **pmt_descriptors,
- struct ca_pmt_stream **pmt_streams);
+ struct ca_pmt_stream **pmt_streams);
static uint32_t en50221_ca_calculate_length(struct ca_pmt_descriptor *pmt_descriptors,
- uint32_t *pmt_descriptors_length,
- struct ca_pmt_stream *pmt_streams);
-static int en50221_app_ca_parse_info(struct en50221_app_ca_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-static int en50221_app_ca_parse_reply(struct en50221_app_ca_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
+ uint32_t *pmt_descriptors_length,
+ struct ca_pmt_stream *pmt_streams);
+static int en50221_app_ca_parse_info(struct en50221_app_ca *ca,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data, uint32_t data_length);
+static int en50221_app_ca_parse_reply(struct en50221_app_ca *ca,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
-en50221_app_ca en50221_app_ca_create(struct en50221_app_send_functions *funcs)
+struct en50221_app_ca *en50221_app_ca_create(struct en50221_app_send_functions *funcs)
{
- struct en50221_app_ca_private *private = NULL;
+ struct en50221_app_ca *ca = NULL;
- // create structure and set it up
- private = malloc(sizeof(struct en50221_app_ca_private));
- if (private == NULL) {
- return NULL;
- }
- private->funcs = funcs;
- private->ca_info_callback = NULL;
- private->ca_pmt_reply_callback = NULL;
+ // create structure and set it up
+ ca = malloc(sizeof(struct en50221_app_ca));
+ if (ca == NULL) {
+ return NULL;
+ }
+ ca->funcs = funcs;
+ ca->ca_info_callback = NULL;
+ ca->ca_pmt_reply_callback = NULL;
- pthread_mutex_init(&private->lock, NULL);
+ pthread_mutex_init(&ca->lock, NULL);
- // done
- return private;
+ // done
+ return ca;
}
-void en50221_app_ca_destroy(en50221_app_ca ca)
+void en50221_app_ca_destroy(struct en50221_app_ca *ca)
{
- struct en50221_app_ca_private *private = (struct en50221_app_ca_private *) ca;
-
- pthread_mutex_destroy(&private->lock);
- free(private);
+ pthread_mutex_destroy(&ca->lock);
+ free(ca);
}
-void en50221_app_ca_register_info_callback(en50221_app_ca ca,
- en50221_app_ca_info_callback callback, void *arg)
+void en50221_app_ca_register_info_callback(struct en50221_app_ca *ca,
+ en50221_app_ca_info_callback
+ callback, void *arg)
{
- struct en50221_app_ca_private *private = (struct en50221_app_ca_private *) ca;
-
- pthread_mutex_lock(&private->lock);
- private->ca_info_callback = callback;
- private->ca_info_callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&ca->lock);
+ ca->ca_info_callback = callback;
+ ca->ca_info_callback_arg = arg;
+ pthread_mutex_unlock(&ca->lock);
}
-void en50221_app_ca_register_pmt_reply_callback(en50221_app_ca ca,
- en50221_app_ca_pmt_reply_callback callback, void *arg)
+void en50221_app_ca_register_pmt_reply_callback(struct en50221_app_ca *ca,
+ en50221_app_ca_pmt_reply_callback
+ callback, void *arg)
{
- struct en50221_app_ca_private *private = (struct en50221_app_ca_private *) ca;
-
- pthread_mutex_lock(&private->lock);
- private->ca_pmt_reply_callback = callback;
- private->ca_pmt_reply_callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&ca->lock);
+ ca->ca_pmt_reply_callback = callback;
+ ca->ca_pmt_reply_callback_arg = arg;
+ pthread_mutex_unlock(&ca->lock);
}
-int en50221_app_ca_info_enq(en50221_app_ca ca,
- uint16_t session_number)
+int en50221_app_ca_info_enq(struct en50221_app_ca *ca,
+ uint16_t session_number)
{
- struct en50221_app_ca_private *private = (struct en50221_app_ca_private *) ca;
- uint8_t data[4];
-
- data[0] = (TAG_CA_INFO_ENQUIRY >> 16) & 0xFF;
- data[1] = (TAG_CA_INFO_ENQUIRY >> 8) & 0xFF;
- data[2] = TAG_CA_INFO_ENQUIRY & 0xFF;
- data[3] = 0;
- return private->funcs->send_data(private->funcs->arg, session_number, data, 4);
+ uint8_t data[4];
+
+ data[0] = (TAG_CA_INFO_ENQUIRY >> 16) & 0xFF;
+ data[1] = (TAG_CA_INFO_ENQUIRY >> 8) & 0xFF;
+ data[2] = TAG_CA_INFO_ENQUIRY & 0xFF;
+ data[3] = 0;
+ return ca->funcs->send_data(ca->funcs->arg, session_number, data, 4);
}
-int en50221_app_ca_pmt(en50221_app_ca ca,
- uint16_t session_number,
- uint8_t *ca_pmt,
- uint32_t ca_pmt_length)
+int en50221_app_ca_pmt(struct en50221_app_ca *ca,
+ uint16_t session_number,
+ uint8_t * ca_pmt, uint32_t ca_pmt_length)
{
- struct en50221_app_ca_private *private = (struct en50221_app_ca_private *) ca;
- uint8_t buf[10];
-
- // set up the tag
- buf[0] = (TAG_CA_PMT >> 16) & 0xFF;
- buf[1] = (TAG_CA_PMT >> 8) & 0xFF;
- buf[2] = TAG_CA_PMT & 0xFF;
-
- // encode the length field
- int length_field_len;
- if ((length_field_len = asn_1_encode(ca_pmt_length, buf+3, 3)) < 0) {
- return -1;
- }
-
- // build the iovecs
- struct iovec iov[2];
- iov[0].iov_base = buf;
- iov[0].iov_len = 3+length_field_len;
- iov[1].iov_base = ca_pmt;
- iov[1].iov_len = ca_pmt_length;
-
- // create the data and send it
- return private->funcs->send_datav(private->funcs->arg, session_number, iov, 2);
+ uint8_t buf[10];
+
+ // set up the tag
+ buf[0] = (TAG_CA_PMT >> 16) & 0xFF;
+ buf[1] = (TAG_CA_PMT >> 8) & 0xFF;
+ buf[2] = TAG_CA_PMT & 0xFF;
+
+ // encode the length field
+ int length_field_len;
+ if ((length_field_len = asn_1_encode(ca_pmt_length, buf + 3, 3)) < 0) {
+ return -1;
+ }
+ // build the iovecs
+ struct iovec iov[2];
+ iov[0].iov_base = buf;
+ iov[0].iov_len = 3 + length_field_len;
+ iov[1].iov_base = ca_pmt;
+ iov[1].iov_len = ca_pmt_length;
+
+ // create the data and send it
+ return ca->funcs->send_datav(ca->funcs->arg, session_number, iov, 2);
}
-int en50221_app_ca_message(en50221_app_ca ca,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length)
+int en50221_app_ca_message(struct en50221_app_ca *ca,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data, uint32_t data_length)
{
- struct en50221_app_ca_private *private = (struct en50221_app_ca_private *) ca;
- (void)resource_id;
-
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
-
- switch(tag)
- {
- case TAG_CA_INFO:
- return en50221_app_ca_parse_info(private, slot_id, session_number, data+3, data_length-3);
- case TAG_CA_PMT_REPLY:
- return en50221_app_ca_parse_reply(private, slot_id, session_number, data+3, data_length-3);
- }
-
- print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
- return -1;
+ (void) resource_id;
+
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+
+ switch (tag) {
+ case TAG_CA_INFO:
+ return en50221_app_ca_parse_info(ca, slot_id,
+ session_number, data + 3,
+ data_length - 3);
+ case TAG_CA_PMT_REPLY:
+ return en50221_app_ca_parse_reply(ca, slot_id,
+ session_number, data + 3,
+ data_length - 3);
+ }
+
+ print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
+ return -1;
}
-int en50221_ca_format_pmt(struct mpeg_pmt_section *pmt, uint8_t *data, uint32_t data_length,
- int move_ca_descriptors,
- uint8_t ca_pmt_list_management, uint8_t ca_pmt_cmd_id)
+int en50221_ca_format_pmt(struct mpeg_pmt_section *pmt, uint8_t * data,
+ uint32_t data_length, int move_ca_descriptors,
+ uint8_t ca_pmt_list_management,
+ uint8_t ca_pmt_cmd_id)
{
- struct ca_pmt_descriptor *pmt_descriptors = NULL;
- uint32_t pmt_descriptors_length = 0;
- struct ca_pmt_stream *pmt_streams = NULL;
- uint32_t total_required_length = 0;
- struct ca_pmt_descriptor *cur_d;
- struct ca_pmt_stream *cur_s;
- int result = -1;
-
- // extract the descriptors and streams
- if (en50221_ca_extract_pmt_descriptors(pmt, &pmt_descriptors))
- goto cleanup;
- if (en50221_ca_extract_streams(pmt, &pmt_streams))
- goto cleanup;
-
- // try and merge them if we have no PMT descriptors
- if ((pmt_descriptors == NULL) && move_ca_descriptors) {
- en50221_ca_try_move_pmt_descriptors(&pmt_descriptors, &pmt_streams);
- }
-
- // calculate the length of all descriptors/streams and the total length required
- total_required_length = en50221_ca_calculate_length(pmt_descriptors, &pmt_descriptors_length, pmt_streams);
-
- // ensure we were supplied with enough data
- if (total_required_length > data_length) {
- goto cleanup;
- }
-
- // format the start of the PMT
- uint32_t data_pos = 0;
- data[data_pos++] = ca_pmt_list_management;
- data[data_pos++] = mpeg_pmt_section_program_number(pmt) >> 8;
- data[data_pos++] = mpeg_pmt_section_program_number(pmt);
- data[data_pos++] = (pmt->head.version_number << 1) | pmt->head.current_next_indicator;
- data[data_pos++] = (pmt_descriptors_length >> 8) & 0x0f;
- data[data_pos++] = pmt_descriptors_length;
-
- // append the PMT descriptors
- if (pmt_descriptors_length) {
- data[data_pos++] = ca_pmt_cmd_id;
- struct ca_pmt_descriptor *cur_d = pmt_descriptors;
- while(cur_d) {
- memcpy(data+data_pos, cur_d->descriptor, cur_d->length);
- data_pos += cur_d->length;
- cur_d = cur_d->next;
- }
- }
-
- // now, append the streams
- cur_s = pmt_streams;
- while(cur_s) {
- data[data_pos++] = cur_s->stream_type;
- data[data_pos++] = (cur_s->pid >> 8) & 0x1f;
- data[data_pos++] = cur_s->pid;
- data[data_pos++] = (cur_s->descriptors_length >> 8) & 0x0f;
- data[data_pos++] = cur_s->descriptors_length;
-
- // append the stream descriptors
- if (cur_s->descriptors_length) {
- data[data_pos++] = ca_pmt_cmd_id;
- struct ca_pmt_descriptor *cur_d = cur_s->descriptors;
- while(cur_d) {
- memcpy(data+data_pos, cur_d->descriptor, cur_d->length);
- data_pos += cur_d->length;
- cur_d = cur_d->next;
- }
- }
- cur_s = cur_s->next;
- }
- result = data_pos;
-
-
-cleanup:
- // free the PMT descriptors
- cur_d = pmt_descriptors;
- while(cur_d) {
- struct ca_pmt_descriptor *next = cur_d->next;
- free(cur_d);
- cur_d = next;
- }
-
- // free the streams
- cur_s = pmt_streams;
- while(cur_s) {
- struct ca_pmt_stream *next_s = cur_s->next;
-
- // free the stream descriptors
- cur_d = cur_s->descriptors;
- while(cur_d) {
- struct ca_pmt_descriptor *next_d = cur_d->next;
- free(cur_d);
- cur_d = next_d;
- }
-
- free(cur_s);
- cur_s = next_s;
- }
- return result;
+ struct ca_pmt_descriptor *pmt_descriptors = NULL;
+ uint32_t pmt_descriptors_length = 0;
+ struct ca_pmt_stream *pmt_streams = NULL;
+ uint32_t total_required_length = 0;
+ struct ca_pmt_descriptor *cur_d;
+ struct ca_pmt_stream *cur_s;
+ int result = -1;
+
+ // extract the descriptors and streams
+ if (en50221_ca_extract_pmt_descriptors(pmt, &pmt_descriptors))
+ goto cleanup;
+ if (en50221_ca_extract_streams(pmt, &pmt_streams))
+ goto cleanup;
+
+ // try and merge them if we have no PMT descriptors
+ if ((pmt_descriptors == NULL) && move_ca_descriptors) {
+ en50221_ca_try_move_pmt_descriptors(&pmt_descriptors,
+ &pmt_streams);
+ }
+ // calculate the length of all descriptors/streams and the total length required
+ total_required_length =
+ en50221_ca_calculate_length(pmt_descriptors,
+ &pmt_descriptors_length,
+ pmt_streams);
+
+ // ensure we were supplied with enough data
+ if (total_required_length > data_length) {
+ goto cleanup;
+ }
+ // format the start of the PMT
+ uint32_t data_pos = 0;
+ data[data_pos++] = ca_pmt_list_management;
+ data[data_pos++] = mpeg_pmt_section_program_number(pmt) >> 8;
+ data[data_pos++] = mpeg_pmt_section_program_number(pmt);
+ data[data_pos++] =
+ (pmt->head.version_number << 1) | pmt->head.
+ current_next_indicator;
+ data[data_pos++] = (pmt_descriptors_length >> 8) & 0x0f;
+ data[data_pos++] = pmt_descriptors_length;
+
+ // append the PMT descriptors
+ if (pmt_descriptors_length) {
+ data[data_pos++] = ca_pmt_cmd_id;
+ cur_d = pmt_descriptors;
+ while (cur_d) {
+ memcpy(data + data_pos, cur_d->descriptor,
+ cur_d->length);
+ data_pos += cur_d->length;
+ cur_d = cur_d->next;
+ }
+ }
+ // now, append the streams
+ cur_s = pmt_streams;
+ while (cur_s) {
+ data[data_pos++] = cur_s->stream_type;
+ data[data_pos++] = (cur_s->pid >> 8) & 0x1f;
+ data[data_pos++] = cur_s->pid;
+ data[data_pos++] = (cur_s->descriptors_length >> 8) & 0x0f;
+ data[data_pos++] = cur_s->descriptors_length;
+
+ // append the stream descriptors
+ if (cur_s->descriptors_length) {
+ data[data_pos++] = ca_pmt_cmd_id;
+ cur_d = cur_s->descriptors;
+ while (cur_d) {
+ memcpy(data + data_pos, cur_d->descriptor,
+ cur_d->length);
+ data_pos += cur_d->length;
+ cur_d = cur_d->next;
+ }
+ }
+ cur_s = cur_s->next;
+ }
+ result = data_pos;
+
+
+ cleanup:
+ // free the PMT descriptors
+ cur_d = pmt_descriptors;
+ while (cur_d) {
+ struct ca_pmt_descriptor *next = cur_d->next;
+ free(cur_d);
+ cur_d = next;
+ }
+
+ // free the streams
+ cur_s = pmt_streams;
+ while (cur_s) {
+ struct ca_pmt_stream *next_s = cur_s->next;
+
+ // free the stream descriptors
+ cur_d = cur_s->descriptors;
+ while (cur_d) {
+ struct ca_pmt_descriptor *next_d = cur_d->next;
+ free(cur_d);
+ cur_d = next_d;
+ }
+
+ free(cur_s);
+ cur_s = next_s;
+ }
+ return result;
}
@@ -308,308 +313,319 @@ cleanup:
-static int en50221_ca_extract_pmt_descriptors(struct mpeg_pmt_section *pmt, struct ca_pmt_descriptor **outdescriptors)
+static int en50221_ca_extract_pmt_descriptors(struct mpeg_pmt_section *pmt,
+ struct ca_pmt_descriptor **outdescriptors)
{
- struct ca_pmt_descriptor *descriptors = NULL;
- struct ca_pmt_descriptor *descriptors_tail = NULL;
- struct ca_pmt_descriptor *cur_d;
-
- struct descriptor *cur_descriptor;
- mpeg_pmt_section_descriptors_for_each(pmt, cur_descriptor) {
- if (cur_descriptor->tag == dtag_mpeg_ca) {
- // create a new structure for this one
- struct ca_pmt_descriptor *new_d = malloc(sizeof(struct ca_pmt_descriptor));
- if (new_d == NULL) {
- goto error_exit;
- }
- new_d->descriptor = (uint8_t*) cur_descriptor;
- new_d->length = cur_descriptor->len+2;
- new_d->next = NULL;
-
- // append it to the list
- if (descriptors == NULL) {
- descriptors = new_d;
- } else {
- descriptors_tail->next = new_d;
- }
- descriptors_tail = new_d;
- }
- }
- *outdescriptors = descriptors;
- return 0;
+ struct ca_pmt_descriptor *descriptors = NULL;
+ struct ca_pmt_descriptor *descriptors_tail = NULL;
+ struct ca_pmt_descriptor *cur_d;
+
+ struct descriptor *cur_descriptor;
+ mpeg_pmt_section_descriptors_for_each(pmt, cur_descriptor) {
+ if (cur_descriptor->tag == dtag_mpeg_ca) {
+ // create a new structure for this one
+ struct ca_pmt_descriptor *new_d =
+ malloc(sizeof(struct ca_pmt_descriptor));
+ if (new_d == NULL) {
+ goto error_exit;
+ }
+ new_d->descriptor = (uint8_t *) cur_descriptor;
+ new_d->length = cur_descriptor->len + 2;
+ new_d->next = NULL;
+
+ // append it to the list
+ if (descriptors == NULL) {
+ descriptors = new_d;
+ } else {
+ descriptors_tail->next = new_d;
+ }
+ descriptors_tail = new_d;
+ }
+ }
+ *outdescriptors = descriptors;
+ return 0;
error_exit:
- cur_d = descriptors;
- while(cur_d) {
- struct ca_pmt_descriptor *next = cur_d->next;
- free(cur_d);
- cur_d = next;
- }
- return -1;
+ cur_d = descriptors;
+ while (cur_d) {
+ struct ca_pmt_descriptor *next = cur_d->next;
+ free(cur_d);
+ cur_d = next;
+ }
+ return -1;
}
-static int en50221_ca_extract_streams(struct mpeg_pmt_section *pmt, struct ca_pmt_stream **outstreams)
+static int en50221_ca_extract_streams(struct mpeg_pmt_section *pmt,
+ struct ca_pmt_stream **outstreams)
{
- struct ca_pmt_stream *streams = NULL;
- struct ca_pmt_stream *streams_tail = NULL;
- struct mpeg_pmt_stream *cur_stream;
- struct descriptor *cur_descriptor;
- struct ca_pmt_stream *cur_s;
-
- mpeg_pmt_section_streams_for_each(pmt, cur_stream) {
- struct ca_pmt_descriptor *descriptors_tail = NULL;
-
- // create a new structure
- struct ca_pmt_stream *new_s = malloc(sizeof(struct ca_pmt_stream));
- if (new_s == NULL) {
- goto exit_cleanup;
- }
- new_s->stream_type = cur_stream->stream_type;
- new_s->pid = cur_stream->pid;
- new_s->descriptors = NULL;
- new_s->next = NULL;
- new_s->descriptors_count = 0;
-
- // append it to the list
- if (streams == NULL) {
- streams = new_s;
- } else {
- streams_tail->next = new_s;
- }
- streams_tail = new_s;
-
- // now process the descriptors
- mpeg_pmt_stream_descriptors_for_each(cur_stream, cur_descriptor) {
- if (cur_descriptor->tag == dtag_mpeg_ca) {
- // create a new structure
- struct ca_pmt_descriptor *new_d = malloc(sizeof(struct ca_pmt_descriptor));
- if (new_d == NULL) {
- goto exit_cleanup;
- }
- new_d->descriptor = (uint8_t*) cur_descriptor;
- new_d->length = cur_descriptor->len+2;
- new_d->next = NULL;
-
- // append it to the list
- if (new_s->descriptors == NULL) {
- new_s->descriptors = new_d;
- } else {
- descriptors_tail->next = new_d;
- }
- descriptors_tail = new_d;
- new_s->descriptors_count++;
- }
- }
- }
- *outstreams = streams;
- return 0;
+ struct ca_pmt_stream *streams = NULL;
+ struct ca_pmt_stream *streams_tail = NULL;
+ struct mpeg_pmt_stream *cur_stream;
+ struct descriptor *cur_descriptor;
+ struct ca_pmt_stream *cur_s;
+
+ mpeg_pmt_section_streams_for_each(pmt, cur_stream) {
+ struct ca_pmt_descriptor *descriptors_tail = NULL;
+
+ // create a new structure
+ struct ca_pmt_stream *new_s =
+ malloc(sizeof(struct ca_pmt_stream));
+ if (new_s == NULL) {
+ goto exit_cleanup;
+ }
+ new_s->stream_type = cur_stream->stream_type;
+ new_s->pid = cur_stream->pid;
+ new_s->descriptors = NULL;
+ new_s->next = NULL;
+ new_s->descriptors_count = 0;
+
+ // append it to the list
+ if (streams == NULL) {
+ streams = new_s;
+ } else {
+ streams_tail->next = new_s;
+ }
+ streams_tail = new_s;
+
+ // now process the descriptors
+ mpeg_pmt_stream_descriptors_for_each(cur_stream,
+ cur_descriptor) {
+ if (cur_descriptor->tag == dtag_mpeg_ca) {
+ // create a new structure
+ struct ca_pmt_descriptor *new_d =
+ malloc(sizeof(struct ca_pmt_descriptor));
+ if (new_d == NULL) {
+ goto exit_cleanup;
+ }
+ new_d->descriptor =
+ (uint8_t *) cur_descriptor;
+ new_d->length = cur_descriptor->len + 2;
+ new_d->next = NULL;
+
+ // append it to the list
+ if (new_s->descriptors == NULL) {
+ new_s->descriptors = new_d;
+ } else {
+ descriptors_tail->next = new_d;
+ }
+ descriptors_tail = new_d;
+ new_s->descriptors_count++;
+ }
+ }
+ }
+ *outstreams = streams;
+ return 0;
exit_cleanup:
- // free the streams
- cur_s = streams;
- while(cur_s) {
- struct ca_pmt_stream *next_s = cur_s->next;
-
- // free the stream descriptors
- struct ca_pmt_descriptor *cur_d = cur_s->descriptors;
- while(cur_d) {
- struct ca_pmt_descriptor *next_d = cur_d->next;
- free(cur_d);
- cur_d = next_d;
- }
-
- free(cur_s);
- cur_s = next_s;
- }
- return -1;
+ // free the streams
+ cur_s = streams;
+ while (cur_s) {
+ struct ca_pmt_stream *next_s = cur_s->next;
+
+ // free the stream descriptors
+ struct ca_pmt_descriptor *cur_d = cur_s->descriptors;
+ while (cur_d) {
+ struct ca_pmt_descriptor *next_d = cur_d->next;
+ free(cur_d);
+ cur_d = next_d;
+ }
+
+ free(cur_s);
+ cur_s = next_s;
+ }
+ return -1;
}
static void en50221_ca_try_move_pmt_descriptors(struct ca_pmt_descriptor **pmt_descriptors,
- struct ca_pmt_stream **pmt_streams)
+ struct ca_pmt_stream **pmt_streams)
{
- // get the first stream
- struct ca_pmt_stream *first_stream = *pmt_streams;
- if (first_stream == NULL)
- return;
-
- // Check that all the other streams with CA descriptors have exactly the same CA descriptors
- struct ca_pmt_stream *cur_stream = first_stream->next;
- while(cur_stream) {
- // if there are differing numbers of descriptors, exit right now
- if (cur_stream->descriptors_count != first_stream->descriptors_count)
- return;
-
- // now verify the descriptors match
- struct ca_pmt_descriptor *cur_descriptor = cur_stream->descriptors;
- struct ca_pmt_descriptor *first_cur_descriptor = first_stream->descriptors;
- while(cur_descriptor) {
- // check the descriptors are the same length
- if (cur_descriptor->length != first_cur_descriptor->length)
- return;
-
- // check their contents match
- if (memcmp(cur_descriptor->descriptor, first_cur_descriptor->descriptor, cur_descriptor->length)) {
- return;
- }
-
- // move to next
- cur_descriptor = cur_descriptor->next;
- first_cur_descriptor = first_cur_descriptor->next;
- }
-
- // move to next
- cur_stream = cur_stream->next;
- }
-
- // if we end up here, all descriptors in all streams matched
-
- // hook the first stream's descriptors into the PMT's
- *pmt_descriptors = first_stream->descriptors;
- first_stream->descriptors = NULL;
- first_stream->descriptors_count = 0;
-
- // now free up all the descriptors in the other streams
- cur_stream = first_stream->next;
- while(cur_stream) {
- struct ca_pmt_descriptor *cur_descriptor = cur_stream->descriptors;
- while(cur_descriptor) {
- struct ca_pmt_descriptor *next = cur_descriptor->next;
- free(cur_descriptor);
- cur_descriptor=next;
- }
- cur_stream->descriptors = NULL;
- cur_stream->descriptors_count = 0;
- cur_stream = cur_stream->next;
- }
+ // get the first stream
+ struct ca_pmt_stream *first_stream = *pmt_streams;
+ if (first_stream == NULL)
+ return;
+
+ // Check that all the other streams with CA descriptors have exactly the same CA descriptors
+ struct ca_pmt_stream *cur_stream = first_stream->next;
+ while (cur_stream) {
+ // if there are differing numbers of descriptors, exit right now
+ if (cur_stream->descriptors_count != first_stream->descriptors_count)
+ return;
+
+ // now verify the descriptors match
+ struct ca_pmt_descriptor *cur_descriptor = cur_stream->descriptors;
+ struct ca_pmt_descriptor *first_cur_descriptor = first_stream->descriptors;
+ while (cur_descriptor) {
+ // check the descriptors are the same length
+ if (cur_descriptor->length != first_cur_descriptor->length)
+ return;
+
+ // check their contents match
+ if (memcmp(cur_descriptor->descriptor,
+ first_cur_descriptor->descriptor,
+ cur_descriptor->length)) {
+ return;
+ }
+ // move to next
+ cur_descriptor = cur_descriptor->next;
+ first_cur_descriptor = first_cur_descriptor->next;
+ }
+
+ // move to next
+ cur_stream = cur_stream->next;
+ }
+
+ // if we end up here, all descriptors in all streams matched
+
+ // hook the first stream's descriptors into the PMT's
+ *pmt_descriptors = first_stream->descriptors;
+ first_stream->descriptors = NULL;
+ first_stream->descriptors_count = 0;
+
+ // now free up all the descriptors in the other streams
+ cur_stream = first_stream->next;
+ while (cur_stream) {
+ struct ca_pmt_descriptor *cur_descriptor = cur_stream->descriptors;
+ while (cur_descriptor) {
+ struct ca_pmt_descriptor *next = cur_descriptor->next;
+ free(cur_descriptor);
+ cur_descriptor = next;
+ }
+ cur_stream->descriptors = NULL;
+ cur_stream->descriptors_count = 0;
+ cur_stream = cur_stream->next;
+ }
}
static uint32_t en50221_ca_calculate_length(struct ca_pmt_descriptor *pmt_descriptors,
- uint32_t *pmt_descriptors_length,
- struct ca_pmt_stream *pmt_streams)
+ uint32_t *pmt_descriptors_length,
+ struct ca_pmt_stream *pmt_streams)
{
- uint32_t total_required_length = 6; // header
- struct ca_pmt_stream *cur_s;
-
- // calcuate the PMT descriptors length
- (*pmt_descriptors_length) = 0;
- struct ca_pmt_descriptor *cur_d = pmt_descriptors;
- while(cur_d) {
- (*pmt_descriptors_length) += cur_d->length;
- cur_d = cur_d->next;
- }
-
- // add on 1 byte for the ca_pmt_cmd_id if we have some descriptors.
- if (*pmt_descriptors_length)
- (*pmt_descriptors_length)++;
-
- // update the total required length
- total_required_length += *pmt_descriptors_length;
-
- // calculate the length of descriptors in the streams
- cur_s = pmt_streams;
- while(cur_s) {
- // calculate the size of descriptors in this stream
- cur_s->descriptors_length = 0;
- cur_d = cur_s->descriptors;
- while(cur_d) {
- cur_s->descriptors_length += cur_d->length;
- cur_d = cur_d->next;
- }
-
- // add on 1 byte for the ca_pmt_cmd_id if we have some descriptors.
- if (cur_s->descriptors_length)
- cur_s->descriptors_length++;
-
- // update the total required length;
- total_required_length += 5 + cur_s->descriptors_length;
-
- cur_s = cur_s->next;
- }
-
- // done
- return total_required_length;
+ uint32_t total_required_length = 6; // header
+ struct ca_pmt_stream *cur_s;
+
+ // calcuate the PMT descriptors length
+ (*pmt_descriptors_length) = 0;
+ struct ca_pmt_descriptor *cur_d = pmt_descriptors;
+ while (cur_d) {
+ (*pmt_descriptors_length) += cur_d->length;
+ cur_d = cur_d->next;
+ }
+
+ // add on 1 byte for the ca_pmt_cmd_id if we have some descriptors.
+ if (*pmt_descriptors_length)
+ (*pmt_descriptors_length)++;
+
+ // update the total required length
+ total_required_length += *pmt_descriptors_length;
+
+ // calculate the length of descriptors in the streams
+ cur_s = pmt_streams;
+ while (cur_s) {
+ // calculate the size of descriptors in this stream
+ cur_s->descriptors_length = 0;
+ cur_d = cur_s->descriptors;
+ while (cur_d) {
+ cur_s->descriptors_length += cur_d->length;
+ cur_d = cur_d->next;
+ }
+
+ // add on 1 byte for the ca_pmt_cmd_id if we have some descriptors.
+ if (cur_s->descriptors_length)
+ cur_s->descriptors_length++;
+
+ // update the total required length;
+ total_required_length += 5 + cur_s->descriptors_length;
+
+ cur_s = cur_s->next;
+ }
+
+ // done
+ return total_required_length;
}
-static int en50221_app_ca_parse_info(struct en50221_app_ca_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_ca_parse_info(struct en50221_app_ca *ca,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data, uint32_t data_length)
{
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- data+=length_field_len;
-
- // parse
- uint32_t ca_id_count = asn_data_length / 2;
-
- // byteswap the IDs
- uint16_t *ids = (uint16_t*) data;
- uint32_t i;
- for(i=0; i<ca_id_count; i++) {
- bswap16(data);
- data+=2;
- }
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_ca_info_callback cb = private->ca_info_callback;
- void *cb_arg = private->ca_info_callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, ca_id_count, ids);
- }
- return 0;
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ // check it
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ data += length_field_len;
+
+ // parse
+ uint32_t ca_id_count = asn_data_length / 2;
+
+ // byteswap the IDs
+ uint16_t *ids = (uint16_t *) data;
+ uint32_t i;
+ for (i = 0; i < ca_id_count; i++) {
+ bswap16(data);
+ data += 2;
+ }
+
+ // tell the app
+ pthread_mutex_lock(&ca->lock);
+ en50221_app_ca_info_callback cb = ca->ca_info_callback;
+ void *cb_arg = ca->ca_info_callback_arg;
+ pthread_mutex_unlock(&ca->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, ca_id_count,
+ ids);
+ }
+ return 0;
}
-static int en50221_app_ca_parse_reply(struct en50221_app_ca_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_ca_parse_reply(struct en50221_app_ca *ca,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data, uint32_t data_length)
{
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length < 4) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- data += length_field_len;
- data_length -= length_field_len;
-
- // process the reply table to fix endian issues
- uint32_t pos = 4;
- bswap16(data);
- while(pos < asn_data_length) {
- bswap16(data+pos);
- pos+= 3;
- }
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_ca_pmt_reply_callback cb = private->ca_pmt_reply_callback;
- void *cb_arg = private->ca_pmt_reply_callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, (struct en50221_app_pmt_reply*) data, asn_data_length);
- }
- return 0;
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ // check it
+ if (asn_data_length < 4) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ data += length_field_len;
+ data_length -= length_field_len;
+
+ // process the reply table to fix endian issues
+ uint32_t pos = 4;
+ bswap16(data);
+ while (pos < asn_data_length) {
+ bswap16(data + pos);
+ pos += 3;
+ }
+
+ // tell the app
+ pthread_mutex_lock(&ca->lock);
+ en50221_app_ca_pmt_reply_callback cb = ca->ca_pmt_reply_callback;
+ void *cb_arg = ca->ca_pmt_reply_callback_arg;
+ pthread_mutex_unlock(&ca->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number,
+ (struct en50221_app_pmt_reply *) data,
+ asn_data_length);
+ }
+ return 0;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ca.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ca.h
index 846312b..7405b06 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ca.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_ca.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APPLICATION_ca_H__
#define __EN50221_APPLICATION_ca_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -60,24 +59,24 @@ extern "C"
* PMT reply structure.
*/
struct en50221_app_pmt_reply {
- uint16_t program_number;
- EBIT3(uint8_t reserved_1 : 2; ,
- uint8_t version_number : 5; ,
- uint8_t current_next_indicator : 1; )
- EBIT2(uint8_t CA_enable_flag : 1; ,
- uint8_t CA_enable : 7; )
- /* struct en50221_app_pmt_stream streams[] */
-} __attribute__((packed));
+ uint16_t program_number;
+ EBIT3(uint8_t reserved_1 : 2;,
+ uint8_t version_number : 5;,
+ uint8_t current_next_indicator : 1;);
+ EBIT2(uint8_t CA_enable_flag : 1;,
+ uint8_t CA_enable : 7;);
+ /* struct en50221_app_pmt_stream streams[] */
+} __attribute__ ((packed));
/**
* A stream within a pmt reply structure.
*/
struct en50221_app_pmt_stream {
- EBIT2(uint16_t reserved_1 : 3; ,
- uint16_t es_pid :13; )
- EBIT2(uint8_t CA_enable_flag : 1; ,
- uint8_t CA_enable : 7; )
-} __attribute__((packed));
+ EBIT2(uint16_t reserved_1 : 3;,
+ uint16_t es_pid :13;);
+ EBIT2(uint8_t CA_enable_flag : 1;,
+ uint8_t CA_enable : 7;);
+} __attribute__ ((packed));
/**
* Convenience iterator for the streams field of the en50221_app_pmt_reply structure.
@@ -102,9 +101,11 @@ struct en50221_app_pmt_stream {
* @param ca_ids Pointer to list of ca_system_ids.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_ca_info_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint32_t ca_id_count,
- uint16_t *ca_ids);
+typedef int (*en50221_app_ca_info_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t ca_id_count,
+ uint16_t * ca_ids);
/**
* Type definition for pmt_reply - called when we receive a pmt_reply.
@@ -116,14 +117,16 @@ typedef int (*en50221_app_ca_info_callback)(void *arg, uint8_t slot_id, uint16_t
* @param reply_size Total size of the struct en50221_app_pmt_reply in bytes.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_ca_pmt_reply_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- struct en50221_app_pmt_reply *reply,
- uint32_t reply_size);
+typedef int (*en50221_app_ca_pmt_reply_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ struct en50221_app_pmt_reply *reply,
+ uint32_t reply_size);
/**
* Opaque type representing a ca resource.
*/
-typedef void *en50221_app_ca;
+struct en50221_app_ca;
/**
* Create an instance of the ca resource.
@@ -131,14 +134,14 @@ typedef void *en50221_app_ca;
* @param funcs Send functions to use.
* @return Instance, or NULL on failure.
*/
-extern en50221_app_ca en50221_app_ca_create(struct en50221_app_send_functions *funcs);
+extern struct en50221_app_ca *en50221_app_ca_create(struct en50221_app_send_functions *funcs);
/**
* Destroy an instance of the ca resource.
*
* @param ca Instance to destroy.
*/
-extern void en50221_app_ca_destroy(en50221_app_ca ca);
+extern void en50221_app_ca_destroy(struct en50221_app_ca *ca);
/**
* Register the callback for when we receive a ca info.
@@ -147,8 +150,9 @@ extern void en50221_app_ca_destroy(en50221_app_ca ca);
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_ca_register_info_callback(en50221_app_ca ca,
- en50221_app_ca_info_callback callback, void *arg);
+extern void en50221_app_ca_register_info_callback(struct en50221_app_ca *ca,
+ en50221_app_ca_info_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a pmt_reply.
@@ -157,8 +161,9 @@ extern void en50221_app_ca_register_info_callback(en50221_app_ca ca,
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_ca_register_pmt_reply_callback(en50221_app_ca ca,
- en50221_app_ca_pmt_reply_callback callback, void *arg);
+extern void en50221_app_ca_register_pmt_reply_callback(struct en50221_app_ca *ca,
+ en50221_app_ca_pmt_reply_callback callback,
+ void *arg);
/**
* Send a ca_info_req to the CAM.
@@ -167,8 +172,8 @@ extern void en50221_app_ca_register_pmt_reply_callback(en50221_app_ca ca,
* @param session_number Session number to send it on.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_ca_info_enq(en50221_app_ca ca,
- uint16_t session_number);
+extern int en50221_app_ca_info_enq(struct en50221_app_ca *ca,
+ uint16_t session_number);
/**
* Send a ca_pmt structure to the CAM.
@@ -179,10 +184,10 @@ extern int en50221_app_ca_info_enq(en50221_app_ca ca,
* @param ca_pmt_length Length of ca_pmt structure in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_ca_pmt(en50221_app_ca ca,
- uint16_t session_number,
- uint8_t *ca_pmt,
- uint32_t ca_pmt_length);
+extern int en50221_app_ca_pmt(struct en50221_app_ca *ca,
+ uint16_t session_number,
+ uint8_t * ca_pmt,
+ uint32_t ca_pmt_length);
/**
* Transform a libucsi PMT into a binary structure for sending to a CAM.
@@ -197,10 +202,11 @@ extern int en50221_app_ca_pmt(en50221_app_ca ca,
* @return Number of bytes used, or -1 on error.
*/
extern int en50221_ca_format_pmt(struct mpeg_pmt_section *pmt,
- uint8_t *data,
- uint32_t data_length,
- int move_ca_descriptors,
- uint8_t ca_pmt_list_management, uint8_t ca_pmt_cmd_id);
+ uint8_t * data,
+ uint32_t data_length,
+ int move_ca_descriptors,
+ uint8_t ca_pmt_list_management,
+ uint8_t ca_pmt_cmd_id);
/**
* Pass data received for this resource into it for parsing.
@@ -213,38 +219,42 @@ extern int en50221_ca_format_pmt(struct mpeg_pmt_section *pmt,
* @param data_length Length of data in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_ca_message(en50221_app_ca ca,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_app_ca_message(struct en50221_app_ca *ca,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t *data,
+ uint32_t data_length);
static inline struct en50221_app_pmt_stream *
- en50221_app_pmt_reply_streams_first(struct en50221_app_pmt_reply *reply, uint32_t reply_size)
+ en50221_app_pmt_reply_streams_first(struct en50221_app_pmt_reply *reply,
+ uint32_t reply_size)
{
- uint32_t pos = sizeof(struct en50221_app_pmt_reply);
+ uint32_t pos = sizeof(struct en50221_app_pmt_reply);
- if (pos >= reply_size)
- return NULL;
+ if (pos >= reply_size)
+ return NULL;
- return (struct en50221_app_pmt_stream *)((uint8_t *)reply+ pos);
+ return (struct en50221_app_pmt_stream *) ((uint8_t *) reply + pos);
}
static inline struct en50221_app_pmt_stream *
- en50221_app_pmt_reply_streams_next(struct en50221_app_pmt_reply * reply,
- struct en50221_app_pmt_stream * pos,
- uint32_t reply_size)
+ en50221_app_pmt_reply_streams_next(struct en50221_app_pmt_reply *reply,
+ struct en50221_app_pmt_stream *pos,
+ uint32_t reply_size)
{
- uint8_t *end = (uint8_t*) reply + reply_size;
- uint8_t *next = (uint8_t *) pos + sizeof(struct en50221_app_pmt_stream);
+ uint8_t *end = (uint8_t *) reply + reply_size;
+ uint8_t *next =
+ (uint8_t *) pos +
+ sizeof(struct en50221_app_pmt_stream);
- if (next >= end)
- return NULL;
+ if (next >= end)
+ return NULL;
- return (struct en50221_app_pmt_stream *) next;
+ return (struct en50221_app_pmt_stream *) next;
}
#ifdef __cplusplus
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_datetime.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_datetime.c
index e21304c..6777003 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_datetime.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_datetime.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
@@ -29,108 +29,109 @@
#include "en50221_app_tags.h"
#include "asn_1.h"
-struct en50221_app_datetime_private {
- struct en50221_app_send_functions *funcs;
+struct en50221_app_datetime {
+ struct en50221_app_send_functions *funcs;
- en50221_app_datetime_enquiry_callback callback;
- void *callback_arg;
+ en50221_app_datetime_enquiry_callback callback;
+ void *callback_arg;
- pthread_mutex_t lock;
+ pthread_mutex_t lock;
};
-static int en50221_app_datetime_parse_enquiry(struct en50221_app_datetime_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
+static int en50221_app_datetime_parse_enquiry(struct en50221_app_datetime *datetime,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
-en50221_app_datetime en50221_app_datetime_create(struct en50221_app_send_functions *funcs)
+struct en50221_app_datetime *en50221_app_datetime_create(struct en50221_app_send_functions *funcs)
{
- struct en50221_app_datetime_private *private = NULL;
+ struct en50221_app_datetime *datetime = NULL;
- // create structure and set it up
- private = malloc(sizeof(struct en50221_app_datetime_private));
- if (private == NULL) {
- return NULL;
- }
- private->funcs = funcs;
- private->callback = NULL;
+ // create structure and set it up
+ datetime = malloc(sizeof(struct en50221_app_datetime));
+ if (datetime == NULL) {
+ return NULL;
+ }
+ datetime->funcs = funcs;
+ datetime->callback = NULL;
- pthread_mutex_init(&private->lock, NULL);
+ pthread_mutex_init(&datetime->lock, NULL);
- // done
- return private;
+ // done
+ return datetime;
}
-void en50221_app_datetime_destroy(en50221_app_datetime datetime)
+void en50221_app_datetime_destroy(struct en50221_app_datetime *datetime)
{
- struct en50221_app_datetime_private *private = (struct en50221_app_datetime_private *) datetime;
-
- pthread_mutex_destroy(&private->lock);
- free(private);
+ pthread_mutex_destroy(&datetime->lock);
+ free(datetime);
}
-void en50221_app_datetime_register_enquiry_callback(en50221_app_datetime datetime,
- en50221_app_datetime_enquiry_callback callback, void *arg)
+void en50221_app_datetime_register_enquiry_callback(struct en50221_app_datetime *datetime,
+ en50221_app_datetime_enquiry_callback callback,
+ void *arg)
{
- struct en50221_app_datetime_private *private = (struct en50221_app_datetime_private *) datetime;
-
- pthread_mutex_lock(&private->lock);
- private->callback = callback;
- private->callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&datetime->lock);
+ datetime->callback = callback;
+ datetime->callback_arg = arg;
+ pthread_mutex_unlock(&datetime->lock);
}
-int en50221_app_datetime_send(en50221_app_datetime datetime,
- uint16_t session_number,
- time_t utc_time,
- int time_offset)
+int en50221_app_datetime_send(struct en50221_app_datetime *datetime,
+ uint16_t session_number,
+ time_t utc_time, int time_offset)
{
- struct en50221_app_datetime_private *private = (struct en50221_app_datetime_private *) datetime;
- uint8_t data[11];
- int data_length;
-
- data[0] = (TAG_DATE_TIME >> 16) & 0xFF;
- data[1] = (TAG_DATE_TIME >> 8) & 0xFF;
- data[2] = TAG_DATE_TIME & 0xFF;
- if (time_offset != -1) {
- data[3] = 7;
- unixtime_to_dvbdate(utc_time, data+4);
- data[9] = time_offset >> 8;
- data[10] = time_offset;
- data_length = 11;
- } else {
- data[3] = 5;
- unixtime_to_dvbdate(utc_time, data+4);
- data_length = 9;
- }
- return private->funcs->send_data(private->funcs->arg, session_number, data, data_length);
+ uint8_t data[11];
+ int data_length;
+
+ data[0] = (TAG_DATE_TIME >> 16) & 0xFF;
+ data[1] = (TAG_DATE_TIME >> 8) & 0xFF;
+ data[2] = TAG_DATE_TIME & 0xFF;
+ if (time_offset != -1) {
+ data[3] = 7;
+ unixtime_to_dvbdate(utc_time, data + 4);
+ data[9] = time_offset >> 8;
+ data[10] = time_offset;
+ data_length = 11;
+ } else {
+ data[3] = 5;
+ unixtime_to_dvbdate(utc_time, data + 4);
+ data_length = 9;
+ }
+ return datetime->funcs->send_data(datetime->funcs->arg,
+ session_number, data,
+ data_length);
}
-int en50221_app_datetime_message(en50221_app_datetime datetime,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length)
+int en50221_app_datetime_message(struct en50221_app_datetime *datetime,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data, uint32_t data_length)
{
- struct en50221_app_datetime_private *private = (struct en50221_app_datetime_private *) datetime;
- (void) resource_id;
-
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
-
- switch(tag)
- {
- case TAG_DATE_TIME_ENQUIRY:
- return en50221_app_datetime_parse_enquiry(private, slot_id, session_number, data+3, data_length-3);
- }
-
- print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
- return -1;
+ (void) resource_id;
+
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+
+ switch (tag) {
+ case TAG_DATE_TIME_ENQUIRY:
+ return en50221_app_datetime_parse_enquiry(datetime,
+ slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ }
+
+ print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
+ return -1;
}
@@ -142,28 +143,31 @@ int en50221_app_datetime_message(en50221_app_datetime datetime,
-static int en50221_app_datetime_parse_enquiry(struct en50221_app_datetime_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_datetime_parse_enquiry(struct en50221_app_datetime *datetime,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // validate data
- if (data_length != 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (data[0] != 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t response_interval = data[1];
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_datetime_enquiry_callback cb = private->callback;
- void *cb_arg = private->callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, response_interval);
- }
- return 0;
+ // validate data
+ if (data_length != 2) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (data[0] != 1) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t response_interval = data[1];
+
+ // tell the app
+ pthread_mutex_lock(&datetime->lock);
+ en50221_app_datetime_enquiry_callback cb = datetime->callback;
+ void *cb_arg = datetime->callback_arg;
+ pthread_mutex_unlock(&datetime->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number,
+ response_interval);
+ }
+ return 0;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_datetime.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_datetime.h
index df813e1..4660630 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_datetime.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_datetime.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APPLICATION_DATETIME_H__
#define __EN50221_APPLICATION_DATETIME_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -44,13 +43,15 @@ extern "C"
* @param response_interval Response interval requested by CAM.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_datetime_enquiry_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t response_interval);
+typedef int (*en50221_app_datetime_enquiry_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t response_interval);
/**
* Opaque type representing a datetime resource.
*/
-typedef void *en50221_app_datetime;
+struct en50221_app_datetime;
/**
* Create an instance of the datetime resource.
@@ -58,14 +59,15 @@ typedef void *en50221_app_datetime;
* @param funcs Send functions to use.
* @return Instance, or NULL on failure.
*/
-extern en50221_app_datetime en50221_app_datetime_create(struct en50221_app_send_functions *funcs);
+extern struct en50221_app_datetime
+ *en50221_app_datetime_create(struct en50221_app_send_functions *funcs);
/**
* Destroy an instance of the datetime resource.
*
* @param datetime Instance to destroy.
*/
-extern void en50221_app_datetime_destroy(en50221_app_datetime datetime);
+extern void en50221_app_datetime_destroy(struct en50221_app_datetime *datetime);
/**
* Register the callback for when we receive a enquiry request.
@@ -74,8 +76,9 @@ extern void en50221_app_datetime_destroy(en50221_app_datetime datetime);
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_datetime_register_enquiry_callback(en50221_app_datetime datetime,
- en50221_app_datetime_enquiry_callback callback, void *arg);
+extern void en50221_app_datetime_register_enquiry_callback(struct en50221_app_datetime *datetime,
+ en50221_app_datetime_enquiry_callback callback,
+ void *arg);
/**
* Send the time to the CAM.
@@ -87,10 +90,10 @@ extern void en50221_app_datetime_register_enquiry_callback(en50221_app_datetime
* UTC and local time in minutes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_datetime_send(en50221_app_datetime datetime,
- uint16_t session_number,
- time_t utc_time,
- int time_offset);
+extern int en50221_app_datetime_send(struct en50221_app_datetime *datetime,
+ uint16_t session_number,
+ time_t utc_time,
+ int time_offset);
/**
* Pass data received for this resource into it for parsing.
@@ -103,14 +106,14 @@ extern int en50221_app_datetime_send(en50221_app_datetime datetime,
* @param data_length Length of data in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_datetime_message(en50221_app_datetime datetime,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_app_datetime_message(struct en50221_app_datetime *datetime,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t *data,
+ uint32_t data_length);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_dvb.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_dvb.c
index dfda1bf..21b2bec 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_dvb.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_dvb.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
@@ -28,137 +28,144 @@
#include "en50221_app_tags.h"
#include "asn_1.h"
-struct en50221_app_dvb_private {
- struct en50221_app_send_functions *funcs;
+struct en50221_app_dvb {
+ struct en50221_app_send_functions *funcs;
- en50221_app_dvb_tune_callback tune_callback;
- void *tune_callback_arg;
+ en50221_app_dvb_tune_callback tune_callback;
+ void *tune_callback_arg;
- en50221_app_dvb_replace_callback replace_callback;
- void *replace_callback_arg;
+ en50221_app_dvb_replace_callback replace_callback;
+ void *replace_callback_arg;
- en50221_app_dvb_clear_replace_callback clear_replace_callback;
- void *clear_replace_callback_arg;
+ en50221_app_dvb_clear_replace_callback clear_replace_callback;
+ void *clear_replace_callback_arg;
- pthread_mutex_t lock;
+ pthread_mutex_t lock;
};
-static int en50221_app_dvb_parse_tune(struct en50221_app_dvb_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
+static int en50221_app_dvb_parse_tune(struct en50221_app_dvb *dvb,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
-static int en50221_app_dvb_parse_replace(struct en50221_app_dvb_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
+static int en50221_app_dvb_parse_replace(struct en50221_app_dvb *dvb,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
-static int en50221_app_dvb_parse_clear_replace(struct en50221_app_dvb_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
+static int en50221_app_dvb_parse_clear_replace(struct en50221_app_dvb *dvb,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
-en50221_app_dvb en50221_app_dvb_create(struct en50221_app_send_functions *funcs)
+struct en50221_app_dvb *en50221_app_dvb_create(struct en50221_app_send_functions *funcs)
{
- struct en50221_app_dvb_private *private = NULL;
-
- // create structure and set it up
- private = malloc(sizeof(struct en50221_app_dvb_private));
- if (private == NULL) {
- return NULL;
- }
- private->funcs = funcs;
- private->tune_callback = NULL;
- private->replace_callback = NULL;
- private->clear_replace_callback = NULL;
-
- pthread_mutex_init(&private->lock, NULL);
-
- // done
- return private;
+ struct en50221_app_dvb *dvb = NULL;
+
+ // create structure and set it up
+ dvb = malloc(sizeof(struct en50221_app_dvb));
+ if (dvb == NULL) {
+ return NULL;
+ }
+ dvb->funcs = funcs;
+ dvb->tune_callback = NULL;
+ dvb->replace_callback = NULL;
+ dvb->clear_replace_callback = NULL;
+
+ pthread_mutex_init(&dvb->lock, NULL);
+
+ // done
+ return dvb;
}
-void en50221_app_dvb_destroy(en50221_app_dvb dvb)
+void en50221_app_dvb_destroy(struct en50221_app_dvb *dvb)
{
- struct en50221_app_dvb_private *private = (struct en50221_app_dvb_private *) dvb;
-
- pthread_mutex_destroy(&private->lock);
- free(private);
+ pthread_mutex_destroy(&dvb->lock);
+ free(dvb);
}
-void en50221_app_dvb_register_tune_callback(en50221_app_dvb dvb,
- en50221_app_dvb_tune_callback callback, void *arg)
+void en50221_app_dvb_register_tune_callback(struct en50221_app_dvb *dvb,
+ en50221_app_dvb_tune_callback callback,
+ void *arg)
{
- struct en50221_app_dvb_private *private = (struct en50221_app_dvb_private *) dvb;
-
- pthread_mutex_lock(&private->lock);
- private->tune_callback = callback;
- private->tune_callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&dvb->lock);
+ dvb->tune_callback = callback;
+ dvb->tune_callback_arg = arg;
+ pthread_mutex_unlock(&dvb->lock);
}
-void en50221_app_dvb_register_replace_callback(en50221_app_dvb dvb,
- en50221_app_dvb_replace_callback callback, void *arg)
+void en50221_app_dvb_register_replace_callback(struct en50221_app_dvb *dvb,
+ en50221_app_dvb_replace_callback callback,
+ void *arg)
{
- struct en50221_app_dvb_private *private = (struct en50221_app_dvb_private *) dvb;
-
- pthread_mutex_lock(&private->lock);
- private->replace_callback = callback;
- private->replace_callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&dvb->lock);
+ dvb->replace_callback = callback;
+ dvb->replace_callback_arg = arg;
+ pthread_mutex_unlock(&dvb->lock);
}
-void en50221_app_dvb_register_clear_replace_callback(en50221_app_dvb dvb,
- en50221_app_dvb_clear_replace_callback callback, void *arg)
+void en50221_app_dvb_register_clear_replace_callback(struct en50221_app_dvb *dvb,
+ en50221_app_dvb_clear_replace_callback callback,
+ void *arg)
{
- struct en50221_app_dvb_private *private = (struct en50221_app_dvb_private *) dvb;
-
- pthread_mutex_lock(&private->lock);
- private->clear_replace_callback = callback;
- private->clear_replace_callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&dvb->lock);
+ dvb->clear_replace_callback = callback;
+ dvb->clear_replace_callback_arg = arg;
+ pthread_mutex_unlock(&dvb->lock);
}
-int en50221_app_dvb_ask_release(en50221_app_dvb dvb, uint16_t session_number)
+int en50221_app_dvb_ask_release(struct en50221_app_dvb *dvb,
+ uint16_t session_number)
{
- struct en50221_app_dvb_private *private = (struct en50221_app_dvb_private *) dvb;
- uint8_t data[4];
+ uint8_t data[4];
- data[0] = (TAG_ASK_RELEASE >> 16) & 0xFF;
- data[1] = (TAG_ASK_RELEASE >> 8) & 0xFF;
- data[2] = TAG_ASK_RELEASE & 0xFF;
- data[3] = 0;
+ data[0] = (TAG_ASK_RELEASE >> 16) & 0xFF;
+ data[1] = (TAG_ASK_RELEASE >> 8) & 0xFF;
+ data[2] = TAG_ASK_RELEASE & 0xFF;
+ data[3] = 0;
- return private->funcs->send_data(private->funcs->arg, session_number, data, 4);
+ return dvb->funcs->send_data(dvb->funcs->arg, session_number, data, 4);
}
-int en50221_app_dvb_message(en50221_app_dvb dvb,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length)
+int en50221_app_dvb_message(struct en50221_app_dvb *dvb,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data, uint32_t data_length)
{
- struct en50221_app_dvb_private *private = (struct en50221_app_dvb_private *) dvb;
- (void) resource_id;
-
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
-
- switch(tag)
- {
- case TAG_TUNE:
- return en50221_app_dvb_parse_tune(private, slot_id, session_number, data+3, data_length-3);
- case TAG_REPLACE:
- return en50221_app_dvb_parse_replace(private, slot_id, session_number, data+3, data_length-3);
- case TAG_CLEAR_REPLACE:
- return en50221_app_dvb_parse_clear_replace(private, slot_id, session_number, data+3, data_length-3);
- }
-
- print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
- return -1;
+ (void) resource_id;
+
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+
+ switch (tag) {
+ case TAG_TUNE:
+ return en50221_app_dvb_parse_tune(dvb, slot_id,
+ session_number, data + 3,
+ data_length - 3);
+ case TAG_REPLACE:
+ return en50221_app_dvb_parse_replace(dvb, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ case TAG_CLEAR_REPLACE:
+ return en50221_app_dvb_parse_clear_replace(dvb, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ }
+
+ print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
+ return -1;
}
@@ -170,94 +177,106 @@ int en50221_app_dvb_message(en50221_app_dvb dvb,
-static int en50221_app_dvb_parse_tune(struct en50221_app_dvb_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_dvb_parse_tune(struct en50221_app_dvb *dvb,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data, uint32_t data_length)
{
- // validate data
- if (data_length < 9) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (data[0] != 8) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t *tune_data = data+1;
-
- // parse it
- uint16_t network_id = (tune_data[0] << 8) | tune_data[1];
- uint16_t original_network_id = (tune_data[2] << 8) | tune_data[3];
- uint16_t transport_stream_id = (tune_data[4] << 8) | tune_data[5];
- uint16_t service_id = (tune_data[6] << 8) | tune_data[7];
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_dvb_tune_callback cb = private->tune_callback;
- void *cb_arg = private->tune_callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, network_id, original_network_id, transport_stream_id, service_id);
- }
- return 0;
+ // validate data
+ if (data_length < 9) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (data[0] != 8) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t *tune_data = data + 1;
+
+ // parse it
+ uint16_t network_id = (tune_data[0] << 8) | tune_data[1];
+ uint16_t original_network_id = (tune_data[2] << 8) | tune_data[3];
+ uint16_t transport_stream_id = (tune_data[4] << 8) | tune_data[5];
+ uint16_t service_id = (tune_data[6] << 8) | tune_data[7];
+
+ // tell the app
+ pthread_mutex_lock(&dvb->lock);
+ en50221_app_dvb_tune_callback cb = dvb->tune_callback;
+ void *cb_arg = dvb->tune_callback_arg;
+ pthread_mutex_unlock(&dvb->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, network_id,
+ original_network_id, transport_stream_id,
+ service_id);
+ }
+ return 0;
}
-static int en50221_app_dvb_parse_replace(struct en50221_app_dvb_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_dvb_parse_replace(struct en50221_app_dvb *dvb,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // validate data
- if (data_length < 6) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (data[0] != 5) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t *replace_data = data+1;
-
- // parse it
- uint8_t replacement_ref = replace_data[0];
- uint16_t replace_pid = ((replace_data[1] & 0x1f)<<8) | replace_data[2];
- uint16_t replacement_pid = ((replace_data[3] & 0x1f)<<8) | replace_data[4];
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_dvb_replace_callback cb = private->replace_callback;
- void *cb_arg = private->replace_callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, replacement_ref, replace_pid, replacement_pid);
- }
- return 0;
+ // validate data
+ if (data_length < 6) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (data[0] != 5) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t *replace_data = data + 1;
+
+ // parse it
+ uint8_t replacement_ref = replace_data[0];
+ uint16_t replace_pid =
+ ((replace_data[1] & 0x1f) << 8) | replace_data[2];
+ uint16_t replacement_pid =
+ ((replace_data[3] & 0x1f) << 8) | replace_data[4];
+
+ // tell the app
+ pthread_mutex_lock(&dvb->lock);
+ en50221_app_dvb_replace_callback cb = dvb->replace_callback;
+ void *cb_arg = dvb->replace_callback_arg;
+ pthread_mutex_unlock(&dvb->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, replacement_ref,
+ replace_pid, replacement_pid);
+ }
+ return 0;
}
-static int en50221_app_dvb_parse_clear_replace(struct en50221_app_dvb_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_dvb_parse_clear_replace(struct en50221_app_dvb *dvb,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // validate data
- if (data_length < 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (data[0] != 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t *replace_data = data+1;
-
- // parse it
- uint8_t replacement_ref = replace_data[0];
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_dvb_clear_replace_callback cb = private->clear_replace_callback;
- void *cb_arg = private->clear_replace_callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, replacement_ref);
- }
- return 0;
+ // validate data
+ if (data_length < 2) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (data[0] != 1) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t *replace_data = data + 1;
+
+ // parse it
+ uint8_t replacement_ref = replace_data[0];
+
+ // tell the app
+ pthread_mutex_lock(&dvb->lock);
+ en50221_app_dvb_clear_replace_callback cb =
+ dvb->clear_replace_callback;
+ void *cb_arg = dvb->clear_replace_callback_arg;
+ pthread_mutex_unlock(&dvb->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number,
+ replacement_ref);
+ }
+ return 0;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_dvb.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_dvb.h
index 7830942..be74e6b 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_dvb.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_dvb.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APPLICATION_DVB_H__
#define __EN50221_APPLICATION_DVB_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -48,9 +47,13 @@ extern "C"
* @param service_id Service id requested by CAM.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_dvb_tune_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint16_t network_id, uint32_t original_network_id,
- uint16_t transport_stream_id, uint16_t service_id);
+typedef int (*en50221_app_dvb_tune_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint16_t network_id,
+ uint32_t original_network_id,
+ uint16_t transport_stream_id,
+ uint16_t service_id);
/**
* Type definition for replace - called when we receive a replace request from a CAM.
@@ -63,9 +66,12 @@ typedef int (*en50221_app_dvb_tune_callback)(void *arg, uint8_t slot_id, uint16_
* @param replacement_pid PID to replace it with.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_dvb_replace_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t replacement_ref,
- uint16_t replaced_pid, uint16_t replacement_pid);
+typedef int (*en50221_app_dvb_replace_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t replacement_ref,
+ uint16_t replaced_pid,
+ uint16_t replacement_pid);
/**
@@ -77,14 +83,16 @@ typedef int (*en50221_app_dvb_replace_callback)(void *arg, uint8_t slot_id, uint
* @param replacement_ref Replacement ref.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_dvb_clear_replace_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t replacement_ref);
+typedef int (*en50221_app_dvb_clear_replace_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t replacement_ref);
/**
* Opaque type representing a dvb resource.
*/
-typedef void *en50221_app_dvb;
+struct en50221_app_dvb;
/**
* Create an instance of the dvb resource.
@@ -92,14 +100,14 @@ typedef void *en50221_app_dvb;
* @param funcs Send functions to use.
* @return Instance, or NULL on failure.
*/
-extern en50221_app_dvb en50221_app_dvb_create(struct en50221_app_send_functions *funcs);
+extern struct en50221_app_dvb *en50221_app_dvb_create(struct en50221_app_send_functions *funcs);
/**
* Destroy an instance of the dvb resource.
*
* @param dvb Instance to destroy.
*/
-extern void en50221_app_dvb_destroy(en50221_app_dvb dvb);
+extern void en50221_app_dvb_destroy(struct en50221_app_dvb *dvb);
/**
* Register the callback for when we receive a tune request.
@@ -108,8 +116,9 @@ extern void en50221_app_dvb_destroy(en50221_app_dvb dvb);
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_dvb_register_tune_callback(en50221_app_dvb dvb,
- en50221_app_dvb_tune_callback callback, void *arg);
+extern void en50221_app_dvb_register_tune_callback(struct en50221_app_dvb *dvb,
+ en50221_app_dvb_tune_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a replace request.
@@ -118,8 +127,9 @@ extern void en50221_app_dvb_register_tune_callback(en50221_app_dvb dvb,
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_dvb_register_replace_callback(en50221_app_dvb dvb,
- en50221_app_dvb_replace_callback callback, void *arg);
+extern void en50221_app_dvb_register_replace_callback(struct en50221_app_dvb *dvb,
+ en50221_app_dvb_replace_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a clear replace request.
@@ -128,8 +138,9 @@ extern void en50221_app_dvb_register_replace_callback(en50221_app_dvb dvb,
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_dvb_register_clear_replace_callback(en50221_app_dvb dvb,
- en50221_app_dvb_clear_replace_callback callback, void *arg);
+extern void en50221_app_dvb_register_clear_replace_callback(struct en50221_app_dvb *dvb,
+ en50221_app_dvb_clear_replace_callback callback,
+ void *arg);
/**
* Send an ask release request to the CAM.
@@ -138,7 +149,8 @@ extern void en50221_app_dvb_register_clear_replace_callback(en50221_app_dvb dvb,
* @param session_number Session number to send it on.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_dvb_ask_release(en50221_app_dvb dvb, uint16_t session_number);
+extern int en50221_app_dvb_ask_release(struct en50221_app_dvb *dvb,
+ uint16_t session_number);
/**
* Pass data received for this resource into it for parsing.
@@ -151,14 +163,14 @@ extern int en50221_app_dvb_ask_release(en50221_app_dvb dvb, uint16_t session_num
* @param data_length Length of data in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_dvb_message(en50221_app_dvb dvb,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_app_dvb_message(struct en50221_app_dvb *dvb,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t *data,
+ uint32_t data_length);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_epg.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_epg.c
index 7237476..87b4743 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_epg.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_epg.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
@@ -29,138 +29,139 @@
#include "en50221_app_tags.h"
#include "asn_1.h"
-struct en50221_app_epg_private {
- struct en50221_app_send_functions *funcs;
+struct en50221_app_epg {
+ struct en50221_app_send_functions *funcs;
- en50221_app_epg_reply_callback callback;
- void *callback_arg;
+ en50221_app_epg_reply_callback callback;
+ void *callback_arg;
- pthread_mutex_t lock;
+ pthread_mutex_t lock;
};
-static int en50221_app_epg_parse_reply(struct en50221_app_epg_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
+static int en50221_app_epg_parse_reply(struct en50221_app_epg *private,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
-en50221_app_epg en50221_app_epg_create(struct en50221_app_send_functions *funcs)
+struct en50221_app_epg *en50221_app_epg_create(struct en50221_app_send_functions *funcs)
{
- struct en50221_app_epg_private *private = NULL;
+ struct en50221_app_epg *epg = NULL;
- // create structure and set it up
- private = malloc(sizeof(struct en50221_app_epg_private));
- if (private == NULL) {
- return NULL;
- }
- private->funcs = funcs;
- private->callback = NULL;
+ // create structure and set it up
+ epg = malloc(sizeof(struct en50221_app_epg));
+ if (epg == NULL) {
+ return NULL;
+ }
+ epg->funcs = funcs;
+ epg->callback = NULL;
- pthread_mutex_init(&private->lock, NULL);
+ pthread_mutex_init(&epg->lock, NULL);
- // done
- return private;
+ // done
+ return epg;
}
-void en50221_app_epg_destroy(en50221_app_epg epg)
+void en50221_app_epg_destroy(struct en50221_app_epg *epg)
{
- struct en50221_app_epg_private *private = (struct en50221_app_epg_private *) epg;
-
- pthread_mutex_destroy(&private->lock);
- free(private);
+ pthread_mutex_destroy(&epg->lock);
+ free(epg);
}
-void en50221_app_epg_register_enquiry_callback(en50221_app_epg epg,
- en50221_app_epg_reply_callback callback, void *arg)
+void en50221_app_epg_register_enquiry_callback(struct en50221_app_epg *epg,
+ en50221_app_epg_reply_callback callback,
+ void *arg)
{
- struct en50221_app_epg_private *private = (struct en50221_app_epg_private *) epg;
-
- pthread_mutex_lock(&private->lock);
- private->callback = callback;
- private->callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&epg->lock);
+ epg->callback = callback;
+ epg->callback_arg = arg;
+ pthread_mutex_unlock(&epg->lock);
}
-int en50221_app_epg_enquire(en50221_app_epg epg,
- uint16_t session_number,
- uint8_t command_id,
- uint16_t network_id,
- uint16_t original_network_id,
- uint16_t transport_stream_id,
- uint16_t service_id,
- uint16_t event_id)
+int en50221_app_epg_enquire(struct en50221_app_epg *epg,
+ uint16_t session_number,
+ uint8_t command_id,
+ uint16_t network_id,
+ uint16_t original_network_id,
+ uint16_t transport_stream_id,
+ uint16_t service_id, uint16_t event_id)
{
- struct en50221_app_epg_private *private = (struct en50221_app_epg_private *) epg;
- uint8_t data[15];
-
- data[0] = (TAG_EPG_ENQUIRY >> 16) & 0xFF;
- data[1] = (TAG_EPG_ENQUIRY >> 8) & 0xFF;
- data[2] = TAG_EPG_ENQUIRY & 0xFF;
- data[3] = 11;
- data[4] = command_id;
- data[5] = network_id >> 8;
- data[6] = network_id;
- data[7] = original_network_id >> 8;
- data[8] = original_network_id;
- data[9] = transport_stream_id >> 8;
- data[10] = transport_stream_id;
- data[11] = service_id >> 8;
- data[12] = service_id;
- data[13] = event_id >> 8;
- data[14] = event_id;
- return private->funcs->send_data(private->funcs->arg, session_number, data, 15);
+ uint8_t data[15];
+
+ data[0] = (TAG_EPG_ENQUIRY >> 16) & 0xFF;
+ data[1] = (TAG_EPG_ENQUIRY >> 8) & 0xFF;
+ data[2] = TAG_EPG_ENQUIRY & 0xFF;
+ data[3] = 11;
+ data[4] = command_id;
+ data[5] = network_id >> 8;
+ data[6] = network_id;
+ data[7] = original_network_id >> 8;
+ data[8] = original_network_id;
+ data[9] = transport_stream_id >> 8;
+ data[10] = transport_stream_id;
+ data[11] = service_id >> 8;
+ data[12] = service_id;
+ data[13] = event_id >> 8;
+ data[14] = event_id;
+ return epg->funcs->send_data(epg->funcs->arg, session_number, data, 15);
}
-int en50221_app_epg_message(en50221_app_epg epg,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length)
+int en50221_app_epg_message(struct en50221_app_epg *epg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data, uint32_t data_length)
{
- struct en50221_app_epg_private *private = (struct en50221_app_epg_private *) epg;
- (void) resource_id;
-
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
-
- switch(tag)
- {
- case TAG_EPG_REPLY:
- return en50221_app_epg_parse_reply(private, slot_id, session_number, data+3, data_length-3);
- }
-
- print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
- return -1;
+ struct en50221_app_epg *private = (struct en50221_app_epg *) epg;
+ (void) resource_id;
+
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+
+ switch (tag) {
+ case TAG_EPG_REPLY:
+ return en50221_app_epg_parse_reply(private, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ }
+
+ print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
+ return -1;
}
-static int en50221_app_epg_parse_reply(struct en50221_app_epg_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_epg_parse_reply(struct en50221_app_epg *epg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // validate data
- if (data_length != 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (data[0] != 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t event_status = data[1];
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_epg_reply_callback cb = private->callback;
- void *cb_arg = private->callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, event_status);
- }
- return 0;
+ // validate data
+ if (data_length != 2) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (data[0] != 1) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t event_status = data[1];
+
+ // tell the app
+ pthread_mutex_lock(&epg->lock);
+ en50221_app_epg_reply_callback cb = epg->callback;
+ void *cb_arg = epg->callback_arg;
+ pthread_mutex_unlock(&epg->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, event_status);
+ }
+ return 0;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_epg.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_epg.h
index dcc65f1..dcfe9da 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_epg.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_epg.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APPLICATION_epg_H__
#define __EN50221_APPLICATION_epg_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -57,13 +56,15 @@ extern "C"
* @param event_status One of the EPG_EVENTSTATUS_* values.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_epg_reply_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t event_status);
+typedef int (*en50221_app_epg_reply_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t event_status);
/**
* Opaque type representing a epg resource.
*/
-typedef void *en50221_app_epg;
+struct en50221_app_epg;
/**
* Create an instance of the epg resource.
@@ -71,14 +72,14 @@ typedef void *en50221_app_epg;
* @param funcs Send functions to use.
* @return Instance, or NULL on failure.
*/
-extern en50221_app_epg en50221_app_epg_create(struct en50221_app_send_functions *funcs);
+extern struct en50221_app_epg *en50221_app_epg_create(struct en50221_app_send_functions *funcs);
/**
* Destroy an instance of the epg resource.
*
* @param epg Instance to destroy.
*/
-extern void en50221_app_epg_destroy(en50221_app_epg epg);
+extern void en50221_app_epg_destroy(struct en50221_app_epg *epg);
/**
* Register the callback for when we receive a enquiry response.
@@ -87,8 +88,9 @@ extern void en50221_app_epg_destroy(en50221_app_epg epg);
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_epg_register_reply_callback(en50221_app_epg epg,
- en50221_app_epg_reply_callback callback, void *arg);
+extern void en50221_app_epg_register_reply_callback(struct en50221_app_epg *epg,
+ en50221_app_epg_reply_callback callback,
+ void *arg);
/**
* Enquire about the entitlement status for an EPG entry.
@@ -103,14 +105,14 @@ extern void en50221_app_epg_register_reply_callback(en50221_app_epg epg,
* @param event_id Event ID concerned.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_epg_enquire(en50221_app_epg epg,
- uint16_t session_number,
- uint8_t command_id,
- uint16_t network_id,
- uint16_t original_network_id,
- uint16_t transport_stream_id,
- uint16_t service_id,
- uint16_t event_id);
+extern int en50221_app_epg_enquire(struct en50221_app_epg *epg,
+ uint16_t session_number,
+ uint8_t command_id,
+ uint16_t network_id,
+ uint16_t original_network_id,
+ uint16_t transport_stream_id,
+ uint16_t service_id,
+ uint16_t event_id);
/**
* Pass data received for this resource into it for parsing.
@@ -123,14 +125,14 @@ extern int en50221_app_epg_enquire(en50221_app_epg epg,
* @param data_length Length of data in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_epg_message(en50221_app_epg epg,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_app_epg_message(struct en50221_app_epg *epg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t *data,
+ uint32_t data_length);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_lowspeed.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_lowspeed.c
index 68d9774..a66598a 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_lowspeed.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_lowspeed.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
@@ -29,486 +29,505 @@
#include "asn_1.h"
struct en50221_app_lowspeed_session {
- uint16_t session_number;
- uint8_t *block_chain;
- uint32_t block_length;
+ uint16_t session_number;
+ uint8_t *block_chain;
+ uint32_t block_length;
- struct en50221_app_lowspeed_session *next;
+ struct en50221_app_lowspeed_session *next;
};
-struct en50221_app_lowspeed_private {
- struct en50221_app_send_functions *funcs;
+struct en50221_app_lowspeed {
+ struct en50221_app_send_functions *funcs;
- en50221_app_lowspeed_command_callback command_callback;
- void *command_callback_arg;
+ en50221_app_lowspeed_command_callback command_callback;
+ void *command_callback_arg;
- en50221_app_lowspeed_send_callback send_callback;
- void *send_callback_arg;
+ en50221_app_lowspeed_send_callback send_callback;
+ void *send_callback_arg;
- struct en50221_app_lowspeed_session *sessions;
+ struct en50221_app_lowspeed_session *sessions;
- pthread_mutex_t lock;
+ pthread_mutex_t lock;
};
static int en50221_app_lowspeed_parse_connect_on_channel(struct en50221_app_lowspeed_command *command,
- uint8_t *data,
- int data_length);
-static int en50221_app_lowspeed_parse_command(struct en50221_app_lowspeed_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-static int en50221_app_lowspeed_parse_send(struct en50221_app_lowspeed_private *private,
- uint8_t slot_id, uint16_t session_number, int more_last,
- uint8_t *data, uint32_t data_length);
-
-
-
-en50221_app_lowspeed en50221_app_lowspeed_create(struct en50221_app_send_functions *funcs)
+ uint8_t *data,
+ int data_length);
+static int en50221_app_lowspeed_parse_command(struct en50221_app_lowspeed *lowspeed,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t *data,
+ uint32_t data_length);
+static int en50221_app_lowspeed_parse_send(struct en50221_app_lowspeed *lowspeed,
+ uint8_t slot_id,
+ uint16_t session_number,
+ int more_last,
+ uint8_t *data,
+ uint32_t data_length);
+
+
+
+struct en50221_app_lowspeed *en50221_app_lowspeed_create(struct en50221_app_send_functions *funcs)
{
- struct en50221_app_lowspeed_private *private = NULL;
-
- // create structure and set it up
- private = malloc(sizeof(struct en50221_app_lowspeed_private));
- if (private == NULL) {
- return NULL;
- }
- private->funcs = funcs;
- private->command_callback = NULL;
- private->send_callback = NULL;
- private->sessions = NULL;
-
- pthread_mutex_init(&private->lock, NULL);
-
- // done
- return private;
+ struct en50221_app_lowspeed *lowspeed = NULL;
+
+ // create structure and set it up
+ lowspeed = malloc(sizeof(struct en50221_app_lowspeed));
+ if (lowspeed == NULL) {
+ return NULL;
+ }
+ lowspeed->funcs = funcs;
+ lowspeed->command_callback = NULL;
+ lowspeed->send_callback = NULL;
+ lowspeed->sessions = NULL;
+
+ pthread_mutex_init(&lowspeed->lock, NULL);
+
+ // done
+ return lowspeed;
}
-void en50221_app_lowspeed_destroy(en50221_app_lowspeed lowspeed)
+void en50221_app_lowspeed_destroy(struct en50221_app_lowspeed *lowspeed)
{
- struct en50221_app_lowspeed_private *private = (struct en50221_app_lowspeed_private *) lowspeed;
-
- struct en50221_app_lowspeed_session *cur_s = private->sessions;
- while(cur_s) {
- struct en50221_app_lowspeed_session *next = cur_s->next;
- if (cur_s->block_chain)
- free(cur_s->block_chain);
- free(cur_s);
- cur_s = next;
- }
-
- pthread_mutex_destroy(&private->lock);
- free(private);
+ struct en50221_app_lowspeed_session *cur_s = lowspeed->sessions;
+ while (cur_s) {
+ struct en50221_app_lowspeed_session *next = cur_s->next;
+ if (cur_s->block_chain)
+ free(cur_s->block_chain);
+ free(cur_s);
+ cur_s = next;
+ }
+
+ pthread_mutex_destroy(&lowspeed->lock);
+ free(lowspeed);
}
-void en50221_app_lowspeed_clear_session(en50221_app_lowspeed lowspeed, uint16_t session_number)
+void en50221_app_lowspeed_clear_session(struct en50221_app_lowspeed *lowspeed,
+ uint16_t session_number)
{
- struct en50221_app_lowspeed_private *private = (struct en50221_app_lowspeed_private *) lowspeed;
-
- pthread_mutex_lock(&private->lock);
- struct en50221_app_lowspeed_session *cur_s = private->sessions;
- struct en50221_app_lowspeed_session *prev_s = NULL;
- while(cur_s) {
- if (cur_s->session_number == session_number) {
- if (cur_s->block_chain)
- free(cur_s->block_chain);
- if (prev_s) {
- prev_s->next = cur_s->next;
- } else {
- private->sessions = cur_s->next;
- }
- free(cur_s);
- return;
- }
-
- prev_s = cur_s;
- cur_s=cur_s->next;
- }
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&lowspeed->lock);
+ struct en50221_app_lowspeed_session *cur_s = lowspeed->sessions;
+ struct en50221_app_lowspeed_session *prev_s = NULL;
+ while (cur_s) {
+ if (cur_s->session_number == session_number) {
+ if (cur_s->block_chain)
+ free(cur_s->block_chain);
+ if (prev_s) {
+ prev_s->next = cur_s->next;
+ } else {
+ lowspeed->sessions = cur_s->next;
+ }
+ free(cur_s);
+ return;
+ }
+
+ prev_s = cur_s;
+ cur_s = cur_s->next;
+ }
+ pthread_mutex_unlock(&lowspeed->lock);
}
-void en50221_app_lowspeed_register_command_callback(en50221_app_lowspeed lowspeed,
- en50221_app_lowspeed_command_callback callback, void *arg)
+void en50221_app_lowspeed_register_command_callback(struct en50221_app_lowspeed *lowspeed,
+ en50221_app_lowspeed_command_callback callback,
+ void *arg)
{
- struct en50221_app_lowspeed_private *private = (struct en50221_app_lowspeed_private *) lowspeed;
-
- pthread_mutex_lock(&private->lock);
- private->command_callback = callback;
- private->command_callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&lowspeed->lock);
+ lowspeed->command_callback = callback;
+ lowspeed->command_callback_arg = arg;
+ pthread_mutex_unlock(&lowspeed->lock);
}
-void en50221_app_lowspeed_register_send_callback(en50221_app_lowspeed lowspeed,
- en50221_app_lowspeed_send_callback callback, void *arg)
+void en50221_app_lowspeed_register_send_callback(struct en50221_app_lowspeed *lowspeed,
+ en50221_app_lowspeed_send_callback callback,
+ void *arg)
{
- struct en50221_app_lowspeed_private *private = (struct en50221_app_lowspeed_private *) lowspeed;
-
- pthread_mutex_lock(&private->lock);
- private->send_callback = callback;
- private->send_callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&lowspeed->lock);
+ lowspeed->send_callback = callback;
+ lowspeed->send_callback_arg = arg;
+ pthread_mutex_unlock(&lowspeed->lock);
}
-int en50221_app_lowspeed_send_comms_reply(en50221_app_lowspeed lowspeed,
- uint16_t session_number,
- uint8_t comms_reply_id,
- uint8_t return_value)
+int en50221_app_lowspeed_send_comms_reply(struct en50221_app_lowspeed *lowspeed,
+ uint16_t session_number,
+ uint8_t comms_reply_id,
+ uint8_t return_value)
{
- struct en50221_app_lowspeed_private *private = (struct en50221_app_lowspeed_private *) lowspeed;
- uint8_t data[6];
-
- data[0] = (TAG_COMMS_REPLY >> 16) & 0xFF;
- data[1] = (TAG_COMMS_REPLY >> 8) & 0xFF;
- data[2] = TAG_COMMS_REPLY & 0xFF;
- data[3] = 2;
- data[4] = comms_reply_id;
- data[5] = return_value;
- return private->funcs->send_data(private->funcs->arg, session_number, data, 6);
+ uint8_t data[6];
+
+ data[0] = (TAG_COMMS_REPLY >> 16) & 0xFF;
+ data[1] = (TAG_COMMS_REPLY >> 8) & 0xFF;
+ data[2] = TAG_COMMS_REPLY & 0xFF;
+ data[3] = 2;
+ data[4] = comms_reply_id;
+ data[5] = return_value;
+ return lowspeed->funcs->send_data(lowspeed->funcs->arg,
+ session_number, data, 6);
}
-int en50221_app_lowspeed_send_comms_data(en50221_app_lowspeed lowspeed,
- uint16_t session_number,
- uint8_t phase_id,
- uint32_t tx_data_length,
- uint8_t *tx_data)
+int en50221_app_lowspeed_send_comms_data(struct en50221_app_lowspeed *lowspeed,
+ uint16_t session_number,
+ uint8_t phase_id,
+ uint32_t tx_data_length,
+ uint8_t * tx_data)
{
- struct en50221_app_lowspeed_private *private = (struct en50221_app_lowspeed_private *) lowspeed;
- uint8_t buf[10];
-
- // the spec defines this limit
- if (tx_data_length > 254) {
- return -1;
- }
-
- // set up the tag
- buf[0] = (TAG_COMMS_RECV_LAST >> 16) & 0xFF;
- buf[1] = (TAG_COMMS_RECV_LAST >> 8) & 0xFF;
- buf[2] = TAG_COMMS_RECV_LAST & 0xFF;
-
- // encode the length field
- int length_field_len;
- if ((length_field_len = asn_1_encode(tx_data_length+1, buf+3, 3)) < 0) {
- return -1;
- }
-
- // the phase_id
- buf[3+length_field_len] = phase_id;
-
- // build the iovecs
- struct iovec iov[2];
- iov[0].iov_base = buf;
- iov[0].iov_len = 3+length_field_len+1;
- iov[1].iov_base = tx_data;
- iov[1].iov_len = tx_data_length;
-
- // create the data and send it
- return private->funcs->send_datav(private->funcs->arg, session_number, iov, 2);
+ uint8_t buf[10];
+
+ // the spec defines this limit
+ if (tx_data_length > 254) {
+ return -1;
+ }
+ // set up the tag
+ buf[0] = (TAG_COMMS_RECV_LAST >> 16) & 0xFF;
+ buf[1] = (TAG_COMMS_RECV_LAST >> 8) & 0xFF;
+ buf[2] = TAG_COMMS_RECV_LAST & 0xFF;
+
+ // encode the length field
+ int length_field_len;
+ if ((length_field_len = asn_1_encode(tx_data_length + 1, buf + 3, 3)) < 0) {
+ return -1;
+ }
+ // the phase_id
+ buf[3 + length_field_len] = phase_id;
+
+ // build the iovecs
+ struct iovec iov[2];
+ iov[0].iov_base = buf;
+ iov[0].iov_len = 3 + length_field_len + 1;
+ iov[1].iov_base = tx_data;
+ iov[1].iov_len = tx_data_length;
+
+ // create the data and send it
+ return lowspeed->funcs->send_datav(lowspeed->funcs->arg,
+ session_number, iov, 2);
}
-int en50221_app_lowspeed_message(en50221_app_lowspeed lowspeed,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length)
+int en50221_app_lowspeed_message(struct en50221_app_lowspeed *lowspeed,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data, uint32_t data_length)
{
- struct en50221_app_lowspeed_private *private = (struct en50221_app_lowspeed_private *) lowspeed;
- (void)resource_id;
-
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
-
- switch(tag)
- {
- case TAG_COMMS_COMMAND:
- return en50221_app_lowspeed_parse_command(private, slot_id, session_number, data+3, data_length-3);
- case TAG_COMMS_SEND_LAST:
- return en50221_app_lowspeed_parse_send(private, slot_id, session_number, 1, data+3, data_length-3);
- case TAG_COMMS_SEND_MORE:
- return en50221_app_lowspeed_parse_send(private, slot_id, session_number, 0, data+3, data_length-3);
- }
-
- print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
- return -1;
+ (void) resource_id;
+
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+
+ switch (tag) {
+ case TAG_COMMS_COMMAND:
+ return en50221_app_lowspeed_parse_command(lowspeed,
+ slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ case TAG_COMMS_SEND_LAST:
+ return en50221_app_lowspeed_parse_send(lowspeed, slot_id,
+ session_number, 1,
+ data + 3,
+ data_length - 3);
+ case TAG_COMMS_SEND_MORE:
+ return en50221_app_lowspeed_parse_send(lowspeed, slot_id,
+ session_number, 0,
+ data + 3,
+ data_length - 3);
+ }
+
+ print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
+ return -1;
}
static int en50221_app_lowspeed_parse_connect_on_channel(struct en50221_app_lowspeed_command *command,
- uint8_t *data,
- int data_length)
+ uint8_t *data,
+ int data_length)
{
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
-
- // check the tag
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
- if (tag != TAG_CONNECTION_DESCRIPTOR) {
- print(LOG_LEVEL, ERROR, 1, "Received bad CONNECT_ON_CHANNEL\n");
- return -1;
- }
- data+=3;
- data_length-=3;
-
- // parse the descriptor-length-field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
- data+=length_field_len;
- data_length-=length_field_len;
-
- // check length field
- if (asn_data_length > data_length) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (asn_data_length < 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
-
- // get the descriptor type
- command->u.connect_on_channel.descriptor_type = data[0];
- data++;
- data_length--;
- asn_data_length--;
-
- // deal with the descriptor itself
- switch(command->u.connect_on_channel.descriptor_type) {
- case CONNECTION_DESCRIPTOR_TYPE_TELEPHONE:
- {
- // get the raw descriptor and validate length
- struct descriptor *d = (struct descriptor*) data;
- if (asn_data_length < 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (asn_data_length != (2 + d->len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (d->tag != dtag_dvb_telephone) {
- print(LOG_LEVEL, ERROR, 1, "Received invalid telephone descriptor\n");
- return -1;
- }
-
- // parse the telephone descriptor
- command->u.connect_on_channel.descriptor.telephone = dvb_telephone_descriptor_codec(d);
- if (command->u.connect_on_channel.descriptor.telephone == NULL) {
- print(LOG_LEVEL, ERROR, 1, "Received invalid telephone descriptor\n");
- return -1;
- }
- data += 2 + d->len;
- data_length -= 2 + d->len;
- break;
- }
- case CONNECTION_DESCRIPTOR_TYPE_CABLE:
- if (asn_data_length != 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- command->u.connect_on_channel.descriptor.cable_channel_id = data[0];
- data++;
- data_length--;
- break;
- default:
- print(LOG_LEVEL, ERROR, 1, "Received unknown connection descriptor %02x\n",
- command->u.connect_on_channel.descriptor_type);
- return -1;
- }
-
- // parse the last bit
- if (data_length != 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- command->u.connect_on_channel.retry_count = data[0];
- command->u.connect_on_channel.timeout = data[1];
-
- // ok
- return 0;
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ // check the tag
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+ if (tag != TAG_CONNECTION_DESCRIPTOR) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received bad CONNECT_ON_CHANNEL\n");
+ return -1;
+ }
+ data += 3;
+ data_length -= 3;
+
+ // parse the descriptor-length-field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ data += length_field_len;
+ data_length -= length_field_len;
+
+ // check length field
+ if (asn_data_length > data_length) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (asn_data_length < 1) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ // get the descriptor type
+ command->u.connect_on_channel.descriptor_type = data[0];
+ data++;
+ data_length--;
+ asn_data_length--;
+
+ // deal with the descriptor itself
+ switch (command->u.connect_on_channel.descriptor_type) {
+ case CONNECTION_DESCRIPTOR_TYPE_TELEPHONE:
+ {
+ // get the raw descriptor and validate length
+ struct descriptor *d = (struct descriptor *) data;
+ if (asn_data_length < 2) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received short data\n");
+ return -1;
+ }
+ if (asn_data_length != (2 + d->len)) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received short data\n");
+ return -1;
+ }
+ if (d->tag != dtag_dvb_telephone) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received invalid telephone descriptor\n");
+ return -1;
+ }
+ // parse the telephone descriptor
+ command->u.connect_on_channel.descriptor.telephone = dvb_telephone_descriptor_codec(d);
+ if (command->u.connect_on_channel.descriptor.telephone == NULL) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received invalid telephone descriptor\n");
+ return -1;
+ }
+ data += 2 + d->len;
+ data_length -= 2 + d->len;
+ break;
+ }
+
+ case CONNECTION_DESCRIPTOR_TYPE_CABLE:
+ if (asn_data_length != 1) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received short data\n");
+ return -1;
+ }
+ command->u.connect_on_channel.descriptor.cable_channel_id = data[0];
+ data++;
+ data_length--;
+ break;
+ default:
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unknown connection descriptor %02x\n",
+ command->u.connect_on_channel.descriptor_type);
+ return -1;
+ }
+
+ // parse the last bit
+ if (data_length != 2) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ command->u.connect_on_channel.retry_count = data[0];
+ command->u.connect_on_channel.timeout = data[1];
+
+ // ok
+ return 0;
}
-static int en50221_app_lowspeed_parse_command(struct en50221_app_lowspeed_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_lowspeed_parse_command(struct en50221_app_lowspeed *lowspeed,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length < 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- data+=length_field_len;
-
- // get command id
- uint8_t command_id = data[0];
- data++;
- asn_data_length--;
-
- // parse the command
- struct en50221_app_lowspeed_command command;
- switch(command_id) {
- case COMMS_COMMAND_ID_CONNECT_ON_CHANNEL:
- if (en50221_app_lowspeed_parse_connect_on_channel(&command, data, asn_data_length)) {
- return -1;
- }
- break;
- case COMMS_COMMAND_ID_SET_PARAMS:
- if (asn_data_length != 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- command.u.set_params.buffer_size = data[0];
- command.u.set_params.timeout = data[1];
- break;
- case COMMS_COMMAND_ID_GET_NEXT_BUFFER:
- if (asn_data_length != 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- command.u.get_next_buffer.phase_id = data[0];
- break;
-
- case COMMS_COMMAND_ID_DISCONNECT_ON_CHANNEL:
- case COMMS_COMMAND_ID_ENQUIRE_STATUS:
- break;
-
- default:
- print(LOG_LEVEL, ERROR, 1, "Received unexpected command_id %02x\n", command_id);
- return -1;
- }
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_lowspeed_command_callback cb = private->command_callback;
- void *cb_arg = private->command_callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, command_id, &command);
- }
- return 0;
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ // check it
+ if (asn_data_length < 1) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ data += length_field_len;
+
+ // get command id
+ uint8_t command_id = data[0];
+ data++;
+ asn_data_length--;
+
+ // parse the command
+ struct en50221_app_lowspeed_command command;
+ switch (command_id) {
+ case COMMS_COMMAND_ID_CONNECT_ON_CHANNEL:
+ if (en50221_app_lowspeed_parse_connect_on_channel
+ (&command, data, asn_data_length)) {
+ return -1;
+ }
+ break;
+ case COMMS_COMMAND_ID_SET_PARAMS:
+ if (asn_data_length != 2) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received short data\n");
+ return -1;
+ }
+ command.u.set_params.buffer_size = data[0];
+ command.u.set_params.timeout = data[1];
+ break;
+ case COMMS_COMMAND_ID_GET_NEXT_BUFFER:
+ if (asn_data_length != 1) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received short data\n");
+ return -1;
+ }
+ command.u.get_next_buffer.phase_id = data[0];
+ break;
+
+ case COMMS_COMMAND_ID_DISCONNECT_ON_CHANNEL:
+ case COMMS_COMMAND_ID_ENQUIRE_STATUS:
+ break;
+
+ default:
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected command_id %02x\n", command_id);
+ return -1;
+ }
+
+ // tell the app
+ pthread_mutex_lock(&lowspeed->lock);
+ en50221_app_lowspeed_command_callback cb = lowspeed->command_callback;
+ void *cb_arg = lowspeed->command_callback_arg;
+ pthread_mutex_unlock(&lowspeed->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, command_id,
+ &command);
+ }
+ return 0;
}
-static int en50221_app_lowspeed_parse_send(struct en50221_app_lowspeed_private *private,
- uint8_t slot_id, uint16_t session_number, int more_last,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_lowspeed_parse_send(struct en50221_app_lowspeed *lowspeed,
+ uint8_t slot_id,
+ uint16_t session_number,
+ int more_last,
+ uint8_t *data,
+ uint32_t data_length)
{
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
-
- // skip over the length field
- data += length_field_len;
-
- // find previous session
- pthread_mutex_lock(&private->lock);
- struct en50221_app_lowspeed_session *cur_s = private->sessions;
- while(cur_s) {
- if (cur_s->session_number == session_number)
- break;
- cur_s=cur_s->next;
- }
-
- // more data is still to come
- if (!more_last) {
- // if there was no previous session, create one
- if (cur_s == NULL) {
- cur_s = malloc(sizeof(struct en50221_app_lowspeed_session));
- if (cur_s == NULL) {
- print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
- pthread_mutex_unlock(&private->lock);
- return -1;
- }
- cur_s->session_number = session_number;
- cur_s->block_chain = NULL;
- cur_s->block_length = 0;
- cur_s->next = private->sessions;
- private->sessions = cur_s;
- }
-
- // append the data
- uint8_t *new_data = realloc(cur_s->block_chain, cur_s->block_length + asn_data_length);
- if (new_data == NULL) {
- print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
- pthread_mutex_unlock(&private->lock);
- return -1;
- }
- memcpy(new_data + cur_s->block_length, data, asn_data_length);
- cur_s->block_chain = new_data;
- cur_s->block_length += asn_data_length;
-
- // done
- pthread_mutex_unlock(&private->lock);
- return 0;
- }
-
- // we hit the last of a possible chain of fragments
- int do_free = 0;
- if (cur_s != NULL) {
- // we have a preceding fragment - need to append
- uint8_t *new_data = realloc(cur_s->block_chain, cur_s->block_length + asn_data_length);
- if (new_data == NULL) {
- print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
- pthread_mutex_unlock(&private->lock);
- return -1;
- }
- memcpy(new_data + cur_s->block_length, data, asn_data_length);
- asn_data_length = cur_s->block_length + asn_data_length;
- data = new_data;
- cur_s->block_chain = NULL;
- cur_s->block_length = 0;
- do_free = 1;
- }
-
- // check the reassembled data length
- if (asn_data_length < 1) {
- pthread_mutex_unlock(&private->lock);
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- if (do_free) free(data);
- return -1;
- }
-
- // now, parse the data
- uint8_t phase_id = data[0];
-
- // tell the app
- en50221_app_lowspeed_send_callback cb = private->send_callback;
- void *cb_arg = private->send_callback_arg;
- pthread_mutex_unlock(&private->lock);
- int cbstatus = 0;
- if (cb) {
- cbstatus = cb(cb_arg, slot_id, session_number, phase_id, data+1, asn_data_length-1);
- }
-
- // done
- if (do_free) free(data);
- return cbstatus;
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ // check it
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ // skip over the length field
+ data += length_field_len;
+
+ // find previous session
+ pthread_mutex_lock(&lowspeed->lock);
+ struct en50221_app_lowspeed_session *cur_s = lowspeed->sessions;
+ while (cur_s) {
+ if (cur_s->session_number == session_number)
+ break;
+ cur_s = cur_s->next;
+ }
+
+ // more data is still to come
+ if (!more_last) {
+ // if there was no previous session, create one
+ if (cur_s == NULL) {
+ cur_s = malloc(sizeof(struct en50221_app_lowspeed_session));
+ if (cur_s == NULL) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Ran out of memory\n");
+ pthread_mutex_unlock(&lowspeed->lock);
+ return -1;
+ }
+ cur_s->session_number = session_number;
+ cur_s->block_chain = NULL;
+ cur_s->block_length = 0;
+ cur_s->next = lowspeed->sessions;
+ lowspeed->sessions = cur_s;
+ }
+ // append the data
+ uint8_t *new_data = realloc(cur_s->block_chain,
+ cur_s->block_length + asn_data_length);
+ if (new_data == NULL) {
+ print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
+ pthread_mutex_unlock(&lowspeed->lock);
+ return -1;
+ }
+ memcpy(new_data + cur_s->block_length, data, asn_data_length);
+ cur_s->block_chain = new_data;
+ cur_s->block_length += asn_data_length;
+
+ // done
+ pthread_mutex_unlock(&lowspeed->lock);
+ return 0;
+ }
+ // we hit the last of a possible chain of fragments
+ int do_free = 0;
+ if (cur_s != NULL) {
+ // we have a preceding fragment - need to append
+ uint8_t *new_data = realloc(cur_s->block_chain,
+ cur_s->block_length + asn_data_length);
+ if (new_data == NULL) {
+ print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
+ pthread_mutex_unlock(&lowspeed->lock);
+ return -1;
+ }
+ memcpy(new_data + cur_s->block_length, data, asn_data_length);
+ asn_data_length = cur_s->block_length + asn_data_length;
+ data = new_data;
+ cur_s->block_chain = NULL;
+ cur_s->block_length = 0;
+ do_free = 1;
+ }
+ // check the reassembled data length
+ if (asn_data_length < 1) {
+ pthread_mutex_unlock(&lowspeed->lock);
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ if (do_free)
+ free(data);
+ return -1;
+ }
+ // now, parse the data
+ uint8_t phase_id = data[0];
+
+ // tell the app
+ en50221_app_lowspeed_send_callback cb = lowspeed->send_callback;
+ void *cb_arg = lowspeed->send_callback_arg;
+ pthread_mutex_unlock(&lowspeed->lock);
+ int cbstatus = 0;
+ if (cb) {
+ cbstatus =
+ cb(cb_arg, slot_id, session_number, phase_id, data + 1, asn_data_length - 1);
+ }
+ // done
+ if (do_free)
+ free(data);
+ return cbstatus;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_lowspeed.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_lowspeed.h
index 4a3e554..0ef983c 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_lowspeed.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_lowspeed.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APPLICATION_LOWSPEED_H__
#define __EN50221_APPLICATION_LOWSPEED_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -57,26 +56,26 @@ extern "C"
* Structure holding information on a received comms command.
*/
struct en50221_app_lowspeed_command {
- union {
- struct {
- uint8_t descriptor_type; // CONNECTION_DESCRIPTOR_TYPE_*
- uint8_t retry_count;
- uint8_t timeout;
- union {
- struct dvb_telephone_descriptor *telephone;
- uint8_t cable_channel_id;
- } descriptor;
- } connect_on_channel;
-
- struct {
- uint8_t buffer_size;
- uint8_t timeout;
- } set_params;
-
- struct {
- uint8_t phase_id;
- } get_next_buffer;
- } u;
+ union {
+ struct {
+ uint8_t descriptor_type; // CONNECTION_DESCRIPTOR_TYPE_*
+ uint8_t retry_count;
+ uint8_t timeout;
+ union {
+ struct dvb_telephone_descriptor *telephone;
+ uint8_t cable_channel_id;
+ } descriptor;
+ } connect_on_channel;
+
+ struct {
+ uint8_t buffer_size;
+ uint8_t timeout;
+ } set_params;
+
+ struct {
+ uint8_t phase_id;
+ } get_next_buffer;
+ } u;
};
/**
@@ -89,9 +88,11 @@ struct en50221_app_lowspeed_command {
* @param command Pointer to a lowspeed command structure containing the command data.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_lowspeed_command_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t command_id,
- struct en50221_app_lowspeed_command *command);
+typedef int (*en50221_app_lowspeed_command_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t command_id,
+ struct en50221_app_lowspeed_command *command);
/**
* Type definition for send - called when we receive data to send. The block can be segmented into
@@ -105,13 +106,17 @@ typedef int (*en50221_app_lowspeed_command_callback)(void *arg, uint8_t slot_id,
* @param length Number of bytes.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_lowspeed_send_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t phase_id, uint8_t *data, uint32_t length);
+typedef int (*en50221_app_lowspeed_send_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t phase_id,
+ uint8_t *data,
+ uint32_t length);
/**
* Opaque type representing a lowspeed resource.
*/
-typedef void *en50221_app_lowspeed;
+struct en50221_app_lowspeed;
/**
* Create an instance of the lowspeed resource.
@@ -119,14 +124,15 @@ typedef void *en50221_app_lowspeed;
* @param funcs Send functions to use.
* @return Instance, or NULL on failure.
*/
-extern en50221_app_lowspeed en50221_app_lowspeed_create(struct en50221_app_send_functions *funcs);
+extern struct en50221_app_lowspeed *
+ en50221_app_lowspeed_create(struct en50221_app_send_functions *funcs);
/**
* Destroy an instance of the lowspeed resource.
*
* @param lowspeed Instance to destroy.
*/
-extern void en50221_app_lowspeed_destroy(en50221_app_lowspeed lowspeed);
+extern void en50221_app_lowspeed_destroy(struct en50221_app_lowspeed *lowspeed);
/**
* Informs the lowspeed object that a session to it has been closed - cleans up internal state.
@@ -134,7 +140,8 @@ extern void en50221_app_lowspeed_destroy(en50221_app_lowspeed lowspeed);
* @param lowspeed lowspeed resource instance.
* @param session_number The session concerned.
*/
-extern void en50221_app_lowspeed_clear_session(en50221_app_lowspeed lowspeed, uint16_t session_number);
+extern void en50221_app_lowspeed_clear_session(struct en50221_app_lowspeed *lowspeed,
+ uint16_t session_number);
/**
* Register the callback for when we receive a comms command.
@@ -143,8 +150,9 @@ extern void en50221_app_lowspeed_clear_session(en50221_app_lowspeed lowspeed, ui
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_lowspeed_register_command_callback(en50221_app_lowspeed lowspeed,
- en50221_app_lowspeed_command_callback callback, void *arg);
+extern void en50221_app_lowspeed_register_command_callback(struct en50221_app_lowspeed *lowspeed,
+ en50221_app_lowspeed_command_callback callback,
+ void *arg);
/**
* Register the callback for when we receive data to send.
@@ -153,8 +161,9 @@ extern void en50221_app_lowspeed_register_command_callback(en50221_app_lowspeed
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_lowspeed_register_send_callback(en50221_app_lowspeed lowspeed,
- en50221_app_lowspeed_send_callback callback, void *arg);
+extern void en50221_app_lowspeed_register_send_callback(struct en50221_app_lowspeed *lowspeed,
+ en50221_app_lowspeed_send_callback callback,
+ void *arg);
/**
* Send a comms reply to the CAM.
@@ -165,10 +174,10 @@ extern void en50221_app_lowspeed_register_send_callback(en50221_app_lowspeed low
* @param return_value Comms reply specific value.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_lowspeed_send_comms_reply(en50221_app_lowspeed lowspeed,
- uint16_t session_number,
- uint8_t comms_reply_id,
- uint8_t return_value);
+extern int en50221_app_lowspeed_send_comms_reply(struct en50221_app_lowspeed *lowspeed,
+ uint16_t session_number,
+ uint8_t comms_reply_id,
+ uint8_t return_value);
/**
* Send received data to the CAM.
@@ -180,11 +189,11 @@ extern int en50221_app_lowspeed_send_comms_reply(en50221_app_lowspeed lowspeed,
* @param tx_data Data.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_lowspeed_send_comms_data(en50221_app_lowspeed lowspeed,
- uint16_t session_number,
- uint8_t phase_id,
- uint32_t tx_data_length,
- uint8_t *tx_data);
+extern int en50221_app_lowspeed_send_comms_data(struct en50221_app_lowspeed *lowspeed,
+ uint16_t session_number,
+ uint8_t phase_id,
+ uint32_t tx_data_length,
+ uint8_t * tx_data);
/**
* Pass data received for this resource into it for parsing.
@@ -197,14 +206,14 @@ extern int en50221_app_lowspeed_send_comms_data(en50221_app_lowspeed lowspeed,
* @param data_length Length of data in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_lowspeed_message(en50221_app_lowspeed lowspeed,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_app_lowspeed_message(struct en50221_app_lowspeed *lowspeed,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data,
+ uint32_t data_length);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_mmi.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_mmi.c
index bb82678..830eaa3 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_mmi.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_mmi.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
@@ -30,1287 +30,1368 @@
#include "asn_1.h"
struct en50221_app_mmi_session {
- uint16_t session_number;
+ uint16_t session_number;
- uint8_t *menu_block_chain;
- uint32_t menu_block_length;
+ uint8_t *menu_block_chain;
+ uint32_t menu_block_length;
- uint8_t *list_block_chain;
- uint32_t list_block_length;
+ uint8_t *list_block_chain;
+ uint32_t list_block_length;
- uint8_t *subtitlesegment_block_chain;
- uint32_t subtitlesegment_block_length;
+ uint8_t *subtitlesegment_block_chain;
+ uint32_t subtitlesegment_block_length;
- uint8_t *subtitledownload_block_chain;
- uint32_t subtitledownload_block_length;
+ uint8_t *subtitledownload_block_chain;
+ uint32_t subtitledownload_block_length;
- struct en50221_app_mmi_session *next;
+ struct en50221_app_mmi_session *next;
};
-struct en50221_app_mmi_private {
- struct en50221_app_send_functions *funcs;
- struct en50221_app_mmi_session *sessions;
+struct en50221_app_mmi {
+ struct en50221_app_send_functions *funcs;
+ struct en50221_app_mmi_session *sessions;
- en50221_app_mmi_close_callback closecallback;
- void *closecallback_arg;
+ en50221_app_mmi_close_callback closecallback;
+ void *closecallback_arg;
- en50221_app_mmi_display_control_callback displaycontrolcallback;
- void *displaycontrolcallback_arg;
+ en50221_app_mmi_display_control_callback displaycontrolcallback;
+ void *displaycontrolcallback_arg;
- en50221_app_mmi_keypad_control_callback keypadcontrolcallback;
- void *keypadcontrolcallback_arg;
+ en50221_app_mmi_keypad_control_callback keypadcontrolcallback;
+ void *keypadcontrolcallback_arg;
- en50221_app_mmi_subtitle_segment_callback subtitlesegmentcallback;
- void *subtitlesegmentcallback_arg;
+ en50221_app_mmi_subtitle_segment_callback subtitlesegmentcallback;
+ void *subtitlesegmentcallback_arg;
- en50221_app_mmi_scene_end_mark_callback sceneendmarkcallback;
- void *sceneendmarkcallback_arg;
+ en50221_app_mmi_scene_end_mark_callback sceneendmarkcallback;
+ void *sceneendmarkcallback_arg;
- en50221_app_mmi_scene_control_callback scenecontrolcallback;
- void *scenecontrolcallback_arg;
+ en50221_app_mmi_scene_control_callback scenecontrolcallback;
+ void *scenecontrolcallback_arg;
- en50221_app_mmi_subtitle_download_callback subtitledownloadcallback;
- void *subtitledownloadcallback_arg;
+ en50221_app_mmi_subtitle_download_callback subtitledownloadcallback;
+ void *subtitledownloadcallback_arg;
- en50221_app_mmi_flush_download_callback flushdownloadcallback;
- void *flushdownloadcallback_arg;
+ en50221_app_mmi_flush_download_callback flushdownloadcallback;
+ void *flushdownloadcallback_arg;
- en50221_app_mmi_enq_callback enqcallback;
- void *enqcallback_arg;
+ en50221_app_mmi_enq_callback enqcallback;
+ void *enqcallback_arg;
- en50221_app_mmi_menu_callback menucallback;
- void *menucallback_arg;
+ en50221_app_mmi_menu_callback menucallback;
+ void *menucallback_arg;
- en50221_app_mmi_list_callback listcallback;
- void *listcallback_arg;
+ en50221_app_mmi_list_callback listcallback;
+ void *listcallback_arg;
- pthread_mutex_t lock;
+ pthread_mutex_t lock;
};
-static int en50221_app_mmi_parse_close(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-static int en50221_app_mmi_parse_display_control(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-static int en50221_app_mmi_parse_keypad_control(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-static int en50221_app_mmi_parse_enq(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-static int en50221_app_mmi_parse_list_menu(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number, uint32_t tag_id,
- int more_last, uint8_t *data, uint32_t data_length);
-static int en50221_app_mmi_parse_subtitle(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number, uint32_t tag_id,
- int more_last, uint8_t *data, uint32_t data_length);
-static int en50221_app_mmi_parse_scene_end_mark(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-static int en50221_app_mmi_parse_scene_control(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-static int en50221_app_mmi_parse_subtitle(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number, uint32_t tag_id,
- int more_last, uint8_t *data, uint32_t data_length);
-static int en50221_app_mmi_parse_flush_download(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-static int en50221_app_mmi_defragment(struct en50221_app_mmi_private *private,
- uint16_t session_number,
- uint32_t tag_id,
- int more_last,
- uint8_t *indata,
- uint32_t indata_length,
- uint8_t **outdata,
- uint32_t *outdata_length);
-static int en50221_app_mmi_defragment_text(uint8_t *data,
- uint32_t data_length,
- uint8_t **outdata,
- uint32_t *outdata_length,
- uint32_t *outconsumed);
-
-
-
-en50221_app_mmi en50221_app_mmi_create(struct en50221_app_send_functions *funcs)
+static int en50221_app_mmi_parse_close(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_app_mmi_parse_display_control(struct en50221_app_mmi
+ *mmi, uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_app_mmi_parse_keypad_control(struct en50221_app_mmi
+ *mmi, uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_app_mmi_parse_enq(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data, uint32_t data_length);
+static int en50221_app_mmi_parse_list_menu(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t tag_id, int more_last,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_app_mmi_parse_subtitle(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t tag_id, int more_last,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_app_mmi_parse_scene_end_mark(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_app_mmi_parse_scene_control(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_app_mmi_parse_subtitle(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t tag_id, int more_last,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_app_mmi_parse_flush_download(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_app_mmi_defragment(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint32_t tag_id, int more_last,
+ uint8_t * indata,
+ uint32_t indata_length,
+ uint8_t ** outdata,
+ uint32_t * outdata_length);
+static int en50221_app_mmi_defragment_text(uint8_t * data,
+ uint32_t data_length,
+ uint8_t ** outdata,
+ uint32_t * outdata_length,
+ uint32_t * outconsumed);
+
+
+
+struct en50221_app_mmi *en50221_app_mmi_create(struct en50221_app_send_functions *funcs)
{
- struct en50221_app_mmi_private *private = NULL;
-
- // create structure and set it up
- private = malloc(sizeof(struct en50221_app_mmi_private));
- if (private == NULL) {
- return NULL;
- }
- private->funcs = funcs;
- private->closecallback = NULL;
- private->displaycontrolcallback = NULL;
- private->keypadcontrolcallback = NULL;
- private->subtitlesegmentcallback = NULL;
- private->sceneendmarkcallback = NULL;
- private->scenecontrolcallback = NULL;
- private->subtitledownloadcallback = NULL;
- private->flushdownloadcallback = NULL;
- private->enqcallback = NULL;
- private->menucallback = NULL;
- private->listcallback = NULL;
- private->sessions = NULL;
-
- pthread_mutex_init(&private->lock, NULL);
-
- // done
- return private;
+ struct en50221_app_mmi *mmi = NULL;
+
+ // create structure and set it up
+ mmi = malloc(sizeof(struct en50221_app_mmi));
+ if (mmi == NULL) {
+ return NULL;
+ }
+ mmi->funcs = funcs;
+ mmi->closecallback = NULL;
+ mmi->displaycontrolcallback = NULL;
+ mmi->keypadcontrolcallback = NULL;
+ mmi->subtitlesegmentcallback = NULL;
+ mmi->sceneendmarkcallback = NULL;
+ mmi->scenecontrolcallback = NULL;
+ mmi->subtitledownloadcallback = NULL;
+ mmi->flushdownloadcallback = NULL;
+ mmi->enqcallback = NULL;
+ mmi->menucallback = NULL;
+ mmi->listcallback = NULL;
+ mmi->sessions = NULL;
+
+ pthread_mutex_init(&mmi->lock, NULL);
+
+ // done
+ return mmi;
}
-void en50221_app_mmi_destroy(en50221_app_mmi mmi)
+void en50221_app_mmi_destroy(struct en50221_app_mmi *mmi)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- struct en50221_app_mmi_session *cur_s = private->sessions;
- while(cur_s) {
- struct en50221_app_mmi_session *next = cur_s->next;
- if (cur_s->menu_block_chain)
- free(cur_s->menu_block_chain);
- if (cur_s->list_block_chain)
- free(cur_s->list_block_chain);
- if (cur_s->subtitlesegment_block_chain)
- free(cur_s->subtitlesegment_block_chain);
- if (cur_s->subtitledownload_block_chain)
- free(cur_s->subtitledownload_block_chain);
- free(cur_s);
- cur_s = next;
- }
-
- pthread_mutex_destroy(&private->lock);
- free(private);
+ struct en50221_app_mmi_session *cur_s = mmi->sessions;
+ while (cur_s) {
+ struct en50221_app_mmi_session *next = cur_s->next;
+ if (cur_s->menu_block_chain)
+ free(cur_s->menu_block_chain);
+ if (cur_s->list_block_chain)
+ free(cur_s->list_block_chain);
+ if (cur_s->subtitlesegment_block_chain)
+ free(cur_s->subtitlesegment_block_chain);
+ if (cur_s->subtitledownload_block_chain)
+ free(cur_s->subtitledownload_block_chain);
+ free(cur_s);
+ cur_s = next;
+ }
+
+ pthread_mutex_destroy(&mmi->lock);
+ free(mmi);
}
-void en50221_app_mmi_clear_session(en50221_app_mmi mmi, uint16_t session_number)
+void en50221_app_mmi_clear_session(struct en50221_app_mmi *mmi,
+ uint16_t session_number)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- struct en50221_app_mmi_session *cur_s = private->sessions;
- struct en50221_app_mmi_session *prev_s = NULL;
- while(cur_s) {
- if (cur_s->session_number == session_number) {
- if (cur_s->menu_block_chain)
- free(cur_s->menu_block_chain);
- if (cur_s->list_block_chain)
- free(cur_s->list_block_chain);
- if (cur_s->subtitlesegment_block_chain)
- free(cur_s->subtitlesegment_block_chain);
- if (cur_s->subtitledownload_block_chain)
- free(cur_s->subtitledownload_block_chain);
- if (prev_s) {
- prev_s->next = cur_s->next;
- } else {
- private->sessions = cur_s->next;
- }
- free(cur_s);
- return;
- }
-
- prev_s = cur_s;
- cur_s=cur_s->next;
- }
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ struct en50221_app_mmi_session *cur_s = mmi->sessions;
+ struct en50221_app_mmi_session *prev_s = NULL;
+ while (cur_s) {
+ if (cur_s->session_number == session_number) {
+ if (cur_s->menu_block_chain)
+ free(cur_s->menu_block_chain);
+ if (cur_s->list_block_chain)
+ free(cur_s->list_block_chain);
+ if (cur_s->subtitlesegment_block_chain)
+ free(cur_s->subtitlesegment_block_chain);
+ if (cur_s->subtitledownload_block_chain)
+ free(cur_s->subtitledownload_block_chain);
+ if (prev_s) {
+ prev_s->next = cur_s->next;
+ } else {
+ mmi->sessions = cur_s->next;
+ }
+ free(cur_s);
+ return;
+ }
+
+ prev_s = cur_s;
+ cur_s = cur_s->next;
+ }
+ pthread_mutex_unlock(&mmi->lock);
}
-void en50221_app_mmi_register_close_callback(en50221_app_mmi mmi,
- en50221_app_mmi_close_callback callback, void *arg)
+void en50221_app_mmi_register_close_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_close_callback callback,
+ void *arg)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- private->closecallback = callback;
- private->closecallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ mmi->closecallback = callback;
+ mmi->closecallback_arg = arg;
+ pthread_mutex_unlock(&mmi->lock);
}
-void en50221_app_mmi_register_display_control_callback(en50221_app_mmi mmi,
- en50221_app_mmi_display_control_callback callback, void *arg)
+void en50221_app_mmi_register_display_control_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_display_control_callback callback,
+ void *arg)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- private->displaycontrolcallback = callback;
- private->displaycontrolcallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ mmi->displaycontrolcallback = callback;
+ mmi->displaycontrolcallback_arg = arg;
+ pthread_mutex_unlock(&mmi->lock);
}
-void en50221_app_mmi_register_keypad_control_callback(en50221_app_mmi mmi,
- en50221_app_mmi_keypad_control_callback callback, void *arg)
+void en50221_app_mmi_register_keypad_control_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_keypad_control_callback callback,
+ void *arg)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- private->keypadcontrolcallback = callback;
- private->keypadcontrolcallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ mmi->keypadcontrolcallback = callback;
+ mmi->keypadcontrolcallback_arg = arg;
+ pthread_mutex_unlock(&mmi->lock);
}
-void en50221_app_mmi_register_subtitle_segment_callback(en50221_app_mmi mmi,
- en50221_app_mmi_subtitle_segment_callback callback, void *arg)
+void en50221_app_mmi_register_subtitle_segment_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_subtitle_segment_callback callback,
+ void *arg)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- private->subtitlesegmentcallback = callback;
- private->subtitlesegmentcallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ mmi->subtitlesegmentcallback = callback;
+ mmi->subtitlesegmentcallback_arg = arg;
+ pthread_mutex_unlock(&mmi->lock);
}
-void en50221_app_mmi_register_scene_end_mark_callback(en50221_app_mmi mmi,
- en50221_app_mmi_scene_end_mark_callback callback, void *arg)
+void en50221_app_mmi_register_scene_end_mark_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_scene_end_mark_callback callback, void *arg)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- private->sceneendmarkcallback = callback;
- private->sceneendmarkcallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ mmi->sceneendmarkcallback = callback;
+ mmi->sceneendmarkcallback_arg = arg;
+ pthread_mutex_unlock(&mmi->lock);
}
-void en50221_app_mmi_register_scene_control_callback(en50221_app_mmi mmi,
- en50221_app_mmi_scene_control_callback callback, void *arg)
+void en50221_app_mmi_register_scene_control_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_scene_control_callback callback, void *arg)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- private->scenecontrolcallback = callback;
- private->scenecontrolcallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ mmi->scenecontrolcallback = callback;
+ mmi->scenecontrolcallback_arg = arg;
+ pthread_mutex_unlock(&mmi->lock);
}
-void en50221_app_mmi_register_subtitle_download_callback(en50221_app_mmi mmi,
- en50221_app_mmi_subtitle_download_callback callback, void *arg)
+void en50221_app_mmi_register_subtitle_download_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_subtitle_download_callback callback,
+ void *arg)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- private->subtitledownloadcallback = callback;
- private->subtitledownloadcallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ mmi->subtitledownloadcallback = callback;
+ mmi->subtitledownloadcallback_arg = arg;
+ pthread_mutex_unlock(&mmi->lock);
}
-void en50221_app_mmi_register_flush_download_callback(en50221_app_mmi mmi,
- en50221_app_mmi_flush_download_callback callback, void *arg)
+void en50221_app_mmi_register_flush_download_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_flush_download_callback callback,
+ void *arg)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- private->flushdownloadcallback = callback;
- private->flushdownloadcallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ mmi->flushdownloadcallback = callback;
+ mmi->flushdownloadcallback_arg = arg;
+ pthread_mutex_unlock(&mmi->lock);
}
-void en50221_app_mmi_register_enq_callback(en50221_app_mmi mmi,
- en50221_app_mmi_enq_callback callback, void *arg)
+void en50221_app_mmi_register_enq_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_enq_callback callback,
+ void *arg)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- private->enqcallback = callback;
- private->enqcallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ mmi->enqcallback = callback;
+ mmi->enqcallback_arg = arg;
+ pthread_mutex_unlock(&mmi->lock);
}
-void en50221_app_mmi_register_menu_callback(en50221_app_mmi mmi,
- en50221_app_mmi_menu_callback callback, void *arg)
+void en50221_app_mmi_register_menu_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_menu_callback callback,
+ void *arg)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- private->menucallback = callback;
- private->menucallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ mmi->menucallback = callback;
+ mmi->menucallback_arg = arg;
+ pthread_mutex_unlock(&mmi->lock);
}
-void en50221_app_mmi_register_list_callback(en50221_app_mmi mmi,
- en50221_app_mmi_list_callback callback, void *arg)
+void en50221_app_mmi_register_list_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_list_callback callback,
+ void *arg)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
-
- pthread_mutex_lock(&private->lock);
- private->listcallback = callback;
- private->listcallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&mmi->lock);
+ mmi->listcallback = callback;
+ mmi->listcallback_arg = arg;
+ pthread_mutex_unlock(&mmi->lock);
}
-int en50221_app_mmi_close(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t cmd_id,
- uint8_t delay)
+int en50221_app_mmi_close(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t cmd_id, uint8_t delay)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
- uint8_t data[6];
- int data_length = 5;
-
- data[0] = (TAG_CLOSE_MMI >> 16) & 0xFF;
- data[1] = (TAG_CLOSE_MMI >> 8) & 0xFF;
- data[2] = TAG_CLOSE_MMI & 0xFF;
- data[3] = 1;
- data[4] = cmd_id;
- if (cmd_id == MMI_CLOSE_MMI_CMD_ID_DELAY) {
- data[3] = 2;
- data[5] = delay;
- data_length = 6;
- }
- return private->funcs->send_data(private->funcs->arg, session_number, data, data_length);
+ uint8_t data[6];
+ int data_length = 5;
+
+ data[0] = (TAG_CLOSE_MMI >> 16) & 0xFF;
+ data[1] = (TAG_CLOSE_MMI >> 8) & 0xFF;
+ data[2] = TAG_CLOSE_MMI & 0xFF;
+ data[3] = 1;
+ data[4] = cmd_id;
+ if (cmd_id == MMI_CLOSE_MMI_CMD_ID_DELAY) {
+ data[3] = 2;
+ data[5] = delay;
+ data_length = 6;
+ }
+ return mmi->funcs->send_data(mmi->funcs->arg, session_number, data,
+ data_length);
}
-int en50221_app_mmi_display_reply(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t reply_id,
- struct en502221_app_mmi_display_reply_details *details)
+int en50221_app_mmi_display_reply(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t reply_id,
+ struct en50221_app_mmi_display_reply_details *details)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
- uint8_t data[32];
- struct iovec iov[2];
- uint32_t iov_count;
- int length_field_len;
-
- // fill out the start of the header
- data[0] = (TAG_DISPLAY_REPLY >> 16) & 0xFF;
- data[1] = (TAG_DISPLAY_REPLY >> 8) & 0xFF;
- data[2] = TAG_DISPLAY_REPLY & 0xFF;
-
- switch(reply_id) {
- case MMI_DISPLAY_REPLY_ID_MMI_MODE_ACK:
- data[3] = 2;
- data[4] = reply_id;
- data[5] = details->u.mode_ack.mmi_mode;
- iov[0].iov_base = data;
- iov[0].iov_len = 6;
- iov_count = 1;
- break;
-
- case MMI_DISPLAY_REPLY_ID_LIST_DISPLAY_CHAR_TABLES:
- case MMI_DISPLAY_REPLY_ID_LIST_INPUT_CHAR_TABLES:
- if ((length_field_len = asn_1_encode(details->u.char_table.table_length+1, data+3, 3)) < 0) {
- return -1;
- }
- data[3+length_field_len] = reply_id;
- iov[0].iov_base = data;
- iov[0].iov_len = 3+length_field_len+1;
- iov[1].iov_base = details->u.char_table.table;
- iov[1].iov_len = details->u.char_table.table_length;
- iov_count = 2;
- break;
-
- case MMI_DISPLAY_REPLY_ID_LIST_OVERLAY_GFX_CHARACTERISTICS:
- case MMI_DISPLAY_REPLY_ID_LIST_FULLSCREEN_GFX_CHARACTERISTICS:
- {
- if ((length_field_len = asn_1_encode(1+9+(details->u.gfx.num_pixel_depths*2), data+3, 3)) < 0) {
- return -1;
- }
- data[3+length_field_len] = reply_id;
- data[3+length_field_len+1] = details->u.gfx.width >> 8;
- data[3+length_field_len+2] = details->u.gfx.width;
- data[3+length_field_len+3] = details->u.gfx.height >> 8;
- data[3+length_field_len+4] = details->u.gfx.height;
- data[3+length_field_len+5] = ((details->u.gfx.aspect_ratio & 0x0f) << 4) |
- ((details->u.gfx.gfx_relation_to_video & 0x07) << 1) |
- (details->u.gfx.multiple_depths & 1);
- data[3+length_field_len+6] = details->u.gfx.display_bytes >> 4;
- data[3+length_field_len+7] = ((details->u.gfx.display_bytes & 0x0f) << 4) |
- ((details->u.gfx.composition_buffer_bytes & 0xf0) >> 4);
- data[3+length_field_len+8] = ((details->u.gfx.composition_buffer_bytes & 0x0f) << 4) |
- ((details->u.gfx.object_cache_bytes & 0xf0) >> 4);
- data[3+length_field_len+9] = ((details->u.gfx.object_cache_bytes & 0x0f) << 4) |
- (details->u.gfx.num_pixel_depths & 0x0f);
-
- // render the pixel depths themselves
- uint8_t *pixdepths = alloca(details->u.gfx.num_pixel_depths * 2);
- if (pixdepths == NULL) {
- return -1;
- }
- uint32_t i;
- for(i=0; i < details->u.gfx.num_pixel_depths; i++) {
- pixdepths[0] = ((details->u.gfx.pixel_depths[i].display_depth & 0x07) << 5) |
- ((details->u.gfx.pixel_depths[i].pixels_per_byte & 0x07) << 2);
- pixdepths[1] = details->u.gfx.pixel_depths[i].region_overhead;
- pixdepths+=2;
- }
-
- // make up the iovs
- iov[0].iov_base = data;
- iov[0].iov_len = 3+length_field_len+10;
- iov[1].iov_base = pixdepths;
- iov[1].iov_len = details->u.gfx.num_pixel_depths *2;
- iov_count = 2;
- break;
- }
-
- default:
- data[3] = 1;
- data[4] = reply_id;
- iov[0].iov_base = data;
- iov[0].iov_len = 5;
- iov_count = 1;
- break;
- }
-
- // sendit
- return private->funcs->send_datav(private->funcs->arg, session_number, iov, iov_count);
+ uint8_t data[32];
+ struct iovec iov[2];
+ uint32_t iov_count;
+ int length_field_len;
+
+ // fill out the start of the header
+ data[0] = (TAG_DISPLAY_REPLY >> 16) & 0xFF;
+ data[1] = (TAG_DISPLAY_REPLY >> 8) & 0xFF;
+ data[2] = TAG_DISPLAY_REPLY & 0xFF;
+
+ switch (reply_id) {
+ case MMI_DISPLAY_REPLY_ID_MMI_MODE_ACK:
+ data[3] = 2;
+ data[4] = reply_id;
+ data[5] = details->u.mode_ack.mmi_mode;
+ iov[0].iov_base = data;
+ iov[0].iov_len = 6;
+ iov_count = 1;
+ break;
+
+ case MMI_DISPLAY_REPLY_ID_LIST_DISPLAY_CHAR_TABLES:
+ case MMI_DISPLAY_REPLY_ID_LIST_INPUT_CHAR_TABLES:
+ if ((length_field_len =
+ asn_1_encode(details->u.char_table.table_length + 1, data + 3, 3)) < 0) {
+ return -1;
+ }
+ data[3 + length_field_len] = reply_id;
+ iov[0].iov_base = data;
+ iov[0].iov_len = 3 + length_field_len + 1;
+ iov[1].iov_base = details->u.char_table.table;
+ iov[1].iov_len = details->u.char_table.table_length;
+ iov_count = 2;
+ break;
+
+ case MMI_DISPLAY_REPLY_ID_LIST_OVERLAY_GFX_CHARACTERISTICS:
+ case MMI_DISPLAY_REPLY_ID_LIST_FULLSCREEN_GFX_CHARACTERISTICS:
+ {
+ if ((length_field_len =
+ asn_1_encode(1 + 9 + (details->u.gfx.num_pixel_depths * 2), data + 3, 3)) < 0) {
+ return -1;
+ }
+ data[3 + length_field_len] = reply_id;
+ data[3 + length_field_len + 1] = details->u.gfx.width >> 8;
+ data[3 + length_field_len + 2] = details->u.gfx.width;
+ data[3 + length_field_len + 3] = details->u.gfx.height >> 8;
+ data[3 + length_field_len + 4] = details->u.gfx.height;
+ data[3 + length_field_len + 5] =
+ ((details->u.gfx.aspect_ratio & 0x0f) << 4) |
+ ((details->u.gfx.gfx_relation_to_video & 0x07) << 1) |
+ (details->u.gfx.multiple_depths & 1);
+ data[3 + length_field_len + 6] = details->u.gfx.display_bytes >> 4;
+ data[3 + length_field_len + 7] =
+ ((details->u.gfx.display_bytes & 0x0f) << 4) |
+ ((details->u.gfx.composition_buffer_bytes & 0xf0) >> 4);
+ data[3 + length_field_len + 8] =
+ ((details->u.gfx.composition_buffer_bytes & 0x0f) << 4) |
+ ((details->u.gfx.object_cache_bytes & 0xf0) >> 4);
+ data[3 + length_field_len + 9] =
+ ((details->u.gfx.object_cache_bytes & 0x0f) << 4) |
+ (details->u.gfx.num_pixel_depths & 0x0f);
+
+ // render the pixel depths themselves
+ uint8_t *pixdepths =
+ alloca(details->u.gfx.num_pixel_depths * 2);
+ if (pixdepths == NULL) {
+ return -1;
+ }
+ uint32_t i;
+ for (i = 0; i < details->u.gfx.num_pixel_depths; i++) {
+ pixdepths[0] =
+ ((details->u.gfx.pixel_depths[i].display_depth & 0x07) << 5) |
+ ((details->u.gfx.pixel_depths[i].pixels_per_byte & 0x07) << 2);
+ pixdepths[1] =
+ details->u.gfx.pixel_depths[i].region_overhead;
+ pixdepths += 2;
+ }
+
+ // make up the iovs
+ iov[0].iov_base = data;
+ iov[0].iov_len = 3 + length_field_len + 10;
+ iov[1].iov_base = pixdepths;
+ iov[1].iov_len =
+ details->u.gfx.num_pixel_depths * 2;
+ iov_count = 2;
+ break;
+ }
+
+ default:
+ data[3] = 1;
+ data[4] = reply_id;
+ iov[0].iov_base = data;
+ iov[0].iov_len = 5;
+ iov_count = 1;
+ break;
+ }
+
+ // sendit
+ return mmi->funcs->send_datav(mmi->funcs->arg, session_number, iov, iov_count);
}
-int en50221_app_mmi_keypress(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t keycode)
+int en50221_app_mmi_keypress(struct en50221_app_mmi *mmi,
+ uint16_t session_number, uint8_t keycode)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
- uint8_t data[5];
-
- data[0] = (TAG_KEYPRESS >> 16) & 0xFF;
- data[1] = (TAG_KEYPRESS >> 8) & 0xFF;
- data[2] = TAG_KEYPRESS & 0xFF;
- data[3] = 1;
- data[4] = keycode;
- return private->funcs->send_data(private->funcs->arg, session_number, data, 5);
+ uint8_t data[5];
+
+ data[0] = (TAG_KEYPRESS >> 16) & 0xFF;
+ data[1] = (TAG_KEYPRESS >> 8) & 0xFF;
+ data[2] = TAG_KEYPRESS & 0xFF;
+ data[3] = 1;
+ data[4] = keycode;
+ return mmi->funcs->send_data(mmi->funcs->arg, session_number, data, 5);
}
-int en50221_app_mmi_display_message(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t display_message_id)
+int en50221_app_mmi_display_message(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t display_message_id)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
- uint8_t data[5];
-
- data[0] = (TAG_DISPLAY_MESSAGE >> 16) & 0xFF;
- data[1] = (TAG_DISPLAY_MESSAGE >> 8) & 0xFF;
- data[2] = TAG_DISPLAY_MESSAGE & 0xFF;
- data[3] = 1;
- data[4] = display_message_id;
- return private->funcs->send_data(private->funcs->arg, session_number, data, 5);
+ uint8_t data[5];
+
+ data[0] = (TAG_DISPLAY_MESSAGE >> 16) & 0xFF;
+ data[1] = (TAG_DISPLAY_MESSAGE >> 8) & 0xFF;
+ data[2] = TAG_DISPLAY_MESSAGE & 0xFF;
+ data[3] = 1;
+ data[4] = display_message_id;
+ return mmi->funcs->send_data(mmi->funcs->arg, session_number, data, 5);
}
-int en50221_app_mmi_scene_done(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t decoder_continue,
- uint8_t scene_reveal,
- uint8_t scene_tag)
+int en50221_app_mmi_scene_done(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t decoder_continue,
+ uint8_t scene_reveal, uint8_t scene_tag)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
- uint8_t data[5];
-
- data[0] = (TAG_SCENE_DONE >> 16) & 0xFF;
- data[1] = (TAG_SCENE_DONE >> 8) & 0xFF;
- data[2] = TAG_SCENE_DONE & 0xFF;
- data[3] = 1;
- data[4] = (decoder_continue ? 0x80 : 0x00) |
- (scene_reveal ? 0x40 : 0x00) |
- (scene_tag & 0x0f);
- return private->funcs->send_data(private->funcs->arg, session_number, data, 5);
+ uint8_t data[5];
+
+ data[0] = (TAG_SCENE_DONE >> 16) & 0xFF;
+ data[1] = (TAG_SCENE_DONE >> 8) & 0xFF;
+ data[2] = TAG_SCENE_DONE & 0xFF;
+ data[3] = 1;
+ data[4] =
+ (decoder_continue ? 0x80 : 0x00) |
+ (scene_reveal ? 0x40 : 0x00) |
+ (scene_tag & 0x0f);
+ return mmi->funcs->send_data(mmi->funcs->arg, session_number, data, 5);
}
-int en50221_app_mmi_download_reply(en50221_app_mmi mmi,
- uint16_t session_number,
- uint16_t object_id,
- uint8_t download_reply_id)
+int en50221_app_mmi_download_reply(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint16_t object_id,
+ uint8_t download_reply_id)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
- uint8_t data[7];
-
- data[0] = (TAG_DOWNLOAD_REPLY >> 16) & 0xFF;
- data[1] = (TAG_DOWNLOAD_REPLY >> 8) & 0xFF;
- data[2] = TAG_DOWNLOAD_REPLY & 0xFF;
- data[3] = 3;
- data[4] = object_id >> 8;
- data[5] = object_id;
- data[6] = download_reply_id;
- return private->funcs->send_data(private->funcs->arg, session_number, data, 7);
+ uint8_t data[7];
+
+ data[0] = (TAG_DOWNLOAD_REPLY >> 16) & 0xFF;
+ data[1] = (TAG_DOWNLOAD_REPLY >> 8) & 0xFF;
+ data[2] = TAG_DOWNLOAD_REPLY & 0xFF;
+ data[3] = 3;
+ data[4] = object_id >> 8;
+ data[5] = object_id;
+ data[6] = download_reply_id;
+ return mmi->funcs->send_data(mmi->funcs->arg, session_number, data, 7);
}
-int en50221_app_mmi_answ(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t answ_id,
- uint8_t *text,
- uint32_t text_count)
+int en50221_app_mmi_answ(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t answ_id,
+ uint8_t * text, uint32_t text_count)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
- uint8_t buf[10];
-
- // set up the tag
- buf[0] = (TAG_ANSWER >> 16) & 0xFF;
- buf[1] = (TAG_ANSWER >> 8) & 0xFF;
- buf[2] = TAG_ANSWER & 0xFF;
-
- // encode the length field
- struct iovec iov[2];
- int length_field_len = 0;
- int iov_count = 1;
- if (answ_id == MMI_ANSW_ID_ANSWER) {
- if ((length_field_len = asn_1_encode(text_count+1, buf+3, 3)) < 0) {
- return -1;
- }
- buf[3+length_field_len] = answ_id;
-
- iov[0].iov_base = buf;
- iov[0].iov_len = 3+length_field_len+1;
- iov[1].iov_base = text;
- iov[1].iov_len = text_count;
- iov_count=2;
- } else {
- buf[3] = 1;
- buf[4] = answ_id;
- iov[0].iov_base = buf;
- iov[0].iov_len = 5;
- iov_count = 1;
- }
-
- // create the data and send it
- return private->funcs->send_datav(private->funcs->arg, session_number, iov, iov_count);
+ uint8_t buf[10];
+
+ // set up the tag
+ buf[0] = (TAG_ANSWER >> 16) & 0xFF;
+ buf[1] = (TAG_ANSWER >> 8) & 0xFF;
+ buf[2] = TAG_ANSWER & 0xFF;
+
+ // encode the length field
+ struct iovec iov[2];
+ int length_field_len = 0;
+ int iov_count = 1;
+ if (answ_id == MMI_ANSW_ID_ANSWER) {
+ if ((length_field_len = asn_1_encode(text_count + 1, buf + 3, 3)) < 0) {
+ return -1;
+ }
+ buf[3 + length_field_len] = answ_id;
+
+ iov[0].iov_base = buf;
+ iov[0].iov_len = 3 + length_field_len + 1;
+ iov[1].iov_base = text;
+ iov[1].iov_len = text_count;
+ iov_count = 2;
+ } else {
+ buf[3] = 1;
+ buf[4] = answ_id;
+ iov[0].iov_base = buf;
+ iov[0].iov_len = 5;
+ iov_count = 1;
+ }
+
+ // create the data and send it
+ return mmi->funcs->send_datav(mmi->funcs->arg, session_number, iov,
+ iov_count);
}
-int en50221_app_mmi_menu_answ(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t choice_ref)
+int en50221_app_mmi_menu_answ(struct en50221_app_mmi *mmi,
+ uint16_t session_number, uint8_t choice_ref)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
- uint8_t data[5];
-
- data[0] = (TAG_MENU_ANSWER >> 16) & 0xFF;
- data[1] = (TAG_MENU_ANSWER >> 8) & 0xFF;
- data[2] = TAG_MENU_ANSWER & 0xFF;
- data[3] = 1;
- data[4] = choice_ref;
- return private->funcs->send_data(private->funcs->arg, session_number, data, 5);
+ uint8_t data[5];
+
+ data[0] = (TAG_MENU_ANSWER >> 16) & 0xFF;
+ data[1] = (TAG_MENU_ANSWER >> 8) & 0xFF;
+ data[2] = TAG_MENU_ANSWER & 0xFF;
+ data[3] = 1;
+ data[4] = choice_ref;
+ return mmi->funcs->send_data(mmi->funcs->arg, session_number, data, 5);
}
-int en50221_app_mmi_message(en50221_app_mmi mmi,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length)
+int en50221_app_mmi_message(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data, uint32_t data_length)
{
- struct en50221_app_mmi_private *private = (struct en50221_app_mmi_private *) mmi;
- (void) resource_id;
-
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
-
- switch(tag)
- {
- case TAG_CLOSE_MMI:
- return en50221_app_mmi_parse_close(private, slot_id, session_number, data+3, data_length-3);
- case TAG_DISPLAY_CONTROL:
- return en50221_app_mmi_parse_display_control(private, slot_id, session_number, data+3, data_length-3);
- case TAG_KEYPAD_CONTROL:
- return en50221_app_mmi_parse_keypad_control(private, slot_id, session_number, data+3, data_length-3);
- case TAG_ENQUIRY:
- return en50221_app_mmi_parse_enq(private, slot_id, session_number, data+3, data_length-3);
- case TAG_MENU_LAST:
- return en50221_app_mmi_parse_list_menu(private, slot_id, session_number, tag, 1, data+3, data_length-3);
- case TAG_MENU_MORE:
- return en50221_app_mmi_parse_list_menu(private, slot_id, session_number, tag, 0, data+3, data_length-3);
- case TAG_LIST_LAST:
- return en50221_app_mmi_parse_list_menu(private, slot_id, session_number, tag, 1, data+3, data_length-3);
- case TAG_LIST_MORE:
- return en50221_app_mmi_parse_list_menu(private, slot_id, session_number, tag, 0, data+3, data_length-3);
- case TAG_SUBTITLE_SEGMENT_LAST:
- return en50221_app_mmi_parse_subtitle(private, slot_id, session_number, tag, 1, data+3, data_length-3);
- case TAG_SUBTITLE_SEGMENT_MORE:
- return en50221_app_mmi_parse_subtitle(private, slot_id, session_number, tag, 0, data+3, data_length-3);
- case TAG_SCENE_END_MARK:
- return en50221_app_mmi_parse_scene_end_mark(private, slot_id, session_number, data+3, data_length-3);
- case TAG_SCENE_CONTROL:
- return en50221_app_mmi_parse_scene_control(private, slot_id, session_number, data+3, data_length-3);
- case TAG_SUBTITLE_DOWNLOAD_LAST:
- return en50221_app_mmi_parse_subtitle(private, slot_id, session_number, tag, 1, data+3, data_length-3);
- case TAG_SUBTITLE_DOWNLOAD_MORE:
- return en50221_app_mmi_parse_subtitle(private, slot_id, session_number, tag, 0, data+3, data_length-3);
- case TAG_FLUSH_DOWNLOAD:
- return en50221_app_mmi_parse_flush_download(private, slot_id, session_number, data+3, data_length-3);
- }
-
- print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
- return -1;
+ (void) resource_id;
+
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+
+ switch (tag) {
+ case TAG_CLOSE_MMI:
+ return en50221_app_mmi_parse_close(mmi, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ case TAG_DISPLAY_CONTROL:
+ return en50221_app_mmi_parse_display_control(mmi, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ case TAG_KEYPAD_CONTROL:
+ return en50221_app_mmi_parse_keypad_control(mmi, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ case TAG_ENQUIRY:
+ return en50221_app_mmi_parse_enq(mmi, slot_id,
+ session_number, data + 3,
+ data_length - 3);
+ case TAG_MENU_LAST:
+ return en50221_app_mmi_parse_list_menu(mmi, slot_id,
+ session_number, tag,
+ 1, data + 3,
+ data_length - 3);
+ case TAG_MENU_MORE:
+ return en50221_app_mmi_parse_list_menu(mmi, slot_id,
+ session_number, tag,
+ 0, data + 3,
+ data_length - 3);
+ case TAG_LIST_LAST:
+ return en50221_app_mmi_parse_list_menu(mmi, slot_id,
+ session_number, tag,
+ 1, data + 3,
+ data_length - 3);
+ case TAG_LIST_MORE:
+ return en50221_app_mmi_parse_list_menu(mmi, slot_id,
+ session_number, tag,
+ 0, data + 3,
+ data_length - 3);
+ case TAG_SUBTITLE_SEGMENT_LAST:
+ return en50221_app_mmi_parse_subtitle(mmi, slot_id,
+ session_number, tag,
+ 1, data + 3,
+ data_length - 3);
+ case TAG_SUBTITLE_SEGMENT_MORE:
+ return en50221_app_mmi_parse_subtitle(mmi, slot_id,
+ session_number, tag,
+ 0, data + 3,
+ data_length - 3);
+ case TAG_SCENE_END_MARK:
+ return en50221_app_mmi_parse_scene_end_mark(mmi, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ case TAG_SCENE_CONTROL:
+ return en50221_app_mmi_parse_scene_control(mmi, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ case TAG_SUBTITLE_DOWNLOAD_LAST:
+ return en50221_app_mmi_parse_subtitle(mmi, slot_id,
+ session_number, tag,
+ 1, data + 3,
+ data_length - 3);
+ case TAG_SUBTITLE_DOWNLOAD_MORE:
+ return en50221_app_mmi_parse_subtitle(mmi, slot_id,
+ session_number, tag,
+ 0, data + 3,
+ data_length - 3);
+ case TAG_FLUSH_DOWNLOAD:
+ return en50221_app_mmi_parse_flush_download(mmi, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ }
+
+ print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
+ return -1;
}
-static int en50221_app_mmi_parse_close(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_mmi_parse_close(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // validate data
- if (data_length < 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (data[0] > (data_length-1)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t cmd_id = data[1];
- uint8_t delay = 0;
- if (cmd_id == MMI_CLOSE_MMI_CMD_ID_DELAY) {
- if (data[0] != 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- delay = data[2];
- }
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_mmi_close_callback cb = private->closecallback;
- void *cb_arg = private->closecallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, cmd_id, delay);
- }
- return 0;
+ // validate data
+ if (data_length < 2) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (data[0] > (data_length - 1)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t cmd_id = data[1];
+ uint8_t delay = 0;
+ if (cmd_id == MMI_CLOSE_MMI_CMD_ID_DELAY) {
+ if (data[0] != 2) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received short data\n");
+ return -1;
+ }
+ delay = data[2];
+ }
+ // tell the app
+ pthread_mutex_lock(&mmi->lock);
+ en50221_app_mmi_close_callback cb = mmi->closecallback;
+ void *cb_arg = mmi->closecallback_arg;
+ pthread_mutex_unlock(&mmi->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, cmd_id, delay);
+ }
+ return 0;
}
-static int en50221_app_mmi_parse_display_control(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_mmi_parse_display_control(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t *data,
+ uint32_t data_length)
{
- // validate data
- if (data_length < 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (data[0] > (data_length-1)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t cmd_id = data[1];
- uint8_t mmi_mode = 0;
- if (cmd_id == MMI_DISPLAY_CONTROL_CMD_ID_SET_MMI_MODE) {
- if (data[0] != 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- mmi_mode = data[2];
- }
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_mmi_display_control_callback cb = private->displaycontrolcallback;
- void *cb_arg = private->displaycontrolcallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, cmd_id, mmi_mode);
- }
- return 0;
+ // validate data
+ if (data_length < 2) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (data[0] > (data_length - 1)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t cmd_id = data[1];
+ uint8_t mmi_mode = 0;
+ if (cmd_id == MMI_DISPLAY_CONTROL_CMD_ID_SET_MMI_MODE) {
+ if (data[0] != 2) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received short data\n");
+ return -1;
+ }
+ mmi_mode = data[2];
+ }
+ // tell the app
+ pthread_mutex_lock(&mmi->lock);
+ en50221_app_mmi_display_control_callback cb = mmi->displaycontrolcallback;
+ void *cb_arg = mmi->displaycontrolcallback_arg;
+ pthread_mutex_unlock(&mmi->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, cmd_id, mmi_mode);
+ }
+ return 0;
}
-static int en50221_app_mmi_parse_keypad_control(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_mmi_parse_keypad_control(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t *data,
+ uint32_t data_length)
{
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (asn_data_length < 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
-
- // skip over the length field
- data += length_field_len;
-
- // extract the information
- uint8_t cmd_id = data[0];
- uint8_t *keycodes = data+1;
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_mmi_keypad_control_callback cb = private->keypadcontrolcallback;
- void *cb_arg = private->keypadcontrolcallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, cmd_id, keycodes, asn_data_length-1);
- }
- return 0;
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ // check it
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (asn_data_length < 1) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ // skip over the length field
+ data += length_field_len;
+
+ // extract the information
+ uint8_t cmd_id = data[0];
+ uint8_t *keycodes = data + 1;
+
+ // tell the app
+ pthread_mutex_lock(&mmi->lock);
+ en50221_app_mmi_keypad_control_callback cb = mmi->keypadcontrolcallback;
+ void *cb_arg = mmi->keypadcontrolcallback_arg;
+ pthread_mutex_unlock(&mmi->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, cmd_id,
+ keycodes, asn_data_length - 1);
+ }
+ return 0;
}
-static int en50221_app_mmi_parse_enq(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_mmi_parse_enq(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data, uint32_t data_length)
{
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (asn_data_length < 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
-
- // skip over the length field
- data += length_field_len;
-
- // extract the information
- uint8_t blind_answer = (data[0] & 0x01) ? 1 : 0;
- uint8_t answer_length = data[1];
- uint8_t *text = data+2;
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_mmi_enq_callback cb = private->enqcallback;
- void *cb_arg = private->enqcallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, blind_answer, answer_length, text, asn_data_length - 2);
- }
- return 0;
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ // check it
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (asn_data_length < 2) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ // skip over the length field
+ data += length_field_len;
+
+ // extract the information
+ uint8_t blind_answer = (data[0] & 0x01) ? 1 : 0;
+ uint8_t answer_length = data[1];
+ uint8_t *text = data + 2;
+
+ // tell the app
+ pthread_mutex_lock(&mmi->lock);
+ en50221_app_mmi_enq_callback cb = mmi->enqcallback;
+ void *cb_arg = mmi->enqcallback_arg;
+ pthread_mutex_unlock(&mmi->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, blind_answer,
+ answer_length, text, asn_data_length - 2);
+ }
+ return 0;
}
-static int en50221_app_mmi_parse_list_menu(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number, uint32_t tag_id,
- int more_last, uint8_t *data, uint32_t data_length)
+static int en50221_app_mmi_parse_list_menu(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t tag_id, int more_last,
+ uint8_t * data,
+ uint32_t data_length)
{
- int result = 0;
- uint8_t *text_flags = NULL;
- struct en50221_app_mmi_text *text_data = NULL;
- uint32_t i;
- uint8_t text_count = 0;
-
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
-
- // skip over the length field
- data += length_field_len;
-
- // defragment
- pthread_mutex_lock(&private->lock);
- uint8_t *outdata;
- uint32_t outdata_length;
- int dfstatus = en50221_app_mmi_defragment(private, session_number, tag_id, more_last,
- data, asn_data_length,
- &outdata, &outdata_length);
- if (dfstatus <= 0) {
- pthread_mutex_unlock(&private->lock);
- return dfstatus;
- }
- data = outdata;
- data_length = outdata_length;
-
- // check the reassembled data length
- if (data_length < 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- pthread_mutex_unlock(&private->lock);
- result = -1;
- goto exit_cleanup;
- }
-
- // now, parse the data
- uint8_t choice_nb = data[0];
- text_count = choice_nb + 3;
- if (choice_nb == 0xff) text_count = 3;
- data++;
- data_length--;
-
- // variables for extracted text state
- text_flags = alloca(text_count);
- if (text_flags == NULL) {
- pthread_mutex_unlock(&private->lock);
- result = -1;
- goto exit_cleanup;
- }
- memset(text_flags, 0, text_count);
- text_data = (struct en50221_app_mmi_text*) alloca(sizeof(struct en50221_app_mmi_text) * text_count);
- if (text_data == NULL) {
- pthread_mutex_unlock(&private->lock);
- result = -1;
- goto exit_cleanup;
- }
- memset(text_data, 0, sizeof(struct en50221_app_mmi_text) * text_count);
-
- // extract the text!
- for(i=0; i<text_count; i++) {
- uint32_t consumed = 0;
- int cur_status = en50221_app_mmi_defragment_text(data, data_length,
- &text_data[i].text, &text_data[i].text_length,
- &consumed);
- if (cur_status < 0) {
- pthread_mutex_unlock(&private->lock);
- result = -1;
- goto exit_cleanup;
- }
-
- text_flags[i] = cur_status;
- data += consumed;
- data_length -= consumed;
- }
-
- // work out what to pass to the user
- struct en50221_app_mmi_text *text_data_for_user =
- (struct en50221_app_mmi_text*) alloca(sizeof(struct en50221_app_mmi_text) * text_count);
- if (text_data_for_user == NULL) {
- result = -1;
- goto exit_cleanup;
- }
- memcpy(text_data_for_user, text_data, sizeof(struct en50221_app_mmi_text) * text_count);
- struct en50221_app_mmi_text *text_ptr = NULL;
- if (text_count > 3) {
- text_ptr = &text_data_for_user[3];
- }
- uint8_t *items_raw = NULL;
- uint32_t items_raw_length = 0;
- if (choice_nb == 0xff) {
- items_raw = data;
- items_raw_length = data_length;
- }
-
- // do callback
- result = 0;
- switch(tag_id) {
- case TAG_MENU_LAST:
- {
- en50221_app_mmi_menu_callback cb = private->menucallback;
- void *cb_arg = private->menucallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- result = cb(cb_arg, slot_id, session_number,
- &text_data_for_user[0],
- &text_data_for_user[1],
- &text_data_for_user[2],
- text_count-3,
- text_ptr,
- items_raw_length,
- items_raw);
- }
- break;
- }
-
- case TAG_LIST_LAST:
- {
- en50221_app_mmi_list_callback cb = private->listcallback;
- void *cb_arg = private->listcallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- result = cb(cb_arg, slot_id, session_number,
- &text_data_for_user[0],
- &text_data_for_user[1],
- &text_data_for_user[2],
- text_count-3,
- text_ptr,
- items_raw_length,
- items_raw);
- }
- break;
- }
-
- default:
- pthread_mutex_unlock(&private->lock);
- break;
- }
+ int result = 0;
+ uint8_t *text_flags = NULL;
+ struct en50221_app_mmi_text *text_data = NULL;
+ uint32_t i;
+ uint8_t text_count = 0;
+
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ // check it
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ // skip over the length field
+ data += length_field_len;
+
+ // defragment
+ pthread_mutex_lock(&mmi->lock);
+ uint8_t *outdata;
+ uint32_t outdata_length;
+ int dfstatus =
+ en50221_app_mmi_defragment(mmi, session_number, tag_id,
+ more_last,
+ data, asn_data_length,
+ &outdata, &outdata_length);
+ if (dfstatus <= 0) {
+ pthread_mutex_unlock(&mmi->lock);
+ return dfstatus;
+ }
+ data = outdata;
+ data_length = outdata_length;
+
+ // check the reassembled data length
+ if (data_length < 1) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ pthread_mutex_unlock(&mmi->lock);
+ result = -1;
+ goto exit_cleanup;
+ }
+ // now, parse the data
+ uint8_t choice_nb = data[0];
+ text_count = choice_nb + 3;
+ if (choice_nb == 0xff)
+ text_count = 3;
+ data++;
+ data_length--;
+
+ // variables for extracted text state
+ text_flags = alloca(text_count);
+ if (text_flags == NULL) {
+ pthread_mutex_unlock(&mmi->lock);
+ result = -1;
+ goto exit_cleanup;
+ }
+ memset(text_flags, 0, text_count);
+ text_data = (struct en50221_app_mmi_text *)
+ alloca(sizeof(struct en50221_app_mmi_text) * text_count);
+ if (text_data == NULL) {
+ pthread_mutex_unlock(&mmi->lock);
+ result = -1;
+ goto exit_cleanup;
+ }
+ memset(text_data, 0,
+ sizeof(struct en50221_app_mmi_text) * text_count);
+
+ // extract the text!
+ for (i = 0; i < text_count; i++) {
+ uint32_t consumed = 0;
+ int cur_status =
+ en50221_app_mmi_defragment_text(data, data_length,
+ &text_data[i].text,
+ &text_data[i].text_length,
+ &consumed);
+ if (cur_status < 0) {
+ pthread_mutex_unlock(&mmi->lock);
+ result = -1;
+ goto exit_cleanup;
+ }
+
+ text_flags[i] = cur_status;
+ data += consumed;
+ data_length -= consumed;
+ }
+
+ // work out what to pass to the user
+ struct en50221_app_mmi_text *text_data_for_user = (struct en50221_app_mmi_text *)
+ alloca(sizeof(struct en50221_app_mmi_text) * text_count);
+ if (text_data_for_user == NULL) {
+ result = -1;
+ goto exit_cleanup;
+ }
+ memcpy(text_data_for_user, text_data,
+ sizeof(struct en50221_app_mmi_text) * text_count);
+ struct en50221_app_mmi_text *text_ptr = NULL;
+ if (text_count > 3) {
+ text_ptr = &text_data_for_user[3];
+ }
+ uint8_t *items_raw = NULL;
+ uint32_t items_raw_length = 0;
+ if (choice_nb == 0xff) {
+ items_raw = data;
+ items_raw_length = data_length;
+ }
+ // do callback
+ result = 0;
+ switch (tag_id) {
+ case TAG_MENU_LAST:
+ {
+ en50221_app_mmi_menu_callback cb = mmi->menucallback;
+ void *cb_arg = mmi->menucallback_arg;
+ pthread_mutex_unlock(&mmi->lock);
+ if (cb) {
+ result =
+ cb(cb_arg, slot_id, session_number,
+ &text_data_for_user[0],
+ &text_data_for_user[1],
+ &text_data_for_user[2],
+ text_count - 3, text_ptr,
+ items_raw_length, items_raw);
+ }
+ break;
+ }
+
+ case TAG_LIST_LAST:
+ {
+ en50221_app_mmi_list_callback cb = mmi->listcallback;
+ void *cb_arg = mmi->listcallback_arg;
+ pthread_mutex_unlock(&mmi->lock);
+ if (cb) {
+ result =
+ cb(cb_arg, slot_id, session_number,
+ &text_data_for_user[0],
+ &text_data_for_user[1],
+ &text_data_for_user[2],
+ text_count - 3, text_ptr,
+ items_raw_length, items_raw);
+ }
+ break;
+ }
+
+ default:
+ pthread_mutex_unlock(&mmi->lock);
+ break;
+ }
exit_cleanup:
- if ((dfstatus == 2) && outdata) free(outdata);
- if (text_flags && text_data) {
- for(i=0; i< text_count; i++) {
- if ((text_flags[i] == 2) && text_data[i].text) {
- free(text_data[i].text);
- }
- }
- }
- return result;
+ if ((dfstatus == 2) && outdata)
+ free(outdata);
+ if (text_flags && text_data) {
+ for (i = 0; i < text_count; i++) {
+ if ((text_flags[i] == 2) && text_data[i].text) {
+ free(text_data[i].text);
+ }
+ }
+ }
+ return result;
}
-static int en50221_app_mmi_parse_subtitle(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number, uint32_t tag_id,
- int more_last, uint8_t *data, uint32_t data_length)
+static int en50221_app_mmi_parse_subtitle(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t tag_id, int more_last,
+ uint8_t * data,
+ uint32_t data_length)
{
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
-
- // skip over the length field
- data += length_field_len;
-
- // defragment
- pthread_mutex_lock(&private->lock);
- uint8_t *outdata;
- uint32_t outdata_length;
- int dfstatus = en50221_app_mmi_defragment(private, session_number, tag_id, more_last,
- data, asn_data_length,
- &outdata, &outdata_length);
- if (dfstatus <= 0) {
- pthread_mutex_unlock(&private->lock);
- return dfstatus;
- }
-
- // do callback
- int cbstatus = 0;
- switch(tag_id) {
- case TAG_SUBTITLE_SEGMENT_LAST:
- {
- en50221_app_mmi_subtitle_segment_callback cb = private->subtitlesegmentcallback;
- void *cb_arg = private->subtitlesegmentcallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- cbstatus = cb(cb_arg, slot_id, session_number, outdata, outdata_length);
- }
- break;
- }
-
- case TAG_SUBTITLE_DOWNLOAD_LAST:
- {
- en50221_app_mmi_subtitle_download_callback cb = private->subtitledownloadcallback;
- void *cb_arg = private->subtitledownloadcallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- cbstatus = cb(cb_arg, slot_id, session_number, outdata, outdata_length);
- }
- break;
- }
- }
-
- // free the data returned by the defragment call if asked to
- if (dfstatus == 2) {
- free(outdata);
- }
-
- // done
- return cbstatus;
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ // check it
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ // skip over the length field
+ data += length_field_len;
+
+ // defragment
+ pthread_mutex_lock(&mmi->lock);
+ uint8_t *outdata;
+ uint32_t outdata_length;
+ int dfstatus =
+ en50221_app_mmi_defragment(mmi, session_number, tag_id,
+ more_last,
+ data, asn_data_length,
+ &outdata, &outdata_length);
+ if (dfstatus <= 0) {
+ pthread_mutex_unlock(&mmi->lock);
+ return dfstatus;
+ }
+ // do callback
+ int cbstatus = 0;
+ switch (tag_id) {
+ case TAG_SUBTITLE_SEGMENT_LAST:
+ {
+ en50221_app_mmi_subtitle_segment_callback cb =
+ mmi->subtitlesegmentcallback;
+ void *cb_arg = mmi->subtitlesegmentcallback_arg;
+ pthread_mutex_unlock(&mmi->lock);
+ if (cb) {
+ cbstatus =
+ cb(cb_arg, slot_id, session_number, outdata, outdata_length);
+ }
+ break;
+ }
+
+ case TAG_SUBTITLE_DOWNLOAD_LAST:
+ {
+ en50221_app_mmi_subtitle_download_callback cb =
+ mmi->subtitledownloadcallback;
+ void *cb_arg = mmi->subtitledownloadcallback_arg;
+ pthread_mutex_unlock(&mmi->lock);
+ if (cb) {
+ cbstatus =
+ cb(cb_arg, slot_id, session_number, outdata, outdata_length);
+ }
+ break;
+ }
+ }
+
+ // free the data returned by the defragment call if asked to
+ if (dfstatus == 2) {
+ free(outdata);
+ }
+ // done
+ return cbstatus;
}
-static int en50221_app_mmi_parse_scene_end_mark(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_mmi_parse_scene_end_mark(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // validate data
- if (data_length != 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (data[0] != 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t flags = data[1];
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_mmi_scene_end_mark_callback cb = private->sceneendmarkcallback;
- void *cb_arg = private->sceneendmarkcallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number,
- (flags & 0x80) ? 1 : 0,
- (flags & 0x40) ? 1 : 0,
- (flags & 0x20) ? 1 : 0,
- flags & 0x0f);
- }
- return 0;
+ // validate data
+ if (data_length != 2) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (data[0] != 1) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t flags = data[1];
+
+ // tell the app
+ pthread_mutex_lock(&mmi->lock);
+ en50221_app_mmi_scene_end_mark_callback cb =
+ mmi->sceneendmarkcallback;
+ void *cb_arg = mmi->sceneendmarkcallback_arg;
+ pthread_mutex_unlock(&mmi->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number,
+ (flags & 0x80) ? 1 : 0,
+ (flags & 0x40) ? 1 : 0,
+ (flags & 0x20) ? 1 : 0, flags & 0x0f);
+ }
+ return 0;
}
-static int en50221_app_mmi_parse_scene_control(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_mmi_parse_scene_control(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // validate data
- if (data_length != 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (data[0] != 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t flags = data[1];
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_mmi_scene_control_callback cb = private->scenecontrolcallback;
- void *cb_arg = private->scenecontrolcallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number,
- (flags & 0x80) ? 1 : 0,
- (flags & 0x40) ? 1 : 0,
- flags & 0x0f);
- }
- return 0;
+ // validate data
+ if (data_length != 2) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (data[0] != 1) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t flags = data[1];
+
+ // tell the app
+ pthread_mutex_lock(&mmi->lock);
+ en50221_app_mmi_scene_control_callback cb = mmi->scenecontrolcallback;
+ void *cb_arg = mmi->scenecontrolcallback_arg;
+ pthread_mutex_unlock(&mmi->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number,
+ (flags & 0x80) ? 1 : 0,
+ (flags & 0x40) ? 1 : 0, flags & 0x0f);
+ }
+ return 0;
}
-static int en50221_app_mmi_parse_flush_download(struct en50221_app_mmi_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_mmi_parse_flush_download(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t *data,
+ uint32_t data_length)
{
- // validate data
- if (data_length != 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (data[0] != 0) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_mmi_flush_download_callback cb = private->flushdownloadcallback;
- void *cb_arg = private->flushdownloadcallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number);
- }
- return 0;
+ // validate data
+ if (data_length != 1) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (data[0] != 0) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ // tell the app
+ pthread_mutex_lock(&mmi->lock);
+ en50221_app_mmi_flush_download_callback cb = mmi->flushdownloadcallback;
+ void *cb_arg = mmi->flushdownloadcallback_arg;
+ pthread_mutex_unlock(&mmi->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number);
+ }
+ return 0;
}
-static int en50221_app_mmi_defragment(struct en50221_app_mmi_private *private,
- uint16_t session_number,
- uint32_t tag_id,
- int more_last,
- uint8_t *indata,
- uint32_t indata_length,
- uint8_t **outdata,
- uint32_t *outdata_length)
+static int en50221_app_mmi_defragment(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint32_t tag_id,
+ int more_last,
+ uint8_t * indata,
+ uint32_t indata_length,
+ uint8_t ** outdata,
+ uint32_t * outdata_length)
{
- struct en50221_app_mmi_session *cur_s = private->sessions;
- while(cur_s) {
- if (cur_s->session_number == session_number)
- break;
- cur_s=cur_s->next;
- }
-
- // more data is still to come
- if (!more_last) {
- // if there was no previous session, create one
- if (cur_s == NULL) {
- cur_s = malloc(sizeof(struct en50221_app_mmi_session));
- if (cur_s == NULL) {
- print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
- return -1;
- }
- cur_s->session_number = session_number;
- cur_s->menu_block_chain = NULL;
- cur_s->menu_block_length = 0;
- cur_s->list_block_chain = NULL;
- cur_s->list_block_length = 0;
- cur_s->subtitlesegment_block_chain = NULL;
- cur_s->subtitlesegment_block_length = 0;
- cur_s->subtitledownload_block_chain = NULL;
- cur_s->subtitledownload_block_length = 0;
- cur_s->next = private->sessions;
- private->sessions = cur_s;
- }
-
- // find the block/block_length to use
- uint8_t **block_chain;
- uint32_t *block_length;
- switch(tag_id) {
- case TAG_MENU_LAST:
- case TAG_MENU_MORE:
- block_chain = &cur_s->menu_block_chain;
- block_length = &cur_s->menu_block_length;
- break;
- case TAG_LIST_LAST:
- case TAG_LIST_MORE:
- block_chain = &cur_s->list_block_chain;
- block_length = &cur_s->list_block_length;
- break;
- case TAG_SUBTITLE_SEGMENT_LAST:
- case TAG_SUBTITLE_SEGMENT_MORE:
- block_chain = &cur_s->subtitlesegment_block_chain;
- block_length = &cur_s->subtitlesegment_block_length;
- break;
- case TAG_SUBTITLE_DOWNLOAD_LAST:
- case TAG_SUBTITLE_DOWNLOAD_MORE:
- block_chain = &cur_s->subtitledownload_block_chain;
- block_length = &cur_s->subtitledownload_block_length;
- break;
- default:
- return -1;
- }
-
- // append the data
- uint8_t *new_data = realloc(*block_chain, *block_length + indata_length);
- if (new_data == NULL) {
- print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
- return -1;
- }
- memcpy(new_data + *block_length, indata, indata_length);
- *block_chain = new_data;
- *block_length += indata_length;
-
- // success, but block not complete yet
- return 0;
- }
-
- // we hit the last of a possible chain of fragments
- if (cur_s != NULL) {
- // find the block/block_length to use
- uint8_t **block_chain;
- uint32_t *block_length;
- switch(tag_id) {
- case TAG_MENU_LAST:
- case TAG_MENU_MORE:
- block_chain = &cur_s->menu_block_chain;
- block_length = &cur_s->menu_block_length;
- break;
- case TAG_LIST_LAST:
- case TAG_LIST_MORE:
- block_chain = &cur_s->list_block_chain;
- block_length = &cur_s->list_block_length;
- break;
- case TAG_SUBTITLE_SEGMENT_LAST:
- case TAG_SUBTITLE_SEGMENT_MORE:
- block_chain = &cur_s->subtitlesegment_block_chain;
- block_length = &cur_s->subtitlesegment_block_length;
- break;
- case TAG_SUBTITLE_DOWNLOAD_LAST:
- case TAG_SUBTITLE_DOWNLOAD_MORE:
- block_chain = &cur_s->subtitledownload_block_chain;
- block_length = &cur_s->subtitledownload_block_length;
- break;
- default:
- return -1;
- }
-
- // we have a preceding fragment - need to append
- uint8_t *new_data = realloc(*block_chain, *block_length + indata_length);
- if (new_data == NULL) {
- print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
- return -1;
- }
- memcpy(new_data + *block_length, indata, indata_length);
- *outdata_length = *block_length + indata_length;
- *outdata = new_data;
- *block_chain = NULL;
- *block_length = 0;
-
- // success, and indicate to free the block when done
- return 2;
- }
-
- // success, but indicate it is not to be freed
- *outdata_length = indata_length;
- *outdata = indata;
- return 1;
+ struct en50221_app_mmi_session *cur_s = mmi->sessions;
+ while (cur_s) {
+ if (cur_s->session_number == session_number)
+ break;
+ cur_s = cur_s->next;
+ }
+
+ // more data is still to come
+ if (!more_last) {
+ // if there was no previous session, create one
+ if (cur_s == NULL) {
+ cur_s = malloc(sizeof(struct en50221_app_mmi_session));
+ if (cur_s == NULL) {
+ print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
+ return -1;
+ }
+ cur_s->session_number = session_number;
+ cur_s->menu_block_chain = NULL;
+ cur_s->menu_block_length = 0;
+ cur_s->list_block_chain = NULL;
+ cur_s->list_block_length = 0;
+ cur_s->subtitlesegment_block_chain = NULL;
+ cur_s->subtitlesegment_block_length = 0;
+ cur_s->subtitledownload_block_chain = NULL;
+ cur_s->subtitledownload_block_length = 0;
+ cur_s->next = mmi->sessions;
+ mmi->sessions = cur_s;
+ }
+ // find the block/block_length to use
+ uint8_t **block_chain;
+ uint32_t *block_length;
+ switch (tag_id) {
+ case TAG_MENU_LAST:
+ case TAG_MENU_MORE:
+ block_chain = &cur_s->menu_block_chain;
+ block_length = &cur_s->menu_block_length;
+ break;
+ case TAG_LIST_LAST:
+ case TAG_LIST_MORE:
+ block_chain = &cur_s->list_block_chain;
+ block_length = &cur_s->list_block_length;
+ break;
+ case TAG_SUBTITLE_SEGMENT_LAST:
+ case TAG_SUBTITLE_SEGMENT_MORE:
+ block_chain = &cur_s->subtitlesegment_block_chain;
+ block_length = &cur_s->subtitlesegment_block_length;
+ break;
+ case TAG_SUBTITLE_DOWNLOAD_LAST:
+ case TAG_SUBTITLE_DOWNLOAD_MORE:
+ block_chain = &cur_s->subtitledownload_block_chain;
+ block_length = &cur_s->subtitledownload_block_length;
+ break;
+ default:
+ return -1;
+ }
+
+ // append the data
+ uint8_t *new_data =
+ realloc(*block_chain, *block_length + indata_length);
+ if (new_data == NULL) {
+ print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
+ return -1;
+ }
+ memcpy(new_data + *block_length, indata, indata_length);
+ *block_chain = new_data;
+ *block_length += indata_length;
+
+ // success, but block not complete yet
+ return 0;
+ }
+ // we hit the last of a possible chain of fragments
+ if (cur_s != NULL) {
+ // find the block/block_length to use
+ uint8_t **block_chain;
+ uint32_t *block_length;
+ switch (tag_id) {
+ case TAG_MENU_LAST:
+ case TAG_MENU_MORE:
+ block_chain = &cur_s->menu_block_chain;
+ block_length = &cur_s->menu_block_length;
+ break;
+ case TAG_LIST_LAST:
+ case TAG_LIST_MORE:
+ block_chain = &cur_s->list_block_chain;
+ block_length = &cur_s->list_block_length;
+ break;
+ case TAG_SUBTITLE_SEGMENT_LAST:
+ case TAG_SUBTITLE_SEGMENT_MORE:
+ block_chain = &cur_s->subtitlesegment_block_chain;
+ block_length = &cur_s->subtitlesegment_block_length;
+ break;
+ case TAG_SUBTITLE_DOWNLOAD_LAST:
+ case TAG_SUBTITLE_DOWNLOAD_MORE:
+ block_chain = &cur_s->subtitledownload_block_chain;
+ block_length = &cur_s->subtitledownload_block_length;
+ break;
+ default:
+ return -1;
+ }
+
+ // we have a preceding fragment - need to append
+ uint8_t *new_data =
+ realloc(*block_chain, *block_length + indata_length);
+ if (new_data == NULL) {
+ print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
+ return -1;
+ }
+ memcpy(new_data + *block_length, indata, indata_length);
+ *outdata_length = *block_length + indata_length;
+ *outdata = new_data;
+ *block_chain = NULL;
+ *block_length = 0;
+
+ // success, and indicate to free the block when done
+ return 2;
+ }
+ // success, but indicate it is not to be freed
+ *outdata_length = indata_length;
+ *outdata = indata;
+ return 1;
}
-static int en50221_app_mmi_defragment_text(uint8_t *data,
- uint32_t data_length,
- uint8_t **outdata,
- uint32_t *outdata_length,
- uint32_t *outconsumed)
+static int en50221_app_mmi_defragment_text(uint8_t * data,
+ uint32_t data_length,
+ uint8_t ** outdata,
+ uint32_t * outdata_length,
+ uint32_t * outconsumed)
{
- uint8_t *text = NULL;
- uint32_t text_length = 0;
- uint32_t consumed = 0;
-
- while(1) {
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Short data\n");
- if (text) free(text);
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
- data += 3;
- data_length -=3;
- consumed += 3;
-
- // get the length of the data and adjust
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- if (text) free(text);
- return -1;
- }
- data += length_field_len;
- data_length -= length_field_len;
- consumed += length_field_len;
-
- // deal with the tags
- if (tag == TAG_TEXT_LAST) {
- if (text == NULL) {
- *outdata = data;
- *outdata_length = asn_data_length;
- *outconsumed = consumed + asn_data_length;
- return 1;
- } else {
- // append the data
- uint8_t *new_text = realloc(text, text_length + asn_data_length);
- if (new_text == NULL) {
- print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
- if (text) free(text);
- return -1;
- }
- memcpy(new_text + text_length, data, asn_data_length);
- *outdata = new_text;
- *outdata_length = text_length + asn_data_length;
- *outconsumed = consumed + asn_data_length;
- return 2;
- }
-
- } else if (tag == TAG_TEXT_MORE) {
- // append the data
- uint8_t *new_text = realloc(text, text_length + asn_data_length);
- if (new_text == NULL) {
- print(LOG_LEVEL, ERROR, 1, "Ran out of memory\n");
- if (text) free(text);
- return -1;
- }
- memcpy(new_text + text_length, data, asn_data_length);
- text = new_text;
- text_length += asn_data_length;
-
- // consume the data
- data += asn_data_length;
- data_length -= asn_data_length;
- consumed += asn_data_length;
- } else {
- // unknown tag
- print(LOG_LEVEL, ERROR, 1, "Unknown MMI text tag\n");
- if (text) free(text);
- return -1;
- }
- }
+ uint8_t *text = NULL;
+ uint32_t text_length = 0;
+ uint32_t consumed = 0;
+
+ while (1) {
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Short data\n");
+ if (text)
+ free(text);
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+ data += 3;
+ data_length -= 3;
+ consumed += 3;
+
+ // get the length of the data and adjust
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len =
+ asn_1_decode(&asn_data_length, data,
+ data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ if (text)
+ free(text);
+ return -1;
+ }
+ data += length_field_len;
+ data_length -= length_field_len;
+ consumed += length_field_len;
+
+ // deal with the tags
+ if (tag == TAG_TEXT_LAST) {
+ if (text == NULL) {
+ *outdata = data;
+ *outdata_length = asn_data_length;
+ *outconsumed = consumed + asn_data_length;
+ return 1;
+ } else {
+ // append the data
+ uint8_t *new_text = realloc(text,
+ text_length + asn_data_length);
+ if (new_text == NULL) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Ran out of memory\n");
+ if (text)
+ free(text);
+ return -1;
+ }
+ memcpy(new_text + text_length, data,
+ asn_data_length);
+ *outdata = new_text;
+ *outdata_length =
+ text_length + asn_data_length;
+ *outconsumed = consumed + asn_data_length;
+ return 2;
+ }
+
+ } else if (tag == TAG_TEXT_MORE) {
+ // append the data
+ uint8_t *new_text =
+ realloc(text, text_length + asn_data_length);
+ if (new_text == NULL) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Ran out of memory\n");
+ if (text)
+ free(text);
+ return -1;
+ }
+ memcpy(new_text + text_length, data,
+ asn_data_length);
+ text = new_text;
+ text_length += asn_data_length;
+
+ // consume the data
+ data += asn_data_length;
+ data_length -= asn_data_length;
+ consumed += asn_data_length;
+ } else {
+ // unknown tag
+ print(LOG_LEVEL, ERROR, 1,
+ "Unknown MMI text tag\n");
+ if (text)
+ free(text);
+ return -1;
+ }
+ }
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_mmi.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_mmi.h
index 486080f..5c5b727 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_mmi.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_mmi.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APPLICATION_mmi_H__
#define __EN50221_APPLICATION_mmi_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -88,48 +87,48 @@ extern "C"
* A pixel depth as supplied with display_reply details
*/
struct en50221_app_mmi_pixel_depth {
- uint8_t display_depth;
- uint8_t pixels_per_byte;
- uint8_t region_overhead;
+ uint8_t display_depth;
+ uint8_t pixels_per_byte;
+ uint8_t region_overhead;
};
/**
* Details returned with a display_reply
*/
-struct en502221_app_mmi_display_reply_details {
- union {
- struct {
- uint16_t width;
- uint16_t height;
- uint8_t aspect_ratio;
- uint8_t gfx_relation_to_video; /* one of MMI_GFX_VIDEO_RELATION_* */
- uint8_t multiple_depths;
- uint16_t display_bytes;
- uint8_t composition_buffer_bytes;
- uint8_t object_cache_bytes;
- uint8_t num_pixel_depths;
- struct en50221_app_mmi_pixel_depth *pixel_depths;
- } gfx; /* MMI_DISPLAY_REPLY_ID_LIST_OVERLAY_GFX_CHARACTERISTICS or
- MMI_DISPLAY_REPLY_ID_LIST_FULLSCREEN_GFX_CHARACTERISTICS */
-
- struct {
- uint32_t table_length;
- uint8_t *table;
- } char_table; /* MMI_DISPLAY_REPLY_ID_LIST_DISPLAY_CHAR_TABLES or
- MMI_DISPLAY_REPLY_ID_LIST_INPUT_CHAR_TABLES */
-
- struct {
- uint8_t mmi_mode; /* one of the MMI_MODE_* values */
- } mode_ack; /* for MMI_DISPLAY_REPLY_ID_MMI_MODE_ACK */
- } u;
+struct en50221_app_mmi_display_reply_details {
+ union {
+ struct {
+ uint16_t width;
+ uint16_t height;
+ uint8_t aspect_ratio;
+ uint8_t gfx_relation_to_video; /* one of MMI_GFX_VIDEO_RELATION_* */
+ uint8_t multiple_depths;
+ uint16_t display_bytes;
+ uint8_t composition_buffer_bytes;
+ uint8_t object_cache_bytes;
+ uint8_t num_pixel_depths;
+ struct en50221_app_mmi_pixel_depth *pixel_depths;
+ } gfx; /* MMI_DISPLAY_REPLY_ID_LIST_OVERLAY_GFX_CHARACTERISTICS or
+ MMI_DISPLAY_REPLY_ID_LIST_FULLSCREEN_GFX_CHARACTERISTICS */
+
+ struct {
+ uint32_t table_length;
+ uint8_t *table;
+ } char_table; /* MMI_DISPLAY_REPLY_ID_LIST_DISPLAY_CHAR_TABLES or
+ MMI_DISPLAY_REPLY_ID_LIST_INPUT_CHAR_TABLES */
+
+ struct {
+ uint8_t mmi_mode; /* one of the MMI_MODE_* values */
+ } mode_ack; /* for MMI_DISPLAY_REPLY_ID_MMI_MODE_ACK */
+ } u;
};
/**
* Pointer to a text string.
*/
struct en50221_app_mmi_text {
- uint8_t *text;
- uint32_t text_length;
+ uint8_t *text;
+ uint32_t text_length;
};
/**
@@ -142,8 +141,11 @@ struct en50221_app_mmi_text {
* @param delay Delay supplied with MMI_CLOSE_MMI_CMD_ID_DELAY.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_mmi_close_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t cmd_id, uint8_t delay);
+typedef int (*en50221_app_mmi_close_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t cmd_id,
+ uint8_t delay);
/**
* Type definition for display_control callback.
@@ -155,8 +157,11 @@ typedef int (*en50221_app_mmi_close_callback)(void *arg, uint8_t slot_id, uint16
* @param delay One of the MMI_MODE_* values.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_mmi_display_control_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t cmd_id, uint8_t mmi_mode);
+typedef int (*en50221_app_mmi_display_control_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t cmd_id,
+ uint8_t mmi_mode);
/**
* Type definition for keypad_control callback.
@@ -169,8 +174,12 @@ typedef int (*en50221_app_mmi_display_control_callback)(void *arg, uint8_t slot_
* @param key_codes_count Number of key codes.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_mmi_keypad_control_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t cmd_id, uint8_t *key_codes, uint32_t key_codes_count);
+typedef int (*en50221_app_mmi_keypad_control_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t cmd_id,
+ uint8_t *key_codes,
+ uint32_t key_codes_count);
/**
* Type definition for subtitle_segment callback.
@@ -182,8 +191,11 @@ typedef int (*en50221_app_mmi_keypad_control_callback)(void *arg, uint8_t slot_i
* @param segment_size Size of segment data.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_mmi_subtitle_segment_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t *segment, uint32_t segment_size);
+typedef int (*en50221_app_mmi_subtitle_segment_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t *segment,
+ uint32_t segment_size);
/**
* Type definition for scene_end_mark callback.
@@ -197,9 +209,13 @@ typedef int (*en50221_app_mmi_subtitle_segment_callback)(void *arg, uint8_t slot
* @param scene_tag
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_mmi_scene_end_mark_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t decoder_continue_flag, uint8_t scene_reveal_flag,
- uint8_t send_scene_done, uint8_t scene_tag);
+typedef int (*en50221_app_mmi_scene_end_mark_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t decoder_continue_flag,
+ uint8_t scene_reveal_flag,
+ uint8_t send_scene_done,
+ uint8_t scene_tag);
/**
* Type definition for scene_control callback.
@@ -212,9 +228,12 @@ typedef int (*en50221_app_mmi_scene_end_mark_callback)(void *arg, uint8_t slot_i
* @param scene_tag
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_mmi_scene_control_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t decoder_continue_flag, uint8_t scene_reveal_flag,
- uint8_t scene_tag);
+typedef int (*en50221_app_mmi_scene_control_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t decoder_continue_flag,
+ uint8_t scene_reveal_flag,
+ uint8_t scene_tag);
/**
* Type definition for subtitle_download callback.
@@ -226,8 +245,11 @@ typedef int (*en50221_app_mmi_scene_control_callback)(void *arg, uint8_t slot_id
* @param segment_size Size of segment data.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_mmi_subtitle_download_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t *segment, uint32_t segment_size);
+typedef int (*en50221_app_mmi_subtitle_download_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t *segment,
+ uint32_t segment_size);
/**
* Type definition for flush_download callback.
@@ -237,7 +259,9 @@ typedef int (*en50221_app_mmi_subtitle_download_callback)(void *arg, uint8_t slo
* @param session_number Session number concerned.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_mmi_flush_download_callback)(void *arg, uint8_t slot_id, uint16_t session_number);
+typedef int (*en50221_app_mmi_flush_download_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number);
/**
* Type definition for enq callback.
@@ -251,9 +275,13 @@ typedef int (*en50221_app_mmi_flush_download_callback)(void *arg, uint8_t slot_i
* @param text_size Size of text data.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_mmi_enq_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t blind_answer, uint8_t expected_answer_length,
- uint8_t *text, uint32_t text_size);
+typedef int (*en50221_app_mmi_enq_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t blind_answer,
+ uint8_t expected_answer_length,
+ uint8_t * text,
+ uint32_t text_size);
/**
* Type definition for menu callback.
@@ -270,12 +298,16 @@ typedef int (*en50221_app_mmi_enq_callback)(void *arg, uint8_t slot_id, uint16_t
* @param items_raw If nonstandard items were supplied, pointer to their data.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_mmi_menu_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- struct en50221_app_mmi_text *title,
- struct en50221_app_mmi_text *sub_title,
- struct en50221_app_mmi_text *bottom,
- uint32_t item_count, struct en50221_app_mmi_text *items,
- uint32_t item_raw_length, uint8_t *items_raw);
+typedef int (*en50221_app_mmi_menu_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ struct en50221_app_mmi_text *title,
+ struct en50221_app_mmi_text *sub_title,
+ struct en50221_app_mmi_text *bottom,
+ uint32_t item_count,
+ struct en50221_app_mmi_text *items,
+ uint32_t item_raw_length,
+ uint8_t *items_raw);
/**
* Type definition for list callback.
@@ -292,17 +324,21 @@ typedef int (*en50221_app_mmi_menu_callback)(void *arg, uint8_t slot_id, uint16_
* @param items_raw If nonstandard items were supplied, pointer to their data.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_mmi_list_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- struct en50221_app_mmi_text *title,
- struct en50221_app_mmi_text *sub_title,
- struct en50221_app_mmi_text *bottom,
- uint32_t item_count, struct en50221_app_mmi_text *items,
- uint32_t item_raw_length, uint8_t *items_raw);
+typedef int (*en50221_app_mmi_list_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ struct en50221_app_mmi_text *title,
+ struct en50221_app_mmi_text *sub_title,
+ struct en50221_app_mmi_text *bottom,
+ uint32_t item_count,
+ struct en50221_app_mmi_text *items,
+ uint32_t item_raw_length,
+ uint8_t *items_raw);
/**
* Opaque type representing a mmi resource.
*/
-typedef void *en50221_app_mmi;
+struct en50221_app_mmi;
/**
* Create an instance of the mmi resource.
@@ -310,14 +346,14 @@ typedef void *en50221_app_mmi;
* @param funcs Send functions to use.
* @return Instance, or NULL on failure.
*/
-extern en50221_app_mmi en50221_app_mmi_create(struct en50221_app_send_functions *funcs);
+extern struct en50221_app_mmi *en50221_app_mmi_create(struct en50221_app_send_functions *funcs);
/**
* Destroy an instance of the mmi resource.
*
* @param mmi Instance to destroy.
*/
-extern void en50221_app_mmi_destroy(en50221_app_mmi mmi);
+extern void en50221_app_mmi_destroy(struct en50221_app_mmi *mmi);
/**
* Informs the mmi object that a session to it has been closed - cleans up internal state.
@@ -325,7 +361,8 @@ extern void en50221_app_mmi_destroy(en50221_app_mmi mmi);
* @param mmi mmi resource instance.
* @param session_number The session concerned.
*/
-extern void en50221_app_mmi_clear_session(en50221_app_mmi mmi, uint16_t session_number);
+extern void en50221_app_mmi_clear_session(struct en50221_app_mmi *mmi,
+ uint16_t session_number);
/**
* Register the callback for when we receive an mmi_close request.
@@ -334,8 +371,9 @@ extern void en50221_app_mmi_clear_session(en50221_app_mmi mmi, uint16_t session_
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_mmi_register_close_callback(en50221_app_mmi mmi,
- en50221_app_mmi_close_callback callback, void *arg);
+extern void en50221_app_mmi_register_close_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_close_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a display control request.
@@ -344,8 +382,9 @@ extern void en50221_app_mmi_register_close_callback(en50221_app_mmi mmi,
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_mmi_register_display_control_callback(en50221_app_mmi mmi,
- en50221_app_mmi_display_control_callback callback, void *arg);
+extern void en50221_app_mmi_register_display_control_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_display_control_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a keypad control request.
@@ -354,8 +393,9 @@ extern void en50221_app_mmi_register_display_control_callback(en50221_app_mmi mm
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_mmi_register_keypad_control_callback(en50221_app_mmi mmi,
- en50221_app_mmi_keypad_control_callback callback, void *arg);
+extern void en50221_app_mmi_register_keypad_control_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_keypad_control_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a subtitle segment request.
@@ -364,8 +404,9 @@ extern void en50221_app_mmi_register_keypad_control_callback(en50221_app_mmi mmi
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_mmi_register_subtitle_segment_callback(en50221_app_mmi mmi,
- en50221_app_mmi_subtitle_segment_callback callback, void *arg);
+extern void en50221_app_mmi_register_subtitle_segment_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_subtitle_segment_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a scene end mark request.
@@ -374,8 +415,9 @@ extern void en50221_app_mmi_register_subtitle_segment_callback(en50221_app_mmi m
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_mmi_register_scene_end_mark_callback(en50221_app_mmi mmi,
- en50221_app_mmi_scene_end_mark_callback callback, void *arg);
+extern void en50221_app_mmi_register_scene_end_mark_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_scene_end_mark_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a scene control request.
@@ -384,8 +426,9 @@ extern void en50221_app_mmi_register_scene_end_mark_callback(en50221_app_mmi mmi
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_mmi_register_scene_control_callback(en50221_app_mmi mmi,
- en50221_app_mmi_scene_control_callback callback, void *arg);
+extern void en50221_app_mmi_register_scene_control_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_scene_control_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a subtitle download request.
@@ -394,8 +437,9 @@ extern void en50221_app_mmi_register_scene_control_callback(en50221_app_mmi mmi,
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_mmi_register_subtitle_download_callback(en50221_app_mmi mmi,
- en50221_app_mmi_subtitle_download_callback callback, void *arg);
+extern void en50221_app_mmi_register_subtitle_download_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_subtitle_download_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a flush download request.
@@ -404,8 +448,9 @@ extern void en50221_app_mmi_register_subtitle_download_callback(en50221_app_mmi
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_mmi_register_flush_download_callback(en50221_app_mmi mmi,
- en50221_app_mmi_flush_download_callback callback, void *arg);
+extern void en50221_app_mmi_register_flush_download_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_flush_download_callback callback,
+ void *arg);
/**
* Register the callback for when we receive an enq request.
@@ -414,8 +459,9 @@ extern void en50221_app_mmi_register_flush_download_callback(en50221_app_mmi mmi
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_mmi_register_enq_callback(en50221_app_mmi mmi,
- en50221_app_mmi_enq_callback callback, void *arg);
+extern void en50221_app_mmi_register_enq_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_enq_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a menu request.
@@ -424,8 +470,9 @@ extern void en50221_app_mmi_register_enq_callback(en50221_app_mmi mmi,
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_mmi_register_menu_callback(en50221_app_mmi mmi,
- en50221_app_mmi_menu_callback callback, void *arg);
+extern void en50221_app_mmi_register_menu_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_menu_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a list request.
@@ -434,8 +481,9 @@ extern void en50221_app_mmi_register_menu_callback(en50221_app_mmi mmi,
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_mmi_register_list_callback(en50221_app_mmi mmi,
- en50221_app_mmi_list_callback callback, void *arg);
+extern void en50221_app_mmi_register_list_callback(struct en50221_app_mmi *mmi,
+ en50221_app_mmi_list_callback callback,
+ void *arg);
/**
* Send an mmi_close to the cam.
@@ -446,10 +494,9 @@ extern void en50221_app_mmi_register_list_callback(en50221_app_mmi mmi,
* @param delay Delay to use if MMI_CLOSE_MMI_CMD_ID_DELAY specified.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_mmi_close(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t cmd_id,
- uint8_t delay);
+extern int en50221_app_mmi_close(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t cmd_id, uint8_t delay);
/**
* Send a display_reply to the cam.
@@ -460,10 +507,10 @@ extern int en50221_app_mmi_close(en50221_app_mmi mmi,
* @param details The details of the reply - can be NULL if the chosen reply_id does not need it.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_mmi_display_reply(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t reply_id,
- struct en502221_app_mmi_display_reply_details *details);
+extern int en50221_app_mmi_display_reply(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t reply_id,
+ struct en50221_app_mmi_display_reply_details *details);
/**
* Send a keypress to the cam.
@@ -473,9 +520,9 @@ extern int en50221_app_mmi_display_reply(en50221_app_mmi mmi,
* @param keycode The keycode.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_mmi_keypress(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t keycode);
+extern int en50221_app_mmi_keypress(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t keycode);
/**
* Send a display message to the cam.
@@ -485,9 +532,9 @@ extern int en50221_app_mmi_keypress(en50221_app_mmi mmi,
* @param display_message_id One of the MMI_DISPLAY_MESSAGE_ID_* values.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_mmi_display_message(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t display_message_id);
+extern int en50221_app_mmi_display_message(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t display_message_id);
/**
* Send a scene done message to the cam.
@@ -499,11 +546,11 @@ extern int en50221_app_mmi_display_message(en50221_app_mmi mmi,
* @param scene_tag Scene tag this responds to.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_mmi_scene_done(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t decoder_continue,
- uint8_t scene_reveal,
- uint8_t scene_tag);
+extern int en50221_app_mmi_scene_done(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t decoder_continue,
+ uint8_t scene_reveal,
+ uint8_t scene_tag);
/**
* Send a download reply to the cam.
@@ -514,10 +561,10 @@ extern int en50221_app_mmi_scene_done(en50221_app_mmi mmi,
* @param download_reply_id One of the MMI_DOWNLOAD_REPLY_ID_* values.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_mmi_download_reply(en50221_app_mmi mmi,
- uint16_t session_number,
- uint16_t object_id,
- uint8_t download_reply_id);
+extern int en50221_app_mmi_download_reply(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint16_t object_id,
+ uint8_t download_reply_id);
/**
* Send an answ to the cam.
@@ -529,11 +576,11 @@ extern int en50221_app_mmi_download_reply(en50221_app_mmi mmi,
* @param text_count Length of text.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_mmi_answ(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t answ_id,
- uint8_t *text,
- uint32_t text_count);
+extern int en50221_app_mmi_answ(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t answ_id,
+ uint8_t * text,
+ uint32_t text_count);
/**
* Send a menu answ to the cam.
@@ -543,9 +590,9 @@ extern int en50221_app_mmi_answ(en50221_app_mmi mmi,
* @param choice_ref Option chosen by user (0=>canceled).
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_mmi_menu_answ(en50221_app_mmi mmi,
- uint16_t session_number,
- uint8_t choice_ref);
+extern int en50221_app_mmi_menu_answ(struct en50221_app_mmi *mmi,
+ uint16_t session_number,
+ uint8_t choice_ref);
/**
* Pass data received for this resource into it for parsing.
@@ -558,14 +605,14 @@ extern int en50221_app_mmi_menu_answ(en50221_app_mmi mmi,
* @param data_length Length of data in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_mmi_message(en50221_app_mmi mmi,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_app_mmi_message(struct en50221_app_mmi *mmi,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t *data,
+ uint32_t data_length);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_rm.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_rm.c
index 71f2b19..7a5bc2f 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_rm.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_rm.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
@@ -29,266 +29,279 @@
#include "en50221_app_tags.h"
#include "asn_1.h"
-struct en50221_app_rm_private {
- struct en50221_app_send_functions *funcs;
+struct en50221_app_rm {
+ struct en50221_app_send_functions *funcs;
- en50221_app_rm_enq_callback enqcallback;
- void *enqcallback_arg;
+ en50221_app_rm_enq_callback enqcallback;
+ void *enqcallback_arg;
- en50221_app_rm_reply_callback replycallback;
- void *replycallback_arg;
+ en50221_app_rm_reply_callback replycallback;
+ void *replycallback_arg;
- en50221_app_rm_changed_callback changedcallback;
- void *changedcallback_arg;
+ en50221_app_rm_changed_callback changedcallback;
+ void *changedcallback_arg;
- pthread_mutex_t lock;
+ pthread_mutex_t lock;
};
-static int en50221_app_rm_parse_profile_enq(struct en50221_app_rm_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-static int en50221_app_rm_parse_profile_reply(struct en50221_app_rm_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-static int en50221_app_rm_parse_profile_change(struct en50221_app_rm_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
-
-
-en50221_app_rm en50221_app_rm_create(struct en50221_app_send_functions *funcs)
+static int en50221_app_rm_parse_profile_enq(struct en50221_app_rm *rm,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_app_rm_parse_profile_reply(struct en50221_app_rm *rm,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_app_rm_parse_profile_change(struct en50221_app_rm *rm,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
+
+
+struct en50221_app_rm *en50221_app_rm_create(struct
+ en50221_app_send_functions
+ *funcs)
{
- struct en50221_app_rm_private *private = NULL;
-
- // create structure and set it up
- private = malloc(sizeof(struct en50221_app_rm_private));
- if (private == NULL) {
- return NULL;
- }
- private->funcs = funcs;
- private->enqcallback = NULL;
- private->replycallback = NULL;
- private->changedcallback = NULL;
-
- pthread_mutex_init(&private->lock, NULL);
-
- // done
- return private;
+ struct en50221_app_rm *rm = NULL;
+
+ // create structure and set it up
+ rm = malloc(sizeof(struct en50221_app_rm));
+ if (rm == NULL) {
+ return NULL;
+ }
+ rm->funcs = funcs;
+ rm->enqcallback = NULL;
+ rm->replycallback = NULL;
+ rm->changedcallback = NULL;
+
+ pthread_mutex_init(&rm->lock, NULL);
+
+ // done
+ return rm;
}
-void en50221_app_rm_destroy(en50221_app_rm rm)
+void en50221_app_rm_destroy(struct en50221_app_rm *rm)
{
- struct en50221_app_rm_private *private = (struct en50221_app_rm_private *) rm;
-
- pthread_mutex_destroy(&private->lock);
- free(private);
+ pthread_mutex_destroy(&rm->lock);
+ free(rm);
}
-void en50221_app_rm_register_enq_callback(en50221_app_rm rm,
- en50221_app_rm_enq_callback callback, void *arg)
+void en50221_app_rm_register_enq_callback(struct en50221_app_rm *rm,
+ en50221_app_rm_enq_callback
+ callback, void *arg)
{
- struct en50221_app_rm_private *private = (struct en50221_app_rm_private *) rm;
-
- pthread_mutex_lock(&private->lock);
- private->enqcallback = callback;
- private->enqcallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&rm->lock);
+ rm->enqcallback = callback;
+ rm->enqcallback_arg = arg;
+ pthread_mutex_unlock(&rm->lock);
}
-void en50221_app_rm_register_reply_callback(en50221_app_rm rm,
- en50221_app_rm_reply_callback callback, void *arg)
+void en50221_app_rm_register_reply_callback(struct en50221_app_rm *rm,
+ en50221_app_rm_reply_callback
+ callback, void *arg)
{
- struct en50221_app_rm_private *private = (struct en50221_app_rm_private *) rm;
-
- pthread_mutex_lock(&private->lock);
- private->replycallback = callback;
- private->replycallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&rm->lock);
+ rm->replycallback = callback;
+ rm->replycallback_arg = arg;
+ pthread_mutex_unlock(&rm->lock);
}
-void en50221_app_rm_register_changed_callback(en50221_app_rm rm,
- en50221_app_rm_changed_callback callback, void *arg)
+void en50221_app_rm_register_changed_callback(struct en50221_app_rm *rm,
+ en50221_app_rm_changed_callback
+ callback, void *arg)
{
- struct en50221_app_rm_private *private = (struct en50221_app_rm_private *) rm;
-
- pthread_mutex_lock(&private->lock);
- private->changedcallback = callback;
- private->changedcallback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&rm->lock);
+ rm->changedcallback = callback;
+ rm->changedcallback_arg = arg;
+ pthread_mutex_unlock(&rm->lock);
}
-int en50221_app_rm_enq(en50221_app_rm rm, uint16_t session_number)
+int en50221_app_rm_enq(struct en50221_app_rm *rm, uint16_t session_number)
{
- struct en50221_app_rm_private *private = (struct en50221_app_rm_private *) rm;
- uint8_t buf[4];
+ uint8_t buf[4];
- // set up the tag
- buf[0] = (TAG_PROFILE_ENQUIRY >> 16) & 0xFF;
- buf[1] = (TAG_PROFILE_ENQUIRY >> 8) & 0xFF;
- buf[2] = TAG_PROFILE_ENQUIRY & 0xFF;
- buf[3] = 0;
+ // set up the tag
+ buf[0] = (TAG_PROFILE_ENQUIRY >> 16) & 0xFF;
+ buf[1] = (TAG_PROFILE_ENQUIRY >> 8) & 0xFF;
+ buf[2] = TAG_PROFILE_ENQUIRY & 0xFF;
+ buf[3] = 0;
- // create the data and send it
- return private->funcs->send_data(private->funcs->arg, session_number, buf, 4);
+ // create the data and send it
+ return rm->funcs->send_data(rm->funcs->arg, session_number, buf, 4);
}
-int en50221_app_rm_reply(en50221_app_rm rm, uint16_t session_number,
- uint32_t resource_id_count,
- uint32_t *resource_ids)
+int en50221_app_rm_reply(struct en50221_app_rm *rm,
+ uint16_t session_number,
+ uint32_t resource_id_count,
+ uint32_t * resource_ids)
{
- struct en50221_app_rm_private *private = (struct en50221_app_rm_private *) rm;
- uint8_t buf[10];
-
- // set up the tag
- buf[0] = (TAG_PROFILE >> 16) & 0xFF;
- buf[1] = (TAG_PROFILE >> 8) & 0xFF;
- buf[2] = TAG_PROFILE & 0xFF;
-
- // encode the length field
- int length_field_len;
- if ((length_field_len = asn_1_encode(resource_id_count*4, buf+3, 3)) < 0) {
- return -1;
- }
-
- // copy the data and byteswap it
- uint32_t *copy_resource_ids = alloca(4*resource_id_count);
- if (copy_resource_ids == NULL) {
- return -1;
- }
- uint8_t *data = (uint8_t*) copy_resource_ids;
- memcpy(data, resource_ids, resource_id_count*4);
- uint32_t i;
- for(i=0; i<resource_id_count; i++) {
- bswap32(data);
- data+=4;
- }
-
- // build the iovecs
- struct iovec iov[2];
- iov[0].iov_base = buf;
- iov[0].iov_len = 3+length_field_len;
- iov[1].iov_base = (uint8_t*) copy_resource_ids;
- iov[1].iov_len = resource_id_count * 4;
-
- // create the data and send it
- return private->funcs->send_datav(private->funcs->arg, session_number, iov, 2);
+ uint8_t buf[10];
+
+ // set up the tag
+ buf[0] = (TAG_PROFILE >> 16) & 0xFF;
+ buf[1] = (TAG_PROFILE >> 8) & 0xFF;
+ buf[2] = TAG_PROFILE & 0xFF;
+
+ // encode the length field
+ int length_field_len;
+ if ((length_field_len = asn_1_encode(resource_id_count * 4, buf + 3, 3)) < 0) {
+ return -1;
+ }
+ // copy the data and byteswap it
+ uint32_t *copy_resource_ids = alloca(4 * resource_id_count);
+ if (copy_resource_ids == NULL) {
+ return -1;
+ }
+ uint8_t *data = (uint8_t *) copy_resource_ids;
+ memcpy(data, resource_ids, resource_id_count * 4);
+ uint32_t i;
+ for (i = 0; i < resource_id_count; i++) {
+ bswap32(data);
+ data += 4;
+ }
+
+ // build the iovecs
+ struct iovec iov[2];
+ iov[0].iov_base = buf;
+ iov[0].iov_len = 3 + length_field_len;
+ iov[1].iov_base = (uint8_t *) copy_resource_ids;
+ iov[1].iov_len = resource_id_count * 4;
+
+ // create the data and send it
+ return rm->funcs->send_datav(rm->funcs->arg, session_number, iov, 2);
}
-int en50221_app_rm_changed(en50221_app_rm rm, uint16_t session_number)
+int en50221_app_rm_changed(struct en50221_app_rm *rm,
+ uint16_t session_number)
{
- struct en50221_app_rm_private *private = (struct en50221_app_rm_private *) rm;
- uint8_t buf[4];
+ uint8_t buf[4];
- // set up the tag
- buf[0] = (TAG_PROFILE_CHANGE >> 16) & 0xFF;
- buf[1] = (TAG_PROFILE_CHANGE >> 8) & 0xFF;
- buf[2] = TAG_PROFILE_CHANGE & 0xFF;
- buf[3] = 0;
+ // set up the tag
+ buf[0] = (TAG_PROFILE_CHANGE >> 16) & 0xFF;
+ buf[1] = (TAG_PROFILE_CHANGE >> 8) & 0xFF;
+ buf[2] = TAG_PROFILE_CHANGE & 0xFF;
+ buf[3] = 0;
- // create the data and send it
- return private->funcs->send_data(private->funcs->arg, session_number, buf, 4);
+ // create the data and send it
+ return rm->funcs->send_data(rm->funcs->arg, session_number, buf, 4);
}
-int en50221_app_rm_message(en50221_app_rm rm,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length)
+int en50221_app_rm_message(struct en50221_app_rm *rm,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data, uint32_t data_length)
{
- struct en50221_app_rm_private *private = (struct en50221_app_rm_private *) rm;
- (void) resource_id;
-
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
-
- // dispatch it
- switch(tag)
- {
- case TAG_PROFILE_ENQUIRY:
- return en50221_app_rm_parse_profile_enq(private, slot_id, session_number, data+3, data_length-3);
- case TAG_PROFILE:
- return en50221_app_rm_parse_profile_reply(private, slot_id, session_number, data+3, data_length-3);
- case TAG_PROFILE_CHANGE:
- return en50221_app_rm_parse_profile_change(private, slot_id, session_number, data+3, data_length-3);
- }
-
- print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
- return -1;
+ (void) resource_id;
+
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+
+ // dispatch it
+ switch (tag) {
+ case TAG_PROFILE_ENQUIRY:
+ return en50221_app_rm_parse_profile_enq(rm, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ case TAG_PROFILE:
+ return en50221_app_rm_parse_profile_reply(rm, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ case TAG_PROFILE_CHANGE:
+ return en50221_app_rm_parse_profile_change(rm, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ }
+
+ print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
+ return -1;
}
-static int en50221_app_rm_parse_profile_enq(struct en50221_app_rm_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_rm_parse_profile_enq(struct en50221_app_rm *rm,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- (void)data;
- (void)data_length;
-
- pthread_mutex_lock(&private->lock);
- en50221_app_rm_enq_callback cb = private->enqcallback;
- void *cb_arg = private->enqcallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number);
- }
- return 0;
+ (void) data;
+ (void) data_length;
+
+ pthread_mutex_lock(&rm->lock);
+ en50221_app_rm_enq_callback cb = rm->enqcallback;
+ void *cb_arg = rm->enqcallback_arg;
+ pthread_mutex_unlock(&rm->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number);
+ }
+ return 0;
}
-static int en50221_app_rm_parse_profile_reply(struct en50221_app_rm_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_rm_parse_profile_reply(struct en50221_app_rm *rm,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t resources_count = asn_data_length / 4;
- uint32_t *resource_ids = (uint32_t*) (data+length_field_len);
- data += length_field_len;
-
- // byteswap it
- uint32_t i;
- for(i=0; i< resources_count; i++) {
- bswap32(data);
- data+=4;
- }
-
- // inform observer
- pthread_mutex_lock(&private->lock);
- en50221_app_rm_reply_callback cb = private->replycallback;
- void *cb_arg = private->replycallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, resources_count, resource_ids);
- }
- return 0;
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ // check it
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t resources_count = asn_data_length / 4;
+ uint32_t *resource_ids = (uint32_t *) (data + length_field_len);
+ data += length_field_len;
+
+ // byteswap it
+ uint32_t i;
+ for (i = 0; i < resources_count; i++) {
+ bswap32(data);
+ data += 4;
+ }
+
+ // inform observer
+ pthread_mutex_lock(&rm->lock);
+ en50221_app_rm_reply_callback cb = rm->replycallback;
+ void *cb_arg = rm->replycallback_arg;
+ pthread_mutex_unlock(&rm->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, resources_count, resource_ids);
+ }
+ return 0;
}
-static int en50221_app_rm_parse_profile_change(struct en50221_app_rm_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_rm_parse_profile_change(struct en50221_app_rm *rm,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- (void)data;
- (void)data_length;
-
- pthread_mutex_lock(&private->lock);
- en50221_app_rm_changed_callback cb = private->changedcallback;
- void *cb_arg = private->changedcallback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number);
- }
- return 0;
+ (void) data;
+ (void) data_length;
+
+ pthread_mutex_lock(&rm->lock);
+ en50221_app_rm_changed_callback cb = rm->changedcallback;
+ void *cb_arg = rm->changedcallback_arg;
+ pthread_mutex_unlock(&rm->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number);
+ }
+ return 0;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_rm.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_rm.h
index aa91ff5..ec97372 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_rm.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_rm.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APPLICATION_RM_H__
#define __EN50221_APPLICATION_RM_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -44,7 +43,9 @@ extern "C"
* @param session_number Session number concerned.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_rm_enq_callback)(void *arg, uint8_t slot_id, uint16_t session_number);
+typedef int (*en50221_app_rm_enq_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number);
/**
* Type definition for profile_reply callback function - called when we receive
@@ -57,9 +58,11 @@ typedef int (*en50221_app_rm_enq_callback)(void *arg, uint8_t slot_id, uint16_t
* @param resource_ids The resource ids themselves.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_rm_reply_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint32_t resource_id_count,
- uint32_t *resource_ids);
+typedef int (*en50221_app_rm_reply_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id_count,
+ uint32_t *resource_ids);
/**
* Type definition for profile_changed callback function - called when we receive
* a profile_changed from a CAM.
@@ -69,14 +72,16 @@ typedef int (*en50221_app_rm_reply_callback)(void *arg, uint8_t slot_id, uint16_
* @param session_number Session number concerned.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_rm_changed_callback)(void *arg, uint8_t slot_id, uint16_t session_number);
+typedef int (*en50221_app_rm_changed_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number);
/**
* Opaque type representing a resource manager.
*/
-typedef void *en50221_app_rm;
+struct en50221_app_rm;
/**
* Create an instance of the resource manager.
@@ -84,14 +89,14 @@ typedef void *en50221_app_rm;
* @param funcs Send functions to use.
* @return Instance, or NULL on failure.
*/
-extern en50221_app_rm en50221_app_rm_create(struct en50221_app_send_functions *funcs);
+extern struct en50221_app_rm *en50221_app_rm_create(struct en50221_app_send_functions *funcs);
/**
* Destroy an instance of the resource manager.
*
* @param rm Instance to destroy.
*/
-extern void en50221_app_rm_destroy(en50221_app_rm rm);
+extern void en50221_app_rm_destroy(struct en50221_app_rm *rm);
/**
* Register the callback for when we receive a profile_enq from a CAM.
@@ -100,8 +105,9 @@ extern void en50221_app_rm_destroy(en50221_app_rm rm);
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_rm_register_enq_callback(en50221_app_rm rm,
- en50221_app_rm_enq_callback callback, void *arg);
+extern void en50221_app_rm_register_enq_callback(struct en50221_app_rm *rm,
+ en50221_app_rm_enq_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a profile_reply from a CAM.
@@ -110,8 +116,9 @@ extern void en50221_app_rm_register_enq_callback(en50221_app_rm rm,
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_rm_register_reply_callback(en50221_app_rm rm,
- en50221_app_rm_reply_callback callback, void *arg);
+extern void en50221_app_rm_register_reply_callback(struct en50221_app_rm *rm,
+ en50221_app_rm_reply_callback callback,
+ void *arg);
/**
* Register the callback for when we receive a profile_changed from a CAM.
@@ -120,8 +127,9 @@ extern void en50221_app_rm_register_reply_callback(en50221_app_rm rm,
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_rm_register_changed_callback(en50221_app_rm rm,
- en50221_app_rm_changed_callback callback, void *arg);
+extern void en50221_app_rm_register_changed_callback(struct en50221_app_rm *rm,
+ en50221_app_rm_changed_callback callback,
+ void *arg);
/**
* Send a profile_enq to a CAM.
@@ -130,7 +138,7 @@ extern void en50221_app_rm_register_changed_callback(en50221_app_rm rm,
* @param session_number Session number to send it on.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_rm_enq(en50221_app_rm rm, uint16_t session_number);
+extern int en50221_app_rm_enq(struct en50221_app_rm *rm, uint16_t session_number);
/**
* Send a profile_reply to a CAM.
@@ -141,9 +149,10 @@ extern int en50221_app_rm_enq(en50221_app_rm rm, uint16_t session_number);
* @param resource_ids The resource IDs themselves
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_rm_reply(en50221_app_rm rm, uint16_t session_number,
- uint32_t resource_id_count,
- uint32_t *resource_ids);
+extern int en50221_app_rm_reply(struct en50221_app_rm *rm,
+ uint16_t session_number,
+ uint32_t resource_id_count,
+ uint32_t * resource_ids);
/**
* Send a profile_changed to a CAM.
@@ -152,7 +161,7 @@ extern int en50221_app_rm_reply(en50221_app_rm rm, uint16_t session_number,
* @param session_number Session number to send it on.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_rm_changed(en50221_app_rm rm, uint16_t session_number);
+extern int en50221_app_rm_changed(struct en50221_app_rm *rm, uint16_t session_number);
/**
* Pass data received for this resource into it for parsing.
@@ -165,14 +174,14 @@ extern int en50221_app_rm_changed(en50221_app_rm rm, uint16_t session_number);
* @param data_length Length of data in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_rm_message(en50221_app_rm rm,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_app_rm_message(struct en50221_app_rm *rm,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t *data,
+ uint32_t data_length);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_smartcard.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_smartcard.c
index c0f6961..763c6c4 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_smartcard.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_smartcard.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
@@ -28,188 +28,186 @@
#include "en50221_app_tags.h"
#include "asn_1.h"
-struct en50221_app_smartcard_private {
- struct en50221_app_send_functions *funcs;
+struct en50221_app_smartcard {
+ struct en50221_app_send_functions *funcs;
- en50221_app_smartcard_command_callback command_callback;
- void *command_callback_arg;
+ en50221_app_smartcard_command_callback command_callback;
+ void *command_callback_arg;
- en50221_app_smartcard_send_callback send_callback;
- void *send_callback_arg;
+ en50221_app_smartcard_send_callback send_callback;
+ void *send_callback_arg;
- pthread_mutex_t lock;
+ pthread_mutex_t lock;
};
-static int en50221_app_smartcard_parse_command(struct en50221_app_smartcard_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
+static int en50221_app_smartcard_parse_command(struct en50221_app_smartcard *smartcard,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
-static int en50221_app_smartcard_parse_send(struct en50221_app_smartcard_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
+static int en50221_app_smartcard_parse_send(struct en50221_app_smartcard *smartcard,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
-en50221_app_smartcard en50221_app_smartcard_create(struct en50221_app_send_functions *funcs)
+struct en50221_app_smartcard *en50221_app_smartcard_create(struct en50221_app_send_functions *funcs)
{
- struct en50221_app_smartcard_private *private = NULL;
+ struct en50221_app_smartcard *smartcard = NULL;
- // create structure and set it up
- private = malloc(sizeof(struct en50221_app_smartcard_private));
- if (private == NULL) {
- return NULL;
- }
- private->funcs = funcs;
- private->command_callback = NULL;
- private->send_callback = NULL;
+ // create structure and set it up
+ smartcard = malloc(sizeof(struct en50221_app_smartcard));
+ if (smartcard == NULL) {
+ return NULL;
+ }
+ smartcard->funcs = funcs;
+ smartcard->command_callback = NULL;
+ smartcard->send_callback = NULL;
- pthread_mutex_init(&private->lock, NULL);
+ pthread_mutex_init(&smartcard->lock, NULL);
- // done
- return private;
+ // done
+ return smartcard;
}
-void en50221_app_smartcard_destroy(en50221_app_smartcard smartcard)
+void en50221_app_smartcard_destroy(struct en50221_app_smartcard *smartcard)
{
- struct en50221_app_smartcard_private *private = (struct en50221_app_smartcard_private *) smartcard;
-
- pthread_mutex_destroy(&private->lock);
- free(private);
+ pthread_mutex_destroy(&smartcard->lock);
+ free(smartcard);
}
-void en50221_app_smartcard_register_command_callback(en50221_app_smartcard smartcard,
- en50221_app_smartcard_command_callback callback, void *arg)
+void en50221_app_smartcard_register_command_callback(struct en50221_app_smartcard *smartcard,
+ en50221_app_smartcard_command_callback callback, void *arg)
{
- struct en50221_app_smartcard_private *private = (struct en50221_app_smartcard_private *) smartcard;
-
- pthread_mutex_lock(&private->lock);
- private->command_callback = callback;
- private->command_callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&smartcard->lock);
+ smartcard->command_callback = callback;
+ smartcard->command_callback_arg = arg;
+ pthread_mutex_unlock(&smartcard->lock);
}
-void en50221_app_smartcard_register_send_callback(en50221_app_smartcard smartcard,
- en50221_app_smartcard_send_callback callback, void *arg)
+void en50221_app_smartcard_register_send_callback(struct en50221_app_smartcard *smartcard,
+ en50221_app_smartcard_send_callback callback, void *arg)
{
- struct en50221_app_smartcard_private *private = (struct en50221_app_smartcard_private *) smartcard;
-
- pthread_mutex_lock(&private->lock);
- private->send_callback = callback;
- private->send_callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&smartcard->lock);
+ smartcard->send_callback = callback;
+ smartcard->send_callback_arg = arg;
+ pthread_mutex_unlock(&smartcard->lock);
}
-int en50221_app_smartcard_command_reply(en50221_app_smartcard smartcard,
- uint16_t session_number,
- uint8_t reply_id,
- uint8_t status,
- uint8_t *data,
- uint32_t data_length)
+int en50221_app_smartcard_command_reply(struct en50221_app_smartcard *smartcard,
+ uint16_t session_number,
+ uint8_t reply_id, uint8_t status,
+ uint8_t *data,
+ uint32_t data_length)
{
- struct en50221_app_smartcard_private *private = (struct en50221_app_smartcard_private *) smartcard;
- uint8_t hdr[10];
- struct iovec iovec[2];
- int iov_count = 0;
-
- // the tag
- hdr[0] = (TAG_SMARTCARD_REPLY >> 16) & 0xFF;
- hdr[1] = (TAG_SMARTCARD_REPLY >> 8) & 0xFF;
- hdr[2] = TAG_SMARTCARD_REPLY & 0xFF;
-
- // the rest of the data
- if (reply_id == SMARTCARD_REPLY_ID_ANSW_TO_RESET) {
- // encode the length field
- int length_field_len;
- if ((length_field_len = asn_1_encode(data_length+2, data+3, 3)) < 0) {
- return -1;
- }
-
- // the rest of the header
- hdr[3+length_field_len] = reply_id;
- hdr[3+length_field_len+1] = status;
- iovec[0].iov_base = hdr;
- iovec[0].iov_len = 3+length_field_len+2;
-
- // the data
- iovec[1].iov_base = data;
- iovec[1].iov_len = data_length;
- iov_count = 2;
- } else {
- hdr[3] = 2;
- hdr[4] = reply_id;
- hdr[5] = status;
- iovec[0].iov_base = data;
- iovec[0].iov_len = 6;
- iov_count = 1;
- }
-
- return private->funcs->send_datav(private->funcs->arg, session_number, iovec, iov_count);
+ uint8_t hdr[10];
+ struct iovec iovec[2];
+ int iov_count = 0;
+
+ // the tag
+ hdr[0] = (TAG_SMARTCARD_REPLY >> 16) & 0xFF;
+ hdr[1] = (TAG_SMARTCARD_REPLY >> 8) & 0xFF;
+ hdr[2] = TAG_SMARTCARD_REPLY & 0xFF;
+
+ // the rest of the data
+ if (reply_id == SMARTCARD_REPLY_ID_ANSW_TO_RESET) {
+ // encode the length field
+ int length_field_len;
+ if ((length_field_len = asn_1_encode(data_length + 2, data + 3, 3)) < 0) {
+ return -1;
+ }
+ // the rest of the header
+ hdr[3 + length_field_len] = reply_id;
+ hdr[3 + length_field_len + 1] = status;
+ iovec[0].iov_base = hdr;
+ iovec[0].iov_len = 3 + length_field_len + 2;
+
+ // the data
+ iovec[1].iov_base = data;
+ iovec[1].iov_len = data_length;
+ iov_count = 2;
+ } else {
+ hdr[3] = 2;
+ hdr[4] = reply_id;
+ hdr[5] = status;
+ iovec[0].iov_base = data;
+ iovec[0].iov_len = 6;
+ iov_count = 1;
+ }
+
+ return smartcard->funcs->send_datav(smartcard->funcs->arg, session_number, iovec, iov_count);
}
-int en50221_app_smartcard_receive(en50221_app_smartcard smartcard,
- uint16_t session_number,
- uint8_t *data,
- uint32_t data_length,
- uint8_t SW1,
- uint8_t SW2)
+int en50221_app_smartcard_receive(struct en50221_app_smartcard *smartcard,
+ uint16_t session_number,
+ uint8_t *data,
+ uint32_t data_length,
+ uint8_t SW1, uint8_t SW2)
{
- struct en50221_app_smartcard_private *private = (struct en50221_app_smartcard_private *) smartcard;
- uint8_t buf[10];
- uint8_t trailer[10];
-
- // set up the tag
- buf[0] = (TAG_SMARTCARD_RCV >> 16) & 0xFF;
- buf[1] = (TAG_SMARTCARD_RCV >> 8) & 0xFF;
- buf[2] = TAG_SMARTCARD_RCV & 0xFF;
-
- // encode the length field
- int length_field_len;
- if ((length_field_len = asn_1_encode(data_length+2, buf+3, 3)) < 0) {
- return -1;
- }
-
- // set up the trailer
- trailer[0] = SW1;
- trailer[1] = SW2;
-
- // build the iovecs
- struct iovec iov[3];
- iov[0].iov_base = buf;
- iov[0].iov_len = 3+length_field_len;
- iov[1].iov_base = data;
- iov[1].iov_len = data_length;
- iov[2].iov_base = trailer;
- iov[2].iov_len = 2;
-
- // create the data and send it
- return private->funcs->send_datav(private->funcs->arg, session_number, iov, 3);
+ uint8_t buf[10];
+ uint8_t trailer[10];
+
+ // set up the tag
+ buf[0] = (TAG_SMARTCARD_RCV >> 16) & 0xFF;
+ buf[1] = (TAG_SMARTCARD_RCV >> 8) & 0xFF;
+ buf[2] = TAG_SMARTCARD_RCV & 0xFF;
+
+ // encode the length field
+ int length_field_len;
+ if ((length_field_len = asn_1_encode(data_length + 2, buf + 3, 3)) < 0) {
+ return -1;
+ }
+ // set up the trailer
+ trailer[0] = SW1;
+ trailer[1] = SW2;
+
+ // build the iovecs
+ struct iovec iov[3];
+ iov[0].iov_base = buf;
+ iov[0].iov_len = 3 + length_field_len;
+ iov[1].iov_base = data;
+ iov[1].iov_len = data_length;
+ iov[2].iov_base = trailer;
+ iov[2].iov_len = 2;
+
+ // create the data and send it
+ return smartcard->funcs->send_datav(smartcard->funcs->arg,
+ session_number, iov, 3);
}
-int en50221_app_smartcard_message(en50221_app_smartcard smartcard,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length)
+int en50221_app_smartcard_message(struct en50221_app_smartcard *smartcard,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t *data, uint32_t data_length)
{
- struct en50221_app_smartcard_private *private = (struct en50221_app_smartcard_private *) smartcard;
- (void)resource_id;
-
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
-
- switch(tag)
- {
- case TAG_SMARTCARD_COMMAND:
- return en50221_app_smartcard_parse_command(private, slot_id, session_number, data+3, data_length-3);
- case TAG_SMARTCARD_SEND:
- return en50221_app_smartcard_parse_send(private, slot_id, session_number, data+3, data_length-3);
- }
-
- print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
- return -1;
+ (void) resource_id;
+
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+
+ switch (tag) {
+ case TAG_SMARTCARD_COMMAND:
+ return en50221_app_smartcard_parse_command(smartcard,
+ slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ case TAG_SMARTCARD_SEND:
+ return en50221_app_smartcard_parse_send(smartcard, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ }
+
+ print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
+ return -1;
}
@@ -218,76 +216,81 @@ int en50221_app_smartcard_message(en50221_app_smartcard smartcard,
-static int en50221_app_smartcard_parse_command(struct en50221_app_smartcard_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_smartcard_parse_command(struct en50221_app_smartcard *smartcard,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- if (data_length != 2) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (data[0] != 1) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t command_id = data[1];
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_smartcard_command_callback cb = private->command_callback;
- void *cb_arg = private->command_callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, command_id);
- }
- return 0;
+ if (data_length != 2) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (data[0] != 1) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t command_id = data[1];
+
+ // tell the app
+ pthread_mutex_lock(&smartcard->lock);
+ en50221_app_smartcard_command_callback cb = smartcard->command_callback;
+ void *cb_arg = smartcard->command_callback_arg;
+ pthread_mutex_unlock(&smartcard->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, command_id);
+ }
+ return 0;
}
-static int en50221_app_smartcard_parse_send(struct en50221_app_smartcard_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_smartcard_parse_send(struct en50221_app_smartcard *smartcard,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length)
{
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length < 8) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- data += length_field_len;
-
- // parse
- uint8_t CLA = data[0];
- uint8_t INS = data[1];
- uint8_t P1 = data[2];
- uint8_t P2 = data[3];
- uint16_t length_in = (data[4]<<8)|data[5];
- uint8_t *data_in = data + 6;
-
- // validate the length
- if ((length_in + 8) != asn_data_length) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint16_t length_out = (data[6+length_in]<<8)|data[6+length_in+1];
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_smartcard_send_callback cb = private->send_callback;
- void *cb_arg = private->send_callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, CLA, INS, P1, P2, data_in, length_in, length_out);
- }
- return 0;
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+ // check it
+ if (asn_data_length < 8) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ data += length_field_len;
+
+ // parse
+ uint8_t CLA = data[0];
+ uint8_t INS = data[1];
+ uint8_t P1 = data[2];
+ uint8_t P2 = data[3];
+ uint16_t length_in = (data[4] << 8) | data[5];
+ uint8_t *data_in = data + 6;
+
+ // validate the length
+ if ((length_in + 8) != asn_data_length) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint16_t length_out =
+ (data[6 + length_in] << 8) | data[6 + length_in + 1];
+
+ // tell the app
+ pthread_mutex_lock(&smartcard->lock);
+ en50221_app_smartcard_send_callback cb = smartcard->send_callback;
+ void *cb_arg = smartcard->send_callback_arg;
+ pthread_mutex_unlock(&smartcard->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, CLA, INS, P1,
+ P2, data_in, length_in, length_out);
+ }
+ return 0;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_smartcard.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_smartcard.h
index 546e8be..bbad4a9 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_smartcard.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_smartcard.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APPLICATION_smartcard_H__
#define __EN50221_APPLICATION_smartcard_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -68,8 +67,10 @@ extern "C"
* @param command_id One of the SMARTCARD_COMMAND_ID_* values
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_smartcard_command_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t command_id);
+typedef int (*en50221_app_smartcard_command_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t command_id);
/**
* Type definition for command - called when we receive a send command.
@@ -86,15 +87,21 @@ typedef int (*en50221_app_smartcard_command_callback)(void *arg, uint8_t slot_id
* @param out_length Number of bytes expected.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_smartcard_send_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t CLA, uint8_t INS, uint8_t P1, uint8_t P2,
- uint8_t *in, uint32_t in_length,
- uint32_t out_length);
+typedef int (*en50221_app_smartcard_send_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t CLA,
+ uint8_t INS,
+ uint8_t P1,
+ uint8_t P2,
+ uint8_t *in,
+ uint32_t in_length,
+ uint32_t out_length);
/**
* Opaque type representing a smartcard resource.
*/
-typedef void *en50221_app_smartcard;
+struct en50221_app_smartcard;
/**
* Create an instance of the smartcard resource.
@@ -102,14 +109,15 @@ typedef void *en50221_app_smartcard;
* @param funcs Send functions to use.
* @return Instance, or NULL on failure.
*/
-extern en50221_app_smartcard en50221_app_smartcard_create(struct en50221_app_send_functions *funcs);
+extern struct en50221_app_smartcard *
+ en50221_app_smartcard_create(struct en50221_app_send_functions *funcs);
/**
* Destroy an instance of the smartcard resource.
*
* @param smartcard Instance to destroy.
*/
-extern void en50221_app_smartcard_destroy(en50221_app_smartcard smartcard);
+extern void en50221_app_smartcard_destroy(struct en50221_app_smartcard *smartcard);
/**
* Register the callback for when we receive a comms command.
@@ -118,8 +126,9 @@ extern void en50221_app_smartcard_destroy(en50221_app_smartcard smartcard);
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_smartcard_register_command_callback(en50221_app_smartcard smartcard,
- en50221_app_smartcard_command_callback callback, void *arg);
+extern void en50221_app_smartcard_register_command_callback(struct en50221_app_smartcard *smartcard,
+ en50221_app_smartcard_command_callback callback,
+ void *arg);
/**
* Register the callback for when we receive data to send.
@@ -128,8 +137,9 @@ extern void en50221_app_smartcard_register_command_callback(en50221_app_smartcar
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_smartcard_register_send_callback(en50221_app_smartcard smartcard,
- en50221_app_smartcard_send_callback callback, void *arg);
+extern void en50221_app_smartcard_register_send_callback(struct en50221_app_smartcard *smartcard,
+ en50221_app_smartcard_send_callback callback,
+ void *arg);
/**
* Send a command response to the CAM.
@@ -142,12 +152,12 @@ extern void en50221_app_smartcard_register_send_callback(en50221_app_smartcard s
* @param data_length Length of data to send.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_smartcard_command_reply(en50221_app_smartcard smartcard,
- uint16_t session_number,
- uint8_t reply_id,
- uint8_t status,
- uint8_t *data,
- uint32_t data_length);
+extern int en50221_app_smartcard_command_reply(struct en50221_app_smartcard *smartcard,
+ uint16_t session_number,
+ uint8_t reply_id,
+ uint8_t status,
+ uint8_t * data,
+ uint32_t data_length);
/**
* Send data received from a smartcart to the CAM.
@@ -160,12 +170,11 @@ extern int en50221_app_smartcard_command_reply(en50221_app_smartcard smartcard,
* @param SW2 SW2 value.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_smartcard_receive(en50221_app_smartcard smartcard,
- uint16_t session_number,
- uint8_t *data,
- uint32_t data_length,
- uint8_t SW1,
- uint8_t SW2);
+extern int en50221_app_smartcard_receive(struct en50221_app_smartcard *smartcard,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length,
+ uint8_t SW1, uint8_t SW2);
/**
* Pass data received for this resource into it for parsing.
@@ -178,14 +187,14 @@ extern int en50221_app_smartcard_receive(en50221_app_smartcard smartcard,
* @param data_length Length of data in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_smartcard_message(en50221_app_smartcard smartcard,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_app_smartcard_message(struct en50221_app_smartcard *smartcard,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data,
+ uint32_t data_length);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_tags.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_tags.h
index 357999b..0f5c2fc 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_tags.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_tags.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
This library is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APP_TAGS_H__
@@ -25,7 +25,7 @@
/* Resource Manager */
#define TAG_PROFILE_ENQUIRY 0x9f8010
-#define TAG_PROFILE 0x9f8011
+#define TAG_PROFILE 0x9f8011
#define TAG_PROFILE_CHANGE 0x9f8012
/* Application Info */
@@ -85,20 +85,20 @@
#define TAG_COMMS_RECV_MORE 0x9f8c06
/* Authentication */
-#define TAG_AUTH_REQ 0x9f8200
-#define TAG_AUTH_RESP 0x9f8201
+#define TAG_AUTH_REQ 0x9f8200
+#define TAG_AUTH_RESP 0x9f8201
/* Teletext */
-#define TAG_TELETEXT_EBU 0x9f9000
+#define TAG_TELETEXT_EBU 0x9f9000
/* Smartcard */
-#define TAG_SMARTCARD_COMMAND 0x9f8e00
-#define TAG_SMARTCARD_REPLY 0x9f8e01
-#define TAG_SMARTCARD_SEND 0x9f8e02
-#define TAG_SMARTCARD_RCV 0x9f8e03
+#define TAG_SMARTCARD_COMMAND 0x9f8e00
+#define TAG_SMARTCARD_REPLY 0x9f8e01
+#define TAG_SMARTCARD_SEND 0x9f8e02
+#define TAG_SMARTCARD_RCV 0x9f8e03
/* EPG */
-#define TAG_EPG_ENQUIRY 0x9f8f00
-#define TAG_EPG_REPLY 0x9f8f01
+#define TAG_EPG_ENQUIRY 0x9f8f00
+#define TAG_EPG_REPLY 0x9f8f01
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_teletext.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_teletext.c
index 8e7f9d9..b839407 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_teletext.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_teletext.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
@@ -28,112 +28,114 @@
#include "en50221_app_tags.h"
#include "asn_1.h"
-struct en50221_app_teletext_private {
- struct en50221_app_send_functions *funcs;
+struct en50221_app_teletext {
+ struct en50221_app_send_functions *funcs;
- en50221_app_teletext_callback callback;
- void *callback_arg;
+ en50221_app_teletext_callback callback;
+ void *callback_arg;
- pthread_mutex_t lock;
+ pthread_mutex_t lock;
};
-static int en50221_app_teletext_parse_ebu(struct en50221_app_teletext_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length);
+static int en50221_app_teletext_parse_ebu(struct en50221_app_teletext *teletext,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t * data,
+ uint32_t data_length);
-en50221_app_teletext en50221_app_teletext_create(struct en50221_app_send_functions *funcs)
+struct en50221_app_teletext *
+ en50221_app_teletext_create(struct en50221_app_send_functions *funcs)
{
- struct en50221_app_teletext_private *private = NULL;
+ struct en50221_app_teletext *teletext = NULL;
- // create structure and set it up
- private = malloc(sizeof(struct en50221_app_teletext_private));
- if (private == NULL) {
- return NULL;
- }
- private->funcs = funcs;
- private->callback = NULL;
+ // create structure and set it up
+ teletext = malloc(sizeof(struct en50221_app_teletext));
+ if (teletext == NULL) {
+ return NULL;
+ }
+ teletext->funcs = funcs;
+ teletext->callback = NULL;
- pthread_mutex_init(&private->lock, NULL);
+ pthread_mutex_init(&teletext->lock, NULL);
- // done
- return private;
+ // done
+ return teletext;
}
-void en50221_app_teletext_destroy(en50221_app_teletext teletext)
+void en50221_app_teletext_destroy(struct en50221_app_teletext *teletext)
{
- struct en50221_app_teletext_private *private = (struct en50221_app_teletext_private *) teletext;
-
- pthread_mutex_destroy(&private->lock);
- free(private);
+ pthread_mutex_destroy(&teletext->lock);
+ free(teletext);
}
-void en50221_app_teletext_register_callback(en50221_app_teletext teletext,
- en50221_app_teletext_callback callback, void *arg)
+void en50221_app_teletext_register_callback(struct en50221_app_teletext *teletext,
+ en50221_app_teletext_callback callback, void *arg)
{
- struct en50221_app_teletext_private *private = (struct en50221_app_teletext_private *) teletext;
-
- pthread_mutex_lock(&private->lock);
- private->callback = callback;
- private->callback_arg = arg;
- pthread_mutex_unlock(&private->lock);
+ pthread_mutex_lock(&teletext->lock);
+ teletext->callback = callback;
+ teletext->callback_arg = arg;
+ pthread_mutex_unlock(&teletext->lock);
}
-int en50221_app_teletext_message(en50221_app_teletext teletext,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length)
+int en50221_app_teletext_message(struct en50221_app_teletext *teletext,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data, uint32_t data_length)
{
- struct en50221_app_teletext_private *private = (struct en50221_app_teletext_private *) teletext;
- (void) resource_id;
-
- // get the tag
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
-
- switch(tag)
- {
- case TAG_TELETEXT_EBU:
- return en50221_app_teletext_parse_ebu(private, slot_id, session_number, data+3, data_length-3);
- }
-
- print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
- return -1;
+ (void) resource_id;
+
+ // get the tag
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint32_t tag = (data[0] << 16) | (data[1] << 8) | data[2];
+
+ switch (tag) {
+ case TAG_TELETEXT_EBU:
+ return en50221_app_teletext_parse_ebu(teletext, slot_id,
+ session_number,
+ data + 3,
+ data_length - 3);
+ }
+
+ print(LOG_LEVEL, ERROR, 1, "Received unexpected tag %x\n", tag);
+ return -1;
}
-static int en50221_app_teletext_parse_ebu(struct en50221_app_teletext_private *private,
- uint8_t slot_id, uint16_t session_number,
- uint8_t *data, uint32_t data_length)
+static int en50221_app_teletext_parse_ebu(struct en50221_app_teletext *teletext,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t *data,
+ uint32_t data_length)
{
- // first of all, decode the length field
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
- return -1;
- }
-
- // check it
- if (asn_data_length > (data_length-length_field_len)) {
- print(LOG_LEVEL, ERROR, 1, "Received short data\n");
- return -1;
- }
- uint8_t *teletext_data = data + length_field_len;
-
- // tell the app
- pthread_mutex_lock(&private->lock);
- en50221_app_teletext_callback cb = private->callback;
- void *cb_arg = private->callback_arg;
- pthread_mutex_unlock(&private->lock);
- if (cb) {
- return cb(cb_arg, slot_id, session_number, teletext_data, asn_data_length);
- }
- return 0;
+ // first of all, decode the length field
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data, data_length)) < 0) {
+ print(LOG_LEVEL, ERROR, 1, "ASN.1 decode error\n");
+ return -1;
+ }
+
+ // check it
+ if (asn_data_length > (data_length - length_field_len)) {
+ print(LOG_LEVEL, ERROR, 1, "Received short data\n");
+ return -1;
+ }
+ uint8_t *teletext_data = data + length_field_len;
+
+ // tell the app
+ pthread_mutex_lock(&teletext->lock);
+ en50221_app_teletext_callback cb = teletext->callback;
+ void *cb_arg = teletext->callback_arg;
+ pthread_mutex_unlock(&teletext->lock);
+ if (cb) {
+ return cb(cb_arg, slot_id, session_number, teletext_data,
+ asn_data_length);
+ }
+ return 0;
}
-
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_teletext.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_teletext.h
index 3dced66..b5b85f1 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_teletext.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_teletext.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APPLICATION_teletext_H__
#define __EN50221_APPLICATION_teletext_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -46,14 +45,16 @@ extern "C"
* @param teletext_data_lenghth Number of bytes.
* @return 0 on success, -1 on failure.
*/
-typedef int (*en50221_app_teletext_callback)(void *arg, uint8_t slot_id, uint16_t session_number,
- uint8_t *teletext_data,
- uint32_t teletext_data_length);
+typedef int (*en50221_app_teletext_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint8_t *teletext_data,
+ uint32_t teletext_data_length);
/**
* Opaque type representing a teletext resource.
*/
-typedef void *en50221_app_teletext;
+struct en50221_app_teletext;
/**
* Create an instance of the teletext resource.
@@ -61,14 +62,15 @@ typedef void *en50221_app_teletext;
* @param funcs Send functions to use.
* @return Instance, or NULL on failure.
*/
-extern en50221_app_teletext en50221_app_teletext_create(struct en50221_app_send_functions *funcs);
+extern struct en50221_app_teletext *
+ en50221_app_teletext_create(struct en50221_app_send_functions *funcs);
/**
* Destroy an instance of the teletext resource.
*
* @param teletext Instance to destroy.
*/
-extern void en50221_app_teletext_destroy(en50221_app_teletext teletext);
+extern void en50221_app_teletext_destroy(struct en50221_app_teletext *teletext);
/**
* Register the callback for when we receive a request.
@@ -77,8 +79,9 @@ extern void en50221_app_teletext_destroy(en50221_app_teletext teletext);
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_app_teletext_register_callback(en50221_app_teletext teletext,
- en50221_app_teletext_callback callback, void *arg);
+extern void en50221_app_teletext_register_callback(struct en50221_app_teletext *teletext,
+ en50221_app_teletext_callback callback,
+ void *arg);
/**
* Pass data received for this resource into it for parsing.
@@ -91,14 +94,14 @@ extern void en50221_app_teletext_register_callback(en50221_app_teletext teletext
* @param data_length Length of data in bytes.
* @return 0 on success, -1 on failure.
*/
-extern int en50221_app_teletext_message(en50221_app_teletext teletext,
- uint8_t slot_id,
- uint16_t session_number,
- uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_app_teletext_message(struct en50221_app_teletext *teletext,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data,
+ uint32_t data_length);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_utils.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_utils.c
index cbbbe2e..df2632a 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_utils.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_utils.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,20 +18,21 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "en50221_app_utils.h"
-struct en50221_app_public_resource_id *
- en50221_app_decode_public_resource_id(struct en50221_app_public_resource_id *idf, uint32_t resource_id)
+struct en50221_app_public_resource_id
+ *en50221_app_decode_public_resource_id(struct en50221_app_public_resource_id *idf,
+ uint32_t resource_id)
{
- // reject private resources
- if ((resource_id & 0xc0000000) == 0xc0000000)
- return NULL;
+ // reject private resources
+ if ((resource_id & 0xc0000000) == 0xc0000000)
+ return NULL;
- idf->resource_class = (resource_id >> 16) & 0xffff; // use the resource_id as the MSBs of class
- idf->resource_type = (resource_id >> 6) & 0x3ff;
- idf->resource_version = resource_id & 0x3f;
- return idf;
+ idf->resource_class = (resource_id >> 16) & 0xffff; // use the resource_id as the MSBs of class
+ idf->resource_type = (resource_id >> 6) & 0x3ff;
+ idf->resource_version = resource_id & 0x3f;
+ return idf;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_utils.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_utils.h
index d20c13b..5c64760 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_utils.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_app_utils.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,15 +18,14 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __EN50221_APP_UTILS_H__
#define __EN50221_APP_UTILS_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -41,30 +40,39 @@ extern "C"
* would need special code for any private resource anyway.
*/
struct en50221_app_public_resource_id {
- uint16_t resource_class;
- uint16_t resource_type;
- uint8_t resource_version;
+ uint16_t resource_class;
+ uint16_t resource_type;
+ uint8_t resource_version;
};
+typedef int (*en50221_send_data) (void *arg,
+ uint16_t session_number,
+ uint8_t * data,
+ uint16_t data_length);
+typedef int (*en50221_send_datav) (void *arg,
+ uint16_t session_number,
+ struct iovec * vector,
+ int iov_count);
+
/**
* An abstraction away from hardcoded send functions so different layers may be
* slotted in under the application layer.
*/
struct en50221_app_send_functions {
- /**
- * Argument to pass to these functions.
- */
- void *arg;
-
- /**
- * Send data.
- */
- int (*send_data)(void *arg, uint16_t session_number, uint8_t *data, uint16_t data_length);
-
- /**
- * Send vector data.
- */
- int (*send_datav)(void *arg, uint16_t session_number, struct iovec *vector, int iov_count);
+ /**
+ * Argument to pass to these functions.
+ */
+ void *arg;
+
+ /**
+ * Send data.
+ */
+ en50221_send_data send_data;
+
+ /**
+ * Send vector data.
+ */
+ en50221_send_datav send_datav;
};
/**
@@ -85,7 +93,8 @@ struct en50221_app_send_functions {
* @return Pointer to idf on success, or NULL if this is not a public resource.
*/
struct en50221_app_public_resource_id *
- en50221_app_decode_public_resource_id(struct en50221_app_public_resource_id *idf, uint32_t resource_id);
+ en50221_app_decode_public_resource_id(struct en50221_app_public_resource_id *idf,
+ uint32_t resource_id);
/**
* Encode an en50221_app_public_resource_id structure into a host-endian uint32_t.
@@ -93,13 +102,11 @@ struct en50221_app_public_resource_id *
* @param idf Structure to encode.
* @return The encoded value
*/
-static inline uint32_t en50221_app_encode_public_resource_id(struct en50221_app_public_resource_id *idf)
-{
- return MKRID(idf->resource_class, idf->resource_type, idf->resource_version);
+static inline uint32_t en50221_app_encode_public_resource_id(struct en50221_app_public_resource_id *idf) {
+ return MKRID(idf->resource_class, idf->resource_type, idf->resource_version);
}
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_errno.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_errno.h
index 5ac57fe..0b53087 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_errno.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_errno.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 session layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,35 +18,32 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EN50221_ERRNO
#define EN50221_ERRNO 1
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
-#define EN50221ERR_CAREAD -1 /* error during read from CA device. */
-#define EN50221ERR_CAWRITE -2 /* error during write to CA device. */
-#define EN50221ERR_TIMEOUT -3 /* timeout occured waiting for a response from a device. */
-#define EN50221ERR_BADSLOTID -4 /* bad slot ID supplied by user - the offending slot_id will not be set. */
-#define EN50221ERR_BADCONNECTIONID -5 /* bad connection ID supplied by user. */
-#define EN50221ERR_BADSTATE -6 /* slot/connection in the wrong state. */
-#define EN50221ERR_BADCAMDATA -7 /* CAM supplied an invalid request. */
-#define EN50221ERR_OUTOFMEMORY -8 /* memory allocation failed. */
-#define EN50221ERR_ASNENCODE -9 /* ASN.1 encode failure - indicates library bug. */
-#define EN50221ERR_OUTOFCONNECTIONS -10 /* no more connections available. */
-#define EN50221ERR_OUTOFSLOTS -11 /* no more slots available - the offending slot_id will not be set. */
-#define EN50221ERR_IOVLIMIT -12 /* Too many struct iovecs were used. */
-#define EN50221ERR_BADSESSIONNUMBER -13 /* Bad session number suppplied by user. */
-#define EN50221ERR_OUTOFSESSIONS -14 /* no more sessions available. */
+#define EN50221ERR_CAREAD -1 /* error during read from CA device. */
+#define EN50221ERR_CAWRITE -2 /* error during write to CA device. */
+#define EN50221ERR_TIMEOUT -3 /* timeout occured waiting for a response from a device. */
+#define EN50221ERR_BADSLOTID -4 /* bad slot ID supplied by user - the offending slot_id will not be set. */
+#define EN50221ERR_BADCONNECTIONID -5 /* bad connection ID supplied by user. */
+#define EN50221ERR_BADSTATE -6 /* slot/connection in the wrong state. */
+#define EN50221ERR_BADCAMDATA -7 /* CAM supplied an invalid request. */
+#define EN50221ERR_OUTOFMEMORY -8 /* memory allocation failed. */
+#define EN50221ERR_ASNENCODE -9 /* ASN.1 encode failure - indicates library bug. */
+#define EN50221ERR_OUTOFCONNECTIONS -10 /* no more connections available. */
+#define EN50221ERR_OUTOFSLOTS -11 /* no more slots available - the offending slot_id will not be set. */
+#define EN50221ERR_IOVLIMIT -12 /* Too many struct iovecs were used. */
+#define EN50221ERR_BADSESSIONNUMBER -13 /* Bad session number suppplied by user. */
+#define EN50221ERR_OUTOFSESSIONS -14 /* no more sessions available. */
#ifdef __cplusplus
}
#endif
-
#endif
-
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_session.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_session.c
index 15cd52a..3fb9902 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_session.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_session.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
@@ -37,918 +37,1019 @@
// these are the possible session statuses
-#define S_STATUS_OPEN 0x00 // session is opened
-#define S_STATUS_CLOSE_NO_RES 0xF0 // could not open session, no proper resource available
-#define S_STATUS_CLOSE_RES_UNAVAILABLE 0xF1 // could not open session, resource unavailable
-#define S_STATUS_CLOSE_RES_LOW_VERSION 0xF2 // could not open session, resource version too low
-#define S_STATUS_CLOSE_RES_BUSY 0xF3 // could not open session, resource is busy
-
-#define ST_OPEN_SESSION_REQ 0x91 // h<--m
-#define ST_OPEN_SESSION_RES 0x92 // h-->m
-#define ST_CREATE_SESSION 0x93 // h-->m
-#define ST_CREATE_SESSION_RES 0x94 // h<--m
-#define ST_CLOSE_SESSION_REQ 0x95 // h<->m
-#define ST_CLOSE_SESSION_RES 0x96 // h<->m
-#define ST_SESSION_NUMBER 0x90 // h<->m
-
-#define S_STATE_IDLE 0x01 // this session is not in use
-#define S_STATE_ACTIVE 0x02 // this session is in use
-#define S_STATE_IN_CREATION 0x04 // this session waits for a ST_CREATE_SESSION_RES to become active
-#define S_STATE_IN_DELETION 0x08 // this session waits for ST_CLOSE_SESSION_RES to become idle again
+#define S_STATUS_OPEN 0x00 // session is opened
+#define S_STATUS_CLOSE_NO_RES 0xF0 // could not open session, no proper resource available
+#define S_STATUS_CLOSE_RES_UNAVAILABLE 0xF1 // could not open session, resource unavailable
+#define S_STATUS_CLOSE_RES_LOW_VERSION 0xF2 // could not open session, resource version too low
+#define S_STATUS_CLOSE_RES_BUSY 0xF3 // could not open session, resource is busy
+
+#define ST_OPEN_SESSION_REQ 0x91 // h<--m
+#define ST_OPEN_SESSION_RES 0x92 // h-->m
+#define ST_CREATE_SESSION 0x93 // h-->m
+#define ST_CREATE_SESSION_RES 0x94 // h<--m
+#define ST_CLOSE_SESSION_REQ 0x95 // h<->m
+#define ST_CLOSE_SESSION_RES 0x96 // h<->m
+#define ST_SESSION_NUMBER 0x90 // h<->m
+
+#define S_STATE_IDLE 0x01 // this session is not in use
+#define S_STATE_ACTIVE 0x02 // this session is in use
+#define S_STATE_IN_CREATION 0x04 // this session waits for a ST_CREATE_SESSION_RES to become active
+#define S_STATE_IN_DELETION 0x08 // this session waits for ST_CLOSE_SESSION_RES to become idle again
// for each session we store its identifier, the resource-id
// it is linked to and the callback of the specific resource
struct en50221_session {
- uint8_t state;
- uint32_t resource_id;
- uint8_t slot_id;
- uint8_t connection_id;
+ uint8_t state;
+ uint32_t resource_id;
+ uint8_t slot_id;
+ uint8_t connection_id;
- en50221_sl_resource_callback callback;
- void *callback_arg;
+ en50221_sl_resource_callback callback;
+ void *callback_arg;
- pthread_mutex_t session_lock;
+ pthread_mutex_t session_lock;
};
-struct en50221_session_layer_private
-{
- uint32_t max_sessions;
- en50221_transport_layer tl;
+struct en50221_session_layer {
+ uint32_t max_sessions;
+ struct en50221_transport_layer *tl;
- en50221_sl_lookup_callback lookup;
- void *lookup_arg;
+ en50221_sl_lookup_callback lookup;
+ void *lookup_arg;
- en50221_sl_session_callback session;
- void *session_arg;
+ en50221_sl_session_callback session;
+ void *session_arg;
- pthread_mutex_t global_lock;
- pthread_mutex_t setcallback_lock;
+ pthread_mutex_t global_lock;
+ pthread_mutex_t setcallback_lock;
- int error;
+ int error;
- struct en50221_session *sessions;
+ struct en50221_session *sessions;
};
-static void en50221_sl_transport_callback(void *arg, int reason, uint8_t *data, uint32_t data_length,
- uint8_t slot_id, uint8_t connection_id);
-static int en50221_sl_alloc_new_session(struct en50221_session_layer_private *private,
- uint32_t resource_id,
- uint8_t slot_id,
- uint8_t connection_id,
- en50221_sl_resource_callback callback, void* arg);
+static void en50221_sl_transport_callback(void *arg, int reason,
+ uint8_t * data,
+ uint32_t data_length,
+ uint8_t slot_id,
+ uint8_t connection_id);
+static int en50221_sl_alloc_new_session(struct en50221_session_layer *sl,
+ uint32_t resource_id,
+ uint8_t slot_id,
+ uint8_t connection_id,
+ en50221_sl_resource_callback
+ callback, void *arg);
-en50221_session_layer en50221_sl_create(en50221_transport_layer tl,
- uint32_t max_sessions)
+struct en50221_session_layer *en50221_sl_create(struct en50221_transport_layer *tl,
+ uint32_t max_sessions)
{
- struct en50221_session_layer_private *private = NULL;
- uint32_t i;
-
- // setup structure
- private = (struct en50221_session_layer_private*) malloc(sizeof(struct en50221_session_layer_private));
- if (private == NULL)
- goto error_exit;
- private->max_sessions = max_sessions;
- private->lookup = NULL;
- private->session = NULL;
- private->tl = tl;
- private->error = 0;
-
- // init the mutex
- pthread_mutex_init(&private->global_lock, NULL);
- pthread_mutex_init(&private->setcallback_lock, NULL);
-
- // create the slots
- private->sessions = malloc(sizeof(struct en50221_session) * max_sessions);
- if (private->sessions == NULL)
- goto error_exit;
-
- // set them up
- for(i=0; i< max_sessions; i++) {
- private->sessions[i].state = S_STATE_IDLE;
- private->sessions[i].callback = NULL;
-
- pthread_mutex_init(&private->sessions[i].session_lock, NULL);
- }
-
- // register ourselves with the transport layer
- en50221_tl_register_callback(tl, en50221_sl_transport_callback, private);
-
- return private;
+ struct en50221_session_layer *sl = NULL;
+ uint32_t i;
+
+ // setup structure
+ sl = (struct en50221_session_layer *)
+ malloc(sizeof(struct en50221_session_layer));
+ if (sl == NULL)
+ goto error_exit;
+ sl->max_sessions = max_sessions;
+ sl->lookup = NULL;
+ sl->session = NULL;
+ sl->tl = tl;
+ sl->error = 0;
+
+ // init the mutex
+ pthread_mutex_init(&sl->global_lock, NULL);
+ pthread_mutex_init(&sl->setcallback_lock, NULL);
+
+ // create the slots
+ sl->sessions = malloc(sizeof(struct en50221_session) * max_sessions);
+ if (sl->sessions == NULL)
+ goto error_exit;
+
+ // set them up
+ for (i = 0; i < max_sessions; i++) {
+ sl->sessions[i].state = S_STATE_IDLE;
+ sl->sessions[i].callback = NULL;
+
+ pthread_mutex_init(&sl->sessions[i].session_lock, NULL);
+ }
+
+ // register ourselves with the transport layer
+ en50221_tl_register_callback(tl, en50221_sl_transport_callback, sl);
+
+ return sl;
error_exit:
- en50221_sl_destroy(private);
- return NULL;
+ en50221_sl_destroy(sl);
+ return NULL;
}
-void en50221_sl_destroy(en50221_session_layer sl)
+void en50221_sl_destroy(struct en50221_session_layer *sl)
{
- struct en50221_session_layer_private *private = (struct en50221_session_layer_private *) sl;
- uint32_t i;
-
- if (private) {
- if (private->sessions) {
- for(i=0; i< private->max_sessions; i++) {
- pthread_mutex_destroy(&private->sessions[i].session_lock);
- }
- free(private->sessions);
- }
-
- pthread_mutex_destroy(&private->setcallback_lock);
- pthread_mutex_destroy(&private->global_lock);
-
- free(private);
- }
+ uint32_t i;
+
+ if (sl) {
+ if (sl->sessions) {
+ for (i = 0; i < sl->max_sessions; i++) {
+ pthread_mutex_destroy(&sl->sessions[i].session_lock);
+ }
+ free(sl->sessions);
+ }
+
+ pthread_mutex_destroy(&sl->setcallback_lock);
+ pthread_mutex_destroy(&sl->global_lock);
+
+ free(sl);
+ }
}
-int en50221_sl_get_error(en50221_session_layer tl)
+int en50221_sl_get_error(struct en50221_session_layer *sl)
{
- struct en50221_session_layer_private *private = (struct en50221_session_layer_private *) tl;
- return private->error;
+ return sl->error;
}
-void en50221_sl_register_lookup_callback(en50221_session_layer sl, en50221_sl_lookup_callback callback, void *arg)
+void en50221_sl_register_lookup_callback(struct en50221_session_layer *sl,
+ en50221_sl_lookup_callback
+ callback, void *arg)
{
- struct en50221_session_layer_private *private = (struct en50221_session_layer_private *) sl;
-
- pthread_mutex_lock(&private->setcallback_lock);
- private->lookup = callback;
- private->lookup_arg = arg;
- pthread_mutex_unlock(&private->setcallback_lock);
+ pthread_mutex_lock(&sl->setcallback_lock);
+ sl->lookup = callback;
+ sl->lookup_arg = arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
}
-void en50221_sl_register_session_callback(en50221_session_layer sl,
- en50221_sl_session_callback callback, void *arg)
+void en50221_sl_register_session_callback(struct en50221_session_layer *sl,
+ en50221_sl_session_callback
+ callback, void *arg)
{
- struct en50221_session_layer_private *private = (struct en50221_session_layer_private *) sl;
-
- pthread_mutex_lock(&private->setcallback_lock);
- private->session = callback;
- private->session_arg = arg;
- pthread_mutex_unlock(&private->setcallback_lock);
+ pthread_mutex_lock(&sl->setcallback_lock);
+ sl->session = callback;
+ sl->session_arg = arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
}
-int en50221_sl_create_session(en50221_session_layer sl, int slot_id, uint8_t connection_id, uint32_t resource_id,
- en50221_sl_resource_callback callback, void* arg)
+int en50221_sl_create_session(struct en50221_session_layer *sl,
+ int slot_id, uint8_t connection_id,
+ uint32_t resource_id,
+ en50221_sl_resource_callback callback,
+ void *arg)
{
- struct en50221_session_layer_private *private = (struct en50221_session_layer_private *) sl;
-
- // lookup next free session_id:
- pthread_mutex_lock(&private->global_lock);
- int session_number = en50221_sl_alloc_new_session(private, resource_id, slot_id, connection_id, callback, arg);
- if (session_number == -1) {
- pthread_mutex_unlock(&private->global_lock);
- return -1;
- }
- pthread_mutex_unlock(&private->global_lock);
-
- // make up the header
- uint8_t hdr[8];
- hdr[0] = ST_CREATE_SESSION;
- hdr[1] = 6;
- hdr[2] = resource_id >> 24;
- hdr[3] = resource_id >> 16;
- hdr[4] = resource_id >> 8;
- hdr[5] = resource_id;
- hdr[6] = session_number >> 8;
- hdr[7] = session_number;
-
- // send this command
- if (en50221_tl_send_data(private->tl, slot_id, connection_id, hdr, 8)) {
- pthread_mutex_lock(&private->sessions[session_number].session_lock);
- if (private->sessions[session_number].state == S_STATE_IN_CREATION) {
- private->sessions[session_number].state = S_STATE_IDLE;
- }
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
-
- private->error = en50221_tl_get_error(private->tl);
- return -1;
- }
-
- // ok.
- return session_number;
+ // lookup next free session_id:
+ pthread_mutex_lock(&sl->global_lock);
+ int session_number =
+ en50221_sl_alloc_new_session(sl, resource_id, slot_id,
+ connection_id, callback, arg);
+ if (session_number == -1) {
+ pthread_mutex_unlock(&sl->global_lock);
+ return -1;
+ }
+ pthread_mutex_unlock(&sl->global_lock);
+
+ // make up the header
+ uint8_t hdr[8];
+ hdr[0] = ST_CREATE_SESSION;
+ hdr[1] = 6;
+ hdr[2] = resource_id >> 24;
+ hdr[3] = resource_id >> 16;
+ hdr[4] = resource_id >> 8;
+ hdr[5] = resource_id;
+ hdr[6] = session_number >> 8;
+ hdr[7] = session_number;
+
+ // send this command
+ if (en50221_tl_send_data(sl->tl, slot_id, connection_id, hdr, 8)) {
+ pthread_mutex_lock(&sl->sessions[session_number].session_lock);
+ if (sl->sessions[session_number].state == S_STATE_IN_CREATION) {
+ sl->sessions[session_number].state = S_STATE_IDLE;
+ }
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+
+ sl->error = en50221_tl_get_error(sl->tl);
+ return -1;
+ }
+ // ok.
+ return session_number;
}
-int en50221_sl_destroy_session(en50221_session_layer sl, uint16_t session_number)
+int en50221_sl_destroy_session(struct en50221_session_layer *sl,
+ uint16_t session_number)
{
- struct en50221_session_layer_private *private = (struct en50221_session_layer_private *) sl;
-
- if (session_number >= private->max_sessions) {
- private->error = EN50221ERR_BADSESSIONNUMBER;
- return -1;
- }
-
- pthread_mutex_lock(&private->sessions[session_number].session_lock);
- if (!(private->sessions[session_number].state & (S_STATE_ACTIVE|S_STATE_IN_DELETION))) {
- private->error = EN50221ERR_BADSESSIONNUMBER;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return -1;
- }
-
- // set the state
- private->sessions[session_number].state = S_STATE_IN_DELETION;
-
- // get essential details
- uint8_t slot_id = private->sessions[session_number].slot_id;
- uint8_t connection_id = private->sessions[session_number].connection_id;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
-
- // sendit
- uint8_t hdr[4];
- hdr[0] = ST_CLOSE_SESSION_REQ;
- hdr[1] = 2;
- hdr[2] = session_number >> 8;
- hdr[3] = session_number;
- if (en50221_tl_send_data(private->tl, slot_id, connection_id, hdr, 4)) {
- pthread_mutex_lock(&private->sessions[session_number].session_lock);
- if (private->sessions[session_number].state == S_STATE_IN_DELETION) {
- private->sessions[session_number].state = S_STATE_IDLE;
- }
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
-
- private->error = en50221_tl_get_error(private->tl);
- return -1;
- }
-
- return 0;
+ if (session_number >= sl->max_sessions) {
+ sl->error = EN50221ERR_BADSESSIONNUMBER;
+ return -1;
+ }
+
+ pthread_mutex_lock(&sl->sessions[session_number].session_lock);
+ if (!(sl->sessions[session_number].state & (S_STATE_ACTIVE | S_STATE_IN_DELETION))) {
+ sl->error = EN50221ERR_BADSESSIONNUMBER;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return -1;
+ }
+ // set the state
+ sl->sessions[session_number].state = S_STATE_IN_DELETION;
+
+ // get essential details
+ uint8_t slot_id = sl->sessions[session_number].slot_id;
+ uint8_t connection_id = sl->sessions[session_number].connection_id;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+
+ // sendit
+ uint8_t hdr[4];
+ hdr[0] = ST_CLOSE_SESSION_REQ;
+ hdr[1] = 2;
+ hdr[2] = session_number >> 8;
+ hdr[3] = session_number;
+ if (en50221_tl_send_data(sl->tl, slot_id, connection_id, hdr, 4)) {
+ pthread_mutex_lock(&sl->sessions[session_number].session_lock);
+ if (sl->sessions[session_number].state == S_STATE_IN_DELETION) {
+ sl->sessions[session_number].state = S_STATE_IDLE;
+ }
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+
+ sl->error = en50221_tl_get_error(sl->tl);
+ return -1;
+ }
+
+ return 0;
}
-int en50221_sl_send_data(en50221_session_layer sl, uint16_t session_number, uint8_t *data, uint16_t data_length)
+int en50221_sl_send_data(struct en50221_session_layer *sl,
+ uint16_t session_number,
+ uint8_t *data,
+ uint16_t data_length)
{
- struct en50221_session_layer_private *private = (struct en50221_session_layer_private *) sl;
-
- if (session_number >= private->max_sessions) {
- private->error = EN50221ERR_BADSESSIONNUMBER;
- return -1;
- }
-
- pthread_mutex_lock(&private->sessions[session_number].session_lock);
- if (private->sessions[session_number].state != S_STATE_ACTIVE) {
- private->error = EN50221ERR_BADSESSIONNUMBER;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return -1;
- }
-
- // get essential details
- uint8_t slot_id = private->sessions[session_number].slot_id;
- uint8_t connection_id = private->sessions[session_number].connection_id;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
-
- // sendit
- struct iovec iov[2];
- uint8_t hdr[4];
- hdr[0] = ST_SESSION_NUMBER;
- hdr[1] = 2;
- hdr[2] = session_number >> 8;
- hdr[3] = session_number;
- iov[0].iov_base = hdr;
- iov[0].iov_len = 4;
- iov[1].iov_base = data;
- iov[1].iov_len = data_length;
- if (en50221_tl_send_datav(private->tl, slot_id, connection_id, iov, 2)) {
- private->error = en50221_tl_get_error(private->tl);
- return -1;
- }
-
- return 0;
+ if (session_number >= sl->max_sessions) {
+ sl->error = EN50221ERR_BADSESSIONNUMBER;
+ return -1;
+ }
+
+ pthread_mutex_lock(&sl->sessions[session_number].session_lock);
+ if (sl->sessions[session_number].state != S_STATE_ACTIVE) {
+ sl->error = EN50221ERR_BADSESSIONNUMBER;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return -1;
+ }
+ // get essential details
+ uint8_t slot_id = sl->sessions[session_number].slot_id;
+ uint8_t connection_id = sl->sessions[session_number].connection_id;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+
+ // sendit
+ struct iovec iov[2];
+ uint8_t hdr[4];
+ hdr[0] = ST_SESSION_NUMBER;
+ hdr[1] = 2;
+ hdr[2] = session_number >> 8;
+ hdr[3] = session_number;
+ iov[0].iov_base = hdr;
+ iov[0].iov_len = 4;
+ iov[1].iov_base = data;
+ iov[1].iov_len = data_length;
+ if (en50221_tl_send_datav(sl->tl, slot_id, connection_id, iov, 2)) {
+ sl->error = en50221_tl_get_error(sl->tl);
+ return -1;
+ }
+
+ return 0;
}
-int en50221_sl_send_datav(en50221_session_layer sl, uint16_t session_number,
- struct iovec *vector, int iov_count)
+int en50221_sl_send_datav(struct en50221_session_layer *sl,
+ uint16_t session_number,
+ struct iovec *vector,
+ int iov_count)
{
- struct en50221_session_layer_private *private = (struct en50221_session_layer_private *) sl;
-
- if (session_number >= private->max_sessions) {
- private->error = EN50221ERR_BADSESSIONNUMBER;
- return -1;
- }
-
- pthread_mutex_lock(&private->sessions[session_number].session_lock);
- if (private->sessions[session_number].state != S_STATE_ACTIVE) {
- private->error = EN50221ERR_BADSESSIONNUMBER;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return -1;
- }
- if (iov_count > 9) {
- private->error = EN50221ERR_IOVLIMIT;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return -1;
- }
- uint8_t slot_id = private->sessions[session_number].slot_id;
- uint8_t connection_id = private->sessions[session_number].connection_id;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
-
- // make up the header
- struct iovec out_iov[10];
- uint8_t hdr[4];
- hdr[0] = ST_SESSION_NUMBER;
- hdr[1] = 2;
- hdr[2] = session_number >> 8;
- hdr[3] = session_number;
- out_iov[0].iov_base = hdr;
- out_iov[0].iov_len = 4;
-
- // make up the data
- memcpy(&out_iov[1], vector, iov_count * sizeof(struct iovec));
-
- // send this command
- if (en50221_tl_send_datav(private->tl, slot_id, connection_id, out_iov, iov_count+1)) {
- private->error = en50221_tl_get_error(private->tl);
- return -1;
- }
- return 0;
+ if (session_number >= sl->max_sessions) {
+ sl->error = EN50221ERR_BADSESSIONNUMBER;
+ return -1;
+ }
+
+ pthread_mutex_lock(&sl->sessions[session_number].session_lock);
+ if (sl->sessions[session_number].state != S_STATE_ACTIVE) {
+ sl->error = EN50221ERR_BADSESSIONNUMBER;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return -1;
+ }
+ if (iov_count > 9) {
+ sl->error = EN50221ERR_IOVLIMIT;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return -1;
+ }
+ uint8_t slot_id = sl->sessions[session_number].slot_id;
+ uint8_t connection_id = sl->sessions[session_number].connection_id;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+
+ // make up the header
+ struct iovec out_iov[10];
+ uint8_t hdr[4];
+ hdr[0] = ST_SESSION_NUMBER;
+ hdr[1] = 2;
+ hdr[2] = session_number >> 8;
+ hdr[3] = session_number;
+ out_iov[0].iov_base = hdr;
+ out_iov[0].iov_len = 4;
+
+ // make up the data
+ memcpy(&out_iov[1], vector, iov_count * sizeof(struct iovec));
+
+ // send this command
+ if (en50221_tl_send_datav(sl->tl, slot_id, connection_id, out_iov, iov_count + 1)) {
+ sl->error = en50221_tl_get_error(sl->tl);
+ return -1;
+ }
+ return 0;
}
-int en50221_sl_broadcast_data(en50221_session_layer sl, int slot_id, uint32_t resource_id,
- uint8_t *data, uint16_t data_length)
+int en50221_sl_broadcast_data(struct en50221_session_layer *sl,
+ int slot_id, uint32_t resource_id,
+ uint8_t *data, uint16_t data_length)
{
- struct en50221_session_layer_private *private = (struct en50221_session_layer_private *) sl;
- uint32_t i;
-
- for(i = 0; i < private->max_sessions; i++)
- {
- pthread_mutex_lock(&private->sessions[i].session_lock);
-
- if (private->sessions[i].state != S_STATE_ACTIVE) {
- pthread_mutex_unlock(&private->sessions[i].session_lock);
- continue;
- }
- if ((slot_id != -1) && (slot_id != private->sessions[i].slot_id)) {
- pthread_mutex_unlock(&private->sessions[i].session_lock);
- continue;
- }
-
- if (private->sessions[i].resource_id == resource_id) {
- pthread_mutex_unlock(&private->sessions[i].session_lock);
- en50221_sl_send_data(sl, i, data, data_length);
- } else {
- pthread_mutex_unlock(&private->sessions[i].session_lock);
- }
- }
-
- return 0;
+ uint32_t i;
+
+ for (i = 0; i < sl->max_sessions; i++) {
+ pthread_mutex_lock(&sl->sessions[i].session_lock);
+
+ if (sl->sessions[i].state != S_STATE_ACTIVE) {
+ pthread_mutex_unlock(&sl->sessions[i].session_lock);
+ continue;
+ }
+ if ((slot_id != -1)
+ && (slot_id != sl->sessions[i].slot_id)) {
+ pthread_mutex_unlock(&sl->sessions[i].session_lock);
+ continue;
+ }
+
+ if (sl->sessions[i].resource_id == resource_id) {
+ pthread_mutex_unlock(&sl->sessions[i].session_lock);
+ en50221_sl_send_data(sl, i, data, data_length);
+ } else {
+ pthread_mutex_unlock(&sl->sessions[i].session_lock);
+ }
+ }
+
+ return 0;
}
-static void en50221_sl_handle_open_session_request(struct en50221_session_layer_private *private,
- uint8_t *data, uint32_t data_length, uint8_t slot_id, uint8_t connection_id)
+static void en50221_sl_handle_open_session_request(struct en50221_session_layer *sl,
+ uint8_t *data,
+ uint32_t data_length,
+ uint8_t slot_id,
+ uint8_t connection_id)
{
- // check
- if (data_length < 5) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %02x\n", slot_id);
- return;
- }
- if (data[0] != 4) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %02x\n", slot_id);
- return;
- }
-
- // get the resource id
- uint32_t requested_resource_id = (data[1] << 24) | (data[2] << 16) | (data[3] << 8) | data[4];
-
- // get lookup callback details
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_sl_lookup_callback lcb = private->lookup;
- void *lcb_arg = private->lookup_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
-
- // first of all, lookup this resource id
- int status = S_STATUS_CLOSE_NO_RES;
- en50221_sl_resource_callback resource_callback = NULL;
- void *resource_arg = NULL;
- uint32_t connected_resource_id;
- if (lcb) {
- status = lcb(lcb_arg, slot_id, requested_resource_id, &resource_callback, &resource_arg, &connected_resource_id);
- switch(status) {
- case 0:
- status = S_STATUS_OPEN;
- break;
-
- case -1:
- status = S_STATUS_CLOSE_NO_RES;
- break;
-
- case -2:
- status = S_STATUS_CLOSE_RES_LOW_VERSION;
- break;
-
- case -3:
- status = S_STATUS_CLOSE_RES_UNAVAILABLE;
- break;
- }
- }
-
- // if we found it, get a new session for it
- int session_number = -1;
- if (status == S_STATUS_OPEN) {
- // lookup next free session_id:
- pthread_mutex_lock(&private->global_lock);
- session_number = en50221_sl_alloc_new_session(private, connected_resource_id, slot_id, connection_id,
- resource_callback, resource_arg);
- pthread_mutex_unlock(&private->global_lock);
-
- if (session_number == -1) {
- status = S_STATUS_CLOSE_NO_RES;
- } else {
- // inform upper layers/ check availability
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_sl_session_callback cb = private->session;
- void *cb_arg = private->session_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
- if (cb) {
- if (cb(cb_arg, S_SCALLBACK_REASON_CAMCONNECTING, slot_id, session_number, connected_resource_id)) {
- status = S_STATUS_CLOSE_RES_BUSY;
- }
- } else {
- status = S_STATUS_CLOSE_RES_UNAVAILABLE;
- }
- }
- }
-
- // send response
- uint8_t hdr[9];
- hdr[0] = ST_OPEN_SESSION_RES;
- hdr[1] = 7;
- hdr[2] = status;
- hdr[3] = connected_resource_id >> 24;
- hdr[4] = connected_resource_id >> 16;
- hdr[5] = connected_resource_id >> 8;
- hdr[6] = connected_resource_id;
- hdr[7] = session_number >> 8;
- hdr[8] = session_number;
- if (en50221_tl_send_data(private->tl, slot_id, connection_id, hdr, 9)) {
- print(LOG_LEVEL, ERROR, 1, "Transport layer error %i occurred\n", en50221_tl_get_error(private->tl));
- status = S_STATUS_CLOSE_NO_RES;
- // fallthrough
- }
-
- // inform upper layers what happened
- if (session_number != -1) {
- // setup session state apppropriately from upper layer response
- pthread_mutex_lock(&private->sessions[session_number].session_lock);
- if (status != S_STATUS_OPEN) {
- private->sessions[session_number].state = S_STATE_IDLE;
- } else {
- private->sessions[session_number].state = S_STATE_ACTIVE;
- }
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
-
- // tell upper layers
- if (private->sessions[session_number].state == S_STATE_ACTIVE) {
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_sl_session_callback cb = private->session;
- void *cb_arg = private->session_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
-
- if (status == S_STATUS_OPEN) {
- if (cb)
- cb(cb_arg, S_SCALLBACK_REASON_CAMCONNECTED, slot_id, session_number, connected_resource_id);
- } else {
- private->sessions[session_number].state = S_STATE_IDLE;
- if (cb)
- cb(cb_arg, S_SCALLBACK_REASON_CAMCONNECTFAIL, slot_id, session_number, connected_resource_id);
- }
- }
- }
+ // check
+ if (data_length < 5) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %02x\n",
+ slot_id);
+ return;
+ }
+ if (data[0] != 4) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %02x\n",
+ slot_id);
+ return;
+ }
+ // get the resource id
+ uint32_t requested_resource_id =
+ (data[1] << 24) | (data[2] << 16) | (data[3] << 8) | data[4];
+
+ // get lookup callback details
+ pthread_mutex_lock(&sl->setcallback_lock);
+ en50221_sl_lookup_callback lcb = sl->lookup;
+ void *lcb_arg = sl->lookup_arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
+
+ // first of all, lookup this resource id
+ int status = S_STATUS_CLOSE_NO_RES;
+ en50221_sl_resource_callback resource_callback = NULL;
+ void *resource_arg = NULL;
+ uint32_t connected_resource_id;
+ if (lcb) {
+ status =
+ lcb(lcb_arg, slot_id, requested_resource_id,
+ &resource_callback, &resource_arg,
+ &connected_resource_id);
+ switch (status) {
+ case 0:
+ status = S_STATUS_OPEN;
+ break;
+
+ case -1:
+ status = S_STATUS_CLOSE_NO_RES;
+ break;
+
+ case -2:
+ status = S_STATUS_CLOSE_RES_LOW_VERSION;
+ break;
+
+ case -3:
+ status = S_STATUS_CLOSE_RES_UNAVAILABLE;
+ break;
+ }
+ }
+ // if we found it, get a new session for it
+ int session_number = -1;
+ if (status == S_STATUS_OPEN) {
+ // lookup next free session_id:
+ pthread_mutex_lock(&sl->global_lock);
+ session_number =
+ en50221_sl_alloc_new_session(sl, connected_resource_id,
+ slot_id, connection_id,
+ resource_callback,
+ resource_arg);
+ pthread_mutex_unlock(&sl->global_lock);
+
+ if (session_number == -1) {
+ status = S_STATUS_CLOSE_NO_RES;
+ } else {
+ // inform upper layers/ check availability
+ pthread_mutex_lock(&sl->setcallback_lock);
+ en50221_sl_session_callback cb = sl->session;
+ void *cb_arg = sl->session_arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
+ if (cb) {
+ if (cb(cb_arg, S_SCALLBACK_REASON_CAMCONNECTING,
+ slot_id, session_number,
+ connected_resource_id)) {
+ status = S_STATUS_CLOSE_RES_BUSY;
+ }
+ } else {
+ status = S_STATUS_CLOSE_RES_UNAVAILABLE;
+ }
+ }
+ }
+ // send response
+ uint8_t hdr[9];
+ hdr[0] = ST_OPEN_SESSION_RES;
+ hdr[1] = 7;
+ hdr[2] = status;
+ hdr[3] = connected_resource_id >> 24;
+ hdr[4] = connected_resource_id >> 16;
+ hdr[5] = connected_resource_id >> 8;
+ hdr[6] = connected_resource_id;
+ hdr[7] = session_number >> 8;
+ hdr[8] = session_number;
+ if (en50221_tl_send_data(sl->tl, slot_id, connection_id, hdr, 9)) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Transport layer error %i occurred\n",
+ en50221_tl_get_error(sl->tl));
+ status = S_STATUS_CLOSE_NO_RES;
+ // fallthrough
+ }
+ // inform upper layers what happened
+ if (session_number != -1) {
+ // setup session state apppropriately from upper layer response
+ pthread_mutex_lock(&sl->sessions[session_number].session_lock);
+ if (status != S_STATUS_OPEN) {
+ sl->sessions[session_number].state = S_STATE_IDLE;
+ } else {
+ sl->sessions[session_number].state = S_STATE_ACTIVE;
+ }
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+
+ // tell upper layers
+ if (sl->sessions[session_number].state == S_STATE_ACTIVE) {
+ pthread_mutex_lock(&sl->setcallback_lock);
+ en50221_sl_session_callback cb = sl->session;
+ void *cb_arg = sl->session_arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
+
+ if (status == S_STATUS_OPEN) {
+ if (cb)
+ cb(cb_arg,
+ S_SCALLBACK_REASON_CAMCONNECTED,
+ slot_id, session_number,
+ connected_resource_id);
+ } else {
+ sl->sessions[session_number].state =
+ S_STATE_IDLE;
+ if (cb)
+ cb(cb_arg,
+ S_SCALLBACK_REASON_CAMCONNECTFAIL,
+ slot_id, session_number,
+ connected_resource_id);
+ }
+ }
+ }
}
-static void en50221_sl_handle_close_session_request(struct en50221_session_layer_private *private,
- uint8_t *data, uint32_t data_length, uint8_t slot_id, uint8_t connection_id)
+static void en50221_sl_handle_close_session_request(struct en50221_session_layer *sl,
+ uint8_t * data,
+ uint32_t data_length,
+ uint8_t slot_id,
+ uint8_t connection_id)
{
- // check
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %02x\n", slot_id);
- return;
- }
- if (data[0] != 2) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %02x\n", slot_id);
- return;
- }
-
- // extract session number
- uint16_t session_number = (data[1] << 8) | data[2];
-
- // check session number is ok
- uint8_t code = 0x00;
- uint32_t resource_id = 0;
- if (session_number >= private->max_sessions) {
- code = 0xF0; // session close error
- print(LOG_LEVEL, ERROR, 1, "Received bad session id %i\n", slot_id);
- } else {
- pthread_mutex_lock(&private->sessions[session_number].session_lock);
- if (slot_id != private->sessions[session_number].slot_id) {
- print(LOG_LEVEL, ERROR, 1, "Received unexpected session on invalid slot %i\n", slot_id);
- code = 0xF0; // session close error
- }
- if (connection_id != private->sessions[session_number].connection_id) {
- print(LOG_LEVEL, ERROR, 1, "Received unexpected session on invalid slot %i\n", slot_id);
- code = 0xF0; // session close error
- }
- if (!(private->sessions[session_number].state & (S_STATE_ACTIVE|S_STATE_IN_DELETION))) {
- print(LOG_LEVEL, ERROR, 1, "Received unexpected session on invalid slot %i\n", slot_id);
- code = 0xF0; // session close error
- }
-
- if (code == 0x00) {
- private->sessions[session_number].state = S_STATE_IDLE;
- code = 0x00; // close ok
- }
- resource_id = private->sessions[session_number].resource_id;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- }
-
- // make up the response
- uint8_t hdr[5];
- hdr[0] = ST_CLOSE_SESSION_RES;
- hdr[1] = 3;
- hdr[2] = code;
- hdr[3] = session_number >> 8;
- hdr[4] = session_number;
-
- // sendit
- if (en50221_tl_send_data(private->tl, slot_id, connection_id, hdr, 5)) {
- print(LOG_LEVEL, ERROR, 1, "Transport layer reports error %i on slot %i\n",
- en50221_tl_get_error(private->tl), slot_id);
- }
-
- // callback to announce destruction to resource if it was ok
- if (code == 0x00) {
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_sl_session_callback cb = private->session;
- void *cb_arg = private->session_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
-
- if (cb)
- cb(cb_arg, S_SCALLBACK_REASON_CLOSE, slot_id, session_number, resource_id);
- }
+ // check
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %02x\n",
+ slot_id);
+ return;
+ }
+ if (data[0] != 2) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %02x\n",
+ slot_id);
+ return;
+ }
+ // extract session number
+ uint16_t session_number = (data[1] << 8) | data[2];
+
+ // check session number is ok
+ uint8_t code = 0x00;
+ uint32_t resource_id = 0;
+ if (session_number >= sl->max_sessions) {
+ code = 0xF0; // session close error
+ print(LOG_LEVEL, ERROR, 1, "Received bad session id %i\n",
+ slot_id);
+ } else {
+ pthread_mutex_lock(&sl->sessions[session_number].
+ session_lock);
+ if (slot_id != sl->sessions[session_number].slot_id) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected session on invalid slot %i\n",
+ slot_id);
+ code = 0xF0; // session close error
+ }
+ if (connection_id != sl->sessions[session_number].connection_id) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected session on invalid slot %i\n",
+ slot_id);
+ code = 0xF0; // session close error
+ }
+ if (!(sl->sessions[session_number].state & (S_STATE_ACTIVE | S_STATE_IN_DELETION))) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected session on invalid slot %i\n",
+ slot_id);
+ code = 0xF0; // session close error
+ }
+
+ if (code == 0x00) {
+ sl->sessions[session_number].state = S_STATE_IDLE;
+ code = 0x00; // close ok
+ }
+ resource_id = sl->sessions[session_number].resource_id;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ }
+
+ // make up the response
+ uint8_t hdr[5];
+ hdr[0] = ST_CLOSE_SESSION_RES;
+ hdr[1] = 3;
+ hdr[2] = code;
+ hdr[3] = session_number >> 8;
+ hdr[4] = session_number;
+
+ // sendit
+ if (en50221_tl_send_data(sl->tl, slot_id, connection_id, hdr, 5)) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Transport layer reports error %i on slot %i\n",
+ en50221_tl_get_error(sl->tl), slot_id);
+ }
+ // callback to announce destruction to resource if it was ok
+ if (code == 0x00) {
+ pthread_mutex_lock(&sl->setcallback_lock);
+ en50221_sl_session_callback cb = sl->session;
+ void *cb_arg = sl->session_arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
+
+ if (cb)
+ cb(cb_arg, S_SCALLBACK_REASON_CLOSE, slot_id,
+ session_number, resource_id);
+ }
}
-static void en50221_sl_handle_create_session_response(struct en50221_session_layer_private *private,
- uint8_t *data, uint32_t data_length, uint8_t slot_id, uint8_t connection_id)
+static void en50221_sl_handle_create_session_response(struct en50221_session_layer *sl,
+ uint8_t * data,
+ uint32_t data_length,
+ uint8_t slot_id,
+ uint8_t connection_id)
{
- // check
- if (data_length < 8) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %02x\n", slot_id);
- return;
- }
- if (data[0] != 7) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %02x\n", slot_id);
- return;
- }
-
- // extract session number
- uint16_t session_number = (data[5] << 8) | data[6];
-
- // check session number is ok
- if (session_number >= private->max_sessions) {
- print(LOG_LEVEL, ERROR, 1, "Received bad session id %i\n", slot_id);
- return;
- }
-
- pthread_mutex_lock(&private->sessions[session_number].session_lock);
- if (slot_id != private->sessions[session_number].slot_id) {
- print(LOG_LEVEL, ERROR, 1, "Received unexpected session on invalid slot %i\n", slot_id);
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return;
- }
- if (connection_id != private->sessions[session_number].connection_id) {
- print(LOG_LEVEL, ERROR, 1, "Received unexpected session on invalid slot %i\n", slot_id);
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return;
- }
- if (private->sessions[session_number].state != S_STATE_IN_CREATION) {
- print(LOG_LEVEL, ERROR, 1, "Received unexpected session on invalid slot %i\n", slot_id);
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return;
- }
-
- // extract status
- if (data[1] != S_STATUS_OPEN) {
- print(LOG_LEVEL, ERROR, 1, "Session creation failed 0x%02x\n", data[1]);
- private->sessions[session_number].state = S_STATE_IDLE;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
-
- // inform upper layers
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_sl_session_callback cb = private->session;
- void *cb_arg = private->session_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
- if (cb)
- cb(cb_arg, S_SCALLBACK_REASON_CONNECTFAIL, slot_id, session_number,
- private->sessions[session_number].resource_id);
- return;
- }
-
- // set it active
- private->sessions[session_number].state = S_STATE_ACTIVE;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
-
- // inform upper layers
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_sl_session_callback cb = private->session;
- void *cb_arg = private->session_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
- if (cb)
- cb(cb_arg, S_SCALLBACK_REASON_CONNECTED, slot_id, session_number,
- private->sessions[session_number].resource_id);
+ // check
+ if (data_length < 8) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %02x\n",
+ slot_id);
+ return;
+ }
+ if (data[0] != 7) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %02x\n",
+ slot_id);
+ return;
+ }
+ // extract session number
+ uint16_t session_number = (data[5] << 8) | data[6];
+
+ // check session number is ok
+ if (session_number >= sl->max_sessions) {
+ print(LOG_LEVEL, ERROR, 1, "Received bad session id %i\n",
+ slot_id);
+ return;
+ }
+
+ pthread_mutex_lock(&sl->sessions[session_number].session_lock);
+ if (slot_id != sl->sessions[session_number].slot_id) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected session on invalid slot %i\n",
+ slot_id);
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return;
+ }
+ if (connection_id != sl->sessions[session_number].connection_id) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected session on invalid slot %i\n",
+ slot_id);
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return;
+ }
+ if (sl->sessions[session_number].state != S_STATE_IN_CREATION) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected session on invalid slot %i\n",
+ slot_id);
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return;
+ }
+ // extract status
+ if (data[1] != S_STATUS_OPEN) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Session creation failed 0x%02x\n", data[1]);
+ sl->sessions[session_number].state = S_STATE_IDLE;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+
+ // inform upper layers
+ pthread_mutex_lock(&sl->setcallback_lock);
+ en50221_sl_session_callback cb = sl->session;
+ void *cb_arg = sl->session_arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
+ if (cb)
+ cb(cb_arg, S_SCALLBACK_REASON_CONNECTFAIL, slot_id,
+ session_number,
+ sl->sessions[session_number].resource_id);
+ return;
+ }
+ // set it active
+ sl->sessions[session_number].state = S_STATE_ACTIVE;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+
+ // inform upper layers
+ pthread_mutex_lock(&sl->setcallback_lock);
+ en50221_sl_session_callback cb = sl->session;
+ void *cb_arg = sl->session_arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
+ if (cb)
+ cb(cb_arg, S_SCALLBACK_REASON_CONNECTED, slot_id,
+ session_number,
+ sl->sessions[session_number].resource_id);
}
-static void en50221_sl_handle_close_session_response(struct en50221_session_layer_private *private,
- uint8_t *data, uint32_t data_length, uint8_t slot_id, uint8_t connection_id)
+static void en50221_sl_handle_close_session_response(struct en50221_session_layer *sl,
+ uint8_t *data,
+ uint32_t data_length,
+ uint8_t slot_id,
+ uint8_t connection_id)
{
- // check
- if (data_length < 5) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %02x\n", slot_id);
- return;
- }
- if (data[0] != 4) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %02x\n", slot_id);
- return;
- }
-
- // extract session number
- uint16_t session_number = (data[2] << 8) | data[3];
-
- // check session number is ok
- if (session_number >= private->max_sessions) {
- print(LOG_LEVEL, ERROR, 1, "Received bad session id %i\n", slot_id);
- return;
- }
-
- pthread_mutex_lock(&private->sessions[session_number].session_lock);
- if (slot_id != private->sessions[session_number].slot_id) {
- print(LOG_LEVEL, ERROR, 1, "Received unexpected session on invalid slot %i\n", slot_id);
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return;
- }
- if (connection_id != private->sessions[session_number].connection_id) {
- print(LOG_LEVEL, ERROR, 1, "Received unexpected session on invalid slot %i\n", slot_id);
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return;
- }
- if (private->sessions[session_number].state != S_STATE_IN_DELETION) {
- print(LOG_LEVEL, ERROR, 1, "Received unexpected session on invalid slot %i\n", slot_id);
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return;
- }
-
- // extract status
- if (data[1] != 0x00) {
- print(LOG_LEVEL, ERROR, 1, "Session close failed 0x%02x\n", data[1]);
- // just fallthrough anyway
- }
-
- // completed
- private->sessions[session_number].state = S_STATE_IDLE;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
+ // check
+ if (data_length < 5) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %02x\n",
+ slot_id);
+ return;
+ }
+ if (data[0] != 4) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %02x\n",
+ slot_id);
+ return;
+ }
+ // extract session number
+ uint16_t session_number = (data[2] << 8) | data[3];
+
+ // check session number is ok
+ if (session_number >= sl->max_sessions) {
+ print(LOG_LEVEL, ERROR, 1, "Received bad session id %i\n", slot_id);
+ return;
+ }
+
+ pthread_mutex_lock(&sl->sessions[session_number].session_lock);
+ if (slot_id != sl->sessions[session_number].slot_id) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected session on invalid slot %i\n",
+ slot_id);
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return;
+ }
+ if (connection_id != sl->sessions[session_number].connection_id) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected session on invalid slot %i\n",
+ slot_id);
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return;
+ }
+ if (sl->sessions[session_number].state != S_STATE_IN_DELETION) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected session on invalid slot %i\n",
+ slot_id);
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return;
+ }
+ // extract status
+ if (data[1] != 0x00) {
+ print(LOG_LEVEL, ERROR, 1, "Session close failed 0x%02x\n", data[1]);
+ // just fallthrough anyway
+ }
+ // completed
+ sl->sessions[session_number].state = S_STATE_IDLE;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
}
-static void en50221_sl_handle_session_package(struct en50221_session_layer_private *private,
- uint8_t *data, uint32_t data_length,
- uint8_t slot_id, uint8_t connection_id)
+static void en50221_sl_handle_session_package(struct en50221_session_layer *sl,
+ uint8_t *data,
+ uint32_t data_length,
+ uint8_t slot_id,
+ uint8_t connection_id)
{
- // check
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %i\n", slot_id);
- return;
- }
- if (data[0] != 2) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %i\n", slot_id);
- return;
- }
-
- // get session number
- uint16_t session_number = (data[1] << 8) | data[2];
-
- // check it
- if (session_number >= private->max_sessions) {
- print(LOG_LEVEL, ERROR, 1, "Received data with bad session_number from module on slot %i\n", slot_id);
- return;
- }
-
- pthread_mutex_lock(&private->sessions[session_number].session_lock);
- if (slot_id != private->sessions[session_number].slot_id) {
- print(LOG_LEVEL, ERROR, 1, "Received unexpected session on invalid slot %i\n", slot_id);
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return;
- }
- if (connection_id != private->sessions[session_number].connection_id) {
- print(LOG_LEVEL, ERROR, 1, "Received unexpected session on invalid slot %i\n", slot_id);
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return;
- }
- if (private->sessions[session_number].state != S_STATE_ACTIVE) {
- print(LOG_LEVEL, ERROR, 1, "Received data with bad session_number from module on slot %i\n", slot_id);
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
- return;
- }
-
- en50221_sl_resource_callback cb = private->sessions[session_number].callback;
- void *cb_arg = private->sessions[session_number].callback_arg;
- uint32_t resource_id = private->sessions[session_number].resource_id;
- pthread_mutex_unlock(&private->sessions[session_number].session_lock);
-
- // there can be > 1 APDU following the package - all for the same session/resource_id tho.
- data += 3;
- data_length -= 3;
- while(data_length) {
- // check length field
- if (data_length < 3) {
- print(LOG_LEVEL, ERROR, 1, "Received invalid sized session package from slot %i\n", slot_id);
- return;
- }
-
- // parse the APDU's length field
- int length_field_len;
- uint16_t asn_data_length;
- if ((length_field_len = asn_1_decode(&asn_data_length, data+3, data_length-3)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "Received invalid sized session package from slot %i\n", slot_id);
- return;
- }
- uint32_t apdu_length = 3 + length_field_len + asn_data_length;
-
- // check there is enough data
- if (apdu_length > data_length) {
- print(LOG_LEVEL, ERROR, 1, "Received invalid sized session package from slot %i\n", slot_id);
- return;
- }
-
- // pass the APDU up to the higher layers
- if (cb)
- cb(cb_arg, slot_id, session_number, resource_id, data, apdu_length);
-
- // next!
- data += apdu_length;
- data_length -= apdu_length;
- }
+ // check
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %i\n",
+ slot_id);
+ return;
+ }
+ if (data[0] != 2) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %i\n",
+ slot_id);
+ return;
+ }
+ // get session number
+ uint16_t session_number = (data[1] << 8) | data[2];
+
+ // check it
+ if (session_number >= sl->max_sessions) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with bad session_number from module on slot %i\n",
+ slot_id);
+ return;
+ }
+
+ pthread_mutex_lock(&sl->sessions[session_number].session_lock);
+ if (slot_id != sl->sessions[session_number].slot_id) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected session on invalid slot %i\n",
+ slot_id);
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return;
+ }
+ if (connection_id != sl->sessions[session_number].connection_id) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unexpected session on invalid slot %i\n",
+ slot_id);
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return;
+ }
+ if (sl->sessions[session_number].state != S_STATE_ACTIVE) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with bad session_number from module on slot %i\n",
+ slot_id);
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+ return;
+ }
+
+ en50221_sl_resource_callback cb = sl->sessions[session_number].callback;
+ void *cb_arg = sl->sessions[session_number].callback_arg;
+ uint32_t resource_id = sl->sessions[session_number].resource_id;
+ pthread_mutex_unlock(&sl->sessions[session_number].session_lock);
+
+ // there can be > 1 APDU following the package - all for the same session/resource_id tho.
+ data += 3;
+ data_length -= 3;
+ while (data_length) {
+ // check length field
+ if (data_length < 3) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received invalid sized session package from slot %i\n",
+ slot_id);
+ return;
+ }
+ // parse the APDU's length field
+ int length_field_len;
+ uint16_t asn_data_length;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data + 3, data_length - 3)) < 0) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received invalid sized session package from slot %i\n",
+ slot_id);
+ return;
+ }
+ uint32_t apdu_length = 3 + length_field_len + asn_data_length;
+
+ // check there is enough data
+ if (apdu_length > data_length) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received invalid sized session package from slot %i\n",
+ slot_id);
+ return;
+ }
+ // pass the APDU up to the higher layers
+ if (cb)
+ cb(cb_arg, slot_id, session_number, resource_id, data, apdu_length);
+
+ // next!
+ data += apdu_length;
+ data_length -= apdu_length;
+ }
}
-static void en50221_sl_transport_callback(void *arg, int reason, uint8_t *data, uint32_t data_length,
- uint8_t slot_id, uint8_t connection_id)
+static void en50221_sl_transport_callback(void *arg, int reason,
+ uint8_t *data,
+ uint32_t data_length,
+ uint8_t slot_id,
+ uint8_t connection_id)
{
- struct en50221_session_layer_private *private = (struct en50221_session_layer_private *) arg;
- uint32_t i;
-
- // deal with the reason for this callback
- switch(reason) {
- case T_CALLBACK_REASON_DATA:
- // fallthrough into rest of this function
- break;
-
- case T_CALLBACK_REASON_CONNECTIONOPEN:
- {
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_sl_session_callback cb = private->session;
- void *cb_arg = private->session_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
-
- if (cb)
- cb(cb_arg, S_SCALLBACK_REASON_TC_CONNECT, slot_id, connection_id, 0);
- return;
- }
-
- case T_CALLBACK_REASON_CAMCONNECTIONOPEN:
- {
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_sl_session_callback cb = private->session;
- void *cb_arg = private->session_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
-
- if (cb)
- cb(cb_arg, S_SCALLBACK_REASON_TC_CAMCONNECT, slot_id, connection_id, 0);
- return;
- }
-
- case T_CALLBACK_REASON_CONNECTIONCLOSE:
- {
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_sl_session_callback cb = private->session;
- void *cb_arg = private->session_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
-
- for(i=0; i< private->max_sessions; i++) {
- pthread_mutex_lock(&private->sessions[i].session_lock);
-
- if (private->sessions[i].state == S_STATE_IDLE) {
- pthread_mutex_unlock(&private->sessions[i].session_lock);
- continue;
- }
- if (private->sessions[i].connection_id != connection_id) {
- pthread_mutex_unlock(&private->sessions[i].session_lock);
- continue;
- }
-
- private->sessions[i].state = S_STATE_IDLE;
-
- uint8_t slot_id = private->sessions[i].slot_id;
- uint32_t resource_id = private->sessions[i].resource_id;
- pthread_mutex_unlock(&private->sessions[i].session_lock);
-
- if (cb)
- cb(cb_arg, S_SCALLBACK_REASON_CLOSE, slot_id, i, resource_id);
- }
- return;
- }
-
- case T_CALLBACK_REASON_SLOTCLOSE:
- {
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_sl_session_callback cb = private->session;
- void *cb_arg = private->session_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
-
- for(i=0; i< private->max_sessions; i++) {
- pthread_mutex_lock(&private->sessions[i].session_lock);
-
- if (private->sessions[i].state == S_STATE_IDLE) {
- pthread_mutex_unlock(&private->sessions[i].session_lock);
- continue;
- }
- if (private->sessions[i].slot_id != slot_id) {
- pthread_mutex_unlock(&private->sessions[i].session_lock);
- continue;
- }
- private->sessions[i].state = S_STATE_IDLE;
-
- uint32_t resource_id = private->sessions[i].resource_id;
- pthread_mutex_unlock(&private->sessions[i].session_lock);
-
- if (cb)
- cb(cb_arg, S_SCALLBACK_REASON_CLOSE, slot_id, i, resource_id);
-
- }
- return;
- }
- }
-
- // sanity check data length
- if (data_length < 1) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %i\n", slot_id);
- return;
- }
-
- // deal with the data
- uint8_t spdu_tag = data[0];
- switch(spdu_tag)
- {
- case ST_OPEN_SESSION_REQ:
- en50221_sl_handle_open_session_request(private, data+1, data_length-1, slot_id, connection_id);
- break;
-
- case ST_CLOSE_SESSION_REQ:
- en50221_sl_handle_close_session_request(private, data+1, data_length-1, slot_id, connection_id);
- break;
-
- case ST_SESSION_NUMBER:
- en50221_sl_handle_session_package(private, data+1, data_length-1, slot_id, connection_id);
- break;
-
- case ST_CREATE_SESSION_RES:
- en50221_sl_handle_create_session_response(private, data+1, data_length-1, slot_id, connection_id);
- break;
-
- case ST_CLOSE_SESSION_RES:
- en50221_sl_handle_close_session_response(private, data+1, data_length-1, slot_id, connection_id);
- break;
-
- default:
- print(LOG_LEVEL, ERROR, 1, "Received unknown session tag %02x from module on slot %i", spdu_tag, slot_id);
- break;
- }
+ struct en50221_session_layer *sl =
+ (struct en50221_session_layer *) arg;
+ uint32_t i;
+
+ // deal with the reason for this callback
+ switch (reason) {
+ case T_CALLBACK_REASON_DATA:
+ // fallthrough into rest of this function
+ break;
+
+ case T_CALLBACK_REASON_CONNECTIONOPEN:
+ {
+ pthread_mutex_lock(&sl->setcallback_lock);
+ en50221_sl_session_callback cb = sl->session;
+ void *cb_arg = sl->session_arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
+
+ if (cb)
+ cb(cb_arg, S_SCALLBACK_REASON_TC_CONNECT,
+ slot_id, connection_id, 0);
+ return;
+ }
+
+ case T_CALLBACK_REASON_CAMCONNECTIONOPEN:
+ {
+ pthread_mutex_lock(&sl->setcallback_lock);
+ en50221_sl_session_callback cb = sl->session;
+ void *cb_arg = sl->session_arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
+
+ if (cb)
+ cb(cb_arg,
+ S_SCALLBACK_REASON_TC_CAMCONNECT,
+ slot_id, connection_id, 0);
+ return;
+ }
+
+ case T_CALLBACK_REASON_CONNECTIONCLOSE:
+ {
+ pthread_mutex_lock(&sl->setcallback_lock);
+ en50221_sl_session_callback cb = sl->session;
+ void *cb_arg = sl->session_arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
+
+ for (i = 0; i < sl->max_sessions; i++) {
+ pthread_mutex_lock(&sl->sessions[i].session_lock);
+
+ if (sl->sessions[i].state == S_STATE_IDLE) {
+ pthread_mutex_unlock(&sl->sessions[i].session_lock);
+ continue;
+ }
+ if (sl->sessions[i].connection_id != connection_id) {
+ pthread_mutex_unlock(&sl->sessions[i].session_lock);
+ continue;
+ }
+
+ sl->sessions[i].state = S_STATE_IDLE;
+
+ uint8_t _slot_id = sl->sessions[i].slot_id;
+ uint32_t resource_id = sl->sessions[i].resource_id;
+ pthread_mutex_unlock(&sl->sessions[i].session_lock);
+
+ if (cb)
+ cb(cb_arg, S_SCALLBACK_REASON_CLOSE, _slot_id, i, resource_id);
+ }
+ return;
+ }
+
+ case T_CALLBACK_REASON_SLOTCLOSE:
+ {
+ pthread_mutex_lock(&sl->setcallback_lock);
+ en50221_sl_session_callback cb = sl->session;
+ void *cb_arg = sl->session_arg;
+ pthread_mutex_unlock(&sl->setcallback_lock);
+
+ for (i = 0; i < sl->max_sessions; i++) {
+ pthread_mutex_lock(&sl->sessions[i].session_lock);
+
+ if (sl->sessions[i].state == S_STATE_IDLE) {
+ pthread_mutex_unlock(&sl->sessions[i].session_lock);
+ continue;
+ }
+ if (sl->sessions[i].slot_id != slot_id) {
+ pthread_mutex_unlock(&sl->sessions[i].session_lock);
+ continue;
+ }
+ sl->sessions[i].state = S_STATE_IDLE;
+
+ uint32_t resource_id = sl->sessions[i].resource_id;
+ pthread_mutex_unlock(&sl->sessions[i].session_lock);
+
+ if (cb)
+ cb(cb_arg, S_SCALLBACK_REASON_CLOSE, slot_id, i, resource_id);
+
+ }
+ return;
+ }
+ }
+
+ // sanity check data length
+ if (data_length < 1) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %i\n",
+ slot_id);
+ return;
+ }
+ // deal with the data
+ uint8_t spdu_tag = data[0];
+ switch (spdu_tag) {
+ case ST_OPEN_SESSION_REQ:
+ en50221_sl_handle_open_session_request(sl, data + 1,
+ data_length - 1,
+ slot_id,
+ connection_id);
+ break;
+
+ case ST_CLOSE_SESSION_REQ:
+ en50221_sl_handle_close_session_request(sl, data + 1,
+ data_length - 1,
+ slot_id,
+ connection_id);
+ break;
+
+ case ST_SESSION_NUMBER:
+ en50221_sl_handle_session_package(sl, data + 1,
+ data_length - 1, slot_id,
+ connection_id);
+ break;
+
+ case ST_CREATE_SESSION_RES:
+ en50221_sl_handle_create_session_response(sl, data + 1,
+ data_length - 1,
+ slot_id,
+ connection_id);
+ break;
+
+ case ST_CLOSE_SESSION_RES:
+ en50221_sl_handle_close_session_response(sl, data + 1,
+ data_length - 1,
+ slot_id,
+ connection_id);
+ break;
+
+ default:
+ print(LOG_LEVEL, ERROR, 1,
+ "Received unknown session tag %02x from module on slot %i",
+ spdu_tag, slot_id);
+ break;
+ }
}
-static int en50221_sl_alloc_new_session(struct en50221_session_layer_private *private,
- uint32_t resource_id,
- uint8_t slot_id,
- uint8_t connection_id,
- en50221_sl_resource_callback callback, void* arg)
+static int en50221_sl_alloc_new_session(struct en50221_session_layer *sl,
+ uint32_t resource_id,
+ uint8_t slot_id,
+ uint8_t connection_id,
+ en50221_sl_resource_callback
+ callback, void *arg)
{
- int session_number = -1;
- uint32_t i;
- for(i = 1; i < private->max_sessions; i++) {
- if (private->sessions[i].state == S_STATE_IDLE) {
- session_number = i;
- break;
- }
- }
- if (session_number == -1) {
- private->error = EN50221ERR_OUTOFSESSIONS;
- return -1;
- }
-
- // setup the session
- private->sessions[session_number].state = S_STATE_IN_CREATION;
- private->sessions[session_number].resource_id = resource_id;
- private->sessions[session_number].slot_id = slot_id;
- private->sessions[session_number].connection_id = connection_id;
- private->sessions[session_number].callback = callback;
- private->sessions[session_number].callback_arg = arg;
-
- // ok
- return session_number;
+ int session_number = -1;
+ uint32_t i;
+ for (i = 1; i < sl->max_sessions; i++) {
+ if (sl->sessions[i].state == S_STATE_IDLE) {
+ session_number = i;
+ break;
+ }
+ }
+ if (session_number == -1) {
+ sl->error = EN50221ERR_OUTOFSESSIONS;
+ return -1;
+ }
+ // setup the session
+ sl->sessions[session_number].state = S_STATE_IN_CREATION;
+ sl->sessions[session_number].resource_id = resource_id;
+ sl->sessions[session_number].slot_id = slot_id;
+ sl->sessions[session_number].connection_id = connection_id;
+ sl->sessions[session_number].callback = callback;
+ sl->sessions[session_number].callback_arg = arg;
+
+ // ok
+ return session_number;
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_session.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_session.h
index 67031d8..7b33518 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_session.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_session.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 session layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian@jusst.de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -26,28 +26,27 @@
#define __EN50221_SESSION_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
#include <stdint.h>
#include <libdvben50221/en50221_transport.h>
-#define S_SCALLBACK_REASON_CAMCONNECTING 0x00 // CAM originated session connecting to resource (check for availability)
-#define S_SCALLBACK_REASON_CAMCONNECTED 0x01 // CAM originated session connection established succesfully
-#define S_SCALLBACK_REASON_CAMCONNECTFAIL 0x02 // CAM originated session connection failed
-#define S_SCALLBACK_REASON_CONNECTED 0x03 // Host originated session ACKed by CAM.
-#define S_SCALLBACK_REASON_CONNECTFAIL 0x04 // Host originated session NACKed by CAM.
-#define S_SCALLBACK_REASON_CLOSE 0x05 // Session closed
-#define S_SCALLBACK_REASON_TC_CONNECT 0x06 // A host originated transport connection has been established.
-#define S_SCALLBACK_REASON_TC_CAMCONNECT 0x07 // A CAM originated transport connection has been established.
+#define S_SCALLBACK_REASON_CAMCONNECTING 0x00 // CAM originated session connecting to resource (check for availability)
+#define S_SCALLBACK_REASON_CAMCONNECTED 0x01 // CAM originated session connection established succesfully
+#define S_SCALLBACK_REASON_CAMCONNECTFAIL 0x02 // CAM originated session connection failed
+#define S_SCALLBACK_REASON_CONNECTED 0x03 // Host originated session ACKed by CAM.
+#define S_SCALLBACK_REASON_CONNECTFAIL 0x04 // Host originated session NACKed by CAM.
+#define S_SCALLBACK_REASON_CLOSE 0x05 // Session closed
+#define S_SCALLBACK_REASON_TC_CONNECT 0x06 // A host originated transport connection has been established.
+#define S_SCALLBACK_REASON_TC_CAMCONNECT 0x07 // A CAM originated transport connection has been established.
/**
* Opaque type representing a session layer.
*/
-typedef void *en50221_session_layer;
+struct en50221_session_layer;
/**
* Type definition for resource callback function - called by session layer when data
@@ -61,9 +60,12 @@ typedef void *en50221_session_layer;
* @param data_length Length of data in bytes.
* @return 0 on success, or -1 on failure.
*/
-typedef int (*en50221_sl_resource_callback)(void *arg, uint8_t slot_id,
- uint16_t session_number, uint32_t resource_id,
- uint8_t *data, uint32_t data_length);
+typedef int (*en50221_sl_resource_callback) (void *arg,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id,
+ uint8_t * data,
+ uint32_t data_length);
/**
* Type definition for resource lookup callback function - used by the session layer to
@@ -80,9 +82,12 @@ typedef int (*en50221_sl_resource_callback)(void *arg, uint8_t slot_id,
* -2 if it exists, but had a lower version, or
* -3 if it exists, but was unavailable.
*/
-typedef int (*en50221_sl_lookup_callback)(void *arg, uint8_t slot_id, uint32_t requested_resource_id,
- en50221_sl_resource_callback *callback_out, void **arg_out,
- uint32_t *resource_id_out);
+typedef int (*en50221_sl_lookup_callback) (void *arg,
+ uint8_t slot_id,
+ uint32_t requested_resource_id,
+ en50221_sl_resource_callback * callback_out,
+ void **arg_out,
+ uint32_t *resource_id_out);
/**
@@ -96,8 +101,10 @@ typedef int (*en50221_sl_lookup_callback)(void *arg, uint8_t slot_id, uint32_t r
* @param resource_id Resource id.
* @return 0 on sucess, or -1 on error.
*/
-typedef int (*en50221_sl_session_callback)(void *arg, int reason,
- uint8_t slot_id, uint16_t session_number, uint32_t resource_id);
+typedef int (*en50221_sl_session_callback) (void *arg, int reason,
+ uint8_t slot_id,
+ uint16_t session_number,
+ uint32_t resource_id);
/**
* Construct a new instance of the session layer.
@@ -106,14 +113,15 @@ typedef int (*en50221_sl_session_callback)(void *arg, int reason,
* @param max_sessions Maximum number of sessions supported.
* @return The en50221_session_layer instance, or NULL on error.
*/
-extern en50221_session_layer en50221_sl_create(en50221_transport_layer tl, uint32_t max_sessions);
+extern struct en50221_session_layer *en50221_sl_create(struct en50221_transport_layer *tl,
+ uint32_t max_sessions);
/**
* Destroy an instance of the session layer.
*
* @param tl The en50221_session_layer instance.
*/
-extern void en50221_sl_destroy(en50221_session_layer sl);
+extern void en50221_sl_destroy(struct en50221_session_layer *sl);
/**
* Gets the last error.
@@ -121,7 +129,7 @@ extern void en50221_sl_destroy(en50221_session_layer sl);
* @param tl The en50221_session_layer instance.
* @return One of the EN50221ERR_* values.
*/
-extern int en50221_sl_get_error(en50221_session_layer tl);
+extern int en50221_sl_get_error(struct en50221_session_layer *tl);
/**
* Register the callback for resource lookup.
@@ -130,8 +138,9 @@ extern int en50221_sl_get_error(en50221_session_layer tl);
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_sl_register_lookup_callback(en50221_session_layer sl,
- en50221_sl_lookup_callback callback, void *arg);
+extern void en50221_sl_register_lookup_callback(struct en50221_session_layer *sl,
+ en50221_sl_lookup_callback callback,
+ void *arg);
/**
* Register the callback for informing about session from a cam.
@@ -140,8 +149,9 @@ extern void en50221_sl_register_lookup_callback(en50221_session_layer sl,
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_sl_register_session_callback(en50221_session_layer sl,
- en50221_sl_session_callback callback, void *arg);
+extern void en50221_sl_register_session_callback(struct en50221_session_layer *sl,
+ en50221_sl_session_callback callback,
+ void *arg);
/**
* Create a new session to a module in a slot.
@@ -153,9 +163,11 @@ extern void en50221_sl_register_session_callback(en50221_session_layer sl,
* @param arg Argument to pass to the callback.
* @return The new session_number, or -1 on error.
*/
-extern int en50221_sl_create_session(en50221_session_layer sl, int slot_id, uint8_t connection_id,
- uint32_t resource_id,
- en50221_sl_resource_callback callback, void* arg);
+extern int en50221_sl_create_session(struct en50221_session_layer *sl, int slot_id,
+ uint8_t connection_id,
+ uint32_t resource_id,
+ en50221_sl_resource_callback callback,
+ void *arg);
/**
* Destroy a session.
@@ -164,7 +176,8 @@ extern int en50221_sl_create_session(en50221_session_layer sl, int slot_id, uint
* @param session_number The session to destroy.
* @return 0 on success, or -1 on error.
*/
-extern int en50221_sl_destroy_session(en50221_session_layer sl, uint16_t session_number);
+extern int en50221_sl_destroy_session(struct en50221_session_layer *sl,
+ uint16_t session_number);
/**
* this function is used to take a data-block, pack into
@@ -176,7 +189,10 @@ extern int en50221_sl_destroy_session(en50221_session_layer sl, uint16_t session
* @param data_length Length of data in bytes.
* @return 0 on success, or -1 on error.
*/
-extern int en50221_sl_send_data(en50221_session_layer sl, uint16_t session_number, uint8_t *data, uint16_t data_length);
+extern int en50221_sl_send_data(struct en50221_session_layer *sl,
+ uint16_t session_number,
+ uint8_t * data,
+ uint16_t data_length);
/**
* this function is used to take a data-block, pack into
@@ -188,8 +204,10 @@ extern int en50221_sl_send_data(en50221_session_layer sl, uint16_t session_numbe
* @param iov_count Number of elements in io vector.
* @return 0 on success, or -1 on error.
*/
-extern int en50221_sl_send_datav(en50221_session_layer sl, uint16_t session_number,
- struct iovec *vector, int iov_count);
+extern int en50221_sl_send_datav(struct en50221_session_layer *sl,
+ uint16_t session_number,
+ struct iovec *vector,
+ int iov_count);
/**
* this is used to send a message to all sessions, linked
@@ -202,11 +220,13 @@ extern int en50221_sl_send_datav(en50221_session_layer sl, uint16_t session_numb
* @param data_length Length of data in bytes.
* @return 0 on success, or -1 on error.
*/
-extern int en50221_sl_broadcast_data(en50221_session_layer sl, int slot_id, uint32_t resource_id,
- uint8_t *data, uint16_t data_length);
+extern int en50221_sl_broadcast_data(struct en50221_session_layer *sl,
+ int slot_id,
+ uint32_t resource_id,
+ uint8_t * data,
+ uint16_t data_length);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam.c
new file mode 100644
index 0000000..a00a844
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam.c
@@ -0,0 +1,54 @@
+/*
+ en50221 encoder An implementation for libdvb
+ an implementation for the en50221 transport layer
+
+ Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <limits.h>
+#include <string.h>
+#include <errno.h>
+#include <libdvbapi/dvbca.h>
+#include "en50221_stdcam.h"
+
+struct en50221_stdcam *en50221_stdcam_create(int adapter, int slotnum,
+ struct en50221_transport_layer *tl,
+ struct en50221_session_layer *sl)
+{
+ struct en50221_stdcam *result = NULL;
+
+ int cafd = dvbca_open(adapter, 0);
+ if (cafd == -1)
+ return NULL;
+
+ int ca_type = dvbca_get_interface_type(cafd, slotnum);
+ switch(ca_type) {
+ case DVBCA_INTERFACE_LINK:
+ result = en50221_stdcam_llci_create(cafd, slotnum, tl, sl);
+ break;
+
+ case DVBCA_INTERFACE_HLCI:
+ result = en50221_stdcam_hlci_create(cafd, slotnum);
+ break;
+ }
+
+ if (result == NULL)
+ close(cafd);
+ return result;
+}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam.h
new file mode 100644
index 0000000..154ff76
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam.h
@@ -0,0 +1,102 @@
+/*
+ en50221 encoder An implementation for libdvb
+ an implementation for the en50221 transport layer
+
+ Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef EN50221_STDCAM_H
+#define EN50221_STDCAM_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libdvben50221/en50221_app_ai.h>
+#include <libdvben50221/en50221_app_ca.h>
+#include <libdvben50221/en50221_app_mmi.h>
+#include <libdvben50221/en50221_session.h>
+#include <libdvben50221/en50221_transport.h>
+
+enum en50221_stdcam_status {
+ EN50221_STDCAM_CAM_NONE,
+ EN50221_STDCAM_CAM_INRESET,
+ EN50221_STDCAM_CAM_OK,
+ EN50221_STDCAM_CAM_BAD,
+};
+
+struct en50221_stdcam {
+ /* one of more of the following may be NULL if a CAM does not support it */
+ struct en50221_app_ai *ai_resource;
+ struct en50221_app_ca *ca_resource;
+ struct en50221_app_mmi *mmi_resource;
+
+ /* if any of these are -1, no connection is in place to this resource yet */
+ int ai_session_number;
+ int ca_session_number;
+ int mmi_session_number;
+
+ /* poll the stdcam instance */
+ enum en50221_stdcam_status (*poll)(struct en50221_stdcam *stdcam);
+
+ /* inform the stdcam of the current DVB time */
+ void (*dvbtime)(struct en50221_stdcam *stdcam, time_t dvbtime);
+
+ /* destroy the stdcam instance */
+ void (*destroy)(struct en50221_stdcam *stdcam, int closefd);
+};
+
+/**
+ * Create an instance of the STDCAM for an LLCI interface.
+ *
+ * @param cafd FD of the CA device.
+ * @param slotnum Slotnum on that CA device.
+ * @param tl Transport layer instance to use.
+ * @param sl Session layer instance to use.
+ * @return en50221_stdcam instance, or NULL on error.
+ */
+extern struct en50221_stdcam *en50221_stdcam_llci_create(int cafd, int slotnum,
+ struct en50221_transport_layer *tl,
+ struct en50221_session_layer *sl);
+
+/**
+ * Create an instance of the STDCAM for an HLCI interface.
+ *
+ * @param cafd FD of the CA device.
+ * @param slotnum Slotnum on that CA device.
+ * @return en50221_stdcam instance, or NULL on error.
+ */
+extern struct en50221_stdcam *en50221_stdcam_hlci_create(int cafd, int slotnum);
+
+/**
+ * Convenience method to create a STDCAM interface for a ca device on a particular adapter.
+ *
+ * @param adapter The DVB adapter concerned.
+ * @param slotnum The ca slot number on that adapter.
+ * @param tl Transport layer instance to use (unused for HLCI cams).
+ * @param sl Session layer instance to use (unused for HLCI cams).
+ * @return en50221_stdcam instance, or NULL on error.
+ */
+extern struct en50221_stdcam *en50221_stdcam_create(int adapter, int slotnum,
+ struct en50221_transport_layer *tl,
+ struct en50221_session_layer *sl);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam_hlci.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam_hlci.c
new file mode 100644
index 0000000..f21637b
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam_hlci.c
@@ -0,0 +1,216 @@
+/*
+ en50221 encoder An implementation for libdvb
+ an implementation for the en50221 transport layer
+
+ Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <limits.h>
+#include <string.h>
+#include <errno.h>
+#include <libdvbapi/dvbca.h>
+#include "en50221_app_utils.h"
+#include "en50221_app_tags.h"
+#include "en50221_stdcam.h"
+
+
+struct en50221_stdcam_hlci {
+ struct en50221_stdcam stdcam;
+
+ int cafd;
+ int slotnum;
+ int initialised;
+ struct en50221_app_send_functions sendfuncs;
+};
+
+static void en50221_stdcam_hlci_destroy(struct en50221_stdcam *stdcam, int closefd);
+static enum en50221_stdcam_status en50221_stdcam_hlci_poll(struct en50221_stdcam *stdcam);
+static int hlci_cam_added(struct en50221_stdcam_hlci *hlci);
+static int hlci_send_data(void *arg, uint16_t session_number,
+ uint8_t * data, uint16_t data_length);
+static int hlci_send_datav(void *arg, uint16_t session_number,
+ struct iovec *vector, int iov_count);
+
+
+
+
+struct en50221_stdcam *en50221_stdcam_hlci_create(int cafd, int slotnum)
+{
+ // try and allocate space for the HLCI stdcam
+ struct en50221_stdcam_hlci *hlci =
+ malloc(sizeof(struct en50221_stdcam_hlci));
+ if (hlci == NULL) {
+ return NULL;
+ }
+ memset(hlci, 0, sizeof(struct en50221_stdcam_hlci));
+
+ // create the sendfuncs
+ hlci->sendfuncs.arg = hlci;
+ hlci->sendfuncs.send_data = hlci_send_data;
+ hlci->sendfuncs.send_datav = hlci_send_datav;
+
+ // create the resources (NOTE: we just use fake session numbers here)
+ hlci->stdcam.ai_resource = en50221_app_ai_create(&hlci->sendfuncs);
+ hlci->stdcam.ai_session_number = 0;
+ hlci->stdcam.ca_resource = en50221_app_ca_create(&hlci->sendfuncs);
+ hlci->stdcam.ca_session_number = 1;
+// hlci->stdcam.mmi_resource = en50221_app_mmi_create(&hlci->sendfuncs);
+ hlci->stdcam.mmi_session_number = -1;
+
+ // done
+ hlci->stdcam.destroy = en50221_stdcam_hlci_destroy;
+ hlci->stdcam.poll = en50221_stdcam_hlci_poll;
+ hlci->slotnum = slotnum;
+ hlci->cafd = cafd;
+ return &hlci->stdcam;
+}
+
+static void en50221_stdcam_hlci_destroy(struct en50221_stdcam *stdcam, int closefd)
+{
+ struct en50221_stdcam_hlci *hlci = (struct en50221_stdcam_hlci *) stdcam;
+
+ if (hlci->stdcam.ai_resource)
+ en50221_app_ai_destroy(hlci->stdcam.ai_resource);
+ if (hlci->stdcam.ca_resource)
+ en50221_app_ca_destroy(hlci->stdcam.ca_resource);
+ if (hlci->stdcam.mmi_resource)
+ en50221_app_mmi_destroy(hlci->stdcam.mmi_resource);
+
+ if (closefd)
+ close(hlci->cafd);
+
+ free(hlci);
+}
+
+static enum en50221_stdcam_status en50221_stdcam_hlci_poll(struct en50221_stdcam *stdcam)
+{
+ struct en50221_stdcam_hlci *hlci = (struct en50221_stdcam_hlci *) stdcam;
+
+ switch(dvbca_get_cam_state(hlci->cafd, hlci->slotnum)) {
+ case DVBCA_CAMSTATE_MISSING:
+ hlci->initialised = 0;
+ break;
+
+ case DVBCA_CAMSTATE_READY:
+ case DVBCA_CAMSTATE_INITIALISING:
+ if (!hlci->initialised)
+ hlci_cam_added(hlci);
+ break;
+ }
+
+ // delay to prevent busy loop
+ usleep(10);
+
+ if (!hlci->initialised) {
+ return EN50221_STDCAM_CAM_NONE;
+ }
+ return EN50221_STDCAM_CAM_OK;
+}
+
+
+
+static int hlci_cam_added(struct en50221_stdcam_hlci *hlci)
+{
+ uint8_t buf[256];
+ int size;
+
+ // get application information
+ if (en50221_app_ai_enquiry(hlci->stdcam.ai_resource, 0)) {
+ return -EIO;
+ }
+ if ((size = dvbca_hlci_read(hlci->cafd, TAG_APP_INFO, buf, sizeof(buf))) < 0) {
+ return size;
+ }
+ if (en50221_app_ai_message(hlci->stdcam.ai_resource, 0, 0, EN50221_APP_AI_RESOURCEID, buf, size)) {
+ return -EIO;
+ }
+
+ // we forge a fake CA_INFO here so the main app works - since it will expect a CA_INFO
+ // this will be replaced with a proper call (below) when the driver support is there
+ buf[0] = TAG_CA_INFO >> 16;
+ buf[1] = (uint8_t) (TAG_CA_INFO >> 8);
+ buf[2] = (uint8_t) TAG_CA_INFO;
+ buf[3] = 0;
+ if (en50221_app_ca_message(hlci->stdcam.ca_resource, 0, 0, EN50221_APP_CA_RESOURCEID, buf, 4)) {
+ return -EIO;
+ }
+
+ /*
+ // get CA information
+ if (en50221_app_ca_info_enq(ca_resource, 0)) {
+ fprintf(stderr, "Failed to send CA INFO enquiry\n");
+ cafd = -1;
+ return -1;
+ }
+ if ((size = dvbca_hlci_read(cafd, TAG_CA_INFO, buf, sizeof(buf))) < 0) {
+ fprintf(stderr, "Failed to read CA INFO\n");
+ cafd = -1;
+ return -1;
+ }
+ if (en50221_app_ca_message(ca_resource, 0, 0, EN50221_APP_CA_RESOURCEID, buf, size)) {
+ fprintf(stderr, "Failed to parse CA INFO\n");
+ cafd = -1;
+ return -1;
+ }
+ */
+
+ // done
+ hlci->initialised = 1;
+ return 0;
+}
+
+static int hlci_send_data(void *arg, uint16_t session_number,
+ uint8_t * data, uint16_t data_length)
+{
+ (void) session_number;
+ struct en50221_stdcam_hlci *hlci = arg;
+
+ return dvbca_hlci_write(hlci->cafd, data, data_length);
+}
+
+static int hlci_send_datav(void *arg, uint16_t session_number,
+ struct iovec *vector, int iov_count)
+{
+ (void) session_number;
+ struct en50221_stdcam_hlci *hlci = arg;
+
+ // calculate the total length of the data to send
+ uint32_t data_size = 0;
+ int i;
+ for (i = 0; i < iov_count; i++) {
+ data_size += vector[i].iov_len;
+ }
+
+ // allocate memory for it
+ uint8_t *buf = malloc(data_size);
+ if (buf == NULL) {
+ return -1;
+ }
+ // merge the iovecs
+ uint32_t pos = 0;
+ for (i = 0; i < iov_count; i++) {
+ memcpy(buf + pos, vector[i].iov_base, vector[i].iov_len);
+ pos += vector[i].iov_len;
+ }
+
+ // sendit and cleanup
+ int status = dvbca_hlci_write(hlci->cafd, buf, data_size);
+ free(buf);
+ return status;
+}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam_llci.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam_llci.c
new file mode 100644
index 0000000..ceaa027
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_stdcam_llci.c
@@ -0,0 +1,437 @@
+/*
+ en50221 encoder An implementation for libdvb
+ an implementation for the en50221 transport layer
+
+ Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <limits.h>
+#include <string.h>
+#include <errno.h>
+#include <libdvbapi/dvbca.h>
+#include <libdvbmisc/dvbmisc.h>
+#include "en50221_app_rm.h"
+#include "en50221_app_datetime.h"
+#include "en50221_app_utils.h"
+#include "en50221_app_tags.h"
+#include "en50221_stdcam.h"
+
+#define LLCI_RESPONSE_TIMEOUT_MS 1000
+#define LLCI_POLL_DELAY_MS 100
+
+/* resource IDs we support */
+static uint32_t resource_ids[] =
+{ EN50221_APP_RM_RESOURCEID,
+ EN50221_APP_CA_RESOURCEID,
+ EN50221_APP_AI_RESOURCEID,
+ EN50221_APP_MMI_RESOURCEID,
+ EN50221_APP_DATETIME_RESOURCEID,
+};
+#define RESOURCE_IDS_COUNT sizeof(resource_ids)/4
+
+struct llci_resource {
+ struct en50221_app_public_resource_id resid;
+ uint32_t binary_resource_id;
+ en50221_sl_resource_callback callback;
+ void *arg;
+};
+
+struct en50221_stdcam_llci {
+ struct en50221_stdcam stdcam;
+
+ int cafd;
+ int slotnum;
+ int state;
+
+ struct llci_resource resources[RESOURCE_IDS_COUNT];
+
+ struct en50221_transport_layer *tl;
+ struct en50221_session_layer *sl;
+ struct en50221_app_send_functions sendfuncs;
+ int tl_slot_id;
+
+ struct en50221_app_rm *rm_resource;
+
+ struct en50221_app_datetime *datetime_resource;
+ int datetime_session_number;
+ uint8_t datetime_response_interval;
+ time_t datetime_next_send;
+ time_t datetime_dvbtime;
+};
+
+static enum en50221_stdcam_status en50221_stdcam_llci_poll(struct en50221_stdcam *stdcam);
+static void en50221_stdcam_llci_dvbtime(struct en50221_stdcam *stdcam, time_t dvbtime);
+static void en50221_stdcam_llci_destroy(struct en50221_stdcam *stdcam, int closefd);
+static void llci_cam_added(struct en50221_stdcam_llci *llci);
+static void llci_cam_in_reset(struct en50221_stdcam_llci *llci);
+static void llci_cam_removed(struct en50221_stdcam_llci *llci);
+
+
+static int llci_lookup_callback(void *arg, uint8_t _slot_id, uint32_t requested_resource_id,
+ en50221_sl_resource_callback *callback_out, void **arg_out,
+ uint32_t *connected_resource_id);
+static int llci_session_callback(void *arg, int reason, uint8_t _slot_id, uint16_t session_number, uint32_t resource_id);
+static int llci_rm_enq_callback(void *arg, uint8_t _slot_id, uint16_t session_number);
+static int llci_rm_reply_callback(void *arg, uint8_t _slot_id, uint16_t session_number, uint32_t resource_id_count, uint32_t *_resource_ids);
+static int llci_rm_changed_callback(void *arg, uint8_t _slot_id, uint16_t session_number);
+
+static int llci_datetime_enquiry_callback(void *arg, uint8_t _slot_id, uint16_t session_number, uint8_t response_interval);
+
+
+struct en50221_stdcam *en50221_stdcam_llci_create(int cafd, int slotnum,
+ struct en50221_transport_layer *tl,
+ struct en50221_session_layer *sl)
+{
+ // try and allocate space for the LLCI stdcam
+ struct en50221_stdcam_llci *llci =
+ malloc(sizeof(struct en50221_stdcam_llci));
+ if (llci == NULL) {
+ return NULL;
+ }
+ memset(llci, 0, sizeof(struct en50221_stdcam_llci));
+
+ // create the sendfuncs
+ llci->sendfuncs.arg = sl;
+ llci->sendfuncs.send_data = (en50221_send_data) en50221_sl_send_data;
+ llci->sendfuncs.send_datav = (en50221_send_datav) en50221_sl_send_datav;
+
+ // create the resource manager resource
+ int resource_idx = 0;
+ llci->rm_resource = en50221_app_rm_create(&llci->sendfuncs);
+ en50221_app_decode_public_resource_id(&llci->resources[resource_idx].resid, EN50221_APP_RM_RESOURCEID);
+ llci->resources[resource_idx].binary_resource_id = EN50221_APP_RM_RESOURCEID;
+ llci->resources[resource_idx].callback = (en50221_sl_resource_callback) en50221_app_rm_message;
+ llci->resources[resource_idx].arg = llci->rm_resource;
+ en50221_app_rm_register_enq_callback(llci->rm_resource, llci_rm_enq_callback, llci);
+ en50221_app_rm_register_reply_callback(llci->rm_resource, llci_rm_reply_callback, llci);
+ en50221_app_rm_register_changed_callback(llci->rm_resource, llci_rm_changed_callback, llci);
+ resource_idx++;
+
+ // create the datetime resource
+ llci->datetime_resource = en50221_app_datetime_create(&llci->sendfuncs);
+ en50221_app_decode_public_resource_id(&llci->resources[resource_idx].resid, EN50221_APP_DATETIME_RESOURCEID);
+ llci->resources[resource_idx].binary_resource_id = EN50221_APP_DATETIME_RESOURCEID;
+ llci->resources[resource_idx].callback = (en50221_sl_resource_callback) en50221_app_datetime_message;
+ llci->resources[resource_idx].arg = llci->datetime_resource;
+ en50221_app_datetime_register_enquiry_callback(llci->datetime_resource, llci_datetime_enquiry_callback, llci);
+ resource_idx++;
+ llci->datetime_session_number = -1;
+ llci->datetime_response_interval = 0;
+ llci->datetime_next_send = 0;
+ llci->datetime_dvbtime = 0;
+
+ // create the application information resource
+ llci->stdcam.ai_resource = en50221_app_ai_create(&llci->sendfuncs);
+ en50221_app_decode_public_resource_id(&llci->resources[resource_idx].resid, EN50221_APP_AI_RESOURCEID);
+ llci->resources[resource_idx].binary_resource_id = EN50221_APP_AI_RESOURCEID;
+ llci->resources[resource_idx].callback = (en50221_sl_resource_callback) en50221_app_ai_message;
+ llci->resources[resource_idx].arg = llci->stdcam.ai_resource;
+ llci->stdcam.ai_session_number = -1;
+ resource_idx++;
+
+ // create the CA resource
+ llci->stdcam.ca_resource = en50221_app_ca_create(&llci->sendfuncs);
+ en50221_app_decode_public_resource_id(&llci->resources[resource_idx].resid, EN50221_APP_CA_RESOURCEID);
+ llci->resources[resource_idx].binary_resource_id = EN50221_APP_CA_RESOURCEID;
+ llci->resources[resource_idx].callback = (en50221_sl_resource_callback) en50221_app_ca_message;
+ llci->resources[resource_idx].arg = llci->stdcam.ca_resource;
+ llci->stdcam.ca_session_number = -1;
+ resource_idx++;
+
+ // create the MMI resource
+ llci->stdcam.mmi_resource = en50221_app_mmi_create(&llci->sendfuncs);
+ en50221_app_decode_public_resource_id(&llci->resources[resource_idx].resid, EN50221_APP_MMI_RESOURCEID);
+ llci->resources[resource_idx].binary_resource_id = EN50221_APP_MMI_RESOURCEID;
+ llci->resources[resource_idx].callback = (en50221_sl_resource_callback) en50221_app_mmi_message;
+ llci->resources[resource_idx].arg = llci->stdcam.mmi_resource;
+ llci->stdcam.mmi_session_number = -1;
+ resource_idx++;
+
+ // register session layer callbacks
+ en50221_sl_register_lookup_callback(sl, llci_lookup_callback, llci);
+ en50221_sl_register_session_callback(sl, llci_session_callback, llci);
+
+ // done
+ llci->stdcam.destroy = en50221_stdcam_llci_destroy;
+ llci->stdcam.poll = en50221_stdcam_llci_poll;
+ llci->stdcam.dvbtime = en50221_stdcam_llci_dvbtime;
+ llci->cafd = cafd;
+ llci->slotnum = slotnum;
+ llci->tl = tl;
+ llci->sl = sl;
+ llci->tl_slot_id = -1;
+ llci->state = EN50221_STDCAM_CAM_INRESET;
+ return &llci->stdcam;
+}
+
+static void en50221_stdcam_llci_dvbtime(struct en50221_stdcam *stdcam, time_t dvbtime)
+{
+ struct en50221_stdcam_llci *llci = (struct en50221_stdcam_llci *) stdcam;
+
+ llci->datetime_dvbtime = dvbtime;
+}
+
+static void en50221_stdcam_llci_destroy(struct en50221_stdcam *stdcam, int closefd)
+{
+ struct en50221_stdcam_llci *llci = (struct en50221_stdcam_llci *) stdcam;
+
+ // "remove" the cam
+ llci_cam_removed(llci);
+
+ // destroy resources
+ if (llci->rm_resource)
+ en50221_app_rm_destroy(llci->rm_resource);
+ if (llci->datetime_resource)
+ en50221_app_datetime_destroy(llci->datetime_resource);
+ if (llci->stdcam.ai_resource)
+ en50221_app_ai_destroy(llci->stdcam.ai_resource);
+ if (llci->stdcam.ca_resource)
+ en50221_app_ca_destroy(llci->stdcam.ca_resource);
+ if (llci->stdcam.mmi_resource)
+ en50221_app_mmi_destroy(llci->stdcam.mmi_resource);
+
+ if (closefd)
+ close(llci->cafd);
+
+ free(llci);
+}
+
+
+
+
+static enum en50221_stdcam_status en50221_stdcam_llci_poll(struct en50221_stdcam *stdcam)
+{
+ struct en50221_stdcam_llci *llci = (struct en50221_stdcam_llci *) stdcam;
+
+ switch(dvbca_get_cam_state(llci->cafd, llci->slotnum)) {
+ case DVBCA_CAMSTATE_MISSING:
+ if (llci->state != EN50221_STDCAM_CAM_NONE)
+ llci_cam_removed(llci);
+ break;
+
+ case DVBCA_CAMSTATE_READY:
+ if (llci->state == EN50221_STDCAM_CAM_NONE)
+ llci_cam_added(llci);
+ else if (llci->state == EN50221_STDCAM_CAM_INRESET)
+ llci_cam_in_reset(llci);
+ break;
+ }
+
+ // poll the stack
+ int error;
+ if ((error = en50221_tl_poll(llci->tl)) != 0) {
+ print(LOG_LEVEL, ERROR, 1, "Error reported by stack:%i\n", en50221_tl_get_error(llci->tl));
+ }
+
+ // send date/time response
+ if (llci->datetime_session_number != -1) {
+ time_t cur_time = time(NULL);
+ if (llci->datetime_response_interval && (cur_time > llci->datetime_next_send)) {
+ en50221_app_datetime_send(llci->datetime_resource,
+ llci->datetime_session_number,
+ llci->datetime_dvbtime, 0);
+ llci->datetime_next_send = cur_time + llci->datetime_response_interval;
+ }
+ }
+
+ return llci->state;
+}
+
+static void llci_cam_added(struct en50221_stdcam_llci *llci)
+{
+ // clear down any old structures
+ if (llci->tl_slot_id != -1) {
+ llci_cam_removed(llci);
+ }
+
+ // reset the CAM
+ dvbca_reset(llci->cafd, llci->slotnum);
+ llci->state = EN50221_STDCAM_CAM_INRESET;
+}
+
+static void llci_cam_in_reset(struct en50221_stdcam_llci *llci)
+{
+ if (dvbca_get_cam_state(llci->cafd, llci->slotnum) != DVBCA_CAMSTATE_READY) {
+ return;
+ }
+
+ // register the slot
+ if ((llci->tl_slot_id = en50221_tl_register_slot(llci->tl, llci->cafd, llci->slotnum,
+ LLCI_RESPONSE_TIMEOUT_MS, LLCI_POLL_DELAY_MS)) < 0) {
+ llci->state = EN50221_STDCAM_CAM_BAD;
+ return;
+ }
+
+ // create a new connection on the slot
+ if (en50221_tl_new_tc(llci->tl, llci->tl_slot_id) < 0) {
+ llci->state = EN50221_STDCAM_CAM_BAD;
+ llci->tl_slot_id = -1;
+ en50221_tl_destroy_slot(llci->tl, llci->tl_slot_id);
+ return;
+ }
+
+ llci->state = EN50221_STDCAM_CAM_OK;
+}
+
+static void llci_cam_removed(struct en50221_stdcam_llci *llci)
+{
+ if (llci->tl_slot_id != -1) {
+ en50221_tl_destroy_slot(llci->tl, llci->tl_slot_id);
+ llci->tl_slot_id = -1;
+ llci->datetime_session_number = -1;
+ llci->stdcam.ai_session_number = -1;
+ llci->stdcam.ca_session_number = -1;
+ llci->stdcam.mmi_session_number = -1;
+ }
+ llci->state = EN50221_STDCAM_CAM_NONE;
+}
+
+
+
+static int llci_lookup_callback(void *arg, uint8_t _slot_id, uint32_t requested_resource_id,
+ en50221_sl_resource_callback *callback_out, void **arg_out,
+ uint32_t *connected_resource_id)
+{
+ struct en50221_app_public_resource_id resid;
+ struct en50221_stdcam_llci *llci = (struct en50221_stdcam_llci *) arg;
+ (void) _slot_id;
+
+ // decode the resource id
+ if (!en50221_app_decode_public_resource_id(&resid, requested_resource_id)) {
+ return -1;
+ }
+
+ // try and find an instance of the resource
+ uint32_t i;
+ for(i=0; i<RESOURCE_IDS_COUNT; i++) {
+ if ((resid.resource_class == llci->resources[i].resid.resource_class) &&
+ (resid.resource_type == llci->resources[i].resid.resource_type)) {
+
+ // limit sessions to certain resources
+ switch(requested_resource_id) {
+ case EN50221_APP_DATETIME_RESOURCEID:
+ if (llci->datetime_session_number != -1)
+ return -3;
+ break;
+ case EN50221_APP_AI_RESOURCEID:
+ if (llci->stdcam.ai_session_number != -1)
+ return -3;
+ break;
+ case EN50221_APP_CA_RESOURCEID:
+ if (llci->stdcam.ca_session_number != -1)
+ return -3;
+ break;
+ case EN50221_APP_MMI_RESOURCEID:
+ if (llci->stdcam.mmi_session_number != -1)
+ return -3;
+ break;
+ }
+
+ // resource is ok.
+ *callback_out = llci->resources[i].callback;
+ *arg_out = llci->resources[i].arg;
+ *connected_resource_id = llci->resources[i].binary_resource_id;
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+static int llci_session_callback(void *arg, int reason, uint8_t _slot_id, uint16_t session_number, uint32_t resource_id)
+{
+ struct en50221_stdcam_llci *llci = (struct en50221_stdcam_llci *) arg;
+ (void) _slot_id;
+
+ switch(reason) {
+ case S_SCALLBACK_REASON_CAMCONNECTED:
+ if (resource_id == EN50221_APP_RM_RESOURCEID) {
+ en50221_app_rm_enq(llci->rm_resource, session_number);
+ } else if (resource_id == EN50221_APP_DATETIME_RESOURCEID) {
+ llci->datetime_session_number = session_number;
+ } else if (resource_id == EN50221_APP_AI_RESOURCEID) {
+ en50221_app_ai_enquiry(llci->stdcam.ai_resource, session_number);
+ llci->stdcam.ai_session_number = session_number;
+ } else if (resource_id == EN50221_APP_CA_RESOURCEID) {
+ en50221_app_ca_info_enq(llci->stdcam.ca_resource, session_number);
+ llci->stdcam.ca_session_number = session_number;
+ } else if (resource_id == EN50221_APP_MMI_RESOURCEID) {
+ llci->stdcam.mmi_session_number = session_number;
+ }
+
+ break;
+ case S_SCALLBACK_REASON_CLOSE:
+ if (resource_id == EN50221_APP_MMI_RESOURCEID) {
+ llci->stdcam.mmi_session_number = -1;
+ }
+
+ break;
+ }
+ return 0;
+}
+
+static int llci_rm_enq_callback(void *arg, uint8_t _slot_id, uint16_t session_number)
+{
+ struct en50221_stdcam_llci *llci = (struct en50221_stdcam_llci *) arg;
+ (void) _slot_id;
+
+ if (en50221_app_rm_reply(llci->rm_resource, session_number, RESOURCE_IDS_COUNT, resource_ids)) {
+ print(LOG_LEVEL, ERROR, 1, "Failed to send RM ENQ on slot %02x\n", _slot_id);
+ }
+ return 0;
+}
+
+static int llci_rm_reply_callback(void *arg, uint8_t _slot_id, uint16_t session_number, uint32_t resource_id_count, uint32_t *_resource_ids)
+{
+ struct en50221_stdcam_llci *llci = (struct en50221_stdcam_llci *) arg;
+ (void) _slot_id;
+ (void) resource_id_count;
+ (void) _resource_ids;
+
+ if (en50221_app_rm_changed(llci->rm_resource, session_number)) {
+ print(LOG_LEVEL, ERROR, 1, "Failed to send RM REPLY on slot %02x\n", _slot_id);
+ }
+ return 0;
+}
+
+static int llci_rm_changed_callback(void *arg, uint8_t _slot_id, uint16_t session_number)
+{
+ struct en50221_stdcam_llci *llci = (struct en50221_stdcam_llci *) arg;
+ (void) _slot_id;
+
+ if (en50221_app_rm_enq(llci->rm_resource, session_number)) {
+ print(LOG_LEVEL, ERROR, 1, "Failed to send RM CHANGED on slot %02x\n", _slot_id);
+ }
+ return 0;
+}
+
+static int llci_datetime_enquiry_callback(void *arg, uint8_t _slot_id, uint16_t session_number, uint8_t response_interval)
+{
+ struct en50221_stdcam_llci *llci = (struct en50221_stdcam_llci *) arg;
+ (void) _slot_id;
+
+ llci->datetime_response_interval = response_interval;
+ llci->datetime_next_send = 0;
+ if (response_interval) {
+ llci->datetime_next_send = time(NULL) + response_interval;
+ }
+ en50221_app_datetime_send(llci->datetime_resource, session_number, llci->datetime_dvbtime, 0);
+
+ return 0;
+}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_transport.c b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_transport.c
index 015c127..f6f46db 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_transport.c
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_transport.c
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 transport layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
@@ -37,1204 +37,1260 @@
// these are the Transport Tags, like
// described in EN50221, Annex A.4.1.13 (pg70)
-#define T_SB 0x80 // sb primitive h<--m
-#define T_RCV 0x81 // receive primitive h-->m
-#define T_CREATE_T_C 0x82 // create transport connection primitive h-->m
-#define T_C_T_C_REPLY 0x83 // ctc reply primitive h<--m
-#define T_DELETE_T_C 0x84 // delete tc primitive h<->m
-#define T_D_T_C_REPLY 0x85 // dtc reply primitive h<->m
-#define T_REQUEST_T_C 0x86 // request transport connection primitive h<--m
-#define T_NEW_T_C 0x87 // new tc / reply to t_request primitive h-->m
-#define T_T_C_ERROR 0x77 // error creating tc primitive h-->m
-#define T_DATA_LAST 0xA0 // convey data from higher constructed h<->m
- // layers
-#define T_DATA_MORE 0xA1 // convey data from higher constructed h<->m
- // layers
+#define T_SB 0x80 // sb primitive h<--m
+#define T_RCV 0x81 // receive primitive h-->m
+#define T_CREATE_T_C 0x82 // create transport connection primitive h-->m
+#define T_C_T_C_REPLY 0x83 // ctc reply primitive h<--m
+#define T_DELETE_T_C 0x84 // delete tc primitive h<->m
+#define T_D_T_C_REPLY 0x85 // dtc reply primitive h<->m
+#define T_REQUEST_T_C 0x86 // request transport connection primitive h<--m
+#define T_NEW_T_C 0x87 // new tc / reply to t_request primitive h-->m
+#define T_T_C_ERROR 0x77 // error creating tc primitive h-->m
+#define T_DATA_LAST 0xA0 // convey data from higher constructed h<->m
+ // layers
+#define T_DATA_MORE 0xA1 // convey data from higher constructed h<->m
+ // layers
struct en50221_message {
- struct en50221_message *next;
- uint32_t length;
- uint8_t data[0];
+ struct en50221_message *next;
+ uint32_t length;
+ uint8_t data[0];
};
struct en50221_connection {
- uint32_t state; // the current state: idle/in_delete/in_create/active
- struct timeval tx_time; // time last request was sent from host->module, or 0 if ok
- struct timeval last_poll_time; // time of last poll transmission
- uint8_t *chain_buffer; // used to save parts of chained packets
- uint32_t buffer_length;
-
- struct en50221_message *send_queue;
- struct en50221_message *send_queue_tail;
+ uint32_t state; // the current state: idle/in_delete/in_create/active
+ struct timeval tx_time; // time last request was sent from host->module, or 0 if ok
+ struct timeval last_poll_time; // time of last poll transmission
+ uint8_t *chain_buffer; // used to save parts of chained packets
+ uint32_t buffer_length;
+
+ struct en50221_message *send_queue;
+ struct en50221_message *send_queue_tail;
};
struct en50221_slot {
- int ca_hndl;
- uint8_t slot; // CAM slot
- struct en50221_connection *connections;
+ int ca_hndl;
+ uint8_t slot; // CAM slot
+ struct en50221_connection *connections;
- pthread_mutex_t slot_lock;
+ pthread_mutex_t slot_lock;
- uint32_t response_timeout;
- uint32_t poll_delay;
+ uint32_t response_timeout;
+ uint32_t poll_delay;
};
-struct en50221_transport_layer_private
-{
- uint8_t max_slots;
- uint8_t max_connections_per_slot;
- struct en50221_slot *slots;
- struct pollfd *slot_pollfds;
- int slots_changed;
+struct en50221_transport_layer {
+ uint8_t max_slots;
+ uint8_t max_connections_per_slot;
+ struct en50221_slot *slots;
+ struct pollfd *slot_pollfds;
+ int slots_changed;
- pthread_mutex_t global_lock;
- pthread_mutex_t setcallback_lock;
+ pthread_mutex_t global_lock;
+ pthread_mutex_t setcallback_lock;
- int error;
- int error_slot;
+ int error;
+ int error_slot;
- en50221_tl_callback callback;
- void *callback_arg;
+ en50221_tl_callback callback;
+ void *callback_arg;
};
-static int en50221_tl_process_data(struct en50221_transport_layer_private *tl, uint8_t slot_id,
- uint8_t *data, uint32_t data_length);
-static int en50221_tl_poll_tc(struct en50221_transport_layer_private *tl, uint8_t slot_id, uint8_t connection_id);
-static int en50221_tl_alloc_new_tc(struct en50221_transport_layer_private *tl, uint8_t slot_id);
-static void queue_message(struct en50221_transport_layer_private *tl, uint8_t slot_id,
- uint8_t connection_id, struct en50221_message *msg);
-static int en50221_tl_handle_create_tc_reply(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id);
-static int en50221_tl_handle_delete_tc(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id);
-static int en50221_tl_handle_delete_tc_reply(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id);
-static int en50221_tl_handle_request_tc(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id);
-static int en50221_tl_handle_data_more(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id,
- uint8_t *data, uint32_t data_length);
-static int en50221_tl_handle_data_last(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id,
- uint8_t *data, uint32_t data_length);
-static int en50221_tl_handle_sb(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id,
- uint8_t *data, uint32_t data_length);
-
-
-en50221_transport_layer en50221_tl_create(uint8_t max_slots, uint8_t max_connections_per_slot)
+static int en50221_tl_process_data(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t * data,
+ uint32_t data_length);
+static int en50221_tl_poll_tc(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t connection_id);
+static int en50221_tl_alloc_new_tc(struct en50221_transport_layer *tl,
+ uint8_t slot_id);
+static void queue_message(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t connection_id,
+ struct en50221_message *msg);
+static int en50221_tl_handle_create_tc_reply(struct en50221_transport_layer
+ *tl, uint8_t slot_id,
+ uint8_t connection_id);
+static int en50221_tl_handle_delete_tc(struct en50221_transport_layer *tl,
+ uint8_t slot_id,
+ uint8_t connection_id);
+static int en50221_tl_handle_delete_tc_reply(struct en50221_transport_layer
+ *tl, uint8_t slot_id,
+ uint8_t connection_id);
+static int en50221_tl_handle_request_tc(struct en50221_transport_layer *tl,
+ uint8_t slot_id,
+ uint8_t connection_id);
+static int en50221_tl_handle_data_more(struct en50221_transport_layer *tl,
+ uint8_t slot_id,
+ uint8_t connection_id,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_tl_handle_data_last(struct en50221_transport_layer *tl,
+ uint8_t slot_id,
+ uint8_t connection_id,
+ uint8_t * data,
+ uint32_t data_length);
+static int en50221_tl_handle_sb(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t connection_id,
+ uint8_t * data, uint32_t data_length);
+
+
+struct en50221_transport_layer *en50221_tl_create(uint8_t max_slots,
+ uint8_t
+ max_connections_per_slot)
{
- struct en50221_transport_layer_private *private = NULL;
- int i;
- int j;
-
- // setup structure
- private = (struct en50221_transport_layer_private*) malloc(sizeof(struct en50221_transport_layer_private));
- if (private == NULL)
- goto error_exit;
- private->max_slots = max_slots;
- private->max_connections_per_slot = max_connections_per_slot;
- private->slots = NULL;
- private->slot_pollfds = NULL;
- private->slots_changed = 1;
- private->callback = NULL;
- private->callback_arg = NULL;
- private->error_slot = 0;
- private->error = 0;
- pthread_mutex_init(&private->global_lock, NULL);
- pthread_mutex_init(&private->setcallback_lock, NULL);
-
- // create the slots
- private->slots = malloc(sizeof(struct en50221_slot) * max_slots);
- if (private->slots == NULL)
- goto error_exit;
-
- // set them up
- for(i=0; i< max_slots; i++) {
- private->slots[i].ca_hndl = -1;
-
- // create the connections for this slot
- private->slots[i].connections = malloc(sizeof(struct en50221_connection) * max_connections_per_slot);
- if (private->slots[i].connections == NULL)
- goto error_exit;
-
- // create a mutex for the slot
- pthread_mutex_init(&private->slots[i].slot_lock, NULL);
-
- // set them up
- for(j = 0; j < max_connections_per_slot; j++) {
- private->slots[i].connections[j].state = T_STATE_IDLE;
- private->slots[i].connections[j].tx_time.tv_sec = 0;
- private->slots[i].connections[j].last_poll_time.tv_sec = 0;
- private->slots[i].connections[j].last_poll_time.tv_usec = 0;
- private->slots[i].connections[j].chain_buffer = NULL;
- private->slots[i].connections[j].buffer_length = 0;
- private->slots[i].connections[j].send_queue = NULL;
- private->slots[i].connections[j].send_queue_tail = NULL;
- }
- }
-
- // create the pollfds
- private->slot_pollfds = malloc(sizeof(struct pollfd) * max_slots);
- if (private->slot_pollfds == NULL) {
- goto error_exit;
- }
- memset(private->slot_pollfds, 0, sizeof(struct pollfd) * max_slots);
-
- return private;
-
-error_exit:
- en50221_tl_destroy(private);
- return NULL;
+ struct en50221_transport_layer *tl = NULL;
+ int i;
+ int j;
+
+ // setup structure
+ tl = (struct en50221_transport_layer *)
+ malloc(sizeof(struct en50221_transport_layer));
+ if (tl == NULL)
+ goto error_exit;
+ tl->max_slots = max_slots;
+ tl->max_connections_per_slot = max_connections_per_slot;
+ tl->slots = NULL;
+ tl->slot_pollfds = NULL;
+ tl->slots_changed = 1;
+ tl->callback = NULL;
+ tl->callback_arg = NULL;
+ tl->error_slot = 0;
+ tl->error = 0;
+ pthread_mutex_init(&tl->global_lock, NULL);
+ pthread_mutex_init(&tl->setcallback_lock, NULL);
+
+ // create the slots
+ tl->slots = malloc(sizeof(struct en50221_slot) * max_slots);
+ if (tl->slots == NULL)
+ goto error_exit;
+
+ // set them up
+ for (i = 0; i < max_slots; i++) {
+ tl->slots[i].ca_hndl = -1;
+
+ // create the connections for this slot
+ tl->slots[i].connections =
+ malloc(sizeof(struct en50221_connection) * max_connections_per_slot);
+ if (tl->slots[i].connections == NULL)
+ goto error_exit;
+
+ // create a mutex for the slot
+ pthread_mutex_init(&tl->slots[i].slot_lock, NULL);
+
+ // set them up
+ for (j = 0; j < max_connections_per_slot; j++) {
+ tl->slots[i].connections[j].state = T_STATE_IDLE;
+ tl->slots[i].connections[j].tx_time.tv_sec = 0;
+ tl->slots[i].connections[j].last_poll_time.tv_sec = 0;
+ tl->slots[i].connections[j].last_poll_time.tv_usec = 0;
+ tl->slots[i].connections[j].chain_buffer = NULL;
+ tl->slots[i].connections[j].buffer_length = 0;
+ tl->slots[i].connections[j].send_queue = NULL;
+ tl->slots[i].connections[j].send_queue_tail = NULL;
+ }
+ }
+
+ // create the pollfds
+ tl->slot_pollfds = malloc(sizeof(struct pollfd) * max_slots);
+ if (tl->slot_pollfds == NULL) {
+ goto error_exit;
+ }
+ memset(tl->slot_pollfds, 0, sizeof(struct pollfd) * max_slots);
+
+ return tl;
+
+ error_exit:
+ en50221_tl_destroy(tl);
+ return NULL;
}
// Destroy an instance of the transport layer
-void en50221_tl_destroy(en50221_transport_layer tl)
+void en50221_tl_destroy(struct en50221_transport_layer *tl)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
- int i, j;
-
- if (private) {
- if (private->slots) {
- for(i=0; i< private->max_slots; i++) {
- if (private->slots[i].connections) {
- for(j=0; j<private->max_connections_per_slot; j++) {
- if (private->slots[i].connections[j].chain_buffer) {
- free(private->slots[i].connections[j].chain_buffer);
- }
-
- struct en50221_message *cur_msg = private->slots[i].connections[j].send_queue;
- while(cur_msg) {
- struct en50221_message *next_msg = cur_msg->next;
- free(cur_msg);
- cur_msg = next_msg;
- }
- private->slots[i].connections[j].send_queue = NULL;
- private->slots[i].connections[j].send_queue_tail = NULL;
- }
- free(private->slots[i].connections);
- pthread_mutex_destroy(&private->slots[i].slot_lock);
- }
- }
- free(private->slots);
- }
- if (private->slot_pollfds) {
- free(private->slot_pollfds);
- }
- pthread_mutex_destroy(&private->setcallback_lock);
- pthread_mutex_destroy(&private->global_lock);
- free(private);
- }
+ int i, j;
+
+ if (tl) {
+ if (tl->slots) {
+ for (i = 0; i < tl->max_slots; i++) {
+ if (tl->slots[i].connections) {
+ for (j = 0; j < tl->max_connections_per_slot; j++) {
+ if (tl->slots[i].connections[j].chain_buffer) {
+ free(tl->slots[i].connections[j].chain_buffer);
+ }
+
+ struct en50221_message *cur_msg =
+ tl->slots[i].connections[j].send_queue;
+ while (cur_msg) {
+ struct en50221_message *next_msg = cur_msg->next;
+ free(cur_msg);
+ cur_msg = next_msg;
+ }
+ tl->slots[i].connections[j].send_queue = NULL;
+ tl->slots[i].connections[j].send_queue_tail = NULL;
+ }
+ free(tl->slots[i].connections);
+ pthread_mutex_destroy(&tl->slots[i].slot_lock);
+ }
+ }
+ free(tl->slots);
+ }
+ if (tl->slot_pollfds) {
+ free(tl->slot_pollfds);
+ }
+ pthread_mutex_destroy(&tl->setcallback_lock);
+ pthread_mutex_destroy(&tl->global_lock);
+ free(tl);
+ }
}
// this can be called from the user-space app to
// register new slots that we should work with
-int en50221_tl_register_slot(en50221_transport_layer tl, int ca_hndl, uint8_t slot,
- uint32_t response_timeout, uint32_t poll_delay)
+int en50221_tl_register_slot(struct en50221_transport_layer *tl,
+ int ca_hndl, uint8_t slot,
+ uint32_t response_timeout,
+ uint32_t poll_delay)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
-
- // lock
- pthread_mutex_lock(&private->global_lock);
-
- // we browse through the array of slots
- // to look for the first unused one
- int i;
- int16_t slot_id = -1;
- for(i=0; i < private->max_slots; i++) {
- if (private->slots[i].ca_hndl == -1) {
- slot_id = i;
- break;
- }
- }
- if (slot_id == -1) {
- private->error = EN50221ERR_OUTOFSLOTS;
- pthread_mutex_unlock(&private->global_lock);
- return -1;
- }
-
- // set up the slot struct
- pthread_mutex_lock(&private->slots[slot_id].slot_lock);
- private->slots[slot_id].ca_hndl = ca_hndl;
- private->slots[slot_id].slot = slot;
- private->slots[slot_id].response_timeout = response_timeout;
- private->slots[slot_id].poll_delay = poll_delay;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
-
- private->slots_changed = 1;
- pthread_mutex_unlock(&private->global_lock);
- return slot_id;
+ // lock
+ pthread_mutex_lock(&tl->global_lock);
+
+ // we browse through the array of slots
+ // to look for the first unused one
+ int i;
+ int16_t slot_id = -1;
+ for (i = 0; i < tl->max_slots; i++) {
+ if (tl->slots[i].ca_hndl == -1) {
+ slot_id = i;
+ break;
+ }
+ }
+ if (slot_id == -1) {
+ tl->error = EN50221ERR_OUTOFSLOTS;
+ pthread_mutex_unlock(&tl->global_lock);
+ return -1;
+ }
+ // set up the slot struct
+ pthread_mutex_lock(&tl->slots[slot_id].slot_lock);
+ tl->slots[slot_id].ca_hndl = ca_hndl;
+ tl->slots[slot_id].slot = slot;
+ tl->slots[slot_id].response_timeout = response_timeout;
+ tl->slots[slot_id].poll_delay = poll_delay;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+
+ tl->slots_changed = 1;
+ pthread_mutex_unlock(&tl->global_lock);
+ return slot_id;
}
-void en50221_tl_destroy_slot(en50221_transport_layer tl, uint8_t slot_id)
+void en50221_tl_destroy_slot(struct en50221_transport_layer *tl,
+ uint8_t slot_id)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
- int i;
-
- if (slot_id >= private->max_slots)
- return;
-
- // lock
- pthread_mutex_lock(&private->global_lock);
-
- // clear the slot
- pthread_mutex_lock(&private->slots[slot_id].slot_lock);
- private->slots[slot_id].ca_hndl = -1;
- for(i=0; i<private->max_connections_per_slot; i++) {
- private->slots[slot_id].connections[i].state = T_STATE_IDLE;
- private->slots[slot_id].connections[i].tx_time.tv_sec = 0;
- private->slots[slot_id].connections[i].last_poll_time.tv_sec = 0;
- private->slots[slot_id].connections[i].last_poll_time.tv_usec = 0;
- if (private->slots[slot_id].connections[i].chain_buffer) {
- free(private->slots[slot_id].connections[i].chain_buffer);
- }
- private->slots[slot_id].connections[i].chain_buffer = NULL;
- private->slots[slot_id].connections[i].buffer_length = 0;
-
- struct en50221_message *cur_msg = private->slots[slot_id].connections[i].send_queue;
- while(cur_msg) {
- struct en50221_message *next_msg = cur_msg->next;
- free(cur_msg);
- cur_msg = next_msg;
- }
- private->slots[slot_id].connections[i].send_queue = NULL;
- private->slots[slot_id].connections[i].send_queue_tail = NULL;
- }
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
-
- // tell upper layers
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_tl_callback cb = private->callback;
- void *cb_arg = private->callback_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
- if (cb)
- cb(cb_arg, T_CALLBACK_REASON_SLOTCLOSE, NULL, 0, slot_id, 0);
-
- private->slots_changed = 1;
- pthread_mutex_unlock(&private->global_lock);
+ int i;
+
+ if (slot_id >= tl->max_slots)
+ return;
+
+ // lock
+ pthread_mutex_lock(&tl->global_lock);
+
+ // clear the slot
+ pthread_mutex_lock(&tl->slots[slot_id].slot_lock);
+ tl->slots[slot_id].ca_hndl = -1;
+ for (i = 0; i < tl->max_connections_per_slot; i++) {
+ tl->slots[slot_id].connections[i].state = T_STATE_IDLE;
+ tl->slots[slot_id].connections[i].tx_time.tv_sec = 0;
+ tl->slots[slot_id].connections[i].last_poll_time.tv_sec = 0;
+ tl->slots[slot_id].connections[i].last_poll_time.tv_usec = 0;
+ if (tl->slots[slot_id].connections[i].chain_buffer) {
+ free(tl->slots[slot_id].connections[i].
+ chain_buffer);
+ }
+ tl->slots[slot_id].connections[i].chain_buffer = NULL;
+ tl->slots[slot_id].connections[i].buffer_length = 0;
+
+ struct en50221_message *cur_msg =
+ tl->slots[slot_id].connections[i].send_queue;
+ while (cur_msg) {
+ struct en50221_message *next_msg = cur_msg->next;
+ free(cur_msg);
+ cur_msg = next_msg;
+ }
+ tl->slots[slot_id].connections[i].send_queue = NULL;
+ tl->slots[slot_id].connections[i].send_queue_tail = NULL;
+ }
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+
+ // tell upper layers
+ pthread_mutex_lock(&tl->setcallback_lock);
+ en50221_tl_callback cb = tl->callback;
+ void *cb_arg = tl->callback_arg;
+ pthread_mutex_unlock(&tl->setcallback_lock);
+ if (cb)
+ cb(cb_arg, T_CALLBACK_REASON_SLOTCLOSE, NULL, 0, slot_id, 0);
+
+ tl->slots_changed = 1;
+ pthread_mutex_unlock(&tl->global_lock);
}
-int en50221_tl_poll(en50221_transport_layer tl)
+int en50221_tl_poll(struct en50221_transport_layer *tl)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
- uint8_t data[4096];
- int slot_id;
- int j;
-
- // make up pollfds if the slots have changed
- pthread_mutex_lock(&private->global_lock);
- if (private->slots_changed) {
- for(slot_id = 0; slot_id < private->max_slots; slot_id++) {
- if (private->slots[slot_id].ca_hndl != -1) {
- private->slot_pollfds[slot_id].fd = private->slots[slot_id].ca_hndl;
- private->slot_pollfds[slot_id].events = POLLIN|POLLPRI|POLLERR;
- private->slot_pollfds[slot_id].revents = 0;
- } else {
- private->slot_pollfds[slot_id].fd = 0;
- private->slot_pollfds[slot_id].events = 0;
- private->slot_pollfds[slot_id].revents = 0;
- }
- }
- private->slots_changed = 0;
- }
- pthread_mutex_unlock(&private->global_lock);
-
- // anything happened?
- if (poll(private->slot_pollfds, private->max_slots, 10) < 0) {
- private->error_slot = -1;
- private->error = EN50221ERR_CAREAD;
- return -1;
- }
-
- // go through all slots (even though poll may not have reported any events
- for(slot_id = 0; slot_id < private->max_slots; slot_id++) {
-
- // check if this slot is still used and get its handle
- pthread_mutex_lock(&private->slots[slot_id].slot_lock);
- if (private->slots[slot_id].ca_hndl == -1) {
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- continue;
- }
- int ca_hndl = private->slots[slot_id].ca_hndl;
-
- if (private->slot_pollfds[slot_id].revents & (POLLPRI | POLLIN)) {
- // read data
- uint8_t r_slot_id;
- uint8_t connection_id;
- int readcnt = dvbca_link_read(ca_hndl, &r_slot_id, &connection_id, data, sizeof(data));
- if (readcnt < 0) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_CAREAD;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
-
- // process it if we got some
- if (readcnt > 0) {
- if (private->slots[slot_id].slot != r_slot_id) {
- // this message is for an other CAM of the same CA
- int new_slot_id;
- for(new_slot_id = 0; new_slot_id < private->max_slots; new_slot_id++) {
- if ((private->slots[new_slot_id].ca_hndl == ca_hndl) && (private->slots[new_slot_id].slot == r_slot_id))
- break;
- }
- if (new_slot_id != private->max_slots) {
- // we found the requested CAM
- pthread_mutex_lock(&private->slots[new_slot_id].slot_lock);
- if (en50221_tl_process_data(private, new_slot_id, data, readcnt)) {
- pthread_mutex_unlock(&private->slots[new_slot_id].slot_lock);
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- pthread_mutex_unlock(&private->slots[new_slot_id].slot_lock);
- } else {
- private->error = EN50221ERR_BADSLOTID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- }
- else if (en50221_tl_process_data(private, slot_id, data, readcnt)) {
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- }
- } else if (private->slot_pollfds[slot_id].revents & POLLERR) {
- // an error was reported
- private->error_slot = slot_id;
- private->error = EN50221ERR_CAREAD;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
-
- // poll the connections on this slot + check for timeouts
- for(j=0; j < private->max_connections_per_slot; j++) {
- // ignore connection if idle
- if (private->slots[slot_id].connections[j].state == T_STATE_IDLE) {
- continue;
- }
-
- // send queued data
- if (private->slots[slot_id].connections[j].state & (T_STATE_IN_CREATION|T_STATE_ACTIVE|T_STATE_ACTIVE_DELETEQUEUED)) {
- // send data if there is some to go and we're not waiting for a response already
- if (private->slots[slot_id].connections[j].send_queue &&
- (private->slots[slot_id].connections[j].tx_time.tv_sec == 0)) {
-
- // get the message
- struct en50221_message *msg = private->slots[slot_id].connections[j].send_queue;
- if (msg->next != NULL) {
- private->slots[slot_id].connections[j].send_queue = msg->next;
- } else {
- private->slots[slot_id].connections[j].send_queue = NULL;
- private->slots[slot_id].connections[j].send_queue_tail = NULL;
- }
-
- // send the message
- if (dvbca_link_write(private->slots[slot_id].ca_hndl, private->slots[slot_id].slot, j, msg->data, msg->length) < 0) {
- free(msg);
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- private->error_slot = slot_id;
- private->error = EN50221ERR_CAWRITE;
- print(LOG_LEVEL, ERROR, 1, "CAWrite failed");
- return -1;
- }
- gettimeofday(&private->slots[slot_id].connections[j].tx_time, 0);
-
- // fixup connection state for T_DELETE_T_C
- if (msg->length && (msg->data[0] == T_DELETE_T_C)) {
- private->slots[slot_id].connections[j].state = T_STATE_IN_DELETION;
- if (private->slots[slot_id].connections[j].chain_buffer) {
- free(private->slots[slot_id].connections[j].chain_buffer);
- }
- private->slots[slot_id].connections[j].chain_buffer = NULL;
- private->slots[slot_id].connections[j].buffer_length = 0;
- }
-
- free(msg);
- }
- }
-
- // poll it if we're not expecting a reponse and the poll time has elapsed
- if (private->slots[slot_id].connections[j].state & T_STATE_ACTIVE) {
- if ((private->slots[slot_id].connections[j].tx_time.tv_sec == 0) &&
- (time_after(private->slots[slot_id].connections[j].last_poll_time, private->slots[slot_id].poll_delay))) {
-
- gettimeofday(&private->slots[slot_id].connections[j].last_poll_time, 0);
- if (en50221_tl_poll_tc(private, slot_id, j)) {
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- }
- }
-
- // check for timeouts - in any state
- if (private->slots[slot_id].connections[j].tx_time.tv_sec &&
- (time_after(private->slots[slot_id].connections[j].tx_time, private->slots[slot_id].response_timeout))) {
-
- if (private->slots[slot_id].connections[j].state & (T_STATE_IN_CREATION|T_STATE_IN_DELETION)) {
- private->slots[slot_id].connections[j].state = T_STATE_IDLE;
- } else if (private->slots[slot_id].connections[j].state & (T_STATE_ACTIVE|T_STATE_ACTIVE_DELETEQUEUED)) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_TIMEOUT;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- }
- }
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- }
-
- return 0;
+ uint8_t data[4096];
+ int slot_id;
+ int j;
+
+ // make up pollfds if the slots have changed
+ pthread_mutex_lock(&tl->global_lock);
+ if (tl->slots_changed) {
+ for (slot_id = 0; slot_id < tl->max_slots; slot_id++) {
+ if (tl->slots[slot_id].ca_hndl != -1) {
+ tl->slot_pollfds[slot_id].fd = tl->slots[slot_id].ca_hndl;
+ tl->slot_pollfds[slot_id].events = POLLIN | POLLPRI | POLLERR;
+ tl->slot_pollfds[slot_id].revents = 0;
+ } else {
+ tl->slot_pollfds[slot_id].fd = 0;
+ tl->slot_pollfds[slot_id].events = 0;
+ tl->slot_pollfds[slot_id].revents = 0;
+ }
+ }
+ tl->slots_changed = 0;
+ }
+ pthread_mutex_unlock(&tl->global_lock);
+
+ // anything happened?
+ if (poll(tl->slot_pollfds, tl->max_slots, 10) < 0) {
+ tl->error_slot = -1;
+ tl->error = EN50221ERR_CAREAD;
+ return -1;
+ }
+ // go through all slots (even though poll may not have reported any events
+ for (slot_id = 0; slot_id < tl->max_slots; slot_id++) {
+
+ // check if this slot is still used and get its handle
+ pthread_mutex_lock(&tl->slots[slot_id].slot_lock);
+ if (tl->slots[slot_id].ca_hndl == -1) {
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ continue;
+ }
+ int ca_hndl = tl->slots[slot_id].ca_hndl;
+
+ if (tl->slot_pollfds[slot_id].revents & (POLLPRI | POLLIN)) {
+ // read data
+ uint8_t r_slot_id;
+ uint8_t connection_id;
+ int readcnt = dvbca_link_read(ca_hndl, &r_slot_id,
+ &connection_id,
+ data, sizeof(data));
+ if (readcnt < 0) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_CAREAD;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ // process it if we got some
+ if (readcnt > 0) {
+ if (tl->slots[slot_id].slot != r_slot_id) {
+ // this message is for an other CAM of the same CA
+ int new_slot_id;
+ for (new_slot_id = 0; new_slot_id < tl->max_slots; new_slot_id++) {
+ if ((tl->slots[new_slot_id].ca_hndl == ca_hndl) &&
+ (tl->slots[new_slot_id].slot == r_slot_id))
+ break;
+ }
+ if (new_slot_id != tl->max_slots) {
+ // we found the requested CAM
+ pthread_mutex_lock(&tl->slots[new_slot_id].slot_lock);
+ if (en50221_tl_process_data(tl, new_slot_id, data, readcnt)) {
+ pthread_mutex_unlock(&tl->slots[new_slot_id].slot_lock);
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ pthread_mutex_unlock(&tl->slots[new_slot_id].slot_lock);
+ } else {
+ tl->error = EN50221ERR_BADSLOTID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ } else
+ if (en50221_tl_process_data(tl, slot_id, data, readcnt)) {
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ }
+ } else if (tl->slot_pollfds[slot_id].revents & POLLERR) {
+ // an error was reported
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_CAREAD;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ // poll the connections on this slot + check for timeouts
+ for (j = 0; j < tl->max_connections_per_slot; j++) {
+ // ignore connection if idle
+ if (tl->slots[slot_id].connections[j].state == T_STATE_IDLE) {
+ continue;
+ }
+ // send queued data
+ if (tl->slots[slot_id].connections[j].state &
+ (T_STATE_IN_CREATION | T_STATE_ACTIVE | T_STATE_ACTIVE_DELETEQUEUED)) {
+ // send data if there is some to go and we're not waiting for a response already
+ if (tl->slots[slot_id].connections[j].send_queue &&
+ (tl->slots[slot_id].connections[j].tx_time.tv_sec == 0)) {
+
+ // get the message
+ struct en50221_message *msg =
+ tl->slots[slot_id].connections[j].send_queue;
+ if (msg->next != NULL) {
+ tl->slots[slot_id].connections[j].send_queue = msg->next;
+ } else {
+ tl->slots[slot_id].connections[j].send_queue = NULL;
+ tl->slots[slot_id].connections[j].send_queue_tail = NULL;
+ }
+
+ // send the message
+ if (dvbca_link_write(tl->slots[slot_id].ca_hndl,
+ tl->slots[slot_id].slot,
+ j,
+ msg->data, msg->length) < 0) {
+ free(msg);
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_CAWRITE;
+ print(LOG_LEVEL, ERROR, 1, "CAWrite failed");
+ return -1;
+ }
+ gettimeofday(&tl->slots[slot_id].connections[j].tx_time, 0);
+
+ // fixup connection state for T_DELETE_T_C
+ if (msg->length && (msg->data[0] == T_DELETE_T_C)) {
+ tl->slots[slot_id].connections[j].state = T_STATE_IN_DELETION;
+ if (tl->slots[slot_id].connections[j].chain_buffer) {
+ free(tl->slots[slot_id].connections[j].chain_buffer);
+ }
+ tl->slots[slot_id].connections[j].chain_buffer = NULL;
+ tl->slots[slot_id].connections[j].buffer_length = 0;
+ }
+
+ free(msg);
+ }
+ }
+ // poll it if we're not expecting a reponse and the poll time has elapsed
+ if (tl->slots[slot_id].connections[j].state & T_STATE_ACTIVE) {
+ if ((tl->slots[slot_id].connections[j].tx_time.tv_sec == 0) &&
+ (time_after(tl->slots[slot_id].connections[j].last_poll_time,
+ tl->slots[slot_id].poll_delay))) {
+
+ gettimeofday(&tl->slots[slot_id].connections[j].last_poll_time, 0);
+ if (en50221_tl_poll_tc(tl, slot_id, j)) {
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ }
+ }
+
+ // check for timeouts - in any state
+ if (tl->slots[slot_id].connections[j].tx_time.tv_sec &&
+ (time_after(tl->slots[slot_id].connections[j].tx_time,
+ tl->slots[slot_id].response_timeout))) {
+
+ if (tl->slots[slot_id].connections[j].state &
+ (T_STATE_IN_CREATION |T_STATE_IN_DELETION)) {
+ tl->slots[slot_id].connections[j].state = T_STATE_IDLE;
+ } else if (tl->slots[slot_id].connections[j].state &
+ (T_STATE_ACTIVE | T_STATE_ACTIVE_DELETEQUEUED)) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_TIMEOUT;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ }
+ }
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ }
+
+ return 0;
}
-void en50221_tl_register_callback(en50221_transport_layer tl, en50221_tl_callback callback, void *arg)
+void en50221_tl_register_callback(struct en50221_transport_layer *tl,
+ en50221_tl_callback callback, void *arg)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
-
- pthread_mutex_lock(&private->setcallback_lock);
- private->callback = callback;
- private->callback_arg = arg;
- pthread_mutex_unlock(&private->setcallback_lock);
+ pthread_mutex_lock(&tl->setcallback_lock);
+ tl->callback = callback;
+ tl->callback_arg = arg;
+ pthread_mutex_unlock(&tl->setcallback_lock);
}
-int en50221_tl_get_error_slot(en50221_transport_layer tl)
+int en50221_tl_get_error_slot(struct en50221_transport_layer *tl)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
- return private->error_slot;
+ return tl->error_slot;
}
-int en50221_tl_get_error(en50221_transport_layer tl)
+int en50221_tl_get_error(struct en50221_transport_layer *tl)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
- return private->error;
+ return tl->error;
}
-int en50221_tl_send_data(en50221_transport_layer tl, uint8_t slot_id, uint8_t connection_id,
- uint8_t *data, uint32_t data_size)
+int en50221_tl_send_data(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t connection_id,
+ uint8_t * data, uint32_t data_size)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
-
#ifdef DEBUG_TXDATA
- printf("[[[[[[[[[[[[[[[[[[[[\n");
- uint32_t ii=0;
- for(ii=0;ii<data_size;ii++) {
- printf("%02x: %02x\n", ii, data[ii]);
- }
- printf("]]]]]]]]]]]]]]]]]]]]\n");
+ printf("[[[[[[[[[[[[[[[[[[[[\n");
+ uint32_t ii = 0;
+ for (ii = 0; ii < data_size; ii++) {
+ printf("%02x: %02x\n", ii, data[ii]);
+ }
+ printf("]]]]]]]]]]]]]]]]]]]]\n");
#endif
- if (slot_id >= private->max_slots) {
- private->error = EN50221ERR_BADSLOTID;
- return -1;
- }
-
- pthread_mutex_lock(&private->slots[slot_id].slot_lock);
- if (private->slots[slot_id].ca_hndl == -1) {
- private->error = EN50221ERR_BADSLOTID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- if (connection_id >= private->max_connections_per_slot) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCONNECTIONID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- if (private->slots[slot_id].connections[connection_id].state != T_STATE_ACTIVE) {
- private->error = EN50221ERR_BADCONNECTIONID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
-
- // allocate msg structure
- struct en50221_message *msg = malloc(sizeof(struct en50221_message)+data_size+10);
- if (msg == NULL) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_OUTOFMEMORY;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
-
- // make up data to send
- int length_field_len;
- msg->data[0] = T_DATA_LAST;
- if ((length_field_len = asn_1_encode(data_size + 1, msg->data + 1, 3)) < 0) {
- free(msg);
- private->error_slot = slot_id;
- private->error = EN50221ERR_ASNENCODE;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- msg->data[1 + length_field_len] = connection_id;
- memcpy(msg->data+1+length_field_len+1, data, data_size);
- msg->length = 1+length_field_len+1+data_size;
-
- // queue it for transmission
- queue_message(private, slot_id, connection_id, msg);
-
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return 0;
+ if (slot_id >= tl->max_slots) {
+ tl->error = EN50221ERR_BADSLOTID;
+ return -1;
+ }
+
+ pthread_mutex_lock(&tl->slots[slot_id].slot_lock);
+ if (tl->slots[slot_id].ca_hndl == -1) {
+ tl->error = EN50221ERR_BADSLOTID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ if (connection_id >= tl->max_connections_per_slot) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCONNECTIONID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ if (tl->slots[slot_id].connections[connection_id].state != T_STATE_ACTIVE) {
+ tl->error = EN50221ERR_BADCONNECTIONID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ // allocate msg structure
+ struct en50221_message *msg =
+ malloc(sizeof(struct en50221_message) + data_size + 10);
+ if (msg == NULL) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_OUTOFMEMORY;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ // make up data to send
+ int length_field_len;
+ msg->data[0] = T_DATA_LAST;
+ if ((length_field_len = asn_1_encode(data_size + 1, msg->data + 1, 3)) < 0) {
+ free(msg);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_ASNENCODE;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ msg->data[1 + length_field_len] = connection_id;
+ memcpy(msg->data + 1 + length_field_len + 1, data, data_size);
+ msg->length = 1 + length_field_len + 1 + data_size;
+
+ // queue it for transmission
+ queue_message(tl, slot_id, connection_id, msg);
+
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return 0;
}
-int en50221_tl_send_datav(en50221_transport_layer tl, uint8_t slot_id, uint8_t connection_id,
- struct iovec *vector, int iov_count)
+int en50221_tl_send_datav(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t connection_id,
+ struct iovec *vector, int iov_count)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
-
#ifdef DEBUG_TXDATA
- printf("[[[[[[[[[[[[[[[[[[[[\n");
- uint32_t ii=0;
- uint32_t iipos=0;
- for(ii=0;ii<(uint32_t) iov_count;ii++) {
- uint32_t jj;
- for(jj=0; jj< vector[ii].iov_len; jj++) {
- printf("%02x: %02x\n", jj+iipos, *((uint8_t*) (vector[ii].iov_base) +jj));
- }
- iipos += vector[ii].iov_len;
- }
- printf("]]]]]]]]]]]]]]]]]]]]\n");
+ printf("[[[[[[[[[[[[[[[[[[[[\n");
+ uint32_t ii = 0;
+ uint32_t iipos = 0;
+ for (ii = 0; ii < (uint32_t) iov_count; ii++) {
+ uint32_t jj;
+ for (jj = 0; jj < vector[ii].iov_len; jj++) {
+ printf("%02x: %02x\n", jj + iipos,
+ *((uint8_t *) (vector[ii].iov_base) + jj));
+ }
+ iipos += vector[ii].iov_len;
+ }
+ printf("]]]]]]]]]]]]]]]]]]]]\n");
#endif
- if (slot_id >= private->max_slots) {
- private->error = EN50221ERR_BADSLOTID;
- return -1;
- }
-
- pthread_mutex_lock(&private->slots[slot_id].slot_lock);
- if (private->slots[slot_id].ca_hndl == -1) {
- private->error = EN50221ERR_BADSLOTID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- if (connection_id >= private->max_connections_per_slot) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCONNECTIONID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- if (private->slots[slot_id].connections[connection_id].state != T_STATE_ACTIVE) {
- private->error = EN50221ERR_BADCONNECTIONID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
-
- // calculate the total length of the data to send
- uint32_t data_size = 0;
- int i;
- for(i=0; i< iov_count; i++) {
- data_size += vector[i].iov_len;
- }
-
- // allocate msg structure
- struct en50221_message *msg = malloc(sizeof(struct en50221_message)+data_size+10);
- if (msg == NULL) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_OUTOFMEMORY;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
-
- // make up data to send
- int length_field_len;
- msg->data[0] = T_DATA_LAST;
- if ((length_field_len = asn_1_encode(data_size + 1, msg->data + 1, 3)) < 0) {
- free(msg);
- private->error_slot = slot_id;
- private->error = EN50221ERR_ASNENCODE;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- msg->data[1 + length_field_len] = connection_id;
- msg->length = 1+length_field_len+1+data_size;
- msg->next = NULL;
-
- // merge the iovecs
- uint32_t pos = 1+length_field_len+1;
- for(i=0; i< iov_count; i++) {
- memcpy(msg->data+pos, vector[i].iov_base, vector[i].iov_len);
- pos += vector[i].iov_len;
- }
-
- // queue it for transmission
- queue_message(private, slot_id, connection_id, msg);
-
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return 0;
+ if (slot_id >= tl->max_slots) {
+ tl->error = EN50221ERR_BADSLOTID;
+ return -1;
+ }
+
+ pthread_mutex_lock(&tl->slots[slot_id].slot_lock);
+ if (tl->slots[slot_id].ca_hndl == -1) {
+ tl->error = EN50221ERR_BADSLOTID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ if (connection_id >= tl->max_connections_per_slot) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCONNECTIONID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ if (tl->slots[slot_id].connections[connection_id].state != T_STATE_ACTIVE) {
+ tl->error = EN50221ERR_BADCONNECTIONID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ // calculate the total length of the data to send
+ uint32_t data_size = 0;
+ int i;
+ for (i = 0; i < iov_count; i++) {
+ data_size += vector[i].iov_len;
+ }
+
+ // allocate msg structure
+ struct en50221_message *msg =
+ malloc(sizeof(struct en50221_message) + data_size + 10);
+ if (msg == NULL) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_OUTOFMEMORY;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ // make up data to send
+ int length_field_len;
+ msg->data[0] = T_DATA_LAST;
+ if ((length_field_len = asn_1_encode(data_size + 1, msg->data + 1, 3)) < 0) {
+ free(msg);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_ASNENCODE;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ msg->data[1 + length_field_len] = connection_id;
+ msg->length = 1 + length_field_len + 1 + data_size;
+ msg->next = NULL;
+
+ // merge the iovecs
+ uint32_t pos = 1 + length_field_len + 1;
+ for (i = 0; i < iov_count; i++) {
+ memcpy(msg->data + pos, vector[i].iov_base,
+ vector[i].iov_len);
+ pos += vector[i].iov_len;
+ }
+
+ // queue it for transmission
+ queue_message(tl, slot_id, connection_id, msg);
+
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return 0;
}
-int en50221_tl_new_tc(en50221_transport_layer tl, uint8_t slot_id)
+int en50221_tl_new_tc(struct en50221_transport_layer *tl, uint8_t slot_id)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
-
- // check
- if (slot_id >= private->max_slots) {
- private->error = EN50221ERR_BADSLOTID;
- return -1;
- }
-
- pthread_mutex_lock(&private->slots[slot_id].slot_lock);
- if (private->slots[slot_id].ca_hndl == -1) {
- private->error = EN50221ERR_BADSLOTID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
-
- // allocate a new connection if possible
- int conid = en50221_tl_alloc_new_tc(private, slot_id);
- if (conid == -1) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_OUTOFCONNECTIONS;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
-
- // allocate msg structure
- struct en50221_message *msg = malloc(sizeof(struct en50221_message)+3);
- if (msg == NULL) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_OUTOFMEMORY;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
-
- // make up the data to send
- msg->data[0] = T_CREATE_T_C;
- msg->data[1] = 1;
- msg->data[2] = conid;
- msg->length = 3;
- msg->next = NULL;
-
- // queue it for transmission
- queue_message(private, slot_id, conid, msg);
-
- // done
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return conid;
+ // check
+ if (slot_id >= tl->max_slots) {
+ tl->error = EN50221ERR_BADSLOTID;
+ return -1;
+ }
+
+ pthread_mutex_lock(&tl->slots[slot_id].slot_lock);
+ if (tl->slots[slot_id].ca_hndl == -1) {
+ tl->error = EN50221ERR_BADSLOTID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ // allocate a new connection if possible
+ int conid = en50221_tl_alloc_new_tc(tl, slot_id);
+ if (conid == -1) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_OUTOFCONNECTIONS;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ // allocate msg structure
+ struct en50221_message *msg =
+ malloc(sizeof(struct en50221_message) + 3);
+ if (msg == NULL) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_OUTOFMEMORY;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ // make up the data to send
+ msg->data[0] = T_CREATE_T_C;
+ msg->data[1] = 1;
+ msg->data[2] = conid;
+ msg->length = 3;
+ msg->next = NULL;
+
+ // queue it for transmission
+ queue_message(tl, slot_id, conid, msg);
+
+ // done
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return conid;
}
-int en50221_tl_del_tc(en50221_transport_layer tl, uint8_t slot_id, uint8_t connection_id)
+int en50221_tl_del_tc(struct en50221_transport_layer *tl, uint8_t slot_id,
+ uint8_t connection_id)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
-
- // check
- if (slot_id >= private->max_slots) {
- private->error = EN50221ERR_BADSLOTID;
- return -1;
- }
-
- pthread_mutex_lock(&private->slots[slot_id].slot_lock);
- if (private->slots[slot_id].ca_hndl == -1) {
- private->error = EN50221ERR_BADSLOTID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- if (connection_id >= private->max_connections_per_slot) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCONNECTIONID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- if (!(private->slots[slot_id].connections[connection_id].state &
- (T_STATE_ACTIVE|T_STATE_IN_DELETION))) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADSTATE;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
-
- // allocate msg structure
- struct en50221_message *msg = malloc(sizeof(struct en50221_message)+3);
- if (msg == NULL) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_OUTOFMEMORY;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
-
- // make up the data to send
- msg->data[0] = T_DELETE_T_C;
- msg->data[1] = 1;
- msg->data[2] = connection_id;
- msg->length = 3;
- msg->next = NULL;
-
- // queue it for transmission
- queue_message(private, slot_id, connection_id, msg);
- private->slots[slot_id].connections[connection_id].state = T_STATE_ACTIVE_DELETEQUEUED;
-
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return 0;
+ // check
+ if (slot_id >= tl->max_slots) {
+ tl->error = EN50221ERR_BADSLOTID;
+ return -1;
+ }
+
+ pthread_mutex_lock(&tl->slots[slot_id].slot_lock);
+ if (tl->slots[slot_id].ca_hndl == -1) {
+ tl->error = EN50221ERR_BADSLOTID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ if (connection_id >= tl->max_connections_per_slot) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCONNECTIONID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ if (!(tl->slots[slot_id].connections[connection_id].state &
+ (T_STATE_ACTIVE | T_STATE_IN_DELETION))) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADSTATE;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ // allocate msg structure
+ struct en50221_message *msg =
+ malloc(sizeof(struct en50221_message) + 3);
+ if (msg == NULL) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_OUTOFMEMORY;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ // make up the data to send
+ msg->data[0] = T_DELETE_T_C;
+ msg->data[1] = 1;
+ msg->data[2] = connection_id;
+ msg->length = 3;
+ msg->next = NULL;
+
+ // queue it for transmission
+ queue_message(tl, slot_id, connection_id, msg);
+ tl->slots[slot_id].connections[connection_id].state =
+ T_STATE_ACTIVE_DELETEQUEUED;
+
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return 0;
}
-int en50221_tl_get_connection_state(en50221_transport_layer tl,
- uint8_t slot_id, uint8_t connection_id)
+int en50221_tl_get_connection_state(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t connection_id)
{
- struct en50221_transport_layer_private *private = (struct en50221_transport_layer_private *) tl;
-
- if (slot_id >= private->max_slots) {
- private->error = EN50221ERR_BADSLOTID;
- return -1;
- }
-
- pthread_mutex_lock(&private->slots[slot_id].slot_lock);
- if (private->slots[slot_id].ca_hndl == -1) {
- private->error = EN50221ERR_BADSLOTID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- if (connection_id >= private->max_connections_per_slot) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCONNECTIONID;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- return -1;
- }
- int state = private->slots[slot_id].connections[connection_id].state;
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
-
- return state;
+ if (slot_id >= tl->max_slots) {
+ tl->error = EN50221ERR_BADSLOTID;
+ return -1;
+ }
+
+ pthread_mutex_lock(&tl->slots[slot_id].slot_lock);
+ if (tl->slots[slot_id].ca_hndl == -1) {
+ tl->error = EN50221ERR_BADSLOTID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ if (connection_id >= tl->max_connections_per_slot) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCONNECTIONID;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+ return -1;
+ }
+ int state = tl->slots[slot_id].connections[connection_id].state;
+ pthread_mutex_unlock(&tl->slots[slot_id].slot_lock);
+
+ return state;
}
// ask the module for new data
-static int en50221_tl_poll_tc(struct en50221_transport_layer_private *private, uint8_t slot_id, uint8_t connection_id)
+static int en50221_tl_poll_tc(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t connection_id)
{
- gettimeofday(&private->slots[slot_id].connections[connection_id].tx_time, 0);
-
- // send command
- uint8_t hdr[3];
- hdr[0] = T_DATA_LAST;
- hdr[1] = 1;
- hdr[2] = connection_id;
- if (dvbca_link_write(private->slots[slot_id].ca_hndl, private->slots[slot_id].slot, connection_id, hdr, 3) < 0) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_CAWRITE;
- return -1;
- }
- return 0;
+ gettimeofday(&tl->slots[slot_id].connections[connection_id].
+ tx_time, 0);
+
+ // send command
+ uint8_t hdr[3];
+ hdr[0] = T_DATA_LAST;
+ hdr[1] = 1;
+ hdr[2] = connection_id;
+ if (dvbca_link_write(tl->slots[slot_id].ca_hndl,
+ tl->slots[slot_id].slot,
+ connection_id, hdr, 3) < 0) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_CAWRITE;
+ return -1;
+ }
+ return 0;
}
// handle incoming data
-static int en50221_tl_process_data(struct en50221_transport_layer_private *private, uint8_t slot_id,
- uint8_t *data, uint32_t data_length)
+static int en50221_tl_process_data(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t * data,
+ uint32_t data_length)
{
- int result;
+ int result;
#ifdef DEBUG_RXDATA
- printf("-------------------\n");
- uint32_t ii=0;
- for(ii=0; ii< data_length; ii++) {
- printf("%02x: %02x\n", ii, data[ii]);
- }
- printf("+++++++++++++++++++\n");
+ printf("-------------------\n");
+ uint32_t ii = 0;
+ for (ii = 0; ii < data_length; ii++) {
+ printf("%02x: %02x\n", ii, data[ii]);
+ }
+ printf("+++++++++++++++++++\n");
#endif
- // process the received data
- while(data_length) {
- // parse the header
- uint8_t tpdu_tag = data[0];
- uint16_t asn_data_length;
- int length_field_len;
- if ((length_field_len = asn_1_decode(&asn_data_length, data + 1, data_length - 1)) < 0) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid asn from module on slot %02x\n", slot_id);
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCAMDATA;
- return -1;
- }
- if ((asn_data_length < 1) || (asn_data_length > (data_length-(1+length_field_len)))) {
- print(LOG_LEVEL, ERROR, 1, "Received data with invalid length from module on slot %02x\n", slot_id);
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCAMDATA;
- return -1;
- }
- uint8_t connection_id = data[1 + length_field_len];
- data += 1 + length_field_len + 1;
- data_length -= (1 + length_field_len + 1);
- asn_data_length--;
-
- // check the connection_id
- if (connection_id >= private->max_connections_per_slot) {
- print(LOG_LEVEL, ERROR, 1, "Received bad connection id %02x from module on slot %02x\n", connection_id, slot_id);
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCONNECTIONID;
- return -1;
- }
-
- // process the TPDUs
- switch(tpdu_tag) {
- case T_C_T_C_REPLY:
- if ((result = en50221_tl_handle_create_tc_reply(private, slot_id, connection_id)) < 0) {
- return -1;
- }
- break;
- case T_DELETE_T_C:
- if ((result = en50221_tl_handle_delete_tc(private, slot_id, connection_id)) < 0) {
- return -1;
- }
- break;
- case T_D_T_C_REPLY:
- if ((result = en50221_tl_handle_delete_tc_reply(private, slot_id, connection_id)) < 0) {
- return -1;
- }
- break;
- case T_REQUEST_T_C:
- if ((result = en50221_tl_handle_request_tc(private, slot_id, connection_id)) < 0) {
- return -1;
- }
- break;
- case T_DATA_MORE:
- if ((result = en50221_tl_handle_data_more(private, slot_id, connection_id, data, asn_data_length)) < 0) {
- return -1;
- }
- break;
- case T_DATA_LAST:
- if ((result = en50221_tl_handle_data_last(private, slot_id, connection_id, data, asn_data_length)) < 0) {
- return -1;
- }
- break;
- case T_SB:
- if ((result = en50221_tl_handle_sb(private, slot_id, connection_id, data, asn_data_length)) < 0) {
- return -1;
- }
- break;
- default:
- print(LOG_LEVEL, ERROR, 1, "Recieved unexpected TPDU tag %02x from module on slot %02x\n",
- tpdu_tag, slot_id);
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCAMDATA;
- return -1;
- }
-
- // skip over the consumed data
- data += asn_data_length;
- data_length -= asn_data_length;
- }
-
- return 0;
+ // process the received data
+ while (data_length) {
+ // parse the header
+ uint8_t tpdu_tag = data[0];
+ uint16_t asn_data_length;
+ int length_field_len;
+ if ((length_field_len = asn_1_decode(&asn_data_length, data + 1, data_length - 1)) < 0) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid asn from module on slot %02x\n",
+ slot_id);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCAMDATA;
+ return -1;
+ }
+ if ((asn_data_length < 1) ||
+ (asn_data_length > (data_length - (1 + length_field_len)))) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received data with invalid length from module on slot %02x\n",
+ slot_id);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCAMDATA;
+ return -1;
+ }
+ uint8_t connection_id = data[1 + length_field_len];
+ data += 1 + length_field_len + 1;
+ data_length -= (1 + length_field_len + 1);
+ asn_data_length--;
+
+ // check the connection_id
+ if (connection_id >= tl->max_connections_per_slot) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received bad connection id %02x from module on slot %02x\n",
+ connection_id, slot_id);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCONNECTIONID;
+ return -1;
+ }
+ // process the TPDUs
+ switch (tpdu_tag) {
+ case T_C_T_C_REPLY:
+ if ((result = en50221_tl_handle_create_tc_reply(tl, slot_id, connection_id)) < 0) {
+ return -1;
+ }
+ break;
+ case T_DELETE_T_C:
+ if ((result = en50221_tl_handle_delete_tc(tl, slot_id, connection_id)) < 0) {
+ return -1;
+ }
+ break;
+ case T_D_T_C_REPLY:
+ if ((result = en50221_tl_handle_delete_tc_reply(tl, slot_id, connection_id)) < 0) {
+ return -1;
+ }
+ break;
+ case T_REQUEST_T_C:
+ if ((result = en50221_tl_handle_request_tc(tl, slot_id, connection_id)) < 0) {
+ return -1;
+ }
+ break;
+ case T_DATA_MORE:
+ if ((result = en50221_tl_handle_data_more(tl, slot_id,
+ connection_id,
+ data,
+ asn_data_length)) < 0) {
+ return -1;
+ }
+ break;
+ case T_DATA_LAST:
+ if ((result = en50221_tl_handle_data_last(tl, slot_id,
+ connection_id,
+ data,
+ asn_data_length)) < 0) {
+ return -1;
+ }
+ break;
+ case T_SB:
+ if ((result = en50221_tl_handle_sb(tl, slot_id,
+ connection_id,
+ data,
+ asn_data_length)) < 0) {
+ return -1;
+ }
+ break;
+ default:
+ print(LOG_LEVEL, ERROR, 1,
+ "Recieved unexpected TPDU tag %02x from module on slot %02x\n",
+ tpdu_tag, slot_id);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCAMDATA;
+ return -1;
+ }
+
+ // skip over the consumed data
+ data += asn_data_length;
+ data_length -= asn_data_length;
+ }
+
+ return 0;
}
-static int en50221_tl_handle_create_tc_reply(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id)
+static int en50221_tl_handle_create_tc_reply(struct en50221_transport_layer
+ *tl, uint8_t slot_id,
+ uint8_t connection_id)
{
- // set this connection to state active
- if (private->slots[slot_id].connections[connection_id].state == T_STATE_IN_CREATION) {
- private->slots[slot_id].connections[connection_id].state = T_STATE_ACTIVE;
- private->slots[slot_id].connections[connection_id].tx_time.tv_sec = 0;
-
- // tell upper layers
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_tl_callback cb = private->callback;
- void *cb_arg = private->callback_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
- if (cb)
- cb(cb_arg, T_CALLBACK_REASON_CONNECTIONOPEN, NULL, 0, slot_id, connection_id);
- } else {
- print(LOG_LEVEL, ERROR, 1, "Received T_C_T_C_REPLY for connection not in "
- "T_STATE_IN_CREATION from module on slot %02x\n", slot_id);
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCAMDATA;
- return -1;
- }
-
- return 0;
+ // set this connection to state active
+ if (tl->slots[slot_id].connections[connection_id].state == T_STATE_IN_CREATION) {
+ tl->slots[slot_id].connections[connection_id].state = T_STATE_ACTIVE;
+ tl->slots[slot_id].connections[connection_id].tx_time.tv_sec = 0;
+
+ // tell upper layers
+ pthread_mutex_lock(&tl->setcallback_lock);
+ en50221_tl_callback cb = tl->callback;
+ void *cb_arg = tl->callback_arg;
+ pthread_mutex_unlock(&tl->setcallback_lock);
+ if (cb)
+ cb(cb_arg, T_CALLBACK_REASON_CONNECTIONOPEN, NULL, 0, slot_id, connection_id);
+ } else {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received T_C_T_C_REPLY for connection not in "
+ "T_STATE_IN_CREATION from module on slot %02x\n",
+ slot_id);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCAMDATA;
+ return -1;
+ }
+
+ return 0;
}
-static int en50221_tl_handle_delete_tc(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id)
+static int en50221_tl_handle_delete_tc(struct en50221_transport_layer *tl,
+ uint8_t slot_id,
+ uint8_t connection_id)
{
- // immediately delete this connection and send D_T_C_REPLY
- if (private->slots[slot_id].connections[connection_id].state & (T_STATE_ACTIVE|T_STATE_IN_DELETION))
- {
- // clear down the slot
- private->slots[slot_id].connections[connection_id].state = T_STATE_IDLE;
- if (private->slots[slot_id].connections[connection_id].chain_buffer) {
- free(private->slots[slot_id].connections[connection_id].chain_buffer);
- }
- private->slots[slot_id].connections[connection_id].chain_buffer = NULL;
- private->slots[slot_id].connections[connection_id].buffer_length = 0;
-
- // send the reply
- uint8_t hdr[3];
- hdr[0] = T_D_T_C_REPLY;
- hdr[1] = 1;
- hdr[2] = connection_id;
- if (dvbca_link_write(private->slots[slot_id].ca_hndl, private->slots[slot_id].slot, connection_id, hdr, 3) < 0) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_CAWRITE;
- return -1;
- }
-
- // tell upper layers
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_tl_callback cb = private->callback;
- void *cb_arg = private->callback_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
- if (cb)
- cb(cb_arg, T_CALLBACK_REASON_CONNECTIONCLOSE, NULL, 0, slot_id, connection_id);
- }
- else {
- print(LOG_LEVEL, ERROR, 1, "Received T_DELETE_T_C for inactive connection from module on slot %02x\n",
- slot_id);
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCAMDATA;
- return -1;
- }
-
- return 0;
+ // immediately delete this connection and send D_T_C_REPLY
+ if (tl->slots[slot_id].connections[connection_id].state &
+ (T_STATE_ACTIVE | T_STATE_IN_DELETION)) {
+ // clear down the slot
+ tl->slots[slot_id].connections[connection_id].state = T_STATE_IDLE;
+ if (tl->slots[slot_id].connections[connection_id].chain_buffer) {
+ free(tl->slots[slot_id].connections[connection_id].chain_buffer);
+ }
+ tl->slots[slot_id].connections[connection_id].chain_buffer = NULL;
+ tl->slots[slot_id].connections[connection_id].buffer_length = 0;
+
+ // send the reply
+ uint8_t hdr[3];
+ hdr[0] = T_D_T_C_REPLY;
+ hdr[1] = 1;
+ hdr[2] = connection_id;
+ if (dvbca_link_write(tl->slots[slot_id].ca_hndl,
+ tl->slots[slot_id].slot,
+ connection_id, hdr, 3) < 0) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_CAWRITE;
+ return -1;
+ }
+ // tell upper layers
+ pthread_mutex_lock(&tl->setcallback_lock);
+ en50221_tl_callback cb = tl->callback;
+ void *cb_arg = tl->callback_arg;
+ pthread_mutex_unlock(&tl->setcallback_lock);
+ if (cb)
+ cb(cb_arg, T_CALLBACK_REASON_CONNECTIONCLOSE, NULL, 0, slot_id, connection_id);
+ } else {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received T_DELETE_T_C for inactive connection from module on slot %02x\n",
+ slot_id);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCAMDATA;
+ return -1;
+ }
+
+ return 0;
}
-static int en50221_tl_handle_delete_tc_reply(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id)
+static int en50221_tl_handle_delete_tc_reply(struct en50221_transport_layer
+ *tl, uint8_t slot_id,
+ uint8_t connection_id)
{
- // delete this connection, should be in T_STATE_IN_DELETION already
- if (private->slots[slot_id].connections[connection_id].state == T_STATE_IN_DELETION) {
- private->slots[slot_id].connections[connection_id].state = T_STATE_IDLE;
- } else {
- print(LOG_LEVEL, ERROR, 1, "Received T_D_T_C_REPLY received for connection not in "
- "T_STATE_IN_DELETION from module on slot %02x\n", slot_id);
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCAMDATA;
- return -1;
- }
-
- return 0;
+ // delete this connection, should be in T_STATE_IN_DELETION already
+ if (tl->slots[slot_id].connections[connection_id].state == T_STATE_IN_DELETION) {
+ tl->slots[slot_id].connections[connection_id].state = T_STATE_IDLE;
+ } else {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received T_D_T_C_REPLY received for connection not in "
+ "T_STATE_IN_DELETION from module on slot %02x\n",
+ slot_id);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCAMDATA;
+ return -1;
+ }
+
+ return 0;
}
-static int en50221_tl_handle_request_tc(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id)
+static int en50221_tl_handle_request_tc(struct en50221_transport_layer *tl,
+ uint8_t slot_id,
+ uint8_t connection_id)
{
- // allocate a new connection if possible
- int conid = en50221_tl_alloc_new_tc(private, slot_id);
- int ca_hndl = private->slots[slot_id].ca_hndl;
- if (conid == -1) {
- print(LOG_LEVEL, ERROR, 1, "Too many connections requested by module on slot %02x\n", slot_id);
-
- // send the error
- uint8_t hdr[4];
- hdr[0] = T_T_C_ERROR;
- hdr[1] = 2;
- hdr[2] = connection_id;
- hdr[3] = 1;
- if (dvbca_link_write(ca_hndl, private->slots[slot_id].slot, connection_id, hdr, 4) < 0) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_CAWRITE;
- return -1;
- }
- private->slots[slot_id].connections[connection_id].tx_time.tv_sec = 0;
- } else {
- // send the NEW_T_C on the connection we received it on
- uint8_t hdr[4];
- hdr[0] = T_NEW_T_C;
- hdr[1] = 2;
- hdr[2] = connection_id;
- hdr[3] = conid;
- if (dvbca_link_write(ca_hndl, private->slots[slot_id].slot, connection_id, hdr, 4) < 0) {
- private->slots[slot_id].connections[conid].state = T_STATE_IDLE;
- private->error_slot = slot_id;
- private->error = EN50221ERR_CAWRITE;
- return -1;
- }
- private->slots[slot_id].connections[connection_id].tx_time.tv_sec = 0;
-
- // send the CREATE_T_C on the new connnection
- hdr[0] = T_CREATE_T_C;
- hdr[1] = 1;
- hdr[2] = conid;
- if (dvbca_link_write(ca_hndl, private->slots[slot_id].slot, conid, hdr, 3) < 0) {
- private->slots[slot_id].connections[conid].state = T_STATE_IDLE;
- private->error_slot = slot_id;
- private->error = EN50221ERR_CAWRITE;
- return -1;
- }
- gettimeofday(&private->slots[slot_id].connections[conid].tx_time, 0);
-
- // tell upper layers
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_tl_callback cb = private->callback;
- void *cb_arg = private->callback_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
- if (cb)
- cb(cb_arg, T_CALLBACK_REASON_CAMCONNECTIONOPEN, NULL, 0, slot_id, conid);
- }
-
- return 0;
+ // allocate a new connection if possible
+ int conid = en50221_tl_alloc_new_tc(tl, slot_id);
+ int ca_hndl = tl->slots[slot_id].ca_hndl;
+ if (conid == -1) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Too many connections requested by module on slot %02x\n",
+ slot_id);
+
+ // send the error
+ uint8_t hdr[4];
+ hdr[0] = T_T_C_ERROR;
+ hdr[1] = 2;
+ hdr[2] = connection_id;
+ hdr[3] = 1;
+ if (dvbca_link_write(ca_hndl, tl->slots[slot_id].slot, connection_id, hdr, 4) < 0) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_CAWRITE;
+ return -1;
+ }
+ tl->slots[slot_id].connections[connection_id].tx_time.
+ tv_sec = 0;
+ } else {
+ // send the NEW_T_C on the connection we received it on
+ uint8_t hdr[4];
+ hdr[0] = T_NEW_T_C;
+ hdr[1] = 2;
+ hdr[2] = connection_id;
+ hdr[3] = conid;
+ if (dvbca_link_write(ca_hndl, tl->slots[slot_id].slot, connection_id, hdr, 4) < 0) {
+ tl->slots[slot_id].connections[conid].state = T_STATE_IDLE;
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_CAWRITE;
+ return -1;
+ }
+ tl->slots[slot_id].connections[connection_id].tx_time.tv_sec = 0;
+
+ // send the CREATE_T_C on the new connnection
+ hdr[0] = T_CREATE_T_C;
+ hdr[1] = 1;
+ hdr[2] = conid;
+ if (dvbca_link_write(ca_hndl, tl->slots[slot_id].slot, conid, hdr, 3) < 0) {
+ tl->slots[slot_id].connections[conid].state = T_STATE_IDLE;
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_CAWRITE;
+ return -1;
+ }
+ gettimeofday(&tl->slots[slot_id].connections[conid].tx_time, 0);
+
+ // tell upper layers
+ pthread_mutex_lock(&tl->setcallback_lock);
+ en50221_tl_callback cb = tl->callback;
+ void *cb_arg = tl->callback_arg;
+ pthread_mutex_unlock(&tl->setcallback_lock);
+ if (cb)
+ cb(cb_arg, T_CALLBACK_REASON_CAMCONNECTIONOPEN, NULL, 0, slot_id, conid);
+ }
+
+ return 0;
}
-static int en50221_tl_handle_data_more(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id,
- uint8_t *data, uint32_t data_length)
+static int en50221_tl_handle_data_more(struct en50221_transport_layer *tl,
+ uint8_t slot_id,
+ uint8_t connection_id,
+ uint8_t * data,
+ uint32_t data_length)
{
- // connection in correct state?
- if (private->slots[slot_id].connections[connection_id].state != T_STATE_ACTIVE) {
- print(LOG_LEVEL, ERROR, 1, "Received T_DATA_MORE for connection not in "
- "T_STATE_ACTIVE from module on slot %02x\n", slot_id);
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCAMDATA;
- return -1;
- }
-
- // a chained data packet is coming in, save
- // it to the buffer and wait for more
- private->slots[slot_id].connections[connection_id].tx_time.tv_sec = 0;
- int new_data_length =
- private->slots[slot_id].connections[connection_id].buffer_length + data_length;
- uint8_t *new_data_buffer =
- realloc(private->slots[slot_id].connections[connection_id].chain_buffer, new_data_length);
- if (new_data_buffer == NULL) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_OUTOFMEMORY;
- return -1;
- }
- private->slots[slot_id].connections[connection_id].chain_buffer = new_data_buffer;
-
- memcpy(private->slots[slot_id].connections[connection_id].chain_buffer +
- private->slots[slot_id].connections[connection_id].buffer_length,
- data, data_length);
- private->slots[slot_id].connections[connection_id].buffer_length = new_data_length;
-
- return 0;
+ // connection in correct state?
+ if (tl->slots[slot_id].connections[connection_id].state != T_STATE_ACTIVE) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received T_DATA_MORE for connection not in "
+ "T_STATE_ACTIVE from module on slot %02x\n",
+ slot_id);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCAMDATA;
+ return -1;
+ }
+ // a chained data packet is coming in, save
+ // it to the buffer and wait for more
+ tl->slots[slot_id].connections[connection_id].tx_time.tv_sec = 0;
+ int new_data_length =
+ tl->slots[slot_id].connections[connection_id].buffer_length + data_length;
+ uint8_t *new_data_buffer =
+ realloc(tl->slots[slot_id].connections[connection_id].chain_buffer, new_data_length);
+ if (new_data_buffer == NULL) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_OUTOFMEMORY;
+ return -1;
+ }
+ tl->slots[slot_id].connections[connection_id].chain_buffer = new_data_buffer;
+
+ memcpy(tl->slots[slot_id].connections[connection_id].chain_buffer +
+ tl->slots[slot_id].connections[connection_id].buffer_length,
+ data, data_length);
+ tl->slots[slot_id].connections[connection_id].buffer_length = new_data_length;
+
+ return 0;
}
-static int en50221_tl_handle_data_last(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id,
- uint8_t *data, uint32_t data_length)
+static int en50221_tl_handle_data_last(struct en50221_transport_layer *tl,
+ uint8_t slot_id,
+ uint8_t connection_id,
+ uint8_t * data,
+ uint32_t data_length)
{
- // connection in correct state?
- if (private->slots[slot_id].connections[connection_id].state != T_STATE_ACTIVE) {
- print(LOG_LEVEL, ERROR, 1, "Received T_DATA_LAST received for connection not in "
- "T_STATE_ACTIVE from module on slot %02x\n", slot_id);
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCAMDATA;
- return -1;
- }
-
- // last package of a chain or single package comes in
- private->slots[slot_id].connections[connection_id].tx_time.tv_sec = 0;
- if (private->slots[slot_id].connections[connection_id].chain_buffer == NULL)
- {
- // single package => dispatch immediately
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_tl_callback cb = private->callback;
- void *cb_arg = private->callback_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
-
- if (cb && data_length) {
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- cb(cb_arg, T_CALLBACK_REASON_DATA, data, data_length, slot_id, connection_id);
- pthread_mutex_lock(&private->slots[slot_id].slot_lock);
- }
- }
- else
- {
- int new_data_length = private->slots[slot_id].connections[connection_id].buffer_length + data_length;
- uint8_t *new_data_buffer =
- realloc(private->slots[slot_id].connections[connection_id].chain_buffer, new_data_length);
- if (new_data_buffer == NULL) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_OUTOFMEMORY;
- return -1;
- }
-
- memcpy(new_data_buffer + private->slots[slot_id].connections[connection_id].buffer_length, data, data_length);
-
- // clean the buffer position
- private->slots[slot_id].connections[connection_id].chain_buffer = NULL;
- private->slots[slot_id].connections[connection_id].buffer_length = 0;
-
- // tell the upper layers
- pthread_mutex_lock(&private->setcallback_lock);
- en50221_tl_callback cb = private->callback;
- void *cb_arg = private->callback_arg;
- pthread_mutex_unlock(&private->setcallback_lock);
- if (cb && data_length) {
- pthread_mutex_unlock(&private->slots[slot_id].slot_lock);
- cb(cb_arg, T_CALLBACK_REASON_DATA, new_data_buffer, new_data_length, slot_id, connection_id);
- pthread_mutex_lock(&private->slots[slot_id].slot_lock);
- }
-
- free(new_data_buffer);
- }
-
- return 0;
+ // connection in correct state?
+ if (tl->slots[slot_id].connections[connection_id].state != T_STATE_ACTIVE) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received T_DATA_LAST received for connection not in "
+ "T_STATE_ACTIVE from module on slot %02x\n",
+ slot_id);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCAMDATA;
+ return -1;
+ }
+ // last package of a chain or single package comes in
+ tl->slots[slot_id].connections[connection_id].tx_time.tv_sec = 0;
+ if (tl->slots[slot_id].connections[connection_id].chain_buffer == NULL) {
+ // single package => dispatch immediately
+ pthread_mutex_lock(&tl->setcallback_lock);
+ en50221_tl_callback cb = tl->callback;
+ void *cb_arg = tl->callback_arg;
+ pthread_mutex_unlock(&tl->setcallback_lock);
+
+ if (cb && data_length) {
+ pthread_mutex_unlock(&tl->slots[slot_id].
+ slot_lock);
+ cb(cb_arg, T_CALLBACK_REASON_DATA, data, data_length, slot_id, connection_id);
+ pthread_mutex_lock(&tl->slots[slot_id].slot_lock);
+ }
+ } else {
+ int new_data_length =
+ tl->slots[slot_id].connections[connection_id].buffer_length + data_length;
+ uint8_t *new_data_buffer =
+ realloc(tl->slots[slot_id].connections[connection_id].chain_buffer, new_data_length);
+ if (new_data_buffer == NULL) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_OUTOFMEMORY;
+ return -1;
+ }
+
+ memcpy(new_data_buffer +
+ tl->slots[slot_id].connections[connection_id].
+ buffer_length, data, data_length);
+
+ // clean the buffer position
+ tl->slots[slot_id].connections[connection_id].chain_buffer = NULL;
+ tl->slots[slot_id].connections[connection_id].buffer_length = 0;
+
+ // tell the upper layers
+ pthread_mutex_lock(&tl->setcallback_lock);
+ en50221_tl_callback cb = tl->callback;
+ void *cb_arg = tl->callback_arg;
+ pthread_mutex_unlock(&tl->setcallback_lock);
+ if (cb && data_length) {
+ pthread_mutex_unlock(&tl->slots[slot_id].
+ slot_lock);
+ cb(cb_arg, T_CALLBACK_REASON_DATA, new_data_buffer,
+ new_data_length, slot_id, connection_id);
+ pthread_mutex_lock(&tl->slots[slot_id].slot_lock);
+ }
+
+ free(new_data_buffer);
+ }
+
+ return 0;
}
-static int en50221_tl_handle_sb(struct en50221_transport_layer_private *private,
- uint8_t slot_id, uint8_t connection_id,
- uint8_t *data, uint32_t data_length)
+static int en50221_tl_handle_sb(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t connection_id,
+ uint8_t * data, uint32_t data_length)
{
- // is the connection id ok?
- if (private->slots[slot_id].connections[connection_id].state != T_STATE_ACTIVE) {
- print(LOG_LEVEL, ERROR, 1, "Received T_SB for connection not in T_STATE_ACTIVE from module on slot %02x\n",
- slot_id);
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCAMDATA;
- return -1;
- }
-
- // did we get enough data in the T_SB?
- if (data_length != 1) {
- print(LOG_LEVEL, ERROR, 1, "Recieved T_SB with invalid length from module on slot %02x\n", slot_id);
- private->error_slot = slot_id;
- private->error = EN50221ERR_BADCAMDATA;
- return -1;
- }
-
- // tell it to send the data if it says there is some
- if (data[0] & 0x80) {
- int ca_hndl = private->slots[slot_id].ca_hndl;
-
- // send the RCV
- uint8_t hdr[3];
- hdr[0] = T_RCV;
- hdr[1] = 1;
- hdr[2] = connection_id;
- if (dvbca_link_write(ca_hndl, private->slots[slot_id].slot, connection_id, hdr, 3) < 0) {
- private->error_slot = slot_id;
- private->error = EN50221ERR_CAWRITE;
- return -1;
- }
- gettimeofday(&private->slots[slot_id].connections[connection_id].tx_time, 0);
-
- } else {
- // no data - indicate not waiting for anything now
- private->slots[slot_id].connections[connection_id].tx_time.tv_sec = 0;
- }
-
- return 0;
+ // is the connection id ok?
+ if (tl->slots[slot_id].connections[connection_id].state != T_STATE_ACTIVE) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Received T_SB for connection not in T_STATE_ACTIVE from module on slot %02x\n",
+ slot_id);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCAMDATA;
+ return -1;
+ }
+ // did we get enough data in the T_SB?
+ if (data_length != 1) {
+ print(LOG_LEVEL, ERROR, 1,
+ "Recieved T_SB with invalid length from module on slot %02x\n",
+ slot_id);
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_BADCAMDATA;
+ return -1;
+ }
+ // tell it to send the data if it says there is some
+ if (data[0] & 0x80) {
+ int ca_hndl = tl->slots[slot_id].ca_hndl;
+
+ // send the RCV
+ uint8_t hdr[3];
+ hdr[0] = T_RCV;
+ hdr[1] = 1;
+ hdr[2] = connection_id;
+ if (dvbca_link_write(ca_hndl, tl->slots[slot_id].slot, connection_id, hdr, 3) < 0) {
+ tl->error_slot = slot_id;
+ tl->error = EN50221ERR_CAWRITE;
+ return -1;
+ }
+ gettimeofday(&tl->slots[slot_id].connections[connection_id].tx_time, 0);
+
+ } else {
+ // no data - indicate not waiting for anything now
+ tl->slots[slot_id].connections[connection_id].tx_time.tv_sec = 0;
+ }
+
+ return 0;
}
-static int en50221_tl_alloc_new_tc(struct en50221_transport_layer_private *private, uint8_t slot_id)
+static int en50221_tl_alloc_new_tc(struct en50221_transport_layer *tl,
+ uint8_t slot_id)
{
- // we browse through the array of connection
- // types, to look for the first unused one
- int i, conid = -1;
- for(i=1; i < private->max_connections_per_slot; i++) {
- if (private->slots[slot_id].connections[i].state == T_STATE_IDLE) {
- conid = i;
- break;
- }
- }
- if (conid == -1) {
- print(LOG_LEVEL, ERROR, 1, "CREATE_T_C failed: no more connections available\n");
- return -1;
- }
-
- // set up the connection struct
- private->slots[slot_id].connections[conid].state = T_STATE_IN_CREATION;
- private->slots[slot_id].connections[conid].chain_buffer = NULL;
- private->slots[slot_id].connections[conid].buffer_length = 0;
-
- return conid;
+ // we browse through the array of connection
+ // types, to look for the first unused one
+ int i, conid = -1;
+ for (i = 1; i < tl->max_connections_per_slot; i++) {
+ if (tl->slots[slot_id].connections[i].state == T_STATE_IDLE) {
+ conid = i;
+ break;
+ }
+ }
+ if (conid == -1) {
+ print(LOG_LEVEL, ERROR, 1,
+ "CREATE_T_C failed: no more connections available\n");
+ return -1;
+ }
+ // set up the connection struct
+ tl->slots[slot_id].connections[conid].state = T_STATE_IN_CREATION;
+ tl->slots[slot_id].connections[conid].chain_buffer = NULL;
+ tl->slots[slot_id].connections[conid].buffer_length = 0;
+
+ return conid;
}
-static void queue_message(struct en50221_transport_layer_private *private, uint8_t slot_id,
- uint8_t connection_id, struct en50221_message *msg)
+static void queue_message(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t connection_id,
+ struct en50221_message *msg)
{
- msg->next = NULL;
- if (private->slots[slot_id].connections[connection_id].send_queue_tail) {
- private->slots[slot_id].connections[connection_id].send_queue_tail->next = msg;
- } else {
- private->slots[slot_id].connections[connection_id].send_queue = msg;
- private->slots[slot_id].connections[connection_id].send_queue_tail = msg;
- }
+ msg->next = NULL;
+ if (tl->slots[slot_id].connections[connection_id].send_queue_tail) {
+ tl->slots[slot_id].connections[connection_id].send_queue_tail->next = msg;
+ tl->slots[slot_id].connections[connection_id].send_queue_tail = msg;
+ } else {
+ tl->slots[slot_id].connections[connection_id].send_queue = msg;
+ tl->slots[slot_id].connections[connection_id].send_queue_tail = msg;
+ }
}
diff --git a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_transport.h b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_transport.h
index e1dd1c5..7882060 100644
--- a/kaffeine/src/input/dvb/lib/libdvben50221/en50221_transport.h
+++ b/kaffeine/src/input/dvb/lib/libdvben50221/en50221_transport.h
@@ -2,7 +2,7 @@
en50221 encoder An implementation for libdvb
an implementation for the en50221 session layer
- Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
+ Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
@@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -26,8 +26,7 @@
#define __EN50221_TRANSPORT_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
#include <stdlib.h>
@@ -37,23 +36,23 @@ extern "C"
/**
* Callback reasons.
*/
-#define T_CALLBACK_REASON_CONNECTIONOPEN 0x00 // A connection we opened _to_ the cam has been ACKed
-#define T_CALLBACK_REASON_CAMCONNECTIONOPEN 0x01 // The cam has opened a connection to _us_.
-#define T_CALLBACK_REASON_DATA 0x02 // Data received
-#define T_CALLBACK_REASON_CONNECTIONCLOSE 0x03 // The cam has told us to close a connection.
-#define T_CALLBACK_REASON_SLOTCLOSE 0x04 // The cam in the supplied slot id has been removed.
+#define T_CALLBACK_REASON_CONNECTIONOPEN 0x00 // A connection we opened _to_ the cam has been ACKed
+#define T_CALLBACK_REASON_CAMCONNECTIONOPEN 0x01 // The cam has opened a connection to _us_.
+#define T_CALLBACK_REASON_DATA 0x02 // Data received
+#define T_CALLBACK_REASON_CONNECTIONCLOSE 0x03 // The cam has told us to close a connection.
+#define T_CALLBACK_REASON_SLOTCLOSE 0x04 // The cam in the supplied slot id has been removed.
// these are the states a TC can be in
-#define T_STATE_IDLE 0x01 // this transport connection is not in use
-#define T_STATE_ACTIVE 0x02 // this transport connection is in use
-#define T_STATE_ACTIVE_DELETEQUEUED 0x04 // this transport connection is about to be deleted
-#define T_STATE_IN_CREATION 0x08 // this transport waits for a T_C_T_C_REPLY to become active
-#define T_STATE_IN_DELETION 0x10 // this transport waits for T_D_T_C_REPLY to become idle again
+#define T_STATE_IDLE 0x01 // this transport connection is not in use
+#define T_STATE_ACTIVE 0x02 // this transport connection is in use
+#define T_STATE_ACTIVE_DELETEQUEUED 0x04 // this transport connection is about to be deleted
+#define T_STATE_IN_CREATION 0x08 // this transport waits for a T_C_T_C_REPLY to become active
+#define T_STATE_IN_DELETION 0x10 // this transport waits for T_D_T_C_REPLY to become idle again
/**
* Opaque type representing a transport layer.
*/
-typedef void *en50221_transport_layer;
+struct en50221_transport_layer;
/**
* Type definition for callback function - used when events are received from a module.
@@ -72,9 +71,11 @@ typedef void *en50221_transport_layer;
* @param slot_id Slot_id the data was received from.
* @param connection_id Connection_id the data was received from.
*/
-typedef void (*en50221_tl_callback)(void *arg, int reason,
- uint8_t *data, uint32_t data_length,
- uint8_t slot_id, uint8_t connection_id);
+typedef void (*en50221_tl_callback) (void *arg, int reason,
+ uint8_t * data,
+ uint32_t data_length,
+ uint8_t slot_id,
+ uint8_t connection_id);
/**
@@ -84,14 +85,15 @@ typedef void (*en50221_tl_callback)(void *arg, int reason,
* @param max_connections_per_slot Maximum connections per slot.
* @return The en50221_transport_layer instance, or NULL on error.
*/
-extern en50221_transport_layer en50221_tl_create(uint8_t max_slots, uint8_t max_connections_per_slot);
+extern struct en50221_transport_layer *en50221_tl_create(uint8_t max_slots,
+ uint8_t max_connections_per_slot);
/**
* Destroy an instance of the transport layer.
*
* @param tl The en50221_transport_layer instance.
*/
-extern void en50221_tl_destroy(en50221_transport_layer tl);
+extern void en50221_tl_destroy(struct en50221_transport_layer *tl);
/**
* Register a new slot with the library.
@@ -103,9 +105,10 @@ extern void en50221_tl_destroy(en50221_transport_layer tl);
* @param poll_delay Interval between polls in ms.
* @return slot_id on sucess, or -1 on error.
*/
-extern int en50221_tl_register_slot(en50221_transport_layer tl, int ca_hndl,
- uint8_t slot, uint32_t response_timeout,
- uint32_t poll_delay);
+extern int en50221_tl_register_slot(struct en50221_transport_layer *tl,
+ int ca_hndl, uint8_t slot,
+ uint32_t response_timeout,
+ uint32_t poll_delay);
/**
* Destroy a registered slot - e.g. if a CAM is removed, or an error occurs. Does
@@ -114,7 +117,7 @@ extern int en50221_tl_register_slot(en50221_transport_layer tl, int ca_hndl,
* @param tl The en50221_transport_layer instance.
* @param slot_id Slot to destroy.
*/
-extern void en50221_tl_destroy_slot(en50221_transport_layer tl, uint8_t slot_id);
+extern void en50221_tl_destroy_slot(struct en50221_transport_layer *tl, uint8_t slot_id);
/**
* Performs one iteration of the transport layer poll -
@@ -126,7 +129,7 @@ extern void en50221_tl_destroy_slot(en50221_transport_layer tl, uint8_t slot_id)
* @param tl The en50221_transport_layer instance.
* @return 0 on succes, or -1 if there was an error of some sort.
*/
-extern int en50221_tl_poll(en50221_transport_layer tl);
+extern int en50221_tl_poll(struct en50221_transport_layer *tl);
/**
* Register the callback for data reception.
@@ -135,8 +138,8 @@ extern int en50221_tl_poll(en50221_transport_layer tl);
* @param callback The callback. Set to NULL to remove the callback completely.
* @param arg Private data passed as arg0 of the callback.
*/
-extern void en50221_tl_register_callback(en50221_transport_layer tl,
- en50221_tl_callback callback, void *arg);
+extern void en50221_tl_register_callback(struct en50221_transport_layer *tl,
+ en50221_tl_callback callback, void *arg);
/**
* Gets the ID of the slot an error occurred on.
@@ -144,7 +147,7 @@ extern void en50221_tl_register_callback(en50221_transport_layer tl,
* @param tl The en50221_transport_layer instance.
* @return The offending slot id.
*/
-extern int en50221_tl_get_error_slot(en50221_transport_layer tl);
+extern int en50221_tl_get_error_slot(struct en50221_transport_layer *tl);
/**
* Gets the last error.
@@ -152,7 +155,7 @@ extern int en50221_tl_get_error_slot(en50221_transport_layer tl);
* @param tl The en50221_transport_layer instance.
* @return One of the EN50221ERR_* values.
*/
-extern int en50221_tl_get_error(en50221_transport_layer tl);
+extern int en50221_tl_get_error(struct en50221_transport_layer *tl);
/**
* This function is used to take a data-block, pack into
@@ -165,9 +168,11 @@ extern int en50221_tl_get_error(en50221_transport_layer tl);
* @param data_length Number of bytes to send.
* @return 0 on success, or -1 on error.
*/
-extern int en50221_tl_send_data(en50221_transport_layer tl,
- uint8_t slot_id, uint8_t connection_id,
- uint8_t *data, uint32_t data_length);
+extern int en50221_tl_send_data(struct en50221_transport_layer *tl,
+ uint8_t slot_id,
+ uint8_t connection_id,
+ uint8_t * data,
+ uint32_t data_length);
/**
* This function is used to take a data-block, pack into
@@ -180,9 +185,9 @@ extern int en50221_tl_send_data(en50221_transport_layer tl,
* @param io_count Number of elements in vector.
* @return 0 on success, or -1 on error.
*/
-extern int en50221_tl_send_datav(en50221_transport_layer tl, uint8_t slot_id,
- uint8_t connection_id, struct iovec *vector,
- int iov_count);
+extern int en50221_tl_send_datav(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t connection_id,
+ struct iovec *vector, int iov_count);
/**
* Create a new transport connection to the cam.
@@ -196,7 +201,7 @@ extern int en50221_tl_send_datav(en50221_transport_layer tl, uint8_t slot_id,
* @param slot_id ID of the slot.
* @return The allocated connection id on success, or -1 on error.
*/
-extern int en50221_tl_new_tc(en50221_transport_layer tl, uint8_t slot_id);
+extern int en50221_tl_new_tc(struct en50221_transport_layer *tl, uint8_t slot_id);
/**
* Deallocates a transport connection.
@@ -210,8 +215,7 @@ extern int en50221_tl_new_tc(en50221_transport_layer tl, uint8_t slot_id);
* @param connection_id Connection id to send the request _on_.
* @return 0 on success, or -1 on error.
*/
-extern int en50221_tl_del_tc(en50221_transport_layer tl, uint8_t slot_id,
- uint8_t connection_id);
+extern int en50221_tl_del_tc(struct en50221_transport_layer *tl, uint8_t slot_id, uint8_t connection_id);
/**
* Checks the state of a connection.
@@ -221,11 +225,10 @@ extern int en50221_tl_del_tc(en50221_transport_layer tl, uint8_t slot_id,
* @param connection_id Connection id to send the request _on_.
* @return One of the T_STATE_* values.
*/
-extern int en50221_tl_get_connection_state(en50221_transport_layer tl,
- uint8_t slot_id, uint8_t connection_id);
+extern int en50221_tl_get_connection_state(struct en50221_transport_layer *tl,
+ uint8_t slot_id, uint8_t connection_id);
#ifdef __cplusplus
}
#endif
-
#endif
diff --git a/kaffeine/src/input/dvb/lib/libdvbmisc/dvbmisc.h b/kaffeine/src/input/dvb/lib/libdvbmisc/dvbmisc.h
index 75713f4..8ac6eee 100644
--- a/kaffeine/src/input/dvb/lib/libdvbmisc/dvbmisc.h
+++ b/kaffeine/src/input/dvb/lib/libdvbmisc/dvbmisc.h
@@ -1,7 +1,7 @@
/*
libdvbmisc - DVB miscellaneous library
- Copyright (C) 2005 Manu Abraham <manu@kromtek.com>
+ Copyright (C) 2005 Manu Abraham <abraham.manu@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/kaffeine/src/input/dvb/lib/libucsi/Makefile.am b/kaffeine/src/input/dvb/lib/libucsi/Makefile.am
index 071f310..36f905e 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/Makefile.am
+++ b/kaffeine/src/input/dvb/lib/libucsi/Makefile.am
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libucsi.la
-SUBDIRS = dvb mpeg .
+SUBDIRS = dvb mpeg atsc .
INCLUDES = -I$(top_srcdir)/kaffeine/src/input/dvb/lib
@@ -9,9 +9,11 @@ libucsi_la_SOURCES = crc32.c \
transport_packet.c
libucsi_la_LDFLAGS = ./mpeg \
- ./dvb
+ ./dvb \
+ /atsc
libucsi_la_LIBADD = ./mpeg/libdvbmpeg.la \
- ./dvb/libdvbdvb.la
+ ./dvb/libdvbdvb.la \
+ ./atsc/libdvbatsc.la
CFLAGS = -g -O2 -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -fPIC
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/Makefile.am b/kaffeine/src/input/dvb/lib/libucsi/atsc/Makefile.am
new file mode 100644
index 0000000..2df5d3b
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/Makefile.am
@@ -0,0 +1,17 @@
+noinst_LTLIBRARIES = libdvbatsc.la
+
+INCLUDES = -I$(top_srcdir)/kaffeine/src/input/dvb/lib
+
+libdvbatsc_la_SOURCES = atsc_text.c \
+ cvct_section.c \
+ dccsct_section.c \
+ dcct_section.c \
+ eit_section.c \
+ ett_section.c \
+ mgt_section.c \
+ rrt_section.c \
+ stt_section.c \
+ tvct_section.c \
+ types.c
+
+CFLAGS = -g -O2 -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -fPIC
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/ac3_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/ac3_descriptor.h
new file mode 100644
index 0000000..489695b
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/ac3_descriptor.h
@@ -0,0 +1,112 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_atsc@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_AC3_DESCRIPTOR
+#define _UCSI_ATSC_AC3_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+
+enum atsc_ac3_channels {
+ ATSC_AC3_CHANNELS_1_PLUS_1 = 0x0,
+ ATSC_AC3_CHANNELS_1_0 = 0x1,
+ ATSC_AC3_CHANNELS_2_0 = 0x2,
+ ATSC_AC3_CHANNELS_3_0 = 0x3,
+ ATSC_AC3_CHANNELS_2_1 = 0x4,
+ ATSC_AC3_CHANNELS_3_1 = 0x5,
+ ATSC_AC3_CHANNELS_2_2 = 0x6,
+ ATSC_AC3_CHANNELS_3_2 = 0x7,
+ ATSC_AC3_CHANNELS_1 = 0x8,
+ ATSC_AC3_CHANNELS_LTEQ_2 = 0x9,
+ ATSC_AC3_CHANNELS_LTEQ_3 = 0xa,
+ ATSC_AC3_CHANNELS_LTEQ_4 = 0xb,
+ ATSC_AC3_CHANNELS_LTEQ_5 = 0xc,
+ ATSC_AC3_CHANNELS_LTEQ_6 = 0xd,
+};
+
+/**
+ * atsc_ac3_descriptor structure.
+ */
+struct atsc_ac3_descriptor {
+ struct descriptor d;
+
+ EBIT2(uint8_t sample_rate_code : 3; ,
+ uint8_t bsid : 5; );
+ EBIT2(uint8_t bit_rate_code : 6; ,
+ uint8_t surround_mode : 2; );
+ EBIT3(uint8_t bsmod : 3; ,
+ uint8_t num_channels : 4; ,
+ uint8_t full_svc : 1; );
+ /* uint8_t additional_info[] */
+} __ucsi_packed;
+
+/**
+ * Process an atsc_ac3_descriptor.
+ *
+ * @param d Generic descriptor structure.
+ * @return atsc_ac3_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_ac3_descriptor*
+ atsc_ac3_descriptor_codec(struct descriptor* d)
+{
+ int pos = 0;
+
+ if (d->len < (pos+4))
+ return NULL;
+ pos += 4;
+
+ return (struct atsc_ac3_descriptor*) d;
+}
+
+/**
+ * Retrieve pointer to additional_info field of a atsc_ac3_descriptor.
+ *
+ * @param d atsc_ac3_descriptor pointer.
+ * @return Pointer to additional_info field.
+ */
+static inline uint8_t *atsc_ac3_descriptor_additional_info(struct atsc_ac3_descriptor *d)
+{
+ int pos = sizeof(struct atsc_ac3_descriptor);
+
+ return ((uint8_t *) d) + pos;
+}
+
+/**
+ * Determine length of additional_info field of a atsc_ac3_descriptor.
+ *
+ * @param d atsc_ac3_descriptor pointer.
+ * @return Length of field in bytes.
+ */
+static inline int atsc_ac3_descriptor_additional_info_length(struct atsc_ac3_descriptor* d)
+{
+ return d->d.len - 3;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/atsc_text.c b/kaffeine/src/input/dvb/lib/libucsi/atsc/atsc_text.c
new file mode 100644
index 0000000..d79c83f
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/atsc_text.c
@@ -0,0 +1,743 @@
+/*
+* section and descriptor parser
+*
+* Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include "libucsi/endianops.h"
+#include "libucsi/atsc/types.h"
+
+#define HUFFTREE_LITERAL_MASK 0x80
+#define HUFFSTRING_END 0x00
+#define HUFFSTRING_ESCAPE 0x1b
+
+#define DEST_ALLOC_DELTA 20
+
+struct hufftree_entry {
+ uint8_t left_idx;
+ uint8_t right_idx;
+} __ucsi_packed;
+
+struct huffbuff {
+ uint8_t *buf;
+ uint32_t buf_len;
+
+ uint32_t cur_byte;
+ uint8_t cur_bit;
+};
+
+
+static struct hufftree_entry program_description_hufftree[][128] = {
+ { {0x14, 0x15}, {0x9b, 0xd6}, {0xc9, 0xcf}, {0xd7, 0xc7}, {0x01, 0xa2},
+ {0xce, 0xcb}, {0x02, 0x03}, {0xc5, 0xcc}, {0xc6, 0xc8}, {0x04, 0xc4},
+ {0x05, 0xc2}, {0x06, 0xc3}, {0xd2, 0x07}, {0xd3, 0x08}, {0xca, 0xd4},
+ {0x09, 0xcd}, {0xd0, 0x0a}, {0xc1, 0x0b}, {0x0c, 0x0d}, {0x0e, 0x0f},
+ {0x10, 0x11}, {0x12, 0x13}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x38, 0x39}, {0xad, 0xaf}, {0xb7, 0xda}, {0xa8, 0xb3}, {0xb5, 0x01},
+ {0x02, 0x9b}, {0xb4, 0xf1}, {0xa2, 0xd5}, {0xd6, 0xd9}, {0x03, 0x04},
+ {0x05, 0xcf}, {0x06, 0xc9}, {0xf9, 0xea}, {0xeb, 0xf5}, {0xf6, 0x07},
+ {0x08, 0x09}, {0xb2, 0xc5}, {0xc6, 0xb1}, {0x0a, 0xee}, {0xcb, 0x0b},
+ {0xd4, 0x0c}, {0xc4, 0xc8}, {0xd2, 0x0d}, {0x0e, 0x0f}, {0xc7, 0xca},
+ {0xce, 0xd0}, {0xd7, 0x10}, {0xc2, 0x11}, {0xcc, 0xec}, {0xe5, 0xe7},
+ {0x12, 0xcd}, {0x13, 0x14}, {0xc3, 0x15}, {0x16, 0x17}, {0xed, 0x18},
+ {0x19, 0xf2}, {0x1a, 0xd3}, {0x1b, 0x1c}, {0xe4, 0x1d}, {0xc1, 0xe3},
+ {0x1e, 0xe9}, {0xf0, 0xe2}, {0xf7, 0x1f}, {0xf3, 0xe6}, {0x20, 0x21},
+ {0x22, 0xe8}, {0xef, 0x23}, {0x24, 0x25}, {0x26, 0x27}, {0x28, 0x29},
+ {0x2a, 0xf4}, {0x2b, 0x2c}, {0x2d, 0x2e}, {0x2f, 0xe1}, {0x30, 0x31},
+ {0x32, 0x33}, {0x34, 0x35}, {0x36, 0x37}, },
+ { {0x9b, 0x9b}, },
+ { {0x03, 0x04}, {0x80, 0xae}, {0xc8, 0xd4}, {0x01, 0x02}, {0x9b, 0xa0}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x02, 0xf3}, {0xa0, 0xf4}, {0x9b, 0x01}, },
+ { {0x9b, 0x9b}, },
+ { {0xac, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x01, 0xa0}, {0x9b, 0xa2}, },
+ { {0x07, 0x08}, {0xe2, 0xe4}, {0xe5, 0xe6}, {0xa0, 0xf2}, {0xe1, 0x01},
+ {0x02, 0xf3}, {0xe3, 0x03}, {0x04, 0x05}, {0x9b, 0x06}, },
+ { {0x04, 0x80}, {0xca, 0xd3}, {0xa2, 0x01}, {0x9b, 0x02}, {0x03, 0xa0}, },
+ { {0x9b, 0xa0}, },
+ { {0x03, 0x04}, {0x9b, 0xb7}, {0xf4, 0xa0}, {0xb0, 0xf3}, {0x01, 0x02}, },
+ { {0xb9, 0x02}, {0xb8, 0x9b}, {0xa0, 0x01}, },
+ { {0xae, 0x02}, {0xb6, 0x9b}, {0x01, 0xa0}, },
+ { {0xa0, 0x01}, {0x9b, 0xb0}, },
+ { {0xae, 0x01}, {0x9b, 0xa0}, },
+ { {0xae, 0x01}, {0xa0, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x01}, {0xac, 0xae}, },
+ { {0x9b, 0x9b}, },
+ { {0x02, 0x03}, {0x9b, 0xa0}, {0xb5, 0xb6}, {0xb8, 0x01}, },
+ { {0x9b, 0xa0}, },
+ { {0x9b, 0xa0}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0xa0}, },
+ { {0x9b, 0x9b}, },
+ { {0x08, 0x09}, {0xe6, 0xf5}, {0xf3, 0xf4}, {0x9b, 0xe4}, {0x01, 0xed},
+ {0x02, 0x03}, {0x04, 0xf2}, {0x05, 0x06}, {0xec, 0xee}, {0x07, 0xa0}, },
+ { {0x05, 0x06}, {0x9b, 0xec}, {0xf5, 0x01}, {0x02, 0xe1}, {0xef, 0xe5},
+ {0xe9, 0xf2}, {0x03, 0x04}, },
+ { {0x06, 0x07}, {0x9b, 0xe9}, {0xf9, 0xf2}, {0xf5, 0x01}, {0x02, 0x03},
+ {0xec, 0xef}, {0xe1, 0x04}, {0xe8, 0x05}, },
+ { {0x05, 0x06}, {0xf9, 0xf2}, {0xf5, 0x9b}, {0xe5, 0xef}, {0x01, 0x02},
+ {0xe9, 0xe1}, {0x03, 0x04}, },
+ { {0x06, 0x07}, {0xe1, 0xe9}, {0xee, 0xf6}, {0xe4, 0xec}, {0xf3, 0x01},
+ {0x02, 0xf2}, {0x03, 0x04}, {0x9b, 0x05}, },
+ { {0x02, 0x03}, {0xe5, 0xec}, {0x9b, 0xef}, {0x01, 0xf2}, },
+ { {0x05, 0x06}, {0xf5, 0xef}, {0x9b, 0xec}, {0xe9, 0x01}, {0xe1, 0xf2},
+ {0x02, 0xe5}, {0x03, 0x04}, },
+ { {0x03, 0x04}, {0x9b, 0xe5}, {0xe9, 0xf5}, {0xe1, 0x01}, {0xef, 0x02}, },
+ { {0x04, 0x05}, {0xa0, 0xc9}, {0xf3, 0x9b}, {0xae, 0xf2}, {0x01, 0x02},
+ {0x03, 0xee}, },
+ { {0xef, 0x05}, {0x9b, 0xae}, {0xe9, 0xe5}, {0x01, 0xf5}, {0x02, 0xe1},
+ {0x03, 0x04}, },
+ { {0xe5, 0x03}, {0xe1, 0xe9}, {0xf2, 0x9b}, {0x01, 0x02}, },
+ { {0x03, 0x04}, {0x9b, 0xe9}, {0xf5, 0x01}, {0xe5, 0x02}, {0xef, 0xe1}, },
+ { {0xe1, 0x05}, {0x9b, 0xe3}, {0xef, 0x01}, {0xf5, 0xe5}, {0x02, 0x03},
+ {0xe9, 0x04}, },
+ { {0xe5, 0x03}, {0x9b, 0xe9}, {0x01, 0xe1}, {0xef, 0x02}, },
+ { {0x03, 0x04}, {0xa7, 0xee}, {0xec, 0xf2}, {0xf3, 0x01}, {0x9b, 0x02}, },
+ { {0xe1, 0x06}, {0x9b, 0xe8}, {0xe9, 0x01}, {0xf2, 0xec}, {0x02, 0xef},
+ {0x03, 0xe5}, {0x04, 0x05}, },
+ { {0x9b, 0x9b}, },
+ { {0x03, 0x04}, {0x9b, 0xae}, {0x01, 0xe9}, {0x02, 0xe1}, {0xe5, 0xef}, },
+ { {0x09, 0x0a}, {0xf6, 0xf9}, {0x01, 0xae}, {0xe3, 0xe9}, {0xf5, 0x9b},
+ {0xe5, 0xef}, {0x02, 0x03}, {0xe1, 0x04}, {0xe8, 0x05}, {0x06, 0xf4},
+ {0x07, 0x08}, },
+ { {0xe8, 0x07}, {0xe5, 0xf7}, {0xd6, 0xe1}, {0x9b, 0xe9}, {0xf2, 0x01},
+ {0x02, 0x03}, {0x04, 0xef}, {0x05, 0x06}, },
+ { {0xae, 0x01}, {0x9b, 0xee}, },
+ { {0xe9, 0x02}, {0xe5, 0x9b}, {0xa0, 0x01}, },
+ { {0x03, 0x04}, {0x9b, 0xe8}, {0xe5, 0xe1}, {0xef, 0x01}, {0xe9, 0x02}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0xef}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x18, 0x19}, {0xe8, 0xef}, {0xf8, 0x9b}, {0xa7, 0xf7}, {0xfa, 0x01},
+ {0x02, 0x03}, {0x04, 0xe5}, {0xae, 0x05}, {0xe6, 0xe2}, {0x06, 0xf6},
+ {0xeb, 0xf5}, {0xe9, 0x07}, {0xf0, 0xf9}, {0xe7, 0x08}, {0x09, 0xe4},
+ {0x0a, 0xe3}, {0x0b, 0xed}, {0x0c, 0xf3}, {0x0d, 0x0e}, {0x0f, 0xec},
+ {0x10, 0xf4}, {0x11, 0x12}, {0xf2, 0xa0}, {0x13, 0x14}, {0x15, 0xee},
+ {0x16, 0x17}, },
+ { {0x0b, 0x0c}, {0xe4, 0xf3}, {0x9b, 0xae}, {0xe2, 0x01}, {0x02, 0x03},
+ {0xec, 0xa0}, {0x04, 0xe9}, {0xf2, 0xf5}, {0x05, 0xf9}, {0xe1, 0x06},
+ {0xef, 0x07}, {0xe5, 0x08}, {0x09, 0x0a}, },
+ { {0x0f, 0x10}, {0xf1, 0xae}, {0xc4, 0xf9}, {0xac, 0x01}, {0xe3, 0x02},
+ {0x9b, 0xf2}, {0x03, 0x04}, {0xa0, 0xec}, {0xf5, 0x05}, {0x06, 0xe9},
+ {0x07, 0xeb}, {0x08, 0xf4}, {0x09, 0xe5}, {0x0a, 0xef}, {0xe1, 0xe8},
+ {0x0b, 0x0c}, {0x0d, 0x0e}, },
+ { {0x13, 0x14}, {0xa7, 0xbb}, {0xe6, 0xed}, {0xf7, 0xe7}, {0xf6, 0x01},
+ {0x02, 0x9b}, {0xee, 0x03}, {0x04, 0xec}, {0x05, 0xf5}, {0x06, 0xac},
+ {0xe4, 0xf9}, {0xf2, 0x07}, {0x08, 0x09}, {0xae, 0x0a}, {0xef, 0x0b},
+ {0xe1, 0xf3}, {0x0c, 0xe9}, {0x0d, 0x0e}, {0x0f, 0x10}, {0xe5, 0x11},
+ {0x12, 0xa0}, },
+ { {0x1d, 0x1e}, {0xa9, 0xe8}, {0xf5, 0x9b}, {0x01, 0xad}, {0xbb, 0xeb},
+ {0xfa, 0x02}, {0xa7, 0xe6}, {0xe2, 0xe7}, {0x03, 0x04}, {0x05, 0x06},
+ {0xe9, 0xf8}, {0x07, 0xac}, {0xef, 0xf0}, {0x08, 0xed}, {0xf6, 0xf9},
+ {0x09, 0xf7}, {0x0a, 0x0b}, {0xae, 0x0c}, {0xe3, 0x0d}, {0xe5, 0xf4},
+ {0x0e, 0x0f}, {0xe4, 0x10}, {0xec, 0x11}, {0xe1, 0x12}, {0x13, 0x14},
+ {0x15, 0x16}, {0xee, 0xf3}, {0x17, 0x18}, {0xf2, 0xa0}, {0x19, 0x1a},
+ {0x1b, 0x1c}, },
+ { {0x09, 0x0a}, {0xae, 0x9b}, {0xec, 0x01}, {0xf5, 0x02}, {0xf4, 0xe6},
+ {0x03, 0xe1}, {0xe5, 0xe9}, {0x04, 0xf2}, {0xef, 0x05}, {0x06, 0x07},
+ {0xa0, 0x08}, },
+ { {0x0e, 0x0f}, {0xad, 0xe7}, {0x9b, 0xa7}, {0xf9, 0x01}, {0xec, 0x02},
+ {0xac, 0xf2}, {0x03, 0xae}, {0xf3, 0xf5}, {0x04, 0x05}, {0xef, 0x06},
+ {0x07, 0xe9}, {0xe1, 0x08}, {0x09, 0xe8}, {0x0a, 0x0b}, {0xe5, 0x0c},
+ {0xa0, 0x0d}, },
+ { {0x0d, 0x0e}, {0xa7, 0xac}, {0xf3, 0xad}, {0x01, 0x02}, {0x9b, 0xf9},
+ {0xf5, 0xae}, {0x03, 0xee}, {0x04, 0xf2}, {0x05, 0x06}, {0xf4, 0x07},
+ {0x08, 0x09}, {0xef, 0xe1}, {0xa0, 0x0a}, {0xe9, 0x0b}, {0x0c, 0xe5}, },
+ { {0x14, 0x15}, {0xac, 0xe2}, {0xf8, 0x9b}, {0xae, 0xfa}, {0x01, 0xeb},
+ {0x02, 0xa0}, {0x03, 0x04}, {0xf0, 0x05}, {0x06, 0xe6}, {0xf6, 0x07},
+ {0xe4, 0xed}, {0xe7, 0x08}, {0xe1, 0xef}, {0xf2, 0x09}, {0x0a, 0x0b},
+ {0xec, 0x0c}, {0xe5, 0xe3}, {0x0d, 0xf4}, {0x0e, 0xf3}, {0x0f, 0x10},
+ {0x11, 0xee}, {0x12, 0x13}, },
+ { {0x03, 0xef}, {0x9b, 0xe1}, {0xe5, 0xf5}, {0x01, 0x02}, },
+ { {0x08, 0x09}, {0xec, 0xf9}, {0xa7, 0xee}, {0x01, 0xac}, {0x9b, 0xae},
+ {0x02, 0x03}, {0x04, 0xf3}, {0x05, 0xe9}, {0x06, 0xa0}, {0x07, 0xe5}, },
+ { {0x16, 0x17}, {0xa7, 0xad}, {0xee, 0xe3}, {0xeb, 0xf2}, {0x9b, 0xe2},
+ {0x01, 0x02}, {0xf5, 0x03}, {0xf4, 0xac}, {0x04, 0x05}, {0xe6, 0xed},
+ {0xf6, 0x06}, {0xae, 0xf0}, {0x07, 0x08}, {0xf3, 0x09}, {0x0a, 0xe4},
+ {0x0b, 0x0c}, {0xf9, 0x0d}, {0xef, 0x0e}, {0xe1, 0x0f}, {0x10, 0xe9},
+ {0xec, 0x11}, {0xa0, 0xe5}, {0x12, 0x13}, {0x14, 0x15}, },
+ { {0x0c, 0x0d}, {0xa7, 0xbb}, {0x9b, 0x01}, {0xf9, 0xae}, {0xe2, 0x02},
+ {0xed, 0xf3}, {0x03, 0xf5}, {0xef, 0xf0}, {0x04, 0x05}, {0xe9, 0x06},
+ {0x07, 0x08}, {0x09, 0xa0}, {0xe1, 0xe5}, {0x0a, 0x0b}, },
+ { {0x19, 0x1a}, {0xad, 0xbb}, {0xe2, 0xea}, {0xed, 0xf2}, {0xfa, 0xe6},
+ {0xec, 0x01}, {0x02, 0x03}, {0x9b, 0xf5}, {0x04, 0xa7}, {0xf6, 0xf9},
+ {0x05, 0x06}, {0xeb, 0xef}, {0x07, 0x08}, {0x09, 0x0a}, {0xac, 0x0b},
+ {0x0c, 0xe3}, {0xae, 0x0d}, {0xee, 0xe9}, {0x0e, 0xe1}, {0x0f, 0xf3},
+ {0x10, 0x11}, {0xf4, 0x12}, {0xe7, 0xe5}, {0x13, 0x14}, {0xe4, 0x15},
+ {0x16, 0x17}, {0xa0, 0x18}, },
+ { {0x1a, 0x1b}, {0xc2, 0x9b}, {0xad, 0xac}, {0xf8, 0x01}, {0xae, 0x02},
+ {0x03, 0xe5}, {0xe7, 0xe8}, {0xf9, 0xe9}, {0xeb, 0x04}, {0xe3, 0xe1},
+ {0x05, 0xf6}, {0x06, 0xe4}, {0x07, 0xe2}, {0xf0, 0x08}, {0x09, 0xf3},
+ {0xf4, 0xf7}, {0xef, 0x0a}, {0x0b, 0x0c}, {0x0d, 0xec}, {0x0e, 0x0f},
+ {0x10, 0xf5}, {0xed, 0x11}, {0xe6, 0xa0}, {0x12, 0xf2}, {0x13, 0x14},
+ {0x15, 0xee}, {0x16, 0x17}, {0x18, 0x19}, },
+ { {0x0e, 0x0f}, {0xad, 0xed}, {0xf9, 0x9b}, {0xae, 0x01}, {0xf3, 0x02},
+ {0x03, 0xf5}, {0xf4, 0xf0}, {0x04, 0xef}, {0x05, 0xe9}, {0x06, 0xe8},
+ {0xa0, 0xe1}, {0xec, 0x07}, {0xf2, 0x08}, {0xe5, 0x09}, {0x0a, 0x0b},
+ {0x0c, 0x0d}, },
+ { {0x9b, 0xf5}, },
+ { {0x19, 0x1a}, {0xa9, 0xbb}, {0xf6, 0xe6}, {0x01, 0x9b}, {0xad, 0xe2},
+ {0xf0, 0x02}, {0xa7, 0x03}, {0x04, 0x05}, {0xf5, 0xe3}, {0xac, 0xe7},
+ {0xf2, 0x06}, {0xeb, 0x07}, {0xec, 0xed}, {0xee, 0xf9}, {0x08, 0xae},
+ {0x09, 0x0a}, {0xe4, 0x0b}, {0x0c, 0xf4}, {0x0d, 0xf3}, {0x0e, 0x0f},
+ {0x10, 0xe1}, {0xef, 0x11}, {0xe9, 0x12}, {0x13, 0xe5}, {0x14, 0xa0},
+ {0x15, 0x16}, {0x17, 0x18}, },
+ { {0xa0, 0x16}, {0xa2, 0xa7}, {0xe2, 0xeb}, {0xed, 0xee}, {0x9b, 0xf7},
+ {0x01, 0x02}, {0x03, 0xbb}, {0xf9, 0xf0}, {0x04, 0x05}, {0xec, 0x06},
+ {0x07, 0x08}, {0xf5, 0xe1}, {0x09, 0xac}, {0xe3, 0x0a}, {0xe8, 0x0b},
+ {0xe9, 0x0c}, {0xef, 0xf3}, {0xae, 0x0d}, {0x0e, 0xe5}, {0x0f, 0x10},
+ {0x11, 0xf4}, {0x12, 0x13}, {0x14, 0x15}, },
+ { {0x14, 0x15}, {0xbb, 0xe2}, {0xad, 0xed}, {0x01, 0x9b}, {0xa7, 0xe3},
+ {0xac, 0xec}, {0xee, 0x02}, {0xf7, 0x03}, {0x04, 0xf9}, {0x05, 0x06},
+ {0x07, 0x08}, {0xf4, 0xae}, {0xf5, 0x09}, {0x0a, 0xf2}, {0xe1, 0xf3},
+ {0x0b, 0x0c}, {0x0d, 0xe9}, {0x0e, 0x0f}, {0xef, 0xe5}, {0x10, 0xa0},
+ {0xe8, 0x11}, {0x12, 0x13}, },
+ { {0x11, 0x12}, {0xef, 0xf6}, {0x9b, 0xeb}, {0xf9, 0x01}, {0xa0, 0xe2},
+ {0x02, 0xe1}, {0x03, 0xed}, {0x04, 0xe3}, {0xe9, 0x05}, {0xe4, 0xe5},
+ {0xe7, 0x06}, {0xec, 0xf0}, {0x07, 0x08}, {0x09, 0x0a}, {0x0b, 0xf3},
+ {0x0c, 0xf4}, {0xee, 0x0d}, {0xf2, 0x0e}, {0x0f, 0x10}, },
+ { {0x05, 0xe5}, {0xf3, 0xf9}, {0x9b, 0x01}, {0xef, 0x02}, {0x03, 0xe1},
+ {0x04, 0xe9}, },
+ { {0x0a, 0x0b}, {0xae, 0x9b}, {0xec, 0xed}, {0x01, 0x02}, {0xf3, 0xee},
+ {0xf2, 0x03}, {0xe5, 0x04}, {0xe8, 0xa0}, {0xe1, 0x05}, {0xef, 0x06},
+ {0x07, 0x08}, {0xe9, 0x09}, },
+ { {0x05, 0x06}, {0xa0, 0xac}, {0xad, 0xf4}, {0xe9, 0x01}, {0x02, 0xe1},
+ {0xe5, 0x03}, {0x9b, 0x04}, },
+ { {0x11, 0xa0}, {0xbf, 0xe1}, {0xe2, 0xe6}, {0xed, 0xe4}, {0xe9, 0xf7},
+ {0xa7, 0x01}, {0x02, 0xbb}, {0x03, 0x04}, {0xec, 0x05}, {0x9b, 0xee},
+ {0x06, 0xef}, {0x07, 0xac}, {0xe5, 0xf3}, {0x08, 0x09}, {0x0a, 0xae},
+ {0x0b, 0x0c}, {0x0d, 0x0e}, {0x0f, 0x10}, },
+ { {0x06, 0x07}, {0xa0, 0xae}, {0xe1, 0xe5}, {0xec, 0xfa}, {0x9b, 0xef},
+ {0xe9, 0x01}, {0x02, 0x03}, {0x04, 0x05}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+};
+
+static struct hufftree_entry program_title_hufftree[][128] = {
+ { {0x1b, 0x1c}, {0xb4, 0xa4}, {0xb2, 0xb7}, {0xda, 0x01}, {0xd1, 0x02},
+ {0x03, 0x9b}, {0x04, 0xd5}, {0xd9, 0x05}, {0xcb, 0xd6}, {0x06, 0xcf},
+ {0x07, 0x08}, {0xca, 0x09}, {0xc9, 0xc5}, {0xc6, 0x0a}, {0xd2, 0xc4},
+ {0xc7, 0xcc}, {0xd0, 0xc8}, {0xd7, 0xce}, {0x0b, 0xc1}, {0x0c, 0xc2},
+ {0xcd, 0xc3}, {0x0d, 0x0e}, {0x0f, 0x10}, {0xd3, 0x11}, {0xd4, 0x12},
+ {0x13, 0x14}, {0x15, 0x16}, {0x17, 0x18}, {0x19, 0x1a}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x29, 0x2a}, {0xd8, 0xe5}, {0xb9, 0x01}, {0xa7, 0xb1}, {0xec, 0xd1},
+ {0x02, 0xad}, {0xb2, 0xda}, {0xe3, 0xb3}, {0x03, 0xe4}, {0xe6, 0x04},
+ {0x9b, 0xe2}, {0x05, 0x06}, {0x07, 0x08}, {0x09, 0xd5}, {0x0a, 0xd6},
+ {0x0b, 0xd9}, {0x0c, 0xa6}, {0xe9, 0xcb}, {0xc5, 0xcf}, {0x0d, 0x0e},
+ {0xca, 0xc9}, {0x0f, 0xc7}, {0x10, 0x11}, {0xe1, 0x12}, {0x13, 0xc6},
+ {0xd2, 0xc8}, {0xce, 0xc1}, {0xc4, 0xd0}, {0xcc, 0x14}, {0x15, 0xef},
+ {0xc2, 0xd7}, {0x16, 0xcd}, {0x17, 0xf4}, {0xd4, 0x18}, {0x19, 0x1a},
+ {0xc3, 0xd3}, {0x1b, 0x1c}, {0x1d, 0x1e}, {0x1f, 0x20}, {0x21, 0x22},
+ {0x23, 0x24}, {0x25, 0x26}, {0x27, 0x28}, },
+ { {0x01, 0x80}, {0xa0, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0xb1, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0xa0}, },
+ { {0x04, 0xf3}, {0xe4, 0xb9}, {0x01, 0xf4}, {0xa0, 0x9b}, {0x02, 0x03}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x01, 0x02}, {0x9b, 0xc1}, {0xc8, 0xd3}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0xa0}, },
+ { {0x07, 0x08}, {0xb1, 0xd2}, {0xd3, 0xd4}, {0xd5, 0xad}, {0xcd, 0xc1},
+ {0x01, 0x02}, {0x03, 0xa0}, {0x04, 0x9b}, {0x05, 0x06}, },
+ { {0xa0, 0x05}, {0xc9, 0xd7}, {0xd3, 0x01}, {0x02, 0x9b}, {0xae, 0x80},
+ {0x03, 0x04}, },
+ { {0x9b, 0x9b}, },
+ { {0x02, 0x03}, {0xad, 0x9b}, {0x01, 0x80}, {0xa0, 0xb0}, },
+ { {0x04, 0x05}, {0x80, 0x9b}, {0xb1, 0xb2}, {0xa0, 0xb0}, {0xb9, 0x01},
+ {0x02, 0x03}, },
+ { {0x02, 0x03}, {0xb1, 0xba}, {0x01, 0xb0}, {0x9b, 0x80}, },
+ { {0x80, 0x01}, {0xb0, 0x9b}, },
+ { {0x9b, 0xb8}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0xb0}, },
+ { {0x9b, 0xa0}, },
+ { {0x02, 0x03}, {0xb1, 0xb3}, {0xb9, 0xb0}, {0x01, 0x9b}, },
+ { {0x9b, 0xa0}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x80}, },
+ { {0x9b, 0x9b}, },
+ { {0x13, 0x14}, {0xaa, 0xad}, {0xae, 0xf6}, {0xe7, 0xf4}, {0xe2, 0xe9},
+ {0x01, 0x02}, {0xc2, 0xf0}, {0x9b, 0xf3}, {0xe3, 0xe6}, {0xf7, 0x03},
+ {0xf5, 0x04}, {0x05, 0x06}, {0xf2, 0x07}, {0x08, 0x09}, {0x0a, 0x0b},
+ {0x0c, 0xe4}, {0xa0, 0x0d}, {0xec, 0xee}, {0x0e, 0xed}, {0x0f, 0x10},
+ {0x11, 0x12}, },
+ { {0x08, 0x09}, {0xc1, 0xd3}, {0x9b, 0x01}, {0xc3, 0x02}, {0xe9, 0xec},
+ {0x03, 0xf2}, {0xf5, 0x04}, {0xef, 0xe1}, {0x05, 0xe5}, {0x06, 0x07}, },
+ { {0x0b, 0x0c}, {0xc1, 0xf9}, {0x01, 0xc2}, {0xcf, 0xe5}, {0xf5, 0x9b},
+ {0xe9, 0x02}, {0xa0, 0x03}, {0x04, 0x05}, {0xf2, 0x06}, {0xec, 0x07},
+ {0xe1, 0x08}, {0x09, 0xe8}, {0x0a, 0xef}, },
+ { {0x05, 0x06}, {0xf9, 0x9b}, {0x01, 0xf5}, {0x02, 0xf2}, {0xe9, 0xe5},
+ {0xef, 0x03}, {0xe1, 0x04}, },
+ { {0x0a, 0x0b}, {0xf1, 0xf5}, {0xf3, 0x01}, {0xed, 0xf9}, {0xc3, 0x02},
+ {0xec, 0xee}, {0xe4, 0xf8}, {0x03, 0x9b}, {0xf6, 0x04}, {0x05, 0xe1},
+ {0x06, 0x07}, {0x08, 0x09}, },
+ { {0x07, 0x08}, {0xa0, 0x9b}, {0xcc, 0x01}, {0xe5, 0x02}, {0xec, 0xf5},
+ {0xef, 0x03}, {0xe9, 0xf2}, {0x04, 0x05}, {0xe1, 0x06}, },
+ { {0x09, 0x0a}, {0xae, 0xec}, {0xf9, 0xc1}, {0xe8, 0x01}, {0x9b, 0x02},
+ {0x03, 0x04}, {0xe1, 0xf5}, {0xe9, 0x05}, {0xe5, 0x06}, {0xf2, 0xef},
+ {0x07, 0x08}, },
+ { {0xef, 0x05}, {0x80, 0x9b}, {0xf5, 0x01}, {0x02, 0xe9}, {0xe1, 0x03},
+ {0xe5, 0x04}, },
+ { {0xee, 0x0b}, {0xba, 0xd4}, {0xae, 0xf2}, {0xe3, 0x01}, {0xa0, 0x02},
+ {0x80, 0x9b}, {0xed, 0x03}, {0xc9, 0xf3}, {0xf4, 0x04}, {0x05, 0x06},
+ {0x07, 0x08}, {0x09, 0x0a}, },
+ { {0x02, 0x03}, {0x9b, 0xf5}, {0x01, 0xe1}, {0xef, 0xe5}, },
+ { {0x05, 0xe9}, {0xe1, 0xef}, {0xf5, 0xee}, {0x9b, 0xe5}, {0x01, 0x02},
+ {0x03, 0x04}, },
+ { {0x04, 0x05}, {0xa0, 0x9b}, {0x01, 0xf5}, {0x02, 0xe5}, {0xef, 0x03},
+ {0xe1, 0xe9}, },
+ { {0x08, 0x09}, {0xaa, 0xd4}, {0x01, 0x9b}, {0xe3, 0x02}, {0xf2, 0x03},
+ {0xe5, 0x04}, {0xf5, 0xf9}, {0xe9, 0x05}, {0xef, 0x06}, {0x07, 0xe1}, },
+ { {0xe5, 0x08}, {0xce, 0xa0}, {0xc6, 0xf5}, {0x01, 0x02}, {0x9b, 0xc2},
+ {0x03, 0xe1}, {0x04, 0xef}, {0x05, 0xe9}, {0x06, 0x07}, },
+ { {0x09, 0x0a}, {0xe4, 0xf3}, {0xe6, 0xf6}, {0xf7, 0xf0}, {0xf2, 0x01},
+ {0xec, 0x02}, {0x03, 0xa0}, {0x9b, 0x04}, {0x05, 0xf5}, {0x06, 0x07},
+ {0xee, 0x08}, },
+ { {0x0b, 0x0c}, {0xa0, 0xf3}, {0xf9, 0xae}, {0xd2, 0xc7}, {0x01, 0x9b},
+ {0x02, 0xf5}, {0x03, 0x04}, {0x05, 0xe9}, {0xec, 0x06}, {0xe5, 0x07},
+ {0xef, 0x08}, {0xe1, 0x09}, {0xf2, 0x0a}, },
+ { {0x01, 0xf5}, {0x9b, 0xd6}, },
+ { {0x04, 0x05}, {0xe8, 0x9b}, {0x01, 0xf5}, {0x02, 0xe1}, {0xe9, 0xef},
+ {0x03, 0xe5}, },
+ { {0x10, 0x11}, {0xaa, 0xec}, {0xf1, 0xae}, {0xa0, 0xf7}, {0xed, 0xee},
+ {0x01, 0x02}, {0x9b, 0xeb}, {0x03, 0x04}, {0x05, 0x06}, {0xe3, 0x07},
+ {0xef, 0x08}, {0xe9, 0xf5}, {0x09, 0xe1}, {0xe5, 0xf0}, {0xe8, 0x0a},
+ {0x0b, 0x0c}, {0x0d, 0xf4}, {0x0e, 0x0f}, },
+ { {0xe8, 0x0a}, {0xad, 0xce}, {0x9b, 0x01}, {0xd6, 0x02}, {0xf5, 0xf7},
+ {0x03, 0x04}, {0xe1, 0xe5}, {0xe9, 0x05}, {0xf2, 0x06}, {0xef, 0x07},
+ {0x08, 0x09}, },
+ { {0xee, 0x03}, {0xec, 0xae}, {0x01, 0x9b}, {0x02, 0xf0}, },
+ { {0x06, 0xe9}, {0xa0, 0xc3}, {0xef, 0x9b}, {0xe5, 0x01}, {0x80, 0x02},
+ {0x03, 0xe1}, {0x04, 0x05}, },
+ { {0x06, 0x07}, {0xc6, 0xd7}, {0x01, 0x9b}, {0xf2, 0x02}, {0x03, 0xe8},
+ {0xe5, 0xe1}, {0x04, 0xe9}, {0xef, 0x05}, },
+ { {0x9b, 0x9b}, },
+ { {0x02, 0xef}, {0xe1, 0x9b}, {0x01, 0xe5}, },
+ { {0x01, 0xef}, {0x9b, 0xe1}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x19, 0x1a}, {0x9b, 0xba}, {0xe5, 0xea}, {0xf8, 0x01}, {0x02, 0xe6},
+ {0xa7, 0x03}, {0xfa, 0xe8}, {0x04, 0xf7}, {0x05, 0xf5}, {0xe2, 0x06},
+ {0xeb, 0x07}, {0xf0, 0x08}, {0x80, 0xf6}, {0xe7, 0x09}, {0xe4, 0x0a},
+ {0xa0, 0xe9}, {0x0b, 0xe3}, {0xf9, 0x0c}, {0x0d, 0xed}, {0x0e, 0x0f},
+ {0xf3, 0x10}, {0x11, 0xec}, {0x12, 0xf4}, {0xf2, 0x13}, {0xee, 0x14},
+ {0x15, 0x16}, {0x17, 0x18}, },
+ { {0x0a, 0x0b}, {0xf3, 0x9b}, {0xf5, 0xe2}, {0x01, 0x80}, {0xa0, 0x02},
+ {0xe5, 0xf2}, {0xe9, 0x03}, {0xec, 0x04}, {0xf9, 0x05}, {0xef, 0x06},
+ {0xe1, 0x07}, {0x08, 0x09}, },
+ { {0x10, 0x11}, {0xc3, 0xcc}, {0xc7, 0x9b}, {0xe3, 0x01}, {0x80, 0xec},
+ {0xf9, 0x02}, {0xf3, 0x03}, {0xf5, 0x04}, {0x05, 0xf2}, {0x06, 0xe9},
+ {0xa0, 0x07}, {0x08, 0xef}, {0xf4, 0x09}, {0x0a, 0xe1}, {0x0b, 0xe8},
+ {0xeb, 0xe5}, {0x0c, 0x0d}, {0x0e, 0x0f}, },
+ { {0x0e, 0x0f}, {0xae, 0xf5}, {0xf7, 0x01}, {0xec, 0x02}, {0xe4, 0xe7},
+ {0xf2, 0x03}, {0x9b, 0xef}, {0x04, 0xf6}, {0x05, 0x06}, {0xf9, 0xf3},
+ {0x07, 0xe9}, {0xe1, 0x08}, {0x09, 0x80}, {0x0a, 0x0b}, {0xe5, 0x0c},
+ {0x0d, 0xa0}, },
+ { {0x1e, 0x1f}, {0x9b, 0xa1}, {0xad, 0xe8}, {0xea, 0xf1}, {0xf5, 0xfa},
+ {0x01, 0x02}, {0x03, 0x04}, {0xba, 0xf8}, {0xa7, 0xe2}, {0xe9, 0x05},
+ {0x06, 0x07}, {0xe6, 0xed}, {0xe7, 0xeb}, {0x08, 0x09}, {0xf6, 0xf0},
+ {0x0a, 0xef}, {0x0b, 0xe3}, {0x0c, 0x0d}, {0x0e, 0xf9}, {0x0f, 0xe4},
+ {0xec, 0x10}, {0xe5, 0x11}, {0xf4, 0xf7}, {0x12, 0x13}, {0xe1, 0x14},
+ {0x15, 0x16}, {0xee, 0xf3}, {0x17, 0x80}, {0x18, 0x19}, {0xf2, 0x1a},
+ {0x1b, 0xa0}, {0x1c, 0x1d}, },
+ { {0xa0, 0x0b}, {0xf5, 0x9b}, {0x01, 0xec}, {0xf3, 0xf2}, {0x80, 0xe1},
+ {0x02, 0x03}, {0xf4, 0xe9}, {0xef, 0xe6}, {0x04, 0x05}, {0x06, 0x07},
+ {0xe5, 0x08}, {0x09, 0x0a}, },
+ { {0x0f, 0x10}, {0xba, 0xf9}, {0xa7, 0xf4}, {0x9b, 0x01}, {0xe7, 0xec},
+ {0x02, 0xee}, {0x03, 0xef}, {0xf5, 0x04}, {0xf2, 0x05}, {0x06, 0xe9},
+ {0x07, 0xf3}, {0xe1, 0x08}, {0x09, 0x0a}, {0x0b, 0xe5}, {0x80, 0x0c},
+ {0xe8, 0xa0}, {0x0d, 0x0e}, },
+ { {0xe5, 0x0d}, {0xe2, 0xf5}, {0xf7, 0x9b}, {0xec, 0x01}, {0xf9, 0xee},
+ {0x02, 0x03}, {0x04, 0xf2}, {0x05, 0x80}, {0x06, 0xa0}, {0xe1, 0xef},
+ {0x07, 0xf4}, {0xe9, 0x08}, {0x09, 0x0a}, {0x0b, 0x0c}, },
+ { {0x15, 0x16}, {0xa1, 0xf8}, {0xe9, 0xeb}, {0x01, 0x80}, {0x9b, 0xfa},
+ {0xe2, 0x02}, {0x03, 0x04}, {0xa0, 0xf0}, {0x05, 0x06}, {0x07, 0xe1},
+ {0x08, 0xe6}, {0xf2, 0xed}, {0xf6, 0x09}, {0xe4, 0x0a}, {0xef, 0xf4},
+ {0xec, 0xf3}, {0xe7, 0xe5}, {0x0b, 0xe3}, {0x0c, 0x0d}, {0x0e, 0x0f},
+ {0x10, 0x11}, {0x12, 0x13}, {0xee, 0x14}, },
+ { {0xef, 0x01}, {0x9b, 0xe1}, },
+ { {0x0b, 0x0c}, {0xd4, 0xef}, {0xe6, 0xec}, {0xf7, 0xe1}, {0x01, 0xba},
+ {0x02, 0x9b}, {0xf9, 0x03}, {0x04, 0x05}, {0xf3, 0x06}, {0x07, 0x08},
+ {0xe9, 0xa0}, {0x09, 0x80}, {0xe5, 0x0a}, },
+ { {0x15, 0x16}, {0xa7, 0xba}, {0xe3, 0xf7}, {0xf2, 0xad}, {0xe2, 0x01},
+ {0x02, 0x9b}, {0xe6, 0x03}, {0xed, 0xf6}, {0x04, 0xeb}, {0x05, 0xf4},
+ {0x06, 0x07}, {0x08, 0xf3}, {0x09, 0xf5}, {0x0a, 0xef}, {0x0b, 0x0c},
+ {0x80, 0xf9}, {0xe1, 0x0d}, {0xe4, 0xe9}, {0xa0, 0x0e}, {0x0f, 0xec},
+ {0xe5, 0x10}, {0x11, 0x12}, {0x13, 0x14}, },
+ { {0x0a, 0x0b}, {0xf9, 0x9b}, {0xf5, 0xf3}, {0x01, 0x02}, {0xe2, 0xed},
+ {0x80, 0x03}, {0xf0, 0xef}, {0x04, 0xa0}, {0x05, 0xe9}, {0x06, 0xe1},
+ {0x07, 0x08}, {0x09, 0xe5}, },
+ { {0x18, 0x19}, {0xe2, 0xea}, {0xf2, 0xe8}, {0xec, 0xed}, {0xfa, 0x9b},
+ {0x01, 0xf5}, {0x02, 0x03}, {0xf6, 0x04}, {0xba, 0xe6}, {0x05, 0x06},
+ {0xeb, 0xef}, {0x07, 0xa7}, {0xf9, 0x08}, {0x09, 0x0a}, {0x0b, 0xe3},
+ {0x0c, 0xee}, {0xe1, 0x0d}, {0xf3, 0x0e}, {0xe9, 0x0f}, {0x10, 0xf4},
+ {0x80, 0xe4}, {0xe5, 0x11}, {0x12, 0xe7}, {0xa0, 0x13}, {0x14, 0x15},
+ {0x16, 0x17}, },
+ { {0x1b, 0x1c}, {0xae, 0xfa}, {0xbf, 0x01}, {0xa7, 0x9b}, {0x02, 0xe9},
+ {0xf8, 0xf9}, {0x03, 0xe5}, {0xe8, 0x04}, {0xe1, 0xeb}, {0x05, 0xe2},
+ {0x06, 0x07}, {0xe3, 0x08}, {0xe7, 0xf4}, {0x09, 0x80}, {0xf6, 0xf0},
+ {0x0a, 0xe4}, {0x0b, 0xf3}, {0xf7, 0x0c}, {0x0d, 0xef}, {0xec, 0xa0},
+ {0x0e, 0x0f}, {0xed, 0xe6}, {0x10, 0xf5}, {0x11, 0x12}, {0x13, 0x14},
+ {0x15, 0xf2}, {0x16, 0xee}, {0x17, 0x18}, {0x19, 0x1a}, },
+ { {0x0e, 0x0f}, {0xed, 0xa7}, {0x9b, 0xe4}, {0x01, 0xf9}, {0xf3, 0xf2},
+ {0xf4, 0x02}, {0xe8, 0x03}, {0xec, 0xf0}, {0x04, 0xe1}, {0xe9, 0x05},
+ {0x06, 0x80}, {0xa0, 0x07}, {0x08, 0x09}, {0x0a, 0xe5}, {0xef, 0x0b},
+ {0x0c, 0x0d}, },
+ { {0x9b, 0xf5}, },
+ { {0x18, 0x19}, {0xba, 0xac}, {0xf6, 0x9b}, {0xf0, 0xe2}, {0x01, 0xe6},
+ {0x02, 0xa7}, {0xae, 0xe7}, {0x03, 0xe3}, {0xf5, 0x04}, {0xed, 0x05},
+ {0x06, 0x07}, {0xeb, 0x08}, {0x09, 0xee}, {0xf2, 0x0a}, {0xe4, 0x0b},
+ {0xf9, 0xec}, {0x0c, 0x0d}, {0xf4, 0x80}, {0x0e, 0xef}, {0xf3, 0xa0},
+ {0xe1, 0x0f}, {0xe9, 0x10}, {0x11, 0xe5}, {0x12, 0x13}, {0x14, 0x15},
+ {0x16, 0x17}, },
+ { {0x19, 0x1a}, {0xa7, 0xac}, {0xbf, 0xc3}, {0xc8, 0xe4}, {0xe6, 0xed},
+ {0xf2, 0xae}, {0xec, 0xee}, {0xf9, 0x01}, {0x02, 0x03}, {0x04, 0xba},
+ {0x05, 0x9b}, {0xf5, 0x06}, {0x07, 0x08}, {0x09, 0xeb}, {0xf0, 0x0a},
+ {0x0b, 0x0c}, {0xe1, 0xe3}, {0x0d, 0xe8}, {0x0e, 0x0f}, {0xef, 0x10},
+ {0x11, 0xf3}, {0x12, 0xe9}, {0x13, 0xe5}, {0x14, 0x15}, {0xf4, 0x16},
+ {0x17, 0xa0}, {0x18, 0x80}, },
+ { {0x14, 0x15}, {0xba, 0xbf}, {0xe4, 0xf7}, {0x9b, 0xa7}, {0x01, 0xee},
+ {0x02, 0x03}, {0x04, 0xe3}, {0xe2, 0xed}, {0x05, 0xf9}, {0x06, 0xf4},
+ {0x07, 0xec}, {0x08, 0xf5}, {0xf2, 0x09}, {0xe1, 0xf3}, {0x0a, 0xef},
+ {0x0b, 0x0c}, {0x0d, 0xe9}, {0x80, 0xe5}, {0x0e, 0xa0}, {0x0f, 0xe8},
+ {0x10, 0x11}, {0x12, 0x13}, },
+ { {0x11, 0x12}, {0xeb, 0xfa}, {0x80, 0xe6}, {0x9b, 0x01}, {0xa0, 0x02},
+ {0x03, 0xe9}, {0xe1, 0x04}, {0xe4, 0xf0}, {0xed, 0xe2}, {0xe3, 0xe7},
+ {0xec, 0x05}, {0xe5, 0x06}, {0x07, 0x08}, {0x09, 0xf4}, {0x0a, 0x0b},
+ {0x0c, 0xf3}, {0xee, 0x0d}, {0x0e, 0xf2}, {0x0f, 0x10}, },
+ { {0x04, 0xe5}, {0xf3, 0xef}, {0x9b, 0x01}, {0xe1, 0x02}, {0x03, 0xe9}, },
+ { {0x0b, 0x0c}, {0xa7, 0xe2}, {0xec, 0xe3}, {0xf2, 0x01}, {0x9b, 0x02},
+ {0x03, 0x04}, {0xe9, 0xef}, {0xee, 0xe5}, {0xe1, 0x80}, {0x05, 0xa0},
+ {0x06, 0x07}, {0x08, 0x09}, {0xf3, 0x0a}, },
+ { {0x05, 0x06}, {0x9b, 0xa0}, {0xe1, 0xe5}, {0xe9, 0x01}, {0x80, 0xf0},
+ {0x02, 0xf4}, {0x03, 0x04}, },
+ { {0xa0, 0x13}, {0xe3, 0xad}, {0xe4, 0xe9}, {0xee, 0xef}, {0xf0, 0xf4},
+ {0xf6, 0xa1}, {0xe1, 0xed}, {0x01, 0xe2}, {0x02, 0x03}, {0x04, 0xa7},
+ {0x05, 0x06}, {0xf7, 0x07}, {0x9b, 0xec}, {0x08, 0xe5}, {0x09, 0x0a},
+ {0x0b, 0x0c}, {0x0d, 0x0e}, {0xf3, 0x0f}, {0x10, 0x11}, {0x80, 0x12}, },
+ { {0x05, 0x06}, {0xe5, 0xfa}, {0xa0, 0xf9}, {0x9b, 0x01}, {0x80, 0xe9},
+ {0x02, 0xe1}, {0x03, 0x04}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+ { {0x9b, 0x9b}, },
+};
+
+
+
+static inline void huffbuff_init(struct huffbuff *hbuf, uint8_t *buf, uint32_t buf_len)
+{
+ memset(hbuf, 0, sizeof(struct huffbuff));
+ hbuf->buf = buf;
+ hbuf->buf_len = buf_len;
+}
+
+static inline int huffbuff_bits(struct huffbuff *hbuf, uint8_t nbits)
+{
+ uint8_t result = 0;
+
+ if (nbits > 8)
+ return -1;
+
+ while(nbits--) {
+ if (hbuf->cur_byte >= hbuf->buf_len) {
+ return -1;
+ }
+
+ result <<= 1;
+ if (hbuf->buf[hbuf->cur_byte] & (0x80 >> hbuf->cur_bit))
+ result |= 1;
+
+ if (++hbuf->cur_bit > 7) {
+ hbuf->cur_byte++;
+ hbuf->cur_bit = 0;
+ }
+ }
+
+ return result;
+}
+
+static inline int append_unicode_char(uint8_t **destbuf, size_t *destbuflen, size_t *destbufpos,
+ uint32_t c)
+{
+ uint8_t tmp[3];
+ int tmplen = 0;
+
+ // encode the unicode character first of all
+ if (c < 0x80) {
+ tmp[0] = c;
+ tmplen = 1;
+ } else if (c < 0x800) {
+ tmp[0] = 0xc0 | ((c >> 6) & 0x1f);
+ tmp[1] = 0x80 | (c & 0x3f);
+ tmplen = 2;
+ } else if (c < 0x10000) {
+ tmp[0] = 0xe0 | ((c >> 12) & 0x0f);
+ tmp[1] = 0x80 | ((c >> 6) & 0x3f);
+ tmp[2] = 0x80 | (c & 0x3f);
+ tmplen = 3;
+ } else {
+ return -1;
+ }
+
+ // do we have enough buffer space?
+ if ((*destbufpos + tmplen) >= *destbuflen) {
+ uint8_t *new_dest = realloc(*destbuf, *destbuflen + DEST_ALLOC_DELTA);
+ if (new_dest == NULL)
+ return -ENOMEM;
+ *destbuf = new_dest;
+ *destbuflen += DEST_ALLOC_DELTA;
+ }
+
+ // copy it into position
+ memcpy(*destbuf + *destbufpos, tmp, tmplen);
+ *destbufpos += tmplen;
+
+ return 0;
+}
+
+static inline int unicode_decode(uint8_t *srcbuf, size_t srcbuflen, int mode,
+ uint8_t **destbuf, size_t *destbuflen, size_t *destbufpos)
+{
+ size_t i;
+ uint32_t msb = mode << 8;
+
+ for(i=0; i< srcbuflen; i++) {
+ if (append_unicode_char(destbuf, destbuflen, destbufpos, msb + srcbuf[i]))
+ return -1;
+ }
+
+ return *destbufpos;
+}
+
+static int huffman_decode_uncompressed(struct huffbuff *hbuf,
+ uint8_t **destbuf, size_t *destbuflen, size_t *destbufpos)
+{
+ int c;
+
+ while(hbuf->cur_byte < hbuf->buf_len) {
+ // get next byte
+ if ((c = huffbuff_bits(hbuf, 8)) < 0)
+ return -1;
+
+ switch(c) {
+ case HUFFSTRING_END:
+ return 0;
+
+ case HUFFSTRING_ESCAPE:
+ return HUFFSTRING_ESCAPE;
+
+ default:
+ if (append_unicode_char(destbuf, destbuflen, destbufpos, c))
+ return -1;
+
+ // if it is 7 bit, we swap back to the compressed context
+ if ((c & 0x80) == 0)
+ return c;
+
+ // characters following an 8 bit uncompressed char are uncompressed as well
+ break;
+ }
+ }
+
+ // ran out of string; pretend we saw an end of string char
+ return HUFFSTRING_END;
+}
+
+static int huffman_decode(uint8_t *src, size_t srclen,
+ uint8_t **destbuf, size_t *destbuflen, size_t *destbufpos,
+ struct hufftree_entry hufftree[][128])
+{
+ struct huffbuff hbuf;
+ int bit;
+ struct hufftree_entry *tree = hufftree[0];
+ uint8_t treeidx = 0;
+ uint8_t treeval;
+ int tmp;
+
+ huffbuff_init(&hbuf, src, srclen);
+
+ while(hbuf.cur_byte < hbuf.buf_len) {
+ // get the next bit
+ if ((bit = huffbuff_bits(&hbuf, 1)) < 0)
+ return *destbufpos;
+
+ if (!bit) {
+ treeval = tree[treeidx].left_idx;
+ } else {
+ treeval = tree[treeidx].right_idx;
+ }
+
+ if (treeval & HUFFTREE_LITERAL_MASK) {
+ switch(treeval & ~HUFFTREE_LITERAL_MASK) {
+ case HUFFSTRING_END:
+ return 0;
+
+ case HUFFSTRING_ESCAPE:
+ if ((tmp =
+ huffman_decode_uncompressed(&hbuf,
+ destbuf, destbuflen, destbufpos)) < 0)
+ return tmp;
+ if (tmp == 0)
+ return *destbufpos;
+
+ tree = hufftree[tmp];
+ treeidx = 0;
+ break;
+
+ default:
+ // stash it
+ if (append_unicode_char(destbuf, destbuflen, destbufpos,
+ treeval & ~HUFFTREE_LITERAL_MASK))
+ return -1;
+ tree = hufftree[treeval & ~HUFFTREE_LITERAL_MASK];
+ treeidx = 0;
+ break;
+ }
+ } else {
+ treeidx = treeval;
+ }
+ }
+
+ return *destbufpos;
+}
+
+int atsc_text_segment_decode(struct atsc_text_string_segment *segment,
+ uint8_t **destbuf, size_t *destbufsize, size_t *destbufpos)
+{
+ if (segment->mode > ATSC_TEXT_SEGMENT_MODE_UNICODE_RANGE_MAX)
+ return -1;
+
+ // mode==0 MUST be used for compressed text
+ if ((segment->mode) && (segment->compression_type))
+ return -1;
+
+ uint8_t *buf = atsc_text_string_segment_bytes(segment);
+
+ switch(segment->compression_type) {
+ case ATSC_TEXT_COMPRESS_NONE:
+ return unicode_decode(buf, segment->number_bytes, segment->mode,
+ destbuf, destbufsize, destbufpos);
+
+ case ATSC_TEXT_COMPRESS_PROGRAM_TITLE:
+ return huffman_decode(buf, segment->number_bytes,
+ destbuf, destbufsize, destbufpos,
+ program_title_hufftree);
+
+ case ATSC_TEXT_COMPRESS_PROGRAM_DESCRIPTION:
+ return huffman_decode(buf, segment->number_bytes,
+ destbuf, destbufsize, destbufpos,
+ program_description_hufftree);
+ }
+
+ return -1;
+}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/caption_service_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/caption_service_descriptor.h
new file mode 100644
index 0000000..29d1794
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/caption_service_descriptor.h
@@ -0,0 +1,137 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_CAPTION_SERVICE_DESCRIPTOR
+#define _UCSI_ATSC_CAPTION_SERVICE_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+#include <libucsi/types.h>
+
+/**
+ * atsc_caption_service_descriptor structure.
+ */
+struct atsc_caption_service_descriptor {
+ struct descriptor d;
+
+ EBIT2(uint8_t reserved : 3; ,
+ uint8_t number_of_services : 5; );
+ /* struct atsc_caption_service_entry entries[] */
+} __ucsi_packed;
+
+/**
+ * An entry in the entries field of a atsc_caption_service_descriptor.
+ */
+struct atsc_caption_service_entry {
+ iso639lang_t language_code;
+ EBIT3(uint8_t digital_cc : 1; ,
+ uint8_t reserved : 1; ,
+ uint8_t value : 6; );
+ EBIT3(uint16_t easy_reader : 1; ,
+ uint16_t wide_aspect_ratio : 1; ,
+ uint16_t reserved1 :14; );
+} __ucsi_packed;
+
+/**
+ * Process an atsc_caption_service_descriptor.
+ *
+ * @param d Generic descriptor pointer.
+ * @return atsc_caption_service_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_caption_service_descriptor*
+ atsc_caption_service_descriptor_codec(struct descriptor* d)
+{
+ struct atsc_caption_service_descriptor *ret =
+ (struct atsc_caption_service_descriptor *) d;
+ uint8_t *buf = (uint8_t*) d + 2;
+ int pos = 0;
+ int idx;
+
+ if (d->len < 1)
+ return NULL;
+ pos++;
+
+ for(idx = 0; idx < ret->number_of_services; idx++) {
+ if (d->len < (pos + sizeof(struct atsc_caption_service_entry)))
+ return NULL;
+
+ bswap16(buf+pos+4);
+
+ pos += sizeof(struct atsc_caption_service_entry);
+ }
+
+ return (struct atsc_caption_service_descriptor*) d;
+}
+
+/**
+ * Iterator for entries field of a atsc_caption_service_descriptor.
+ *
+ * @param d atsc_caption_service_descriptor pointer.
+ * @param pos Variable holding a pointer to the current atsc_caption_service_entry.
+ * @param idx Field iterator integer.
+ */
+#define atsc_caption_service_descriptor_entries_for_each(d, pos, idx) \
+ for ((pos) = atsc_caption_service_descriptor_entries_first(d), idx=0; \
+ (pos); \
+ (pos) = atsc_caption_service_descriptor_entries_next(d, pos, ++idx))
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_caption_service_entry*
+ atsc_caption_service_descriptor_entries_first(struct atsc_caption_service_descriptor *d)
+{
+ if (d->number_of_services == 0)
+ return NULL;
+
+ return (struct atsc_caption_service_entry *)
+ ((uint8_t*) d + sizeof(struct atsc_caption_service_descriptor));
+}
+
+static inline struct atsc_caption_service_entry*
+ atsc_caption_service_descriptor_entries_next(struct atsc_caption_service_descriptor *d,
+ struct atsc_caption_service_entry *pos,
+ int idx)
+{
+ if (idx >= d->number_of_services)
+ return NULL;
+
+ return (struct atsc_caption_service_entry *)
+ ((uint8_t *) pos + sizeof(struct atsc_caption_service_entry));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/component_name_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/component_name_descriptor.h
new file mode 100644
index 0000000..3b9cab7
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/component_name_descriptor.h
@@ -0,0 +1,92 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_COMPONENT_NAME_DESCRIPTOR
+#define _UCSI_ATSC_COMPONENT_NAME_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+#include <libucsi/types.h>
+#include <libucsi/atsc/types.h>
+
+/**
+ * atsc_component_name_descriptor structure.
+ */
+struct atsc_component_name_descriptor {
+ struct descriptor d;
+
+ /* struct atsc_text text[] */
+} __ucsi_packed;
+
+/**
+ * Process an atsc_component_name_descriptor.
+ *
+ * @param d Generic descriptor pointer.
+ * @return atsc_component_name_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_component_name_descriptor*
+ atsc_component_name_descriptor_codec(struct descriptor* d)
+{
+ uint8_t *txt = ((uint8_t*) d) + sizeof(struct atsc_component_name_descriptor);
+
+ if (atsc_text_validate(txt, d->len))
+ return NULL;
+
+ return (struct atsc_component_name_descriptor*) d;
+}
+
+/**
+ * Accessor for the text field of an atsc_component_name_descriptor.
+ *
+ * @param d atsc_component_name_descriptor pointer.
+ * @return Pointer to the atsc_text data, or NULL on error.
+ */
+static inline struct atsc_text*
+ atsc_component_name_descriptor_text(struct atsc_component_name_descriptor *d)
+{
+ uint8_t *txt = ((uint8_t*) d) + sizeof(struct atsc_component_name_descriptor);
+
+ return (struct atsc_text*) txt;
+}
+
+/**
+ * Accessor for the length of the text field of an atsc_component_name_descriptor_text.
+ *
+ * @param d atsc_component_name_descriptor pointer.
+ * @return The length in bytes.
+ */
+static inline int
+ atsc_component_name_descriptor_text_length(struct atsc_component_name_descriptor *d)
+{
+ return d->d.len;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/content_advisory_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/content_advisory_descriptor.h
new file mode 100644
index 0000000..da19813
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/content_advisory_descriptor.h
@@ -0,0 +1,235 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_CONTENT_ADVISORY_DESCRIPTOR
+#define _UCSI_ATSC_CONTENT_ADVISORY_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+#include <libucsi/types.h>
+
+/**
+ * atsc_content_advisory_descriptor structure.
+ */
+struct atsc_content_advisory_descriptor {
+ struct descriptor d;
+
+ EBIT2(uint8_t reserved : 2; ,
+ uint8_t rating_region_count : 6; );
+ /* struct atsc_content_advisory_entry entries[] */
+} __ucsi_packed;
+
+/**
+ * An entry in the entries field of a atsc_content_advisory_descriptor.
+ */
+struct atsc_content_advisory_entry {
+ uint8_t rating_region;
+ uint8_t rated_dimensions;
+ /* struct atsc_content_advisory_entry_dimension dimensions[] */
+ /* struct atsc_content_advisory_entry_part2 part2 */
+} __ucsi_packed;
+
+/**
+ * An entry in the entries field of a atsc_content_advisory_descriptor.
+ */
+struct atsc_content_advisory_entry_dimension {
+ uint8_t rating_dimension_j;
+ EBIT2(uint8_t reserved : 4; ,
+ uint8_t rating_value : 4; );
+} __ucsi_packed;
+
+/**
+ * Part2 of an atsc_content_advisory_entry.
+ */
+struct atsc_content_advisory_entry_part2 {
+ uint8_t rating_description_length;
+ /* struct atsc_text description */
+} __ucsi_packed;
+
+/**
+ * Process an atsc_content_advisory_descriptor.
+ *
+ * @param d Generic descriptor pointer.
+ * @return atsc_content_advisory_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_content_advisory_descriptor*
+ atsc_content_advisory_descriptor_codec(struct descriptor* d)
+{
+ struct atsc_content_advisory_descriptor *ret =
+ (struct atsc_content_advisory_descriptor *) d;
+ uint8_t *buf = (uint8_t*) d + 2;
+ int pos = 0;
+ int idx;
+
+ if (d->len < 1)
+ return NULL;
+ pos++;
+
+ for(idx = 0; idx < ret->rating_region_count; idx++) {
+ if (d->len < (pos + sizeof(struct atsc_content_advisory_entry)))
+ return NULL;
+ struct atsc_content_advisory_entry *entry =
+ (struct atsc_content_advisory_entry *) (buf + pos);
+ pos += sizeof(struct atsc_content_advisory_entry);
+
+ if (d->len < (pos + (sizeof(struct atsc_content_advisory_entry_dimension) *
+ entry->rated_dimensions)))
+ return NULL;
+ pos += sizeof(struct atsc_content_advisory_entry_dimension) * entry->rated_dimensions;
+
+ if (d->len < (pos + sizeof(struct atsc_content_advisory_entry_part2)))
+ return NULL;
+ struct atsc_content_advisory_entry_part2 *part2 =
+ (struct atsc_content_advisory_entry_part2 *) (buf + pos);
+ pos += sizeof(struct atsc_content_advisory_entry_part2);
+
+ if (d->len < (pos + part2->rating_description_length))
+ return NULL;
+
+ if (atsc_text_validate(buf+pos, part2->rating_description_length))
+ return NULL;
+
+ pos += part2->rating_description_length;
+ }
+
+ return (struct atsc_content_advisory_descriptor*) d;
+}
+
+/**
+ * Iterator for entries field of a atsc_content_advisory_descriptor.
+ *
+ * @param d atsc_content_advisory_descriptor pointer.
+ * @param pos Variable holding a pointer to the current atsc_content_advisory_entry.
+ * @param idx Integer used to count which entry we are in.
+ */
+#define atsc_content_advisory_descriptor_entries_for_each(d, pos, idx) \
+ for ((pos) = atsc_content_advisory_descriptor_entries_first(d), idx=0; \
+ (pos); \
+ (pos) = atsc_content_advisory_descriptor_entries_next(d, pos, ++idx))
+
+/**
+ * Iterator for dimensions field of a atsc_content_advisory_entry.
+ *
+ * @param d atsc_content_advisory_entry pointer.
+ * @param pos Variable holding a pointer to the current atsc_content_advisory_entry_dimension.
+ * @param idx Integer used to count which dimension we are in.
+ */
+#define atsc_content_advisory_entry_dimensions_for_each(d, pos, idx) \
+ for ((pos) = atsc_content_advisory_entry_dimensions_first(d), idx=0; \
+ (pos); \
+ (pos) = atsc_content_advisory_entry_dimensions_next(d, pos, ++idx))
+
+/**
+ * Accessor for the part2 field of an atsc_content_advisory_entry.
+ *
+ * @param entry atsc_content_advisory_entry pointer.
+ * @return struct atsc_content_advisory_entry_part2 pointer.
+ */
+static inline struct atsc_content_advisory_entry_part2 *
+ atsc_content_advisory_entry_part2(struct atsc_content_advisory_entry *entry)
+{
+ int pos = sizeof(struct atsc_content_advisory_entry);
+ pos += entry->rated_dimensions * sizeof(struct atsc_content_advisory_entry_dimension);
+
+ return (struct atsc_content_advisory_entry_part2 *) (((uint8_t*) entry) + pos);
+}
+
+
+/**
+ * Accessor for the description field of an atsc_content_advisory_entry_part2.
+ *
+ * @param part2 atsc_content_advisory_entry_part2 pointer.
+ * @return Pointer to the atsc_text data, or NULL on error.
+ */
+static inline struct atsc_text*
+ atsc_content_advisory_entry_part2_description(struct atsc_content_advisory_entry_part2 *part2)
+{
+ uint8_t *txt = ((uint8_t*) part2) + sizeof(struct atsc_content_advisory_entry_part2);
+
+ return (struct atsc_text *) txt;
+}
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_content_advisory_entry*
+ atsc_content_advisory_descriptor_entries_first(struct atsc_content_advisory_descriptor *d)
+{
+ if (d->rating_region_count == 0)
+ return NULL;
+
+ return (struct atsc_content_advisory_entry *)
+ ((uint8_t*) d + sizeof(struct atsc_content_advisory_descriptor));
+}
+
+static inline struct atsc_content_advisory_entry*
+ atsc_content_advisory_descriptor_entries_next(struct atsc_content_advisory_descriptor *d,
+ struct atsc_content_advisory_entry *pos,
+ int idx)
+{
+ if (idx >= d->rating_region_count)
+ return NULL;
+ struct atsc_content_advisory_entry_part2 *part2 =
+ atsc_content_advisory_entry_part2(pos);
+
+ return (struct atsc_content_advisory_entry *)
+ ((uint8_t *) part2 +
+ sizeof(struct atsc_content_advisory_entry_part2) +
+ part2->rating_description_length);
+}
+
+static inline struct atsc_content_advisory_entry_dimension*
+ atsc_content_advisory_entry_dimensions_first(struct atsc_content_advisory_entry *e)
+{
+ if (e->rated_dimensions == 0)
+ return NULL;
+
+ return (struct atsc_content_advisory_entry_dimension *)
+ ((uint8_t*) e + sizeof(struct atsc_content_advisory_entry));
+}
+
+static inline struct atsc_content_advisory_entry_dimension*
+ atsc_content_advisory_entry_dimensions_next(struct atsc_content_advisory_entry *e,
+ struct atsc_content_advisory_entry_dimension *pos,
+ int idx)
+{
+ uint8_t *next = (uint8_t *) pos + sizeof(struct atsc_content_advisory_entry_dimension);
+
+ if (idx >= e->rated_dimensions)
+ return NULL;
+ return (struct atsc_content_advisory_entry_dimension *) next;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/cvct_section.c b/kaffeine/src/input/dvb/lib/libucsi/atsc/cvct_section.c
new file mode 100644
index 0000000..6edbc03
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/cvct_section.c
@@ -0,0 +1,77 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <libucsi/atsc/cvct_section.h>
+
+struct atsc_cvct_section *atsc_cvct_section_codec(struct atsc_section_psip *psip)
+{
+ uint8_t * buf = (uint8_t *) psip;
+ size_t pos = sizeof(struct atsc_section_psip);
+ size_t len = section_ext_length(&(psip->ext_head));
+ int idx;
+
+ if (len < sizeof(struct atsc_cvct_section))
+ return NULL;
+ struct atsc_cvct_section *cvct = (struct atsc_cvct_section *) psip;
+
+ pos++;
+ for(idx =0; idx < cvct->num_channels_in_section; idx++) {
+ if ((pos + sizeof(struct atsc_cvct_channel)) > len)
+ return NULL;
+ struct atsc_cvct_channel *channel = (struct atsc_cvct_channel *) (buf+pos);
+
+ pos += 7*2;
+
+ bswap32(buf+pos);
+ bswap32(buf+pos+4);
+ bswap16(buf+pos+8);
+ bswap16(buf+pos+10);
+ bswap16(buf+pos+12);
+ bswap16(buf+pos+14);
+ bswap16(buf+pos+16);
+ pos+=18;
+
+ if ((pos + channel->descriptors_length) > len)
+ return NULL;
+ if (verify_descriptors(buf + pos, channel->descriptors_length))
+ return NULL;
+
+ pos += channel->descriptors_length;
+ }
+
+ if ((pos + sizeof(struct atsc_cvct_section_part2)) > len)
+ return NULL;
+ struct atsc_cvct_section_part2 *part2 = (struct atsc_cvct_section_part2 *) (buf+pos);
+
+ bswap16(buf+pos);
+ pos+=2;
+
+ if ((pos + part2->descriptors_length) > len)
+ return NULL;
+ if (verify_descriptors(buf + pos, part2->descriptors_length))
+ return NULL;
+
+ pos += part2->descriptors_length;
+ if (pos != len)
+ return NULL;
+
+ return (struct atsc_cvct_section *) psip;
+}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/cvct_section.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/cvct_section.h
new file mode 100644
index 0000000..c3d418a
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/cvct_section.h
@@ -0,0 +1,228 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_CVCT_SECTION_H
+#define _UCSI_ATSC_CVCT_SECTION_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/atsc/section.h>
+
+/**
+ * atsc_cvct_section structure.
+ */
+struct atsc_cvct_section {
+ struct atsc_section_psip head;
+
+ uint8_t num_channels_in_section;
+ /* struct atsc_cvct_channel channels[] */
+ /* struct atsc_cvct_channel_part2 part2 */
+} __ucsi_packed;
+
+struct atsc_cvct_channel {
+ uint16_t short_name[7]; // UTF-16 network ordered
+ EBIT4(uint32_t reserved : 4; ,
+ uint32_t major_channel_number :10; ,
+ uint32_t minor_channel_number :10; ,
+ uint32_t modulation_mode : 8; );
+ uint32_t carrier_frequency;
+ uint16_t channel_TSID;
+ uint16_t program_number;
+ EBIT8(uint16_t ETM_location : 2; ,
+ uint16_t access_controlled : 1; ,
+ uint16_t hidden : 1; ,
+ uint16_t path_select : 1; ,
+ uint16_t out_of_band : 1; ,
+ uint16_t hide_guide : 1; ,
+ uint16_t reserved2 : 3; ,
+ uint16_t service_type : 6; );
+ uint16_t source_id;
+ EBIT2(uint16_t reserved3 : 6; ,
+ uint16_t descriptors_length :10; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+struct atsc_cvct_section_part2 {
+ EBIT2(uint16_t reserved : 6; ,
+ uint16_t descriptors_length :10; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+static inline struct atsc_cvct_channel *atsc_cvct_section_channels_first(struct atsc_cvct_section *cvct);
+static inline struct atsc_cvct_channel *
+ atsc_cvct_section_channels_next(struct atsc_cvct_section *cvct, struct atsc_cvct_channel *pos, int idx);
+
+/**
+ * Process a atsc_cvct_section.
+ *
+ * @param section Pointer to anj atsc_section_psip structure.
+ * @return atsc_cvct_section pointer, or NULL on error.
+ */
+struct atsc_cvct_section *atsc_cvct_section_codec(struct atsc_section_psip *section);
+
+/**
+ * Accessor for the transport_stream_id field of a CVCT.
+ *
+ * @param cvdt CVDT pointer.
+ * @return The transport_stream_id.
+ */
+static inline uint16_t atsc_cvct_section_transport_stream_id(struct atsc_cvct_section *cvct)
+{
+ return cvct->head.ext_head.table_id_ext;
+}
+
+/**
+ * Iterator for the tables field in an atsc_cvct_section.
+ *
+ * @param mgt atsc_cvct_section pointer.
+ * @param pos Variable containing a pointer to the current atsc_cvct_channel.
+ * @param idx Integer used to count which table we in.
+ */
+#define atsc_cvct_section_channels_for_each(mgt, pos, idx) \
+ for ((pos) = atsc_cvct_section_channels_first(mgt), idx=0; \
+ (pos); \
+ (pos) = atsc_cvct_section_channels_next(mgt, pos, ++idx))
+
+/**
+ * Iterator for the descriptors field in a atsc_cvct_channel structure.
+ *
+ * @param table atsc_cvct_channel pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_cvct_channel_descriptors_for_each(table, pos) \
+ for ((pos) = atsc_cvct_channel_descriptors_first(table); \
+ (pos); \
+ (pos) = atsc_cvct_channel_descriptors_next(table, pos))
+
+/**
+ * Accessor for the second part of an atsc_cvct_section.
+ *
+ * @param mgt atsc_cvct_section pointer.
+ * @return atsc_cvct_section_part2 pointer.
+ */
+static inline struct atsc_cvct_section_part2 *
+ atsc_cvct_section_part2(struct atsc_cvct_section *mgt)
+{
+ int pos = sizeof(struct atsc_cvct_section);
+
+ struct atsc_cvct_channel *cur_table;
+ int idx;
+ atsc_cvct_section_channels_for_each(mgt, cur_table, idx) {
+ pos += sizeof(struct atsc_cvct_channel);
+ pos += cur_table->descriptors_length;
+ }
+
+ return (struct atsc_cvct_section_part2 *) (((uint8_t*) mgt) + pos);
+}
+
+/**
+ * Iterator for the descriptors field in a atsc_cvct_section structure.
+ *
+ * @param part2 atsc_cvct_section_part2 pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_cvct_section_part2_descriptors_for_each(part2, pos) \
+ for ((pos) = atsc_cvct_section_part2_descriptors_first(part2); \
+ (pos); \
+ (pos) = atsc_cvct_section_part2_descriptors_next(part2, pos))
+
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_cvct_channel *
+ atsc_cvct_section_channels_first(struct atsc_cvct_section *cvct)
+{
+ size_t pos = sizeof(struct atsc_cvct_section);
+
+ if (cvct->num_channels_in_section == 0)
+ return NULL;
+
+ return (struct atsc_cvct_channel*) (((uint8_t *) cvct) + pos);
+}
+
+static inline struct atsc_cvct_channel *
+ atsc_cvct_section_channels_next(struct atsc_cvct_section *cvct,
+ struct atsc_cvct_channel *pos,
+ int idx)
+{
+ if (idx >= cvct->num_channels_in_section)
+ return NULL;
+
+ return (struct atsc_cvct_channel *)
+ (((uint8_t*) pos) + sizeof(struct atsc_cvct_channel) + pos->descriptors_length);
+}
+
+static inline struct descriptor *
+ atsc_cvct_channel_descriptors_first(struct atsc_cvct_channel *table)
+{
+ size_t pos = sizeof(struct atsc_cvct_channel);
+
+ if (table->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) table) + pos);
+}
+
+static inline struct descriptor *
+ atsc_cvct_channel_descriptors_next(struct atsc_cvct_channel *table,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) table + sizeof(struct atsc_cvct_channel),
+ table->descriptors_length,
+ pos);
+}
+
+static inline struct descriptor *
+ atsc_cvct_section_part2_descriptors_first(struct atsc_cvct_section_part2 *part2)
+{
+ size_t pos = sizeof(struct atsc_cvct_section_part2);
+
+ if (part2->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) part2) + pos);
+}
+
+static inline struct descriptor *
+ atsc_cvct_section_part2_descriptors_next(struct atsc_cvct_section_part2 *part2,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) part2 + sizeof(struct atsc_cvct_section_part2),
+ part2->descriptors_length,
+ pos);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/dcc_arriving_request_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/dcc_arriving_request_descriptor.h
new file mode 100644
index 0000000..af76eac
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/dcc_arriving_request_descriptor.h
@@ -0,0 +1,107 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_DCC_ARRIVING_REQUEST_DESCRIPTOR
+#define _UCSI_ATSC_DCC_ARRIVING_REQUEST_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+#include <libucsi/types.h>
+
+enum atsc_dcc_arriving_request_type {
+ DCC_ARRIVAL_TYPE_DEFER_10SEC = 0x01,
+ DCC_ARRIVAL_TYPE_DEFER = 0x02,
+};
+
+/**
+ * atsc_dcc_arriving_request_descriptor structure.
+ */
+struct atsc_dcc_arriving_request_descriptor {
+ struct descriptor d;
+
+ uint8_t dcc_arriving_request_type;
+ uint8_t dcc_arriving_request_text_length;
+ /* struct atsc_text text[] */
+} __ucsi_packed;
+
+/**
+ * Process an atsc_dcc_arriving_request_descriptor.
+ *
+ * @param d Generic descriptor pointer.
+ * @return atsc_dcc_arriving_request_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_dcc_arriving_request_descriptor*
+ atsc_dcc_arriving_request_descriptor_codec(struct descriptor* d)
+{
+ struct atsc_dcc_arriving_request_descriptor *ret =
+ (struct atsc_dcc_arriving_request_descriptor *) d;
+
+ if (d->len < 2)
+ return NULL;
+
+ if (d->len != 2 + ret->dcc_arriving_request_text_length)
+ return NULL;
+
+ if (atsc_text_validate((uint8_t*) d + sizeof(struct atsc_dcc_arriving_request_descriptor),
+ ret->dcc_arriving_request_text_length))
+ return NULL;
+
+ return (struct atsc_dcc_arriving_request_descriptor*) d;
+}
+
+/**
+ * Accessor for the text field of an atsc_dcc_arriving_request_descriptor.
+ *
+ * @param d atsc_dcc_arriving_request_descriptor pointer.
+ * @return Pointer to the atsc_text data, or NULL on error.
+ */
+static inline struct atsc_text*
+ atsc_dcc_arriving_request_descriptor_text(struct atsc_dcc_arriving_request_descriptor *d)
+{
+ uint8_t *txt = ((uint8_t*) d) + sizeof(struct atsc_dcc_arriving_request_descriptor);
+
+ return (struct atsc_text*) txt;
+}
+
+/**
+ * Accessor for the length of the text field of an atsc_dcc_arriving_request_descriptor.
+ *
+ * @param d atsc_dcc_arriving_request_descriptor pointer.
+ * @return The length in bytes.
+ */
+static inline int
+ atsc_dcc_arriving_request_descriptor_text_length(struct
+ atsc_dcc_arriving_request_descriptor *d)
+{
+ return d->d.len - 2;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/dcc_departing_request_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/dcc_departing_request_descriptor.h
new file mode 100644
index 0000000..851f0cc
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/dcc_departing_request_descriptor.h
@@ -0,0 +1,108 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_DCC_DEPARTING_REQUEST_DESCRIPTOR
+#define _UCSI_ATSC_DCC_DEPARTING_REQUEST_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+#include <libucsi/types.h>
+
+enum atsc_dcc_departing_request_type {
+ DCC_DEPART_TYPE_IMMEDIATE = 0x01,
+ DCC_DEPART_TYPE_DEFER_10SEC = 0x02,
+ DCC_DEPART_TYPE_DEFER = 0x03,
+};
+
+/**
+ * atsc_dcc_departing_request_descriptor structure.
+ */
+struct atsc_dcc_departing_request_descriptor {
+ struct descriptor d;
+
+ uint8_t dcc_departing_request_type;
+ uint8_t dcc_departing_request_text_length;
+ /* struct atsc_text text[] */
+} __ucsi_packed;
+
+/**
+ * Process an atsc_dcc_departing_request_descriptor.
+ *
+ * @param d Generic descriptor pointer.
+ * @return atsc_dcc_departing_request_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_dcc_departing_request_descriptor*
+ atsc_dcc_departing_request_descriptor_codec(struct descriptor* d)
+{
+ struct atsc_dcc_departing_request_descriptor *ret =
+ (struct atsc_dcc_departing_request_descriptor *) d;
+
+ if (d->len < 2)
+ return NULL;
+
+ if (d->len != 2 + ret->dcc_departing_request_text_length)
+ return NULL;
+
+ if (atsc_text_validate(((uint8_t*) d) + sizeof(struct atsc_dcc_departing_request_descriptor),
+ ret->dcc_departing_request_text_length))
+ return NULL;
+
+ return (struct atsc_dcc_departing_request_descriptor*) d;
+}
+
+/**
+ * Accessor for the text field of an atsc_dcc_departing_request_descriptor.
+ *
+ * @param d atsc_dcc_departing_request_descriptor pointer.
+ * @return Pointer to the atsc_text data, or NULL on error.
+ */
+static inline struct atsc_text*
+ atsc_dcc_departing_request_descriptor_text(struct atsc_dcc_departing_request_descriptor *d)
+{
+ uint8_t *txt = ((uint8_t*) d) + sizeof(struct atsc_dcc_departing_request_descriptor);
+
+ return (struct atsc_text*) txt;
+}
+
+/**
+ * Accessor for the length of the text field of an atsc_dcc_departing_request_descriptor.
+ *
+ * @param d atsc_dcc_departing_request_descriptor pointer.
+ * @return The length in bytes.
+ */
+static inline int
+ atsc_dcc_departing_request_descriptor_text_length(struct
+ atsc_dcc_departing_request_descriptor *d)
+{
+ return d->d.len - 2;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/dccsct_section.c b/kaffeine/src/input/dvb/lib/libucsi/atsc/dccsct_section.c
new file mode 100644
index 0000000..59ad069
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/dccsct_section.c
@@ -0,0 +1,109 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <libucsi/atsc/dccsct_section.h>
+
+struct atsc_dccsct_section *atsc_dccsct_section_codec(struct atsc_section_psip *psip)
+{
+ uint8_t * buf = (uint8_t *) psip;
+ size_t pos = 0;
+ size_t len = section_ext_length(&(psip->ext_head));
+ int idx;
+
+ if (len < sizeof(struct atsc_dccsct_section))
+ return NULL;
+ struct atsc_dccsct_section *dccsct = (struct atsc_dccsct_section *) psip;
+
+ pos += sizeof(struct atsc_dccsct_section);
+ for(idx =0; idx < dccsct->updates_defined; idx++) {
+ if (len < (pos + sizeof(struct atsc_dccsct_update)))
+ return NULL;
+ struct atsc_dccsct_update *update = (struct atsc_dccsct_update *) (buf+pos);
+
+ pos += sizeof(struct atsc_dccsct_update);
+ if (len < (pos + update->update_data_length))
+ return NULL;
+
+ switch(update->update_type) {
+ case ATSC_DCCST_UPDATE_NEW_GENRE: {
+ int sublen = sizeof(struct atsc_dccsct_update_new_genre);
+ if (update->update_data_length < sublen)
+ return NULL;
+
+ if (atsc_text_validate(buf+pos+sublen, update->update_data_length - sublen))
+ return NULL;
+ break;
+ }
+ case ATSC_DCCST_UPDATE_NEW_STATE: {
+ int sublen = sizeof(struct atsc_dccsct_update_new_state);
+ if (update->update_data_length < sublen)
+ return NULL;
+
+ if (atsc_text_validate(buf+pos+sublen, update->update_data_length - sublen))
+ return NULL;
+ break;
+ }
+ case ATSC_DCCST_UPDATE_NEW_COUNTY: {
+ int sublen = sizeof(struct atsc_dccsct_update_new_county);
+ if (update->update_data_length < sublen)
+ return NULL;
+ bswap16(buf+pos+1);
+
+ if (atsc_text_validate(buf+pos+sublen, update->update_data_length - sublen))
+ return NULL;
+ break;
+ }
+ }
+
+ pos += update->update_data_length;
+ if (len < (pos + sizeof(struct atsc_dccsct_update_part2)))
+ return NULL;
+ struct atsc_dccsct_update_part2 *part2 = (struct atsc_dccsct_update_part2 *) buf + pos;
+
+ bswap16(buf+pos);
+
+ pos += sizeof(struct atsc_dccsct_update_part2);
+ if (len < (pos + part2->descriptors_length))
+ return NULL;
+ if (verify_descriptors(buf + pos, part2->descriptors_length))
+ return NULL;
+
+ pos += part2->descriptors_length;
+ }
+
+ if (len < (pos + sizeof(struct atsc_dccsct_section_part2)))
+ return NULL;
+ struct atsc_dccsct_section_part2 *part2 = (struct atsc_dccsct_section_part2 *) (buf+pos);
+
+ bswap16(buf+pos);
+
+ pos += sizeof(struct atsc_dccsct_section_part2);
+ if (len < (pos + part2->descriptors_length))
+ return NULL;
+ if (verify_descriptors(buf + pos, part2->descriptors_length))
+ return NULL;
+
+ pos += part2->descriptors_length;
+ if (pos != len)
+ return NULL;
+
+ return (struct atsc_dccsct_section *) psip;
+}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/dccsct_section.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/dccsct_section.h
new file mode 100644
index 0000000..f9f3522
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/dccsct_section.h
@@ -0,0 +1,327 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_DCCSCT_SECTION_H
+#define _UCSI_ATSC_DCCSCT_SECTION_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/atsc/section.h>
+#include <libucsi/atsc/types.h>
+
+enum atsc_dccst_update_types {
+ ATSC_DCCST_UPDATE_NEW_GENRE = 0x01,
+ ATSC_DCCST_UPDATE_NEW_STATE = 0x02,
+ ATSC_DCCST_UPDATE_NEW_COUNTY = 0x03,
+};
+
+/**
+ * atsc_dccsct_section structure.
+ */
+struct atsc_dccsct_section {
+ struct atsc_section_psip head;
+
+ uint8_t updates_defined;
+ /* struct atsc_dccsct_update updates */
+ /* struct atsc_dccsct_section_part2 part2 */
+} __ucsi_packed;
+
+struct atsc_dccsct_update {
+ uint8_t update_type;
+ uint8_t update_data_length;
+ /* struct atsc_dccsct_update_XXX data -- depends on update_type */
+ /* struct atsc_dccsct_update_part2 part2 */
+} __ucsi_packed;
+
+struct atsc_dccsct_update_new_genre {
+ uint8_t genre_category_code;
+ /* atsc_text name */
+} __ucsi_packed;
+
+struct atsc_dccsct_update_new_state {
+ uint8_t dcc_state_location_code;
+ /* atsc_text name */
+} __ucsi_packed;
+
+struct atsc_dccsct_update_new_county {
+ uint8_t state_code;
+ EBIT2(uint16_t reserved : 6; ,
+ uint16_t dcc_county_location_code :10; );
+ /* atsc_text name */
+} __ucsi_packed;
+
+struct atsc_dccsct_update_part2 {
+ EBIT2(uint16_t reserved : 6; ,
+ uint16_t descriptors_length :10; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+struct atsc_dccsct_section_part2 {
+ EBIT2(uint16_t reserved : 6; ,
+ uint16_t descriptors_length :10; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+/**
+ * Process an atsc_dccsct_section.
+ *
+ * @param section Pointer to an atsc_section_psip structure.
+ * @return atsc_dccsct_section pointer, or NULL on error.
+ */
+struct atsc_dccsct_section *atsc_dccsct_section_codec(struct atsc_section_psip *section);
+
+/**
+ * Accessor for the dccsct_type field of a dccsct.
+ *
+ * @param dccsct dccsct pointer.
+ * @return The dccsct_type.
+ */
+static inline uint16_t atsc_dccsct_section_dccsct_type(struct atsc_dccsct_section *dccsct)
+{
+ return dccsct->head.ext_head.table_id_ext;
+}
+
+/**
+ * Iterator for the updates field in an atsc_dccsct_section.
+ *
+ * @param dccsct atsc_dccsct_section pointer.
+ * @param pos Variable containing a pointer to the current atsc_dccsct_update.
+ * @param idx Integer used to count which test we are in.
+ */
+#define atsc_dccsct_section_updates_for_each(dccsct, pos, idx) \
+ for ((pos) = atsc_dccsct_section_updates_first(dccsct), idx=0; \
+ (pos); \
+ (pos) = atsc_dccsct_section_updates_next(dccsct, pos, ++idx))
+
+/**
+ * Accessor for the data field of a new genre atsc_dccsct_update.
+ *
+ * @param update atsc_dccsct_update pointer.
+ * @return struct atsc_dccsct_update_new_genre pointer.
+ */
+static inline struct atsc_dccsct_update_new_genre *atsc_dccsct_update_new_genre(struct atsc_dccsct_update *update)
+{
+ if (update->update_type != ATSC_DCCST_UPDATE_NEW_GENRE)
+ return NULL;
+
+ return (struct atsc_dccsct_update_new_genre *)
+ (((uint8_t*) update) + sizeof(struct atsc_dccsct_update));
+}
+
+/**
+ * Accessor for the name field of an atsc_dccsct_update_new_genre.
+ *
+ * @param update atsc_dccsct_update_new_genre pointer.
+ * @return text pointer.
+ */
+static inline struct atsc_text *atsc_dccsct_update_new_genre_name(struct atsc_dccsct_update *update)
+{
+ if ((update->update_data_length - 1) == 0)
+ return NULL;
+
+ return (struct atsc_text *)
+ (((uint8_t*) update) + sizeof(struct atsc_dccsct_update_new_genre));
+}
+
+/**
+ * Accessor for the data field of a new state atsc_dccsct_update.
+ *
+ * @param update atsc_dccsct_update pointer.
+ * @return struct atsc_dccsct_update_new_state pointer.
+ */
+static inline struct atsc_dccsct_update_new_state *
+ atsc_dccsct_update_new_state(struct atsc_dccsct_update *update)
+{
+ if (update->update_type != ATSC_DCCST_UPDATE_NEW_STATE)
+ return NULL;
+
+ return (struct atsc_dccsct_update_new_state *)
+ (((uint8_t*) update) + sizeof(struct atsc_dccsct_update));
+}
+
+/**
+ * Accessor for the name field of an atsc_dccsct_update_new_state.
+ *
+ * @param update atsc_dccsct_update_new_state pointer.
+ * @return text pointer.
+ */
+static inline struct atsc_text *atsc_dccsct_update_new_state_name(struct atsc_dccsct_update *update)
+{
+ if ((update->update_data_length - 1) == 0)
+ return NULL;
+
+ return (struct atsc_text *)
+ (((uint8_t*) update) + sizeof(struct atsc_dccsct_update_new_state));
+}
+
+/**
+ * Accessor for the data field of a new county atsc_dccsct_update.
+ *
+ * @param update atsc_dccsct_update pointer.
+ * @return struct atsc_dccsct_update_new_county pointer.
+ */
+static inline struct atsc_dccsct_update_new_county *
+ atsc_dccsct_update_new_county(struct atsc_dccsct_update *update)
+{
+ if (update->update_type != ATSC_DCCST_UPDATE_NEW_COUNTY)
+ return NULL;
+
+ return (struct atsc_dccsct_update_new_county *)
+ (((uint8_t*) update) + sizeof(struct atsc_dccsct_update));
+}
+
+/**
+ * Accessor for the name field of an atsc_dccsct_update_new_county.
+ *
+ * @param update atsc_dccsct_update_new_county pointer.
+ * @return text pointer.
+ */
+static inline struct atsc_text *atsc_dccsct_update_new_county_name(struct atsc_dccsct_update *update)
+{
+ if ((update->update_data_length - 3) == 0)
+ return NULL;
+
+ return (struct atsc_text*)
+ (((uint8_t*) update) + sizeof(struct atsc_dccsct_update_new_county));
+}
+
+/**
+ * Accessor for the part2 field of an atsc_dccsct_update.
+ *
+ * @param update atsc_dccsct_update pointer.
+ * @return struct atsc_dccsct_test_part2 pointer.
+ */
+static inline struct atsc_dccsct_update_part2 *atsc_dccsct_update_part2(struct atsc_dccsct_update *update)
+{
+ int pos = sizeof(struct atsc_dccsct_update);
+ pos += update->update_data_length;
+
+ return (struct atsc_dccsct_update_part2 *) (((uint8_t*) update) + pos);
+}
+
+/**
+ * Iterator for the descriptors field in an atsc_dccsct_update_part2 structure.
+ *
+ * @param part2 atsc_dccsct_update_part2 pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_dccsct_update_part2_descriptors_for_each(part2, pos) \
+ for ((pos) = atsc_dccsct_update_part2_descriptors_first(part2); \
+ (pos); \
+ (pos) = atsc_dccsct_update_part2_descriptors_next(part2, pos))
+
+/**
+ * Iterator for the descriptors field in a atsc_dccsct_section_part2 structure.
+ *
+ * @param part2 atsc_dccsct_section_part2 pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_dccsct_section_part2_descriptors_for_each(part2, pos) \
+ for ((pos) = atsc_dccsct_section_part2_descriptors_first(part2); \
+ (pos); \
+ (pos) = atsc_dccsct_section_part2_descriptors_next(part2, pos))
+
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_dccsct_update *
+ atsc_dccsct_section_updates_first(struct atsc_dccsct_section *dccsct)
+{
+ size_t pos = sizeof(struct atsc_dccsct_section);
+
+ if (dccsct->updates_defined == 0)
+ return NULL;
+
+ return (struct atsc_dccsct_update*) (((uint8_t *) dccsct) + pos);
+}
+
+static inline struct atsc_dccsct_update*
+ atsc_dccsct_section_updates_next(struct atsc_dccsct_section *dccsct,
+ struct atsc_dccsct_update *pos,
+ int idx)
+{
+ if (idx >= dccsct->updates_defined)
+ return NULL;
+
+ struct atsc_dccsct_update_part2 *part2 = atsc_dccsct_update_part2(pos);
+ int len = sizeof(struct atsc_dccsct_update_part2);
+ len += part2->descriptors_length;
+
+ return (struct atsc_dccsct_update *) (((uint8_t*) part2) + len);
+}
+
+static inline struct descriptor *
+ atsc_dccsct_update_part2_descriptors_first(struct atsc_dccsct_update_part2 *part2)
+{
+ size_t pos = sizeof(struct atsc_dccsct_update_part2);
+
+ if (part2->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) part2) + pos);
+}
+
+static inline struct descriptor *
+ atsc_dccsct_update_part2_descriptors_next(struct atsc_dccsct_update_part2 *part2,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) part2 + sizeof(struct atsc_dccsct_update_part2),
+ part2->descriptors_length,
+ pos);
+}
+
+static inline struct descriptor *
+ atsc_dccsct_section_part2_descriptors_first(struct atsc_dccsct_section_part2 *part2)
+{
+ size_t pos = sizeof(struct atsc_dccsct_section_part2);
+
+ if (part2->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) part2) + pos);
+}
+
+static inline struct descriptor *
+ atsc_dccsct_section_part2_descriptors_next(struct atsc_dccsct_section_part2 *part2,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) part2 + sizeof(struct atsc_dccsct_section_part2),
+ part2->descriptors_length,
+ pos);
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/dcct_section.c b/kaffeine/src/input/dvb/lib/libucsi/atsc/dcct_section.c
new file mode 100644
index 0000000..7d0b83b
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/dcct_section.c
@@ -0,0 +1,96 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <libucsi/atsc/dcct_section.h>
+
+struct atsc_dcct_section *atsc_dcct_section_codec(struct atsc_section_psip *psip)
+{
+ uint8_t * buf = (uint8_t *) psip;
+ size_t pos = 0;
+ size_t len = section_ext_length(&(psip->ext_head));
+ int testidx;
+ int termidx;
+
+ if (len < sizeof(struct atsc_dcct_section))
+ return NULL;
+ struct atsc_dcct_section *dcct = (struct atsc_dcct_section *) psip;
+
+ pos += sizeof(struct atsc_dcct_section);
+ for(testidx =0; testidx < dcct->dcc_test_count; testidx++) {
+ if (len < (pos + sizeof(struct atsc_dcct_test)))
+ return NULL;
+ struct atsc_dcct_test *test = (struct atsc_dcct_test *) (buf+pos);
+
+ bswap24(buf+pos);
+ bswap24(buf+pos+3);
+ bswap32(buf+pos+6);
+ bswap32(buf+pos+10);
+
+ pos += sizeof(struct atsc_dcct_test);
+ for(termidx =0; termidx < test->dcc_term_count; termidx++) {
+ if (len < (pos + sizeof(struct atsc_dcct_term)))
+ return NULL;
+ struct atsc_dcct_term *term = (struct atsc_dcct_term *) (buf+pos);
+
+ bswap64(buf+pos+1);
+ bswap16(buf+pos+9);
+
+ pos += sizeof(struct atsc_dcct_term);
+ if (len < (pos + term->descriptors_length))
+ return NULL;
+ if (verify_descriptors(buf + pos, term->descriptors_length))
+ return NULL;
+
+ pos += term->descriptors_length;
+ }
+
+ if (len < (pos + sizeof(struct atsc_dcct_test_part2)))
+ return NULL;
+ struct atsc_dcct_test_part2 *part2 = (struct atsc_dcct_test_part2 *) (buf+pos);
+
+ bswap16(buf+pos);
+
+ pos += sizeof(struct atsc_dcct_test_part2);
+ if (len < (pos + part2->descriptors_length))
+ return NULL;
+ if (verify_descriptors(buf + pos, part2->descriptors_length))
+ return NULL;
+ pos += part2->descriptors_length;
+ }
+
+ if (len < (pos + sizeof(struct atsc_dcct_section_part2)))
+ return NULL;
+ struct atsc_dcct_section_part2 *part2 = (struct atsc_dcct_section_part2 *) (buf+pos);
+
+ bswap16(buf+pos);
+
+ pos += sizeof(struct atsc_dcct_section_part2);
+ if (len < (pos + part2->descriptors_length))
+ return NULL;
+ if (verify_descriptors(buf + pos, part2->descriptors_length))
+ return NULL;
+
+ pos += part2->descriptors_length;
+ if (pos != len)
+ return NULL;
+
+ return (struct atsc_dcct_section *) psip;
+}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/dcct_section.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/dcct_section.h
new file mode 100644
index 0000000..647bd4b
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/dcct_section.h
@@ -0,0 +1,380 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_DCCT_SECTION_H
+#define _UCSI_ATSC_DCCT_SECTION_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/atsc/section.h>
+#include <libucsi/atsc/types.h>
+
+enum atsc_dcc_context {
+ ATSC_DCC_CONTEXT_TEMPORARY_RETUNE = 0,
+ ATSC_DCC_CONTEXT_CHANNEL_REDIRECT = 1,
+};
+
+enum atsc_dcc_selection_type {
+ ATSC_DCC_SELECTION_UNCONDITIONAL_CHANNEL_CHANGE = 0x00,
+ ATSC_DCC_SELECTION_NUMERIC_POSTAL_CODE_INCLUSION = 0x01,
+ ATSC_DCC_SELECTION_ALPHANUMERIC_POSTAL_CODE_INCLUSION = 0x02,
+ ATSC_DCC_SELECTION_DEMOGRAPHIC_CATEGORY_ONE_OR_MORE = 0x05,
+ ATSC_DCC_SELECTION_DEMOGRAPHIC_CATEGORY_ALL = 0x06,
+ ATSC_DCC_SELECTION_GENRE_CATEGORY_ONE_OR_MORE = 0x07,
+ ATSC_DCC_SELECTION_GENRE_CATEGORY_ALL = 0x08,
+ ATSC_DCC_SELECTION_CANNOT_BE_AUTHORIZED = 0x09,
+ ATSC_DCC_SELECTION_GEOGRAPHIC_LOCATION_INCLUSION = 0x0c,
+ ATSC_DCC_SELECTION_RATING_BLOCKED = 0x0d,
+ ATSC_DCC_SELECTION_RETURN_TO_ORIGINAL_CHANNEL = 0x0f,
+ ATSC_DCC_SELECTION_NUMERIC_POSTAL_CODE_EXCLUSION = 0x11,
+ ATSC_DCC_SELECTION_ALPHANUMERIC_POSTAL_CODE_EXCLUSION = 0x12,
+ ATSC_DCC_SELECTION_DEMOGRAPHIC_CATEGORY_NOT_ONE_OR_MORE = 0x15,
+ ATSC_DCC_SELECTION_DEMOGRAPHIC_CATEGORY_NOT_ALL = 0x16,
+ ATSC_DCC_SELECTION_GENRE_CATEGORY_NOT_ONE_OR_MORE = 0x17,
+ ATSC_DCC_SELECTION_GENRE_CATEGORY_NOT_ALL = 0x18,
+ ATSC_DCC_SELECTION_GEOGRAPHIC_LOCATION_EXCLUSION = 0x1c,
+ ATSC_DCC_SELECTION_VIEWER_DIRECT_SELECT_A = 0x20,
+ ATSC_DCC_SELECTION_VIEWER_DIRECT_SELECT_B = 0x21,
+ ATSC_DCC_SELECTION_VIEWER_DIRECT_SELECT_C = 0x22,
+ ATSC_DCC_SELECTION_VIEWER_DIRECT_SELECT_D = 0x23,
+};
+
+/**
+ * atsc_dcct_section structure.
+ */
+struct atsc_dcct_section {
+ struct atsc_section_psip head;
+
+ uint8_t dcc_test_count;
+ /* struct atsc_dcct_test tests */
+ /* struct atsc_dcct_section_part2 part2 */
+} __ucsi_packed;
+
+struct atsc_dcct_test {
+ EBIT4(uint32_t dcc_context : 1; ,
+ uint32_t reserved : 3; ,
+ uint32_t dcc_from_major_channel_number :10; ,
+ uint32_t dcc_from_minor_channel_number :10; );
+ EBIT3(uint32_t reserved1 : 4; ,
+ uint32_t dcc_to_major_channel_number :10; ,
+ uint32_t dcc_to_minor_channel_number :10; );
+ atsctime_t start_time;
+ atsctime_t end_time;
+ uint8_t dcc_term_count;
+ /* struct atsc_dcct_term terms */
+ /* struct atsc_dcct_test_part2 part2 */
+} __ucsi_packed;
+
+struct atsc_dcct_term {
+ uint8_t dcc_selection_type;
+ uint64_t dcc_selection_id;
+ EBIT2(uint16_t reserved : 6; ,
+ uint16_t descriptors_length :10; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+struct atsc_dcct_test_part2 {
+ EBIT2(uint16_t reserved : 6; ,
+ uint16_t descriptors_length :10; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+struct atsc_dcct_section_part2 {
+ EBIT2(uint16_t reserved : 6; ,
+ uint16_t descriptors_length :10; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+static inline struct atsc_dcct_test *
+ atsc_dcct_section_tests_first(struct atsc_dcct_section *dcct);
+static inline struct atsc_dcct_test *
+ atsc_dcct_section_tests_next(struct atsc_dcct_section *dcct,
+ struct atsc_dcct_test *pos,
+ int idx);
+static inline struct atsc_dcct_term *
+ atsc_dcct_test_terms_first(struct atsc_dcct_test *test);
+static inline struct atsc_dcct_term *
+ atsc_dcct_test_terms_next(struct atsc_dcct_test *test,
+ struct atsc_dcct_term *pos,
+ int idx);
+
+
+/**
+ * Process an atsc_dcct_section.
+ *
+ * @param section Pointer to an atsc_section_psip structure.
+ * @return atsc_dcct_section pointer, or NULL on error.
+ */
+struct atsc_dcct_section *atsc_dcct_section_codec(struct atsc_section_psip *section);
+
+/**
+ * Accessor for the dcc_subtype field of a dcct.
+ *
+ * @param dcct dcct pointer.
+ * @return The dcc_subtype.
+ */
+static inline uint8_t atsc_dcct_section_dcc_subtype(struct atsc_dcct_section *dcct)
+{
+ return dcct->head.ext_head.table_id_ext >> 8;
+}
+
+/**
+ * Accessor for the dcc_id field of a dcct.
+ *
+ * @param dcct dcct pointer.
+ * @return The dcc_id.
+ */
+static inline uint8_t atsc_dcct_section_dcc_id(struct atsc_dcct_section *dcct)
+{
+ return dcct->head.ext_head.table_id_ext & 0xff;
+}
+
+/**
+ * Iterator for the tests field in an atsc_dcct_section.
+ *
+ * @param dcct atsc_dcct_section pointer.
+ * @param pos Variable containing a pointer to the current atsc_dcct_test.
+ * @param idx Integer used to count which test we are in.
+ */
+#define atsc_dcct_section_tests_for_each(dcct, pos, idx) \
+ for ((pos) = atsc_dcct_section_tests_first(dcct), idx=0; \
+ (pos); \
+ (pos) = atsc_dcct_section_tests_next(dcct, pos, ++idx))
+
+/**
+ * Iterator for the terms field in an atsc_dcct_test.
+ *
+ * @param test atsc_dcct_test pointer.
+ * @param pos Variable containing a pointer to the current atsc_dcct_term.
+ * @param idx Integer used to count which test we are in.
+ */
+#define atsc_dcct_test_terms_for_each(test, pos, idx) \
+ for ((pos) = atsc_dcct_test_terms_first(test), idx=0; \
+ (pos); \
+ (pos) = atsc_dcct_test_terms_next(test, pos, ++idx))
+
+/**
+ * Iterator for the descriptors field in a atsc_dcct_term structure.
+ *
+ * @param term atsc_dcct_term pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_dcct_term_descriptors_for_each(term, pos) \
+ for ((pos) = atsc_dcct_term_descriptors_first(term); \
+ (pos); \
+ (pos) = atsc_dcct_term_descriptors_next(term, pos))
+
+/**
+ * Accessor for the part2 field of an atsc_dcct_test.
+ *
+ * @param test atsc_dcct_test pointer.
+ * @return struct atsc_dcct_test_part2 pointer.
+ */
+static inline struct atsc_dcct_test_part2 *atsc_dcct_test_part2(struct atsc_dcct_test *test)
+{
+ int pos = sizeof(struct atsc_dcct_test);
+
+ struct atsc_dcct_term *cur_term;
+ int idx;
+ atsc_dcct_test_terms_for_each(test, cur_term, idx) {
+ pos += sizeof(struct atsc_dcct_term);
+ pos += cur_term->descriptors_length;
+ }
+
+ return (struct atsc_dcct_test_part2 *) (((uint8_t*) test) + pos);
+}
+
+/**
+ * Iterator for the descriptors field in a atsc_dcct_test_part2 structure.
+ *
+ * @param term atsc_dcct_test_part2 pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_dcct_test_part2_descriptors_for_each(part2, pos) \
+ for ((pos) = atsc_dcct_test_part2_descriptors_first(part2); \
+ (pos); \
+ (pos) = atsc_dcct_test_part2_descriptors_next(part2, pos))
+
+/**
+ * Accessor for the part2 field of an atsc_dcct_section.
+ *
+ * @param dcct atsc_dcct_section pointer.
+ * @return struct atsc_dcct_section_part2 pointer.
+ */
+static inline struct atsc_dcct_section_part2 *atsc_dcct_section_part2(struct atsc_dcct_section *dcct)
+{
+ int pos = sizeof(struct atsc_dcct_section);
+
+ struct atsc_dcct_test *cur_test;
+ int testidx;
+ atsc_dcct_section_tests_for_each(dcct, cur_test, testidx) {
+ struct atsc_dcct_test_part2 *part2 = atsc_dcct_test_part2(cur_test);
+ pos += ((uint8_t*) part2 - (uint8_t*) cur_test);
+
+ pos += sizeof(struct atsc_dcct_test_part2);
+ pos += part2->descriptors_length;
+ }
+
+ return (struct atsc_dcct_section_part2 *) (((uint8_t*) dcct) + pos);
+}
+
+/**
+ * Iterator for the descriptors field in a atsc_dcct_section_part2 structure.
+ *
+ * @param part2 atsc_dcct_section_part2 pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_dcct_section_part2_descriptors_for_each(part2, pos) \
+ for ((pos) = atsc_dcct_section_part2_descriptors_first(part2); \
+ (pos); \
+ (pos) = atsc_dcct_section_part2_descriptors_next(part2, pos))
+
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_dcct_test *
+ atsc_dcct_section_tests_first(struct atsc_dcct_section *dcct)
+{
+ size_t pos = sizeof(struct atsc_dcct_section);
+
+ if (dcct->dcc_test_count == 0)
+ return NULL;
+
+ return (struct atsc_dcct_test*) (((uint8_t *) dcct) + pos);
+}
+
+static inline struct atsc_dcct_test *
+ atsc_dcct_section_tests_next(struct atsc_dcct_section *dcct,
+ struct atsc_dcct_test *pos,
+ int idx)
+{
+ if (idx >= dcct->dcc_test_count)
+ return NULL;
+
+ struct atsc_dcct_test_part2 *part2 = atsc_dcct_test_part2(pos);
+ int len = sizeof(struct atsc_dcct_test_part2);
+ len += part2->descriptors_length;
+
+ return (struct atsc_dcct_test *) (((uint8_t*) part2) + len);
+}
+
+static inline struct atsc_dcct_term *
+ atsc_dcct_test_terms_first(struct atsc_dcct_test *test)
+{
+ size_t pos = sizeof(struct atsc_dcct_test);
+
+ if (test->dcc_term_count == 0)
+ return NULL;
+
+ return (struct atsc_dcct_term*) (((uint8_t *) test) + pos);
+}
+
+static inline struct atsc_dcct_term *
+ atsc_dcct_test_terms_next(struct atsc_dcct_test *test,
+ struct atsc_dcct_term *pos,
+ int idx)
+{
+ if (idx >= test->dcc_term_count)
+ return NULL;
+
+ int len = sizeof(struct atsc_dcct_term);
+ len += pos->descriptors_length;
+
+ return (struct atsc_dcct_term *) (((uint8_t*) pos) + len);
+}
+
+static inline struct descriptor *
+ atsc_dcct_term_descriptors_first(struct atsc_dcct_term *term)
+{
+ size_t pos = sizeof(struct atsc_dcct_term);
+
+ if (term->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) term) + pos);
+}
+
+static inline struct descriptor *
+ atsc_dcct_term_descriptors_next(struct atsc_dcct_term *term,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) term + sizeof(struct atsc_dcct_term),
+ term->descriptors_length,
+ pos);
+}
+
+static inline struct descriptor *
+ atsc_dcct_test_part2_descriptors_first(struct atsc_dcct_test_part2 *part2)
+{
+ size_t pos = sizeof(struct atsc_dcct_test_part2);
+
+ if (part2->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) part2) + pos);
+}
+
+static inline struct descriptor *
+ atsc_dcct_test_part2_descriptors_next(struct atsc_dcct_test_part2 *part2,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) part2 + sizeof(struct atsc_dcct_test_part2),
+ part2->descriptors_length,
+ pos);
+}
+
+static inline struct descriptor *
+ atsc_dcct_section_part2_descriptors_first(struct atsc_dcct_section_part2 *part2)
+{
+ size_t pos = sizeof(struct atsc_dcct_section_part2);
+
+ if (part2->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) part2) + pos);
+}
+
+static inline struct descriptor *
+ atsc_dcct_section_part2_descriptors_next(struct atsc_dcct_section_part2 *part2,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) part2 + sizeof(struct atsc_dcct_section_part2),
+ part2->descriptors_length,
+ pos);
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/descriptor.h
index a18b29d..a57176a 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/atsc/descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/descriptor.h
@@ -28,39 +28,37 @@ extern "C"
#endif
#include <libucsi/endianops.h>
+#include <libucsi/atsc/stuffing_descriptor.h>
+#include <libucsi/atsc/ac3_descriptor.h>
+#include <libucsi/atsc/caption_service_descriptor.h>
+#include <libucsi/atsc/component_name_descriptor.h>
+#include <libucsi/atsc/content_advisory_descriptor.h>
+#include <libucsi/atsc/dcc_arriving_request_descriptor.h>
+#include <libucsi/atsc/dcc_departing_request_descriptor.h>
+#include <libucsi/atsc/extended_channel_name_descriptor.h>
+#include <libucsi/atsc/genre_descriptor.h>
+#include <libucsi/atsc/rc_descriptor.h>
+#include <libucsi/atsc/service_location_descriptor.h>
+#include <libucsi/atsc/time_shifted_service_descriptor.h>
/**
* Enumeration of ATSC descriptor tags.
*/
enum atsc_descriptor_tag {
-
-/* A 52/A describes a
- * dtag_atsc_ac3_registration = 0x05, */
-
-/* A90 describes a
- * dtag_atsc_association_tag = 0x14, */
-
dtag_atsc_stuffing = 0x80,
dtag_atsc_ac3_audio = 0x81,
dtag_atsc_caption_service = 0x86,
dtag_atsc_content_advisory = 0x87,
- dtag_atsc_ca = 0x88,
dtag_atsc_extended_channel_name = 0xa0,
dtag_atsc_service_location = 0xa1,
dtag_atsc_time_shifted_service = 0xa2,
dtag_atsc_component_name = 0xa3,
- dtag_atsc_data_service = 0xa4,
- dtag_atsc_pid_count = 0xa5,
- dtag_atsc_download = 0xa6,
- dtag_atsc_MPE = 0xa7,
dtag_atsc_dcc_departing_request = 0xa8,
dtag_atsc_dcc_arriving_request = 0xa9,
dtag_atsc_redistribution_control = 0xaa,
- dtag_atsc_dcc_location_code = 0xab,
dtag_atsc_private_information = 0xad,
- dtag_atsc_module_link = 0xb4,
- dtag_atsc_crc32 = 0xb5,
- dtag_atsc_group_link = 0xb8,
+ dtag_atsc_content_identifier = 0xb6,
+ dtag_atsc_genre = 0xab,
};
#ifdef __cplusplus
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/eit_section.c b/kaffeine/src/input/dvb/lib/libucsi/atsc/eit_section.c
new file mode 100644
index 0000000..48cdda6
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/eit_section.c
@@ -0,0 +1,71 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <libucsi/atsc/eit_section.h>
+
+struct atsc_eit_section *atsc_eit_section_codec(struct atsc_section_psip *psip)
+{
+ uint8_t * buf = (uint8_t *) psip;
+ size_t pos = 0;
+ size_t len = section_ext_length(&(psip->ext_head));
+ int idx;
+
+ if (len < sizeof(struct atsc_eit_section))
+ return NULL;
+ struct atsc_eit_section *eit = (struct atsc_eit_section *) psip;
+
+ pos += sizeof(struct atsc_eit_section);
+ for(idx =0; idx < eit->num_events_in_section; idx++) {
+ if (len < (pos + sizeof(struct atsc_eit_event)))
+ return NULL;
+ struct atsc_eit_event *event = (struct atsc_eit_event *) (buf+pos);
+
+ bswap16(buf+pos);
+ bswap32(buf+pos+2);
+ bswap32(buf+pos+6);
+
+ pos += sizeof(struct atsc_eit_event);
+ if (len < (pos + event->title_length))
+ return NULL;
+ if (atsc_text_validate(buf+pos, event->title_length))
+ return NULL;
+
+ pos += event->title_length;
+ if (len < (pos + sizeof(struct atsc_eit_event_part2)))
+ return NULL;
+ struct atsc_eit_event_part2 *part2 = (struct atsc_eit_event_part2 *) (buf+pos);
+
+ bswap16(buf+pos);
+
+ pos += sizeof(struct atsc_eit_event_part2);
+ if (len < (pos + part2->descriptors_length))
+ return NULL;
+
+ if (verify_descriptors(buf + pos, part2->descriptors_length))
+ return NULL;
+ pos += part2->descriptors_length;
+ }
+
+ if (pos != len)
+ return NULL;
+
+ return (struct atsc_eit_section *) psip;
+}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/eit_section.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/eit_section.h
new file mode 100644
index 0000000..84bef16
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/eit_section.h
@@ -0,0 +1,191 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_EIT_SECTION_H
+#define _UCSI_ATSC_EIT_SECTION_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/atsc/section.h>
+#include <libucsi/atsc/types.h>
+
+/**
+ * atsc_eit_section structure.
+ */
+struct atsc_eit_section {
+ struct atsc_section_psip head;
+
+ uint8_t num_events_in_section;
+ /* struct atsc_eit_event events[] */
+} __ucsi_packed;
+
+struct atsc_eit_event {
+ EBIT2(uint16_t reserved : 2; ,
+ uint16_t event_id :14; );
+ atsctime_t start_time;
+ EBIT4(uint32_t reserved1 : 2; ,
+ uint32_t ETM_location : 2; ,
+ uint32_t length_in_seconds :20; ,
+ uint32_t title_length : 8; );
+ /* struct atsc_text title_text */
+ /* struct atsc_eit_event_part2 part2 */
+} __ucsi_packed;
+
+struct atsc_eit_event_part2 {
+ EBIT2(uint16_t reserved : 4; ,
+ uint16_t descriptors_length :12; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+
+/**
+ * Process a atsc_eit_section.
+ *
+ * @param section Pointer to an atsc_section_psip structure.
+ * @return atsc_eit_section pointer, or NULL on error.
+ */
+struct atsc_eit_section *atsc_eit_section_codec(struct atsc_section_psip *section);
+
+/**
+ * Accessor for the source_id field of an EIT.
+ *
+ * @param eit EIT pointer.
+ * @return The source_id .
+ */
+static inline uint16_t atsc_eit_section_source_id(struct atsc_eit_section *eit)
+{
+ return eit->head.ext_head.table_id_ext;
+}
+
+/**
+ * Iterator for the events field in an atsc_eit_section.
+ *
+ * @param eit atsc_eit_section pointer.
+ * @param pos Variable containing a pointer to the current atsc_eit_event.
+ * @param idx Integer used to count which event we are in.
+ */
+#define atsc_eit_section_events_for_each(eit, pos, idx) \
+ for ((pos) = atsc_eit_section_events_first(eit), idx=0; \
+ (pos); \
+ (pos) = atsc_eit_section_events_next(eit, pos, ++idx))
+
+/**
+ * Accessor for the title_text field of an atsc_eit_event.
+ *
+ * @param event atsc_eit_event pointer.
+ * @return struct atsc_text pointer, or NULL on error.
+ */
+static inline struct atsc_text *atsc_eit_event_name_title_text(struct atsc_eit_event *event)
+{
+ if (event->title_length == 0)
+ return NULL;
+
+ return (struct atsc_text*)(((uint8_t*) event) + sizeof(struct atsc_eit_event));
+}
+
+/**
+ * Accessor for the part2 field of an atsc_eit_event.
+ *
+ * @param event atsc_eit_event pointer.
+ * @return struct atsc_eit_event_part2 pointer.
+ */
+static inline struct atsc_eit_event_part2 *atsc_eit_event_part2(struct atsc_eit_event *event)
+{
+ return (struct atsc_eit_event_part2 *)
+ (((uint8_t*) event) + sizeof(struct atsc_eit_event) + event->title_length);
+}
+
+/**
+ * Iterator for the descriptors field in a atsc_eit_section structure.
+ *
+ * @param part2 atsc_eit_event_part2 pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_eit_event_part2_descriptors_for_each(part2, pos) \
+ for ((pos) = atsc_eit_event_part2_descriptors_first(part2); \
+ (pos); \
+ (pos) = atsc_eit_event_part2_descriptors_next(part2, pos))
+
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_eit_event *
+ atsc_eit_section_events_first(struct atsc_eit_section *eit)
+{
+ size_t pos = sizeof(struct atsc_eit_section);
+
+ if (eit->num_events_in_section == 0)
+ return NULL;
+
+ return (struct atsc_eit_event*) (((uint8_t *) eit) + pos);
+}
+
+static inline struct atsc_eit_event *
+ atsc_eit_section_events_next(struct atsc_eit_section *eit,
+ struct atsc_eit_event *pos,
+ int idx)
+{
+ if (idx >= eit->num_events_in_section)
+ return NULL;
+
+ struct atsc_eit_event_part2 *part2 = atsc_eit_event_part2(pos);
+ int len = sizeof(struct atsc_eit_event_part2);
+ len += part2->descriptors_length;
+
+ return (struct atsc_eit_event *) (((uint8_t*) part2) + len);
+}
+
+static inline struct descriptor *
+ atsc_eit_event_part2_descriptors_first(struct atsc_eit_event_part2 *part2)
+{
+ size_t pos = sizeof(struct atsc_eit_event_part2);
+
+ if (part2->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) part2) + pos);
+}
+
+static inline struct descriptor *
+ atsc_eit_event_part2_descriptors_next(struct atsc_eit_event_part2 *part2,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) part2 + sizeof(struct atsc_eit_event_part2),
+ part2->descriptors_length,
+ pos);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/ett_section.c b/kaffeine/src/input/dvb/lib/libucsi/atsc/ett_section.c
new file mode 100644
index 0000000..ab2ff9c
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/ett_section.c
@@ -0,0 +1,42 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <libucsi/atsc/ett_section.h>
+#include <libucsi/atsc/types.h>
+
+struct atsc_ett_section *atsc_ett_section_codec(struct atsc_section_psip *psip)
+{
+ uint8_t * buf = (uint8_t *) psip;
+ size_t pos = sizeof(struct atsc_section_psip);
+ size_t len = section_ext_length(&(psip->ext_head));
+
+ if (len < sizeof(struct atsc_ett_section))
+ return NULL;
+
+ bswap32(buf + pos);
+ pos += 4;
+
+ if (atsc_text_validate(buf + pos,
+ section_ext_length(&psip->ext_head) - sizeof(struct atsc_ett_section)))
+ return NULL;
+
+ return (struct atsc_ett_section *) psip;
+}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/ett_section.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/ett_section.h
new file mode 100644
index 0000000..e2bb510
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/ett_section.h
@@ -0,0 +1,91 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_ETT_SECTION_H
+#define _UCSI_ATSC_ETT_SECTION_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/atsc/section.h>
+
+enum atsc_etm_type {
+ ATSC_ETM_CHANNEL = 0x00,
+ ATSC_ETM_EVENT = 0x02,
+};
+
+/**
+ * atsc_ett_section structure.
+ */
+struct atsc_ett_section {
+ struct atsc_section_psip head;
+
+ EBIT3(uint32_t ETM_source_id :16; ,
+ uint32_t ETM_sub_id :14; ,
+ uint32_t ETM_type : 2; );
+ /* struct atsc_text extended_text_message */
+} __ucsi_packed;
+
+/**
+ * Process a atsc_ett_section.
+ *
+ * @param section Pointer to an atsc_section_psip structure.
+ * @return atsc_ett_section pointer, or NULL on error.
+ */
+struct atsc_ett_section *atsc_ett_section_codec(struct atsc_section_psip *section);
+
+/**
+ * Accessor for the extended_text_message part of an atsc_ett_section.
+ *
+ * @param ett atsc_ett_section pointer.
+ * @return atsc_text pointer, or NULL on error.
+ */
+static inline struct atsc_text*
+ atsc_ett_section_extended_text_message(struct atsc_ett_section *ett)
+{
+ int pos = sizeof(struct atsc_ett_section);
+ int len = section_ext_length(&ett->head.ext_head) - sizeof(struct atsc_ett_section);
+
+ if (len == 0)
+ return NULL;
+
+ return (struct atsc_text*)(((uint8_t*) ett) + pos);
+}
+
+/**
+ * Accessor for the extended_text_message part of an atsc_ett_section.
+ *
+ * @param ett atsc_ett_section pointer.
+ * @return The length.
+ */
+static inline int
+ atsc_ett_section_extended_text_message_length(struct atsc_ett_section *ett)
+{
+ return section_ext_length(&ett->head.ext_head) - sizeof(struct atsc_ett_section);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/extended_channel_name_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/extended_channel_name_descriptor.h
new file mode 100644
index 0000000..d0b714b
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/extended_channel_name_descriptor.h
@@ -0,0 +1,92 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_EXTENDED_CHANNEL_NAME_DESCRIPTOR
+#define _UCSI_ATSC_EXTENDED_CHANNEL_NAME_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+#include <libucsi/types.h>
+#include <libucsi/atsc/types.h>
+
+/**
+ * atsc_extended_channel_name_descriptor structure.
+ */
+struct atsc_extended_channel_name_descriptor {
+ struct descriptor d;
+
+ /* struct atsc_text text[] */
+} __ucsi_packed;
+
+/**
+ * Process an atsc_extended_channel_name_descriptor.
+ *
+ * @param d Generic descriptor pointer.
+ * @return atsc_extended_channel_name_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_extended_channel_name_descriptor*
+ atsc_extended_channel_name_descriptor_codec(struct descriptor* d)
+{
+ if (atsc_text_validate(((uint8_t*) d) + sizeof(struct atsc_extended_channel_name_descriptor),
+ d->len))
+ return NULL;
+
+ return (struct atsc_extended_channel_name_descriptor*) d;
+}
+
+/**
+ * Accessor for the text field of an atsc_extended_channel_name_descriptor.
+ *
+ * @param d atsc_extended_channel_name_descriptor pointer.
+ * @return Pointer to the atsc_text data, or NULL on error.
+ */
+static inline struct atsc_text*
+ atsc_extended_channel_name_descriptor_text(struct atsc_extended_channel_name_descriptor *d)
+{
+ uint8_t *txt = ((uint8_t*) d) + sizeof(struct atsc_extended_channel_name_descriptor);
+
+ return (struct atsc_text*) txt;
+}
+
+/**
+ * Accessor for the length of the text field of an atsc_extended_channel_name_descriptor.
+ *
+ * @param d atsc_extended_channel_name_descriptor pointer.
+ * @return The length in bytes.
+ */
+static inline int
+ atsc_extended_channel_name_descriptor_text_length(struct
+ atsc_extended_channel_name_descriptor *d)
+{
+ return d->d.len;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/genre_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/genre_descriptor.h
new file mode 100644
index 0000000..a6fc542
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/genre_descriptor.h
@@ -0,0 +1,82 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_GENRE_DESCRIPTOR
+#define _UCSI_ATSC_GENRE_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+#include <libucsi/types.h>
+
+/**
+ * atsc_genre_descriptor structure.
+ */
+struct atsc_genre_descriptor {
+ struct descriptor d;
+
+ EBIT2(uint8_t reserved : 3; ,
+ uint8_t attribute_count : 5; );
+ /* uint8_t attributes[] */
+} __ucsi_packed;
+
+/**
+ * Process an atsc_genre_descriptor.
+ *
+ * @param d Generic descriptor pointer.
+ * @return atsc_genre_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_genre_descriptor*
+ atsc_genre_descriptor_codec(struct descriptor* d)
+{
+ struct atsc_genre_descriptor *ret =
+ (struct atsc_genre_descriptor *) d;
+
+ if (d->len < 1)
+ return NULL;
+
+ if (d->len != (1 + ret->attribute_count))
+ return NULL;
+
+ return (struct atsc_genre_descriptor*) d;
+}
+
+/**
+ * Accessor for the attributes field of an atsc_genre_descriptor.
+ *
+ * @param d atsc_genre_descriptor pointer.
+ * @return Pointer to the attributes.
+ */
+static inline uint8_t*
+ atsc_genre_descriptor_attributes(struct atsc_genre_descriptor *d)
+{
+ return ((uint8_t*) d) + sizeof(struct atsc_genre_descriptor);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/mgt_section.c b/kaffeine/src/input/dvb/lib/libucsi/atsc/mgt_section.c
new file mode 100644
index 0000000..bc6b3f2
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/mgt_section.c
@@ -0,0 +1,76 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <libucsi/atsc/mgt_section.h>
+
+struct atsc_mgt_section *atsc_mgt_section_codec(struct atsc_section_psip *psip)
+{
+ uint8_t * buf = (uint8_t *) psip;
+ size_t pos = sizeof(struct atsc_section_psip);
+ size_t len = section_ext_length(&(psip->ext_head));
+ struct atsc_mgt_section *mgt = (struct atsc_mgt_section *) psip;
+ int i;
+
+ if (len < sizeof(struct atsc_mgt_section))
+ return NULL;
+
+ bswap16(buf + pos);
+ pos += 2;
+
+ // we cannot use the tables_defined value here because of the braindead ATSC spec!
+ for(i=0; i < mgt->tables_defined; i++) {
+ // we think we're still in the tables - process as normal
+ if ((pos + sizeof(struct atsc_mgt_table)) > len)
+ return NULL;
+ struct atsc_mgt_table *table = (struct atsc_mgt_table *) (buf+pos);
+
+ bswap16(buf+pos);
+ bswap16(buf+pos+2);
+ bswap32(buf+pos+5);
+ bswap16(buf+pos+9);
+
+ pos += sizeof(struct atsc_mgt_table);
+ if ((pos + table->table_type_descriptors_length) > len)
+ return NULL;
+ if (verify_descriptors(buf + pos, table->table_type_descriptors_length))
+ return NULL;
+
+ pos += table->table_type_descriptors_length;
+ }
+
+ if ((pos + sizeof(struct atsc_mgt_section_part2)) > len)
+ return NULL;
+ struct atsc_mgt_section_part2 *part2 = (struct atsc_mgt_section_part2 *) (buf+pos);
+
+ bswap16(buf+pos);
+
+ pos += sizeof(struct atsc_mgt_section_part2);
+ if ((pos + part2->descriptors_length) > len)
+ return NULL;
+ if (verify_descriptors(buf + pos, part2->descriptors_length))
+ return NULL;
+ pos += part2->descriptors_length;
+
+ if (pos != len)
+ return NULL;
+
+ return (struct atsc_mgt_section *) psip;
+}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/mgt_section.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/mgt_section.h
new file mode 100644
index 0000000..3102a54
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/mgt_section.h
@@ -0,0 +1,215 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_MGT_SECTION_H
+#define _UCSI_ATSC_MGT_SECTION_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/atsc/section.h>
+
+enum atsc_mgt_section_table_type {
+ ATSC_MGT_TABLE_TYPE_TVCT_CURRENT = 0,
+ ATSC_MGT_TABLE_TYPE_TVCT_NEXT = 1,
+ ATSC_MGT_TABLE_TYPE_CVCT_CURRENT = 2,
+ ATSC_MGT_TABLE_TYPE_CVCT_NEXT = 3,
+ ATSC_MGT_TABLE_TYPE_CHANNEL_ETT = 4,
+ ATSC_MGT_TABLE_TYPE_DCCSCT = 5,
+};
+
+/**
+ * atsc_mgt_section structure.
+ */
+struct atsc_mgt_section {
+ struct atsc_section_psip head;
+
+ uint16_t tables_defined;
+ /* struct atsc_mgt_table tables[] */
+ /* struct atsc_mgt_section_part2 part2 */
+} __ucsi_packed;
+
+struct atsc_mgt_table {
+ uint16_t table_type;
+ EBIT2(uint16_t reserved : 3; ,
+ uint16_t table_type_PID :13; );
+ EBIT2(uint8_t reserved1 : 3; ,
+ uint8_t table_type_version_number : 5; );
+ uint32_t number_bytes;
+ EBIT2(uint16_t reserved2 : 4; ,
+ uint16_t table_type_descriptors_length :12; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+struct atsc_mgt_section_part2 {
+ EBIT2(uint16_t reserved : 4; ,
+ uint16_t descriptors_length :12; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+static inline struct atsc_mgt_table * atsc_mgt_section_tables_first(struct atsc_mgt_section *mgt);
+static inline struct atsc_mgt_table *
+ atsc_mgt_section_tables_next(struct atsc_mgt_section *mgt, struct atsc_mgt_table *pos, int idx);
+
+/**
+ * Process a atsc_mgt_section.
+ *
+ * @param section Pointer to an atsc_section_psip structure.
+ * @return atsc_mgt_section pointer, or NULL on error.
+ */
+struct atsc_mgt_section *atsc_mgt_section_codec(struct atsc_section_psip *section);
+
+/**
+ * Iterator for the tables field in an atsc_mgt_section.
+ *
+ * @param mgt atsc_mgt_section pointer.
+ * @param pos Variable containing a pointer to the current atsc_mgt_table.
+ * @param idx Integer used to count which table we in.
+ */
+#define atsc_mgt_section_tables_for_each(mgt, pos, idx) \
+ for ((pos) = atsc_mgt_section_tables_first(mgt), idx=0; \
+ (pos); \
+ (pos) = atsc_mgt_section_tables_next(mgt, pos, ++idx))
+
+/**
+ * Iterator for the descriptors field in a atsc_mgt_table structure.
+ *
+ * @param table atsc_mgt_table pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_mgt_table_descriptors_for_each(table, pos) \
+ for ((pos) = atsc_mgt_table_descriptors_first(table); \
+ (pos); \
+ (pos) = atsc_mgt_table_descriptors_next(table, pos))
+
+/**
+ * Accessor for the second part of an atsc_mgt_section.
+ *
+ * @param mgt atsc_mgt_section pointer.
+ * @return atsc_mgt_section_part2 pointer.
+ */
+static inline struct atsc_mgt_section_part2 *
+ atsc_mgt_section_part2(struct atsc_mgt_section *mgt)
+{
+ int pos = sizeof(struct atsc_mgt_section);
+
+ struct atsc_mgt_table *cur_table;
+ int idx;
+ atsc_mgt_section_tables_for_each(mgt, cur_table, idx) {
+ pos += sizeof(struct atsc_mgt_table);
+ pos += cur_table->table_type_descriptors_length;
+ }
+
+ return (struct atsc_mgt_section_part2 *) (((uint8_t*) mgt) + pos);
+}
+
+/**
+ * Iterator for the descriptors field in a atsc_mgt_section structure.
+ *
+ * @param part2 atsc_mgt_section_part2 pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_mgt_section_part2_descriptors_for_each(part2, pos) \
+ for ((pos) = atsc_mgt_section_part2_descriptors_first(part2); \
+ (pos); \
+ (pos) = atsc_mgt_section_part2_descriptors_next(part2, pos))
+
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_mgt_table *
+ atsc_mgt_section_tables_first(struct atsc_mgt_section *mgt)
+{
+ size_t pos = sizeof(struct atsc_mgt_section);
+
+ if (mgt->tables_defined == 0)
+ return NULL;
+
+ return (struct atsc_mgt_table*) (((uint8_t *) mgt) + pos);
+}
+
+static inline struct atsc_mgt_table *
+ atsc_mgt_section_tables_next(struct atsc_mgt_section *mgt,
+ struct atsc_mgt_table *pos,
+ int idx)
+{
+ if (idx >= mgt->tables_defined)
+ return NULL;
+
+ return (struct atsc_mgt_table *)
+ (((uint8_t*) pos) + sizeof(struct atsc_mgt_table) + pos->table_type_descriptors_length);
+}
+
+static inline struct descriptor *
+ atsc_mgt_table_descriptors_first(struct atsc_mgt_table *table)
+{
+ size_t pos = sizeof(struct atsc_mgt_table);
+
+ if (table->table_type_descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) table) + pos);
+}
+
+static inline struct descriptor *
+ atsc_mgt_table_descriptors_next(struct atsc_mgt_table *table,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) table + sizeof(struct atsc_mgt_table),
+ table->table_type_descriptors_length,
+ pos);
+}
+
+static inline struct descriptor *
+ atsc_mgt_section_part2_descriptors_first(struct atsc_mgt_section_part2 *part2)
+{
+ size_t pos = sizeof(struct atsc_mgt_section_part2);
+
+ if (part2->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) part2) + pos);
+}
+
+static inline struct descriptor *
+ atsc_mgt_section_part2_descriptors_next(struct atsc_mgt_section_part2 *part2,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) part2 + sizeof(struct atsc_mgt_section_part2),
+ part2->descriptors_length,
+ pos);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/rc_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/rc_descriptor.h
new file mode 100644
index 0000000..4fb0e8e
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/rc_descriptor.h
@@ -0,0 +1,83 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_RC_DESCRIPTOR
+#define _UCSI_ATSC_RC_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+#include <libucsi/types.h>
+
+/**
+ * atsc_rc_descriptor structure.
+ */
+struct atsc_rc_descriptor {
+ struct descriptor d;
+
+ /* uint8_t info[] */
+} __ucsi_packed;
+
+/**
+ * Process an atsc_rc_descriptor.
+ *
+ * @param d Generic descriptor pointer.
+ * @return atsc_rc_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_rc_descriptor*
+ atsc_rc_descriptor_codec(struct descriptor* d)
+{
+ return (struct atsc_rc_descriptor*) d;
+}
+
+/**
+ * Accessor for the info field of an atsc_rc_descriptor.
+ *
+ * @param d atsc_rc_descriptor pointer.
+ * @return Pointer to the atsc_text data.
+ */
+static inline uint8_t*
+ atsc_rc_descriptor_info(struct atsc_rc_descriptor *d)
+{
+ return ((uint8_t*) d) + sizeof(struct atsc_rc_descriptor);
+}
+
+/**
+ * Accessor for the length of the info field of an atsc_rc_descriptor.
+ *
+ * @param d atsc_rc_descriptor pointer.
+ * @return The length
+ */
+static inline int
+ atsc_rc_descriptor_info_length(struct atsc_rc_descriptor *d)
+{
+ return d->d.len;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/rrt_section.c b/kaffeine/src/input/dvb/lib/libucsi/atsc/rrt_section.c
new file mode 100644
index 0000000..6e96c3a
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/rrt_section.c
@@ -0,0 +1,108 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <libucsi/atsc/rrt_section.h>
+
+struct atsc_rrt_section *atsc_rrt_section_codec(struct atsc_section_psip *psip)
+{
+ uint8_t * buf = (uint8_t *) psip;
+ size_t pos = 0;
+ size_t len = section_ext_length(&(psip->ext_head));
+ int idx;
+ int vidx;
+ struct atsc_rrt_section *rrt = (struct atsc_rrt_section *) psip;
+
+ if (len < sizeof(struct atsc_rrt_section))
+ return NULL;
+ pos += sizeof(struct atsc_rrt_section);
+
+ if (len < (pos + rrt->rating_region_name_length))
+ return NULL;
+ if (atsc_text_validate(buf+pos, rrt->rating_region_name_length))
+ return NULL;
+
+ pos += rrt->rating_region_name_length;
+ if (len < (pos + sizeof(struct atsc_rrt_section_part2)))
+ return NULL;
+ struct atsc_rrt_section_part2 *rrtpart2 = (struct atsc_rrt_section_part2 *) (buf+pos);
+
+ pos += sizeof(struct atsc_rrt_section_part2);
+ for(idx =0; idx < rrtpart2->dimensions_defined; idx++) {
+ if (len < (pos + sizeof(struct atsc_rrt_dimension)))
+ return NULL;
+ struct atsc_rrt_dimension *dimension = (struct atsc_rrt_dimension *) (buf+pos);
+
+ pos += sizeof(struct atsc_rrt_dimension);
+ if (len < (pos + dimension->dimension_name_length))
+ return NULL;
+ if (atsc_text_validate(buf+pos, dimension->dimension_name_length))
+ return NULL;
+
+ pos += dimension->dimension_name_length;
+ if (len < (pos + sizeof(struct atsc_rrt_dimension_part2)))
+ return NULL;
+ struct atsc_rrt_dimension_part2 *dpart2 = (struct atsc_rrt_dimension_part2 *) (buf+pos);
+
+ pos += sizeof(struct atsc_rrt_dimension_part2);
+ for(vidx =0; vidx < dpart2->values_defined; vidx++) {
+ if (len < (pos + sizeof(struct atsc_rrt_dimension_value)))
+ return NULL;
+ struct atsc_rrt_dimension_value *value = (struct atsc_rrt_dimension_value *) (buf+pos);
+
+ pos += sizeof(struct atsc_rrt_dimension_value);
+ if (len < (pos + value->abbrev_rating_value_length))
+ return NULL;
+ if (atsc_text_validate(buf+pos, value->abbrev_rating_value_length))
+ return NULL;
+
+ pos += value->abbrev_rating_value_length;
+ if (len < (pos + sizeof(struct atsc_rrt_dimension_value_part2)))
+ return NULL;
+ struct atsc_rrt_dimension_value_part2 *vpart2 =
+ (struct atsc_rrt_dimension_value_part2 *) (buf+pos);
+
+ pos += sizeof(struct atsc_rrt_dimension_value_part2);
+ if (len < (pos + vpart2->rating_value_length))
+ return NULL;
+ if (atsc_text_validate(buf+pos, vpart2->rating_value_length))
+ return NULL;
+
+ pos+= vpart2->rating_value_length;
+ }
+ }
+
+ if (len < (pos + sizeof(struct atsc_rrt_section_part3)))
+ return NULL;
+ struct atsc_rrt_section_part3 *part3 = (struct atsc_rrt_section_part3 *) (buf+pos);
+
+ pos += sizeof(struct atsc_rrt_section_part3);
+ if (len < (pos + part3->descriptors_length))
+ return NULL;
+
+ if (verify_descriptors(buf + pos, part3->descriptors_length))
+ return NULL;
+
+ pos += part3->descriptors_length;
+ if (pos != len)
+ return NULL;
+
+ return (struct atsc_rrt_section *) psip;
+}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/rrt_section.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/rrt_section.h
new file mode 100644
index 0000000..fba4596
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/rrt_section.h
@@ -0,0 +1,379 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_RRT_SECTION_H
+#define _UCSI_ATSC_RRT_SECTION_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/atsc/section.h>
+#include <libucsi/atsc/types.h>
+
+/**
+ * atsc_rrt_section structure.
+ */
+struct atsc_rrt_section {
+ struct atsc_section_psip head;
+
+ uint8_t rating_region_name_length;
+ /* struct atsc_text rating_region_name_text */
+ /* struct atsc_rrt_section_part2 part2 */
+} __ucsi_packed;
+
+struct atsc_rrt_section_part2 {
+ uint8_t dimensions_defined;
+ /* struct atsc_rrt_dimension dimensions[] */
+ /* struct atsc_rrt_section_part3 part3 */
+} __ucsi_packed;
+
+struct atsc_rrt_dimension {
+ uint8_t dimension_name_length;
+ /* struct atsc_text dimension_name_text */
+ /* struct atsc_rrt_dimension_part2 part2 */
+} __ucsi_packed;
+
+struct atsc_rrt_dimension_part2 {
+ EBIT3(uint8_t reserved : 3; ,
+ uint8_t graduated_scale : 1; ,
+ uint8_t values_defined : 4; );
+ /* struct atsc_rrt_dimension_value values[] */
+} __ucsi_packed;
+
+struct atsc_rrt_dimension_value {
+ uint8_t abbrev_rating_value_length;
+ /* struct atsc_text abbrev_rating_value_text */
+ /* struct atsc_rrt_dimension_value_part2 */
+} __ucsi_packed;
+
+struct atsc_rrt_dimension_value_part2 {
+ uint8_t rating_value_length;
+ /* struct atsc_text rating_value_text */
+} __ucsi_packed;
+
+struct atsc_rrt_section_part3 {
+ EBIT2(uint16_t reserved : 6; ,
+ uint16_t descriptors_length :10; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+
+static inline struct atsc_rrt_dimension *
+ atsc_rrt_section_dimensions_first(struct atsc_rrt_section_part2 *part2);
+static inline struct atsc_rrt_dimension *
+ atsc_rrt_section_dimensions_next(struct atsc_rrt_section_part2 *part2,
+ struct atsc_rrt_dimension *pos,
+ int idx);
+static inline struct atsc_rrt_dimension_value *
+ atsc_rrt_dimension_part2_values_first(struct atsc_rrt_dimension_part2 *part2);
+static inline struct atsc_rrt_dimension_value *
+ atsc_rrt_dimension_part2_values_next(struct atsc_rrt_dimension_part2 *part2,
+ struct atsc_rrt_dimension_value *pos,
+ int idx);
+
+/**
+ * Process a atsc_rrt_section.
+ *
+ * @param section Pointer to anj atsc_section_psip structure.
+ * @return atsc_rrt_section pointer, or NULL on error.
+ */
+struct atsc_rrt_section *atsc_rrt_section_codec(struct atsc_section_psip *section);
+
+/**
+ * Accessor for the rating_region field of an RRT.
+ *
+ * @param rrt RRT pointer.
+ * @return The transport_stream_id.
+ */
+static inline uint8_t atsc_rrt_section_rating_region(struct atsc_rrt_section *rrt)
+{
+ return rrt->head.ext_head.table_id_ext & 0xff;
+}
+
+/**
+ * Accessor for the rating_region_name_text field of an RRT.
+ *
+ * @param rrt RRT pointer.
+ * @return struct atsc_text pointer, or NULL.
+ */
+static inline struct atsc_text *atsc_rrt_section_rating_region_name_text(struct atsc_rrt_section *rrt)
+{
+ if (rrt->rating_region_name_length == 0)
+ return NULL;
+
+ return (struct atsc_text*)(((uint8_t*) rrt) + sizeof(struct atsc_rrt_section));
+}
+
+/**
+ * Accessor for the part2 field of an RRT.
+ *
+ * @param rrt RRT pointer.
+ * @return struct atsc_rrt_section_part2 pointer.
+ */
+static inline struct atsc_rrt_section_part2 *atsc_rrt_section_part2(struct atsc_rrt_section *rrt)
+{
+ return (struct atsc_rrt_section_part2 *)
+ (((uint8_t*) rrt) + sizeof(struct atsc_rrt_section) +
+ rrt->rating_region_name_length);
+}
+
+/**
+ * Iterator for the dimensions field in an atsc_rrt_section_part2.
+ *
+ * @param rrt atsc_rrt_section pointer.
+ * @param pos Variable containing a pointer to the current atsc_rrt_dimension.
+ * @param idx Integer used to count which dimension we are in.
+ */
+#define atsc_rrt_section_dimensions_for_each(rrt, pos, idx) \
+ for ((pos) = atsc_rrt_section_dimensions_first(rrt), idx=0; \
+ (pos); \
+ (pos) = atsc_rrt_section_dimensions_next(rrt, pos, ++idx))
+
+/**
+ * Accessor for the dimension_name_text field of an atsc_rrt_dimension.
+ *
+ * @param dimension atsc_rrt_dimension pointer.
+ * @return struct atsc_text pointer, or NULL on error.
+ */
+static inline struct atsc_text *atsc_rrt_dimension_name_text(struct atsc_rrt_dimension *dimension)
+{
+ if (dimension->dimension_name_length == 0)
+ return NULL;
+
+ return (struct atsc_text*)(((uint8_t*) dimension) + sizeof(struct atsc_rrt_dimension));
+}
+
+/**
+ * Accessor for the part2 field of an atsc_rrt_dimension.
+ *
+ * @param dimension atsc_rrt_dimension pointer.
+ * @return struct atsc_rrt_dimension_part2 pointer.
+ */
+static inline struct atsc_rrt_dimension_part2 *atsc_rrt_dimension_part2(struct atsc_rrt_dimension *dimension)
+{
+ return (struct atsc_rrt_dimension_part2 *)
+ (((uint8_t*) dimension) +
+ sizeof(struct atsc_rrt_dimension) +
+ dimension->dimension_name_length);
+}
+
+/**
+ * Iterator for the values field in a atsc_rrt_dimension_part2 structure.
+ *
+ * @param part2 atsc_rrt_dimension_part2 pointer.
+ * @param pos Variable containing a pointer to the current value.
+ * @param idx Integer used to count which value we are in
+ */
+#define atsc_rrt_dimension_part2_values_for_each(part2, pos, idx) \
+ for ((pos) = atsc_rrt_dimension_part2_values_first(part2), idx=0; \
+ (pos); \
+ (pos) = atsc_rrt_dimension_part2_values_next(part2, pos, ++idx))
+
+/**
+ * Accessor for the dimension_name_text field of an atsc_rrt_dimension.
+ *
+ * @param dimension atsc_rrt_dimension pointer.
+ * @return struct atsc_text pointer.
+ */
+static inline struct atsc_text *
+ atsc_rrt_dimension_value_abbrev_rating_value_text(struct atsc_rrt_dimension_value *value)
+{
+ if (value->abbrev_rating_value_length == 0)
+ return NULL;
+
+ return (struct atsc_text*)(((uint8_t*) value) + sizeof(struct atsc_rrt_dimension_value));
+}
+
+/**
+ * Accessor for the part2 field of an atsc_rrt_dimension_value.
+ *
+ * @param value atsc_rrt_dimension_value pointer.
+ * @return struct atsc_rrt_dimension_value_part2 pointer.
+ */
+static inline struct atsc_rrt_dimension_value_part2 *atsc_rrt_dimension_value_part2(struct atsc_rrt_dimension_value *value)
+{
+ return (struct atsc_rrt_dimension_value_part2 *)
+ (((uint8_t*) value) +
+ sizeof(struct atsc_rrt_dimension_value) +
+ value->abbrev_rating_value_length);
+}
+
+/**
+ * Accessor for the rating_value_text field of an atsc_rrt_dimension_value_part2.
+ *
+ * @param part2 atsc_rrt_dimension_value_part2 pointer.
+ * @return struct atsc_text pointer.
+ */
+static inline struct atsc_text *atsc_rrt_dimension_value_part2_rating_value_text(struct atsc_rrt_dimension_value_part2 *part2)
+{
+ if (part2->rating_value_length == 0)
+ return NULL;
+
+ return (struct atsc_text*)(((uint8_t*) part2) + sizeof(struct atsc_rrt_dimension_value_part2));
+}
+
+/**
+ * Accessor for the third part of an atsc_rrt_section.
+ *
+ * @param part2 atsc_rrt_section_part2 pointer.
+ * @return atsc_rrt_section_part3 pointer.
+ */
+static inline struct atsc_rrt_section_part3 *
+ atsc_rrt_section_part3(struct atsc_rrt_section_part2 *part2)
+{
+ int pos = sizeof(struct atsc_rrt_section_part2);
+
+ struct atsc_rrt_dimension *cur_dimension;
+ int idx;
+ atsc_rrt_section_dimensions_for_each(part2, cur_dimension, idx) {
+ pos += sizeof(struct atsc_rrt_dimension);
+ pos += cur_dimension->dimension_name_length;
+ pos += sizeof(struct atsc_rrt_dimension_part2);
+
+ // now we need to iterate over the values. yuck
+ struct atsc_rrt_dimension_part2 *dpart2 = atsc_rrt_dimension_part2(cur_dimension);
+ struct atsc_rrt_dimension_value *cur_value;
+ int vidx;
+ atsc_rrt_dimension_part2_values_for_each(dpart2, cur_value, vidx) {
+ pos += sizeof(struct atsc_rrt_dimension_value);
+ pos += cur_value->abbrev_rating_value_length;
+
+ struct atsc_rrt_dimension_value_part2 *vpart2 = atsc_rrt_dimension_value_part2(cur_value);
+ pos += sizeof(struct atsc_rrt_dimension_value_part2);
+ pos += vpart2->rating_value_length;
+ }
+ }
+
+ return (struct atsc_rrt_section_part3 *) (((uint8_t*) part2) + pos);
+}
+
+/**
+ * Iterator for the descriptors field in a atsc_rrt_section structure.
+ *
+ * @param part3 atsc_rrt_section_part3 pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_rrt_section_part3_descriptors_for_each(part3, pos) \
+ for ((pos) = atsc_rrt_section_part3_descriptors_first(part3); \
+ (pos); \
+ (pos) = atsc_rrt_section_part3_descriptors_next(part3, pos))
+
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_rrt_dimension *
+ atsc_rrt_section_dimensions_first(struct atsc_rrt_section_part2 *part2)
+{
+ size_t pos = sizeof(struct atsc_rrt_section_part2);
+
+ if (part2->dimensions_defined == 0)
+ return NULL;
+
+ return (struct atsc_rrt_dimension*) (((uint8_t *) part2) + pos);
+}
+
+static inline struct atsc_rrt_dimension *
+ atsc_rrt_section_dimensions_next(struct atsc_rrt_section_part2 *part2,
+ struct atsc_rrt_dimension *pos,
+ int idx)
+{
+ if (idx >= part2->dimensions_defined)
+ return NULL;
+
+ struct atsc_rrt_dimension_part2 *dpart2 = atsc_rrt_dimension_part2(pos);
+ int len = sizeof(struct atsc_rrt_dimension_part2);
+
+ // now we need to iterate over the values. yuck
+ struct atsc_rrt_dimension_value *cur_value;
+ int vidx;
+ atsc_rrt_dimension_part2_values_for_each(dpart2, cur_value, vidx) {
+ len += sizeof(struct atsc_rrt_dimension_value);
+ len += cur_value->abbrev_rating_value_length;
+
+ struct atsc_rrt_dimension_value_part2 *vpart2 = atsc_rrt_dimension_value_part2(cur_value);
+ len += sizeof(struct atsc_rrt_dimension_value_part2);
+ len += vpart2->rating_value_length;
+ }
+
+ return (struct atsc_rrt_dimension *) (((uint8_t*) dpart2) + len);
+}
+
+static inline struct atsc_rrt_dimension_value *
+ atsc_rrt_dimension_part2_values_first(struct atsc_rrt_dimension_part2 *part2)
+{
+ size_t pos = sizeof(struct atsc_rrt_dimension_part2);
+
+ if (part2->values_defined == 0)
+ return NULL;
+
+ return (struct atsc_rrt_dimension_value*) (((uint8_t *) part2) + pos);
+}
+
+static inline struct atsc_rrt_dimension_value *
+ atsc_rrt_dimension_part2_values_next(struct atsc_rrt_dimension_part2 *part2,
+ struct atsc_rrt_dimension_value *pos,
+ int idx)
+{
+ if (idx >= part2->values_defined)
+ return NULL;
+
+ struct atsc_rrt_dimension_value_part2 *vpart2 = atsc_rrt_dimension_value_part2(pos);
+ int len = sizeof(struct atsc_rrt_dimension_value_part2);
+ len += vpart2->rating_value_length;
+
+ return (struct atsc_rrt_dimension_value *) (((uint8_t*) vpart2) + len);
+}
+
+static inline struct descriptor *
+ atsc_rrt_section_part3_descriptors_first(struct atsc_rrt_section_part3 *part3)
+{
+ size_t pos = sizeof(struct atsc_rrt_section_part3);
+
+ if (part3->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) part3) + pos);
+}
+
+static inline struct descriptor *
+ atsc_rrt_section_part3_descriptors_next(struct atsc_rrt_section_part3 *part3,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) part3 + sizeof(struct atsc_rrt_section_part3),
+ part3->descriptors_length,
+ pos);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/section.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/section.h
index e693b9d..23d59ea 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/atsc/section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/section.h
@@ -19,6 +19,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include <libucsi/section.h>
+#include <libucsi/atsc/mgt_section.h>
+#include <libucsi/atsc/tvct_section.h>
+#include <libucsi/atsc/cvct_section.h>
+#include <libucsi/atsc/rrt_section.h>
+#include <libucsi/atsc/eit_section.h>
+#include <libucsi/atsc/ett_section.h>
+#include <libucsi/atsc/stt_section.h>
+#include <libucsi/atsc/dcct_section.h>
+#include <libucsi/atsc/dccsct_section.h>
+
#ifndef _UCSI_ATSC_SECTION_H
#define _UCSI_ATSC_SECTION_H 1
@@ -27,40 +38,44 @@ extern "C"
{
#endif
+#define ATSC_BASE_PID 0x1ffb
+
/**
* Enumeration of ATSC section tags.
*/
enum atsc_section_tag {
-/* 0xC0-0xC6 [ATSC coordinated values which are defined in other standards.] */
- stag_atsc_master_guide = 0xc7,
+ stag_atsc_master_guide = 0xc7,
stag_atsc_terrestrial_virtual_channel = 0xc8,
- stag_atsc_cable_virtual_channel = 0xc9,
- stag_atsc_rating_region = 0xca,
- stag_atsc_event_informationen = 0xcb,
- stag_atsc_extended_text = 0xcc,
+ stag_atsc_cable_virtual_channel = 0xc9,
+ stag_atsc_rating_region = 0xca,
+ stag_atsc_event_information = 0xcb,
+ stag_atsc_extended_text = 0xcc,
stag_atsc_system_time = 0xcd,
+};
- stag_atsc_data_event = 0xce,
- stag_atsc_data_service = 0xcf,
- stag_atsc_network_resources = 0xd1,
- stag_atsc_long_term_serivce = 0xd2,
-/* identical to DVB/ISO ?
- 0x3F DSM-CC Addressable Section Table
- 0x3B DSM-CC Section Table
- 0x3C DSM-CC Section Table */
-
- /* 0xCE-0xD2 [ATSC coordinated values which are defined in other standards.] */
- stag_atsc_directed_channel_change = 0xd3,
- stag_atsc_directed_channel_change_selection_code = 0xd4,
+/**
+ * ATSC specific PSIP section structure.
+ */
+struct atsc_section_psip {
+ struct section_ext ext_head;
+ uint8_t protocol_version;
+} __ucsi_packed;
- /* 0xD5-0xDF [ATSC coordinated values which are defined in other standards.] */
- stag_atsc_aggregate_event_information = 0xd6,
- stag_atsc_aggregate_extended_text = 0xd7,
- stag_atsc_satellite_virtual_channel = 0xda,
+/**
+ * Decode a PSIP section structure.
+ *
+ * @param section_ext Pointer to the processed section_ext structure.
+ * @return Pointer to the parsed section_psip structure, or NULL if invalid.
+ */
+static inline struct atsc_section_psip *atsc_section_psip_decode(struct section_ext *section_ext)
+{
+ size_t len = section_ext_length(section_ext);
+ if (len < sizeof(struct atsc_section_psip)) {
+ return NULL;
+ }
- /* 0xE0-0xE5 [Used in other systems] */
- /* 0xE6-0xFE [Reserved for future ATSC use] */
-};
+ return (struct atsc_section_psip *) section_ext;
+}
#ifdef __cplusplus
}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/service_location_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/service_location_descriptor.h
new file mode 100644
index 0000000..aad5b4a
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/service_location_descriptor.h
@@ -0,0 +1,141 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_SERVICE_LOCATION_DESCRIPTOR
+#define _UCSI_ATSC_SERVICE_LOCATION_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+#include <libucsi/types.h>
+
+enum atsc_stream_types {
+ ATSC_STREAM_TYPE_VIDEO = 0x02,
+ ATSC_STREAM_TYPE_AUDIO = 0x81,
+};
+
+/**
+ * atsc_service_location_descriptor structure.
+ */
+struct atsc_service_location_descriptor {
+ struct descriptor d;
+
+ EBIT2(uint16_t reserved : 3; ,
+ uint16_t PCR_PID :13; );
+ uint8_t number_elements;
+ /* struct atsc_service_location_element elements[] */
+} __ucsi_packed;
+
+/**
+ * An entry in the elements field of an atsc_service_location_descriptor.
+ */
+struct atsc_caption_service_location_element {
+ uint8_t stream_type;
+ EBIT2(uint16_t reserved : 3; ,
+ uint16_t elementary_PID :13; );
+ iso639lang_t language_code;
+} __ucsi_packed;
+
+/**
+ * Process an atsc_service_location_descriptor.
+ *
+ * @param d Generic descriptor pointer.
+ * @return atsc_service_location_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_service_location_descriptor*
+ atsc_service_location_descriptor_codec(struct descriptor* d)
+{
+ struct atsc_service_location_descriptor *ret =
+ (struct atsc_service_location_descriptor *) d;
+ uint8_t *buf = (uint8_t*) d + 2;
+ int pos = 0;
+ int idx;
+
+ if (d->len < 3)
+ return NULL;
+ bswap16(buf + pos);
+ pos+=3;
+
+ for(idx = 0; idx < ret->number_elements; idx++) {
+ if (d->len < (pos + sizeof(struct atsc_caption_service_entry)))
+ return NULL;
+
+ bswap16(buf+pos+1);
+
+ pos += sizeof(struct atsc_caption_service_entry);
+ }
+
+ return (struct atsc_service_location_descriptor*) d;
+}
+
+/**
+ * Iterator for elements field of a atsc_service_location_descriptor.
+ *
+ * @param d atsc_service_location_descriptor pointer.
+ * @param pos Variable holding a pointer to the current atsc_service_location_element.
+ * @param idx Integer used to count which dimension we are in.
+ */
+#define atsc_service_location_descriptor_elements_for_each(d, pos, idx) \
+ for ((pos) = atsc_service_location_descriptor_elements_first(d), idx=0; \
+ (pos); \
+ (pos) = atsc_service_location_descriptor_elements_next(d, pos, ++idx))
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_caption_service_location_element*
+ atsc_service_location_descriptor_elements_first(struct atsc_service_location_descriptor *d)
+{
+ if (d->number_elements == 0)
+ return NULL;
+
+ return (struct atsc_caption_service_location_element *)
+ ((uint8_t*) d + sizeof(struct atsc_service_location_descriptor));
+}
+
+static inline struct atsc_caption_service_location_element*
+ atsc_service_location_descriptor_elements_next(struct atsc_service_location_descriptor *d,
+ struct atsc_caption_service_location_element *pos,
+ int idx)
+{
+ uint8_t *next = (uint8_t *) pos + sizeof(struct atsc_caption_service_location_element);
+
+ if (idx >= d->number_elements)
+ return NULL;
+ return (struct atsc_caption_service_location_element *) next;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/stt_section.c b/kaffeine/src/input/dvb/lib/libucsi/atsc/stt_section.c
new file mode 100644
index 0000000..23ddd76
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/stt_section.c
@@ -0,0 +1,42 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <libucsi/atsc/stt_section.h>
+
+struct atsc_stt_section *atsc_stt_section_codec(struct atsc_section_psip *psip)
+{
+ uint8_t *buf = (uint8_t *) psip;
+ size_t pos = sizeof(struct atsc_section_psip);
+ size_t len = section_ext_length(&(psip->ext_head));
+
+ if (len < sizeof(struct atsc_stt_section))
+ return NULL;
+
+ bswap32(buf + pos);
+ pos += 5;
+ bswap16(buf + pos);
+ pos += 2;
+
+ if (verify_descriptors(buf + pos, len - sizeof(struct atsc_stt_section)))
+ return NULL;
+
+ return (struct atsc_stt_section *) psip;
+}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/stt_section.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/stt_section.h
new file mode 100644
index 0000000..79db5a1
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/stt_section.h
@@ -0,0 +1,105 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_STT_SECTION_H
+#define _UCSI_ATSC_STT_SECTION_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/atsc/section.h>
+#include <libucsi/atsc/types.h>
+
+/**
+ * atsc_stt_section structure.
+ */
+struct atsc_stt_section {
+ struct atsc_section_psip head;
+
+ atsctime_t system_time;
+ uint8_t gps_utc_offset;
+ EBIT4(uint16_t DS_status : 1; ,
+ uint16_t reserved : 2; ,
+ uint16_t DS_day_of_month : 5; ,
+ uint16_t DS_hour : 8; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+/**
+ * Process a atsc_stt_section.
+ *
+ * @param section Pointer to an atsc_section_psip structure.
+ * @return atsc_stt_section pointer, or NULL on error.
+ */
+struct atsc_stt_section *atsc_stt_section_codec(struct atsc_section_psip *section);
+
+/**
+ * Iterator for the services field in a atsc_stt_section.
+ *
+ * @param stt atsc_stt_section pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_stt_section_descriptors_for_each(stt, pos) \
+ for ((pos) = atsc_stt_section_descriptors_first(stt); \
+ (pos); \
+ (pos) = atsc_stt_section_descriptors_next(stt, pos))
+
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct descriptor *
+ atsc_stt_section_descriptors_first(struct atsc_stt_section *stt)
+{
+ size_t pos = sizeof(struct atsc_stt_section);
+
+ if (pos >= section_ext_length(&stt->head.ext_head))
+ return NULL;
+
+ return (struct descriptor*) ((uint8_t *) stt + pos);
+}
+
+static inline struct descriptor *
+ atsc_stt_section_descriptors_next(struct atsc_stt_section *stt,
+ struct descriptor *pos)
+{
+ int len = section_ext_length(&stt->head.ext_head);
+ len -= sizeof(struct atsc_stt_section);
+
+ return next_descriptor((uint8_t*) stt + sizeof(struct atsc_stt_section),
+ len,
+ pos);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/stuffing_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/stuffing_descriptor.h
new file mode 100644
index 0000000..777c282
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/stuffing_descriptor.h
@@ -0,0 +1,82 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_atsc@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_STUFFING_DESCRIPTOR
+#define _UCSI_ATSC_STUFFING_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+
+/**
+ * atsc_stuffing_descriptor.
+ */
+struct atsc_stuffing_descriptor {
+ struct descriptor d;
+
+ /* uint8_t data[] */
+} __ucsi_packed;
+
+/**
+ * Process a atsc_stuffing_descriptor.
+ *
+ * @param d Generic descriptor structure.
+ * @return atsc_stuffing_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_stuffing_descriptor*
+ atsc_stuffing_descriptor_codec(struct descriptor* d)
+{
+ return (struct atsc_stuffing_descriptor*) d;
+}
+
+/**
+ * Retrieve a pointer to the data field of a atsc_stuffing_descriptor.
+ *
+ * @param d atsc_stuffing_descriptor pointer.
+ * @return Pointer to the field.
+ */
+static inline uint8_t *
+ atsc_stuffing_descriptor_data(struct atsc_stuffing_descriptor *d)
+{
+ return (uint8_t *) d + sizeof(struct atsc_stuffing_descriptor);
+}
+
+/**
+ * Calculate length of the data field of a atsc_stuffing_descriptor.
+ *
+ * @param d atsc_stuffing_descriptor pointer.
+ * @return The length in bytes.
+ */
+static inline int
+ atsc_stuffing_descriptor_data_length(struct atsc_stuffing_descriptor *d)
+{
+ return d->d.len;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/time_shifted_service_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/time_shifted_service_descriptor.h
new file mode 100644
index 0000000..599e66d
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/time_shifted_service_descriptor.h
@@ -0,0 +1,136 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_TIME_SHIFTED_SERVICE_DESCRIPTOR
+#define _UCSI_ATSC_TIME_SHIFTED_SERVICE_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/endianops.h>
+#include <libucsi/types.h>
+
+/**
+ * atsc_time_shifted_service_descriptor structure.
+ */
+struct atsc_time_shifted_service_descriptor {
+ struct descriptor d;
+
+ EBIT2(uint8_t reserved : 3; ,
+ uint8_t number_of_services : 5; );
+ /* struct atsc_time_shifted_service services[] */
+} __ucsi_packed;
+
+/**
+ * An entry in the services field of an atsc_time_shifted_service_descriptor.
+ */
+struct atsc_time_shifted_service {
+ EBIT2(uint16_t reserved : 6; ,
+ uint16_t time_shift :10; );
+ EBIT3(uint32_t reserved2 : 4; ,
+ uint32_t major_channel_number :10; ,
+ uint32_t minor_channel_number :10; );
+} __ucsi_packed;
+
+/**
+ * Process an atsc_time_shifted_service_descriptor.
+ *
+ * @param d Generic descriptor pointer.
+ * @return atsc_time_shifted_service_descriptor pointer, or NULL on error.
+ */
+static inline struct atsc_time_shifted_service_descriptor*
+ atsc_time_shifted_service_descriptor_codec(struct descriptor* d)
+{
+ struct atsc_time_shifted_service_descriptor *ret =
+ (struct atsc_time_shifted_service_descriptor *) d;
+ uint8_t *buf = (uint8_t*) d + 2;
+ int pos = 0;
+ int idx;
+
+ if (d->len < 1)
+ return NULL;
+ pos++;
+
+ for(idx = 0; idx < ret->number_of_services; idx++) {
+ if (d->len < (pos + sizeof(struct atsc_time_shifted_service)))
+ return NULL;
+
+ bswap16(buf+pos);
+ bswap24(buf+pos+2);
+
+ pos += sizeof(struct atsc_time_shifted_service);
+ }
+
+ return (struct atsc_time_shifted_service_descriptor*) d;
+}
+
+/**
+ * Iterator for services field of a atsc_time_shifted_service_descriptor.
+ *
+ * @param d atsc_time_shifted_service_descriptor pointer.
+ * @param pos Variable holding a pointer to the current atsc_service_location_element.
+ * @param idx Integer used to count which service we are in.
+ */
+#define atsc_time_shifted_service_descriptor_services_for_each(d, pos, idx) \
+ for ((pos) = atsc_time_shifted_service_descriptor_services_first(d), idx=0; \
+ (pos); \
+ (pos) = atsc_time_shifted_service_descriptor_services_next(d, pos, ++idx))
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_time_shifted_service*
+ atsc_time_shifted_service_descriptor_services_first(struct atsc_time_shifted_service_descriptor *d)
+{
+ if (d->number_of_services == 0)
+ return NULL;
+
+ return (struct atsc_time_shifted_service *)
+ ((uint8_t*) d + sizeof(struct atsc_time_shifted_service_descriptor));
+}
+
+static inline struct atsc_time_shifted_service*
+ atsc_time_shifted_service_descriptor_services_next(struct atsc_time_shifted_service_descriptor *d,
+ struct atsc_time_shifted_service *pos,
+ int idx)
+{
+ uint8_t *next = (uint8_t *) pos + sizeof(struct atsc_time_shifted_service);
+
+ if (idx >= d->number_of_services)
+ return NULL;
+ return (struct atsc_time_shifted_service *) next;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/tvct_section.c b/kaffeine/src/input/dvb/lib/libucsi/atsc/tvct_section.c
new file mode 100644
index 0000000..d187414
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/tvct_section.c
@@ -0,0 +1,81 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <libucsi/atsc/tvct_section.h>
+
+struct atsc_tvct_section *atsc_tvct_section_codec(struct atsc_section_psip *psip)
+{
+ uint8_t * buf = (uint8_t *) psip;
+ size_t pos = sizeof(struct atsc_section_psip);
+ size_t len = section_ext_length(&(psip->ext_head));
+ int idx;
+ struct atsc_tvct_section *tvct = (struct atsc_tvct_section *) psip;
+
+ if (len < sizeof(struct atsc_tvct_section))
+ return NULL;
+
+ pos++;
+
+ for(idx =0; idx < tvct->num_channels_in_section; idx++) {
+
+ if ((pos + sizeof(struct atsc_tvct_channel)) > len)
+ return NULL;
+ struct atsc_tvct_channel *channel = (struct atsc_tvct_channel *) (buf+pos);
+
+ pos += 7*2;
+
+ bswap32(buf+pos);
+ bswap32(buf+pos+4);
+ bswap16(buf+pos+8);
+ bswap16(buf+pos+10);
+ bswap16(buf+pos+12);
+ bswap16(buf+pos+14);
+ bswap16(buf+pos+16);
+ pos+=18;
+
+ if ((pos + channel->descriptors_length) > len)
+ return NULL;
+ if (verify_descriptors(buf + pos, channel->descriptors_length))
+ return NULL;
+
+ pos += channel->descriptors_length;
+ }
+
+ if ((pos + sizeof(struct atsc_tvct_section_part2)) > len)
+ return NULL;
+ struct atsc_tvct_section_part2 *part2 = (struct atsc_tvct_section_part2 *) (buf+pos);
+
+ bswap16(buf+pos);
+ pos+=2;
+
+ if ((pos + part2->descriptors_length) > len)
+ return NULL;
+
+ if (verify_descriptors(buf + pos, part2->descriptors_length))
+ return NULL;
+
+ pos += part2->descriptors_length;
+
+ if (pos != len)
+ return NULL;
+
+ return (struct atsc_tvct_section *) psip;
+}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/tvct_section.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/tvct_section.h
new file mode 100644
index 0000000..77bc5f4
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/tvct_section.h
@@ -0,0 +1,227 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_TVCT_SECTION_H
+#define _UCSI_ATSC_TVCT_SECTION_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/atsc/section.h>
+
+/**
+ * atsc_tvct_section structure.
+ */
+struct atsc_tvct_section {
+ struct atsc_section_psip head;
+
+ uint8_t num_channels_in_section;
+ /* struct atsc_tvct_channel channels[] */
+ /* struct atsc_tvct_channel_part2 part2 */
+} __ucsi_packed;
+
+struct atsc_tvct_channel {
+ uint16_t short_name[7]; // UTF-16 network ordered
+ EBIT4(uint32_t reserved : 4; ,
+ uint32_t major_channel_number :10; ,
+ uint32_t minor_channel_number :10; ,
+ uint32_t modulation_mode : 8; );
+ uint32_t carrier_frequency;
+ uint16_t channel_TSID;
+ uint16_t program_number;
+ EBIT7(uint16_t ETM_location : 2; ,
+ uint16_t access_controlled : 1; ,
+ uint16_t hidden : 1; ,
+ uint16_t reserved1 : 2; ,
+ uint16_t hide_guide : 1; ,
+ uint16_t reserved2 : 3; ,
+ uint16_t service_type : 6; );
+ uint16_t source_id;
+ EBIT2(uint16_t reserved3 : 6; ,
+ uint16_t descriptors_length :10; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+struct atsc_tvct_section_part2 {
+ EBIT2(uint16_t reserved : 6; ,
+ uint16_t descriptors_length :10; );
+ /* struct descriptor descriptors[] */
+} __ucsi_packed;
+
+static inline struct atsc_tvct_channel *atsc_tvct_section_channels_first(struct atsc_tvct_section *tvct);
+static inline struct atsc_tvct_channel *
+ atsc_tvct_section_channels_next(struct atsc_tvct_section *tvct, struct atsc_tvct_channel *pos, int idx);
+
+/**
+ * Process a atsc_tvct_section.
+ *
+ * @param section Pointer to an atsc_section_psip structure.
+ * @return atsc_tvct_section pointer, or NULL on error.
+ */
+struct atsc_tvct_section *atsc_tvct_section_codec(struct atsc_section_psip *section);
+
+/**
+ * Accessor for the transport_stream_id field of a TVCT.
+ *
+ * @param tvct TVCT pointer.
+ * @return The transport_stream_id.
+ */
+static inline uint16_t atsc_tvct_section_transport_stream_id(struct atsc_tvct_section *tvct)
+{
+ return tvct->head.ext_head.table_id_ext;
+}
+
+/**
+ * Iterator for the channels field in an atsc_tvct_section.
+ *
+ * @param mgt atsc_tvct_section pointer.
+ * @param pos Variable containing a pointer to the current atsc_tvct_channel.
+ * @param idx Integer used to count which channel we in.
+ */
+#define atsc_tvct_section_channels_for_each(mgt, pos, idx) \
+ for ((pos) = atsc_tvct_section_channels_first(mgt), idx=0; \
+ (pos); \
+ (pos) = atsc_tvct_section_channels_next(mgt, pos, ++idx))
+
+/**
+ * Iterator for the descriptors field in a atsc_tvct_channel structure.
+ *
+ * @param channel atsc_tvct_channel pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_tvct_channel_descriptors_for_each(channel, pos) \
+ for ((pos) = atsc_tvct_channel_descriptors_first(channel); \
+ (pos); \
+ (pos) = atsc_tvct_channel_descriptors_next(channel, pos))
+
+/**
+ * Accessor for the second part of an atsc_tvct_section.
+ *
+ * @param mgt atsc_tvct_section pointer.
+ * @return atsc_tvct_section_part2 pointer.
+ */
+static inline struct atsc_tvct_section_part2 *
+ atsc_tvct_section_part2(struct atsc_tvct_section *mgt)
+{
+ int pos = sizeof(struct atsc_tvct_section);
+
+ struct atsc_tvct_channel *cur_channel;
+ int idx;
+ atsc_tvct_section_channels_for_each(mgt, cur_channel, idx) {
+ pos += sizeof(struct atsc_tvct_channel);
+ pos += cur_channel->descriptors_length;
+ }
+
+ return (struct atsc_tvct_section_part2 *) (((uint8_t*) mgt) + pos);
+}
+
+/**
+ * Iterator for the descriptors field in a atsc_tvct_section structure.
+ *
+ * @param part2 atsc_tvct_section_part2 pointer.
+ * @param pos Variable containing a pointer to the current descriptor.
+ */
+#define atsc_tvct_section_part2_descriptors_for_each(part2, pos) \
+ for ((pos) = atsc_tvct_section_part2_descriptors_first(part2); \
+ (pos); \
+ (pos) = atsc_tvct_section_part2_descriptors_next(part2, pos))
+
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_tvct_channel *
+ atsc_tvct_section_channels_first(struct atsc_tvct_section *tvct)
+{
+ size_t pos = sizeof(struct atsc_tvct_section);
+
+ if (tvct->num_channels_in_section == 0)
+ return NULL;
+
+ return (struct atsc_tvct_channel*) (((uint8_t *) tvct) + pos);
+}
+
+static inline struct atsc_tvct_channel *
+ atsc_tvct_section_channels_next(struct atsc_tvct_section *tvct,
+ struct atsc_tvct_channel *pos,
+ int idx)
+{
+ if (idx >= tvct->num_channels_in_section)
+ return NULL;
+
+ return (struct atsc_tvct_channel *)
+ (((uint8_t*) pos) + sizeof(struct atsc_tvct_channel) + pos->descriptors_length);
+}
+
+static inline struct descriptor *
+ atsc_tvct_channel_descriptors_first(struct atsc_tvct_channel *channel)
+{
+ size_t pos = sizeof(struct atsc_tvct_channel);
+
+ if (channel->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) channel) + pos);
+}
+
+static inline struct descriptor *
+ atsc_tvct_channel_descriptors_next(struct atsc_tvct_channel *channel,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) channel + sizeof(struct atsc_tvct_channel),
+ channel->descriptors_length,
+ pos);
+}
+
+static inline struct descriptor *
+ atsc_tvct_section_part2_descriptors_first(struct atsc_tvct_section_part2 *part2)
+{
+ size_t pos = sizeof(struct atsc_tvct_section_part2);
+
+ if (part2->descriptors_length == 0)
+ return NULL;
+
+ return (struct descriptor*) (((uint8_t *) part2) + pos);
+}
+
+static inline struct descriptor *
+ atsc_tvct_section_part2_descriptors_next(struct atsc_tvct_section_part2 *part2,
+ struct descriptor *pos)
+{
+ return next_descriptor((uint8_t*) part2 + sizeof(struct atsc_tvct_section_part2),
+ part2->descriptors_length,
+ pos);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/types.c b/kaffeine/src/input/dvb/lib/libucsi/atsc/types.c
new file mode 100644
index 0000000..8f4b7ea
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/types.c
@@ -0,0 +1,71 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <string.h>
+#include "libucsi/atsc/types.h"
+
+/* GPS epoch == unix time_t at 06/Jan/1980 */
+#define GPS_EPOCH 315964800
+
+
+int atsc_text_validate(uint8_t *buf, int len)
+{
+ int i;
+ int j;
+ int number_strings;
+ int number_segments;
+ int number_bytes;
+ int pos = 0;
+
+ if (len == 0)
+ return 0;
+ number_strings = buf[pos];
+ pos++;
+
+ for(i=0; i< number_strings; i++) {
+ if (len < (pos+4))
+ return -1;
+ number_segments = buf[pos+3];
+ pos+=4;
+
+ for(j=0; j < number_segments; j++) {
+ if (len < (pos+3))
+ return -1;
+ number_bytes = buf[pos+2];
+ pos+=3;
+
+ if (len < (pos + number_bytes))
+ return -1;
+ pos += number_bytes;
+ }
+ }
+
+ return 0;
+}
+
+time_t atsctime_to_unixtime(atsctime_t atsc)
+{
+ return atsc + GPS_EPOCH;
+}
+
+atsctime_t unixtime_to_atsctime(time_t t)
+{
+ return t - GPS_EPOCH;
+}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/atsc/types.h b/kaffeine/src/input/dvb/lib/libucsi/atsc/types.h
new file mode 100644
index 0000000..4d4b802
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/atsc/types.h
@@ -0,0 +1,227 @@
+ /*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_ATSC_TYPES_H
+#define _UCSI_ATSC_TYPES_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdint.h>
+#include <time.h>
+#include <libucsi/types.h>
+
+enum atsc_vct_modulation {
+ ATSC_VCT_MODULATION_ANALOG = 0x01,
+ ATSC_VCT_MODULATION_SCTE_MODE1 = 0x02,
+ ATSC_VCT_MODULATION_SCTE_MODE2 = 0x03,
+ ATSC_VCT_MODULATION_8VSB = 0x04,
+ ATSC_VCT_MODULATION_16VSB = 0x05,
+};
+
+enum atsc_vct_service_type {
+ ATSC_VCT_SERVICE_TYPE_ANALOG = 0x01,
+ ATSC_VCT_SERVICE_TYPE_TV = 0x02,
+ ATSC_VCT_SERVICE_TYPE_AUDIO = 0x03,
+ ATSC_VCT_SERVICE_TYPE_DATA = 0x04,
+};
+
+enum atsc_etm_location {
+ ATSC_VCT_ETM_NONE = 0x00,
+ ATSC_VCT_ETM_IN_THIS_PTC = 0x01,
+ ATSC_VCT_ETM_IN_CHANNEL_TSID = 0x02,
+};
+
+enum atsc_text_compress_type {
+ ATSC_TEXT_COMPRESS_NONE = 0x00,
+ ATSC_TEXT_COMPRESS_PROGRAM_TITLE = 0x01,
+ ATSC_TEXT_COMPRESS_PROGRAM_DESCRIPTION = 0x02,
+};
+
+enum atsc_text_segment_mode {
+ ATSC_TEXT_SEGMENT_MODE_UNICODE_RANGE_MIN = 0x00,
+ ATSC_TEXT_SEGMENT_MODE_UNICODE_RANGE_MAX = 0x33,
+ ATSC_TEXT_SEGMENT_MODE_SCSU = 0x3e,
+ ATSC_TEXT_SEGMENT_MODE_UTF16 = 0x3f,
+ ATSC_TEXT_SEGMENT_MODE_TAIWAN_BITMAP = 0x40,
+ ATSC_TEXT_SEGMENT_MODE_TAIWAN_CODEWORD_BITMAP = 0x41,
+};
+
+typedef uint32_t atsctime_t;
+
+struct atsc_text {
+ uint8_t number_strings;
+ /* struct atsc_text_string strings[] */
+};
+
+struct atsc_text_string {
+ iso639lang_t language_code;
+ uint8_t number_segments;
+ /* struct atsc_text_string_segment segments[] */
+};
+
+struct atsc_text_string_segment {
+ uint8_t compression_type;
+ uint8_t mode;
+ uint8_t number_bytes;
+ /* uint8_t bytes[] */
+};
+
+/**
+ * Iterator for strings field of an atsc_text structure.
+ *
+ * @param txt atsc_text pointer.
+ * @param pos Variable holding a pointer to the current atsc_text_string.
+ * @param idx Iterator variable.
+ */
+#define atsc_text_strings_for_each(txt, pos, idx) \
+ for ((pos) = atsc_text_strings_first(txt), idx=0; \
+ (pos); \
+ (pos) = atsc_text_strings_next(txt, pos, ++idx))
+
+/**
+ * Iterator for segments field of an atsc_text_string structure.
+ *
+ * @param str atsc_text_string pointer.
+ * @param pos Variable holding a pointer to the current atsc_text_string_segment.
+ * @param idx Iterator variable.
+ */
+#define atsc_text_string_segments_for_each(str, pos, idx) \
+ for ((pos) = atsc_text_string_segments_first(str), idx=0; \
+ (pos); \
+ (pos) = atsc_text_string_segments_next(str, pos, ++idx))
+
+/**
+ * Accessor for the bytes field of an atsc_text_string_segment.
+ *
+ * @param seg atsc_text_string_segment pointer.
+ * @return Pointer to the bytes.
+ */
+static inline uint8_t*
+ atsc_text_string_segment_bytes(struct atsc_text_string_segment *d)
+{
+ return ((uint8_t*) d) + sizeof(struct atsc_text_string_segment);
+}
+
+/**
+ * Validate a buffer containing an atsc_text structure.
+ *
+ * @param buf Start of the atsc_text structure.
+ * @param len Length in bytes of the buffer.
+ * @return 0 if valid, nonzero if not.
+ */
+extern int atsc_text_validate(uint8_t *buf, int len);
+
+/**
+ * Decodes an atsc_text_segment with mode < 0x3e. Decompression of the ATSC text encoding IS
+ * supported. The output text will be in the UTF-8 encoding.
+ *
+ * @param segment Pointer to the segment to decode.
+ * @param destbuf Pointer to the malloc()ed buffer to append text to (pass NULL if none).
+ * @param destbufsize Size of destbuf in bytes.
+ * @param destbufpos Position within destbuf. This will be updated to point after the end of the
+ * string on exit.
+ * @return New value of destbufpos, or < 0 on error.
+ */
+extern int atsc_text_segment_decode(struct atsc_text_string_segment *segment,
+ uint8_t **destbuf, size_t *destbufsize, size_t *destbufpos);
+
+/**
+ * Convert from ATSC time to unix time_t.
+ *
+ * @param atsc ATSC time.
+ * @return The time value.
+ */
+extern time_t atsctime_to_unixtime(atsctime_t atsc);
+
+/**
+ * Convert from unix time_t to atsc time.
+ *
+ * @param t unix time_t.
+ * @return The atsc time value.
+ */
+extern atsctime_t unixtime_to_atsctime(time_t t);
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct atsc_text_string*
+ atsc_text_strings_first(struct atsc_text *txt)
+{
+ if (txt->number_strings == 0)
+ return NULL;
+
+ return (struct atsc_text_string *)
+ ((uint8_t*) txt + sizeof(struct atsc_text));
+}
+
+static inline struct atsc_text_string*
+ atsc_text_strings_next(struct atsc_text *txt, struct atsc_text_string *pos, int idx)
+{
+ int i;
+ uint8_t *buf;
+
+ if (idx >= txt->number_strings)
+ return NULL;
+
+ buf = ((uint8_t*) pos) + sizeof(struct atsc_text_string);
+ for(i=0; i < pos->number_segments; i++) {
+ struct atsc_text_string_segment *seg =
+ (struct atsc_text_string_segment *) buf;
+
+ buf += sizeof(struct atsc_text_string_segment);
+ buf += seg->number_bytes;
+ }
+
+ return (struct atsc_text_string *) buf;
+}
+
+static inline struct atsc_text_string_segment*
+ atsc_text_string_segments_first(struct atsc_text_string *str)
+{
+ if (str->number_segments == 0)
+ return NULL;
+
+ return (struct atsc_text_string_segment *)
+ ((uint8_t*) str + sizeof(struct atsc_text_string));
+}
+
+static inline struct atsc_text_string_segment*
+ atsc_text_string_segments_next(struct atsc_text_string *str,
+ struct atsc_text_string_segment *pos, int idx)
+{
+ if (idx >= str->number_segments)
+ return NULL;
+
+ return (struct atsc_text_string_segment *)
+ (((uint8_t*) pos) + sizeof(struct atsc_text_string_segment) + pos->number_bytes);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/crc32.h b/kaffeine/src/input/dvb/lib/libucsi/crc32.h
index 5d77e84..7d781ce 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/crc32.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/crc32.h
@@ -40,9 +40,9 @@ extern uint32_t crc32tbl[];
* @param len Number of bytes.
* @return Calculated CRC.
*/
-static inline uint32_t crc32(uint32_t crc, uint8_t* buf, int len)
+static inline uint32_t crc32(uint32_t crc, uint8_t* buf, size_t len)
{
- int i;
+ size_t i;
for (i=0; i< len; i++) {
crc = (crc << 8) ^ crc32tbl[((crc >> 24) ^ buf[i]) & 0xff];
diff --git a/kaffeine/src/input/dvb/lib/libucsi/descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/descriptor.h
index 809936d..606e45d 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/descriptor.h
@@ -47,7 +47,7 @@ struct descriptor {
* @return Pointer to next descriptor, or NULL if there are none.
*/
static inline struct descriptor *
- next_descriptor(uint8_t * buf, int len, struct descriptor * pos)
+ next_descriptor(uint8_t * buf, size_t len, struct descriptor * pos)
{
uint8_t* next;
@@ -105,9 +105,9 @@ static inline int
/******************************** PRIVATE CODE ********************************/
-static inline int verify_descriptors(uint8_t * buf, int len)
+static inline int verify_descriptors(uint8_t * buf, size_t len)
{
- int pos = 0;
+ size_t pos = 0;
while (pos < len) {
if ((pos + 2) > len)
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/ac3_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/ac3_descriptor.h
index d60e37b..0a2a5cd 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/ac3_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/ac3_descriptor.h
@@ -40,7 +40,7 @@ struct dvb_ac3_descriptor {
uint8_t bsid_flag : 1; ,
uint8_t mainid_flag : 1; ,
uint8_t asvc_flag : 1; ,
- uint8_t reserved : 4; )
+ uint8_t reserved : 4; );
/* uint8_t additional_info[] */
} __ucsi_packed;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/adaptation_field_data_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/adaptation_field_data_descriptor.h
index 69a21b8..b207054 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/adaptation_field_data_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/adaptation_field_data_descriptor.h
@@ -37,7 +37,7 @@ struct dvb_adaptation_field_data_descriptor {
struct descriptor d;
EBIT2(uint8_t reserved : 7; ,
- uint8_t announcement_switching_data : 1; )
+ uint8_t announcement_switching_data : 1; );
} __ucsi_packed;
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/ait_application_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/ait_application_descriptor.h
index 877d9c0..95fb7e3 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/ait_application_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/ait_application_descriptor.h
@@ -36,7 +36,7 @@ extern "C"
enum {
AVB_AIT_APPLICATION_VISIBILITY_HIDDEN = 0x00,
AVB_AIT_APPLICATION_VISIBILITY_APPSONLY = 0x01,
- AVB_AIT_APPLICATION_VISIBILITY_VISIBLE = 0x03
+ AVB_AIT_APPLICATION_VISIBILITY_VISIBLE = 0x03,
};
/**
@@ -66,7 +66,7 @@ struct dvb_ait_application_profile {
struct dvb_ait_application_descriptor_part2 {
EBIT3(uint8_t service_bound_flag : 1; ,
uint8_t visibility : 2; ,
- uint8_t reserved : 5; )
+ uint8_t reserved : 5; );
uint8_t application_priority;
/* uint8_t transport_protocol_label[] */
} __ucsi_packed;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/ait_application_icons_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/ait_application_icons_descriptor.h
index 5ea5932..431cd6c 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/ait_application_icons_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/ait_application_icons_descriptor.h
@@ -45,7 +45,7 @@ enum {
AIT_APPLICATION_ICON_FLAG_128_128 = 0x040,
AIT_APPLICATION_ICON_FLAG_128_128_43 = 0x080,
- AIT_APPLICATION_ICON_FLAG_96_128_169 = 0x100
+ AIT_APPLICATION_ICON_FLAG_96_128_169 = 0x100,
};
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/ancillary_data_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/ancillary_data_descriptor.h
index 7a0280d..04b2f59 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/ancillary_data_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/ancillary_data_descriptor.h
@@ -42,7 +42,7 @@ struct dvb_ancillary_data_descriptor {
uint8_t dab_ancillary_data : 1; ,
uint8_t announcement_switching_data : 1; ,
uint8_t extended_ancillary_data : 1; ,
- uint8_t dvd_video_ancillary_data : 1; )
+ uint8_t dvd_video_ancillary_data : 1; );
} __ucsi_packed;
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/announcement_support_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/announcement_support_descriptor.h
index 55a570b..9eb20c4 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/announcement_support_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/announcement_support_descriptor.h
@@ -41,7 +41,7 @@ enum {
DVB_ANNOUNCEMENT_SUPPORT_NEWS_FLASH = 0x10,
DVB_ANNOUNCEMENT_SUPPORT_WEATHER_FLASH = 0x20,
DVB_ANNOUNCEMENT_SUPPORT_EVENT_ANNOUNCEMENT = 0x40,
- DVB_ANNOUNCEMENT_SUPPORT_PERSONAL_CALL = 0x80
+ DVB_ANNOUNCEMENT_SUPPORT_PERSONAL_CALL = 0x80,
};
/**
@@ -55,7 +55,7 @@ enum {
DVB_ANNOUNCEMENT_TYPE_NEWS_FLASH = 0x04,
DVB_ANNOUNCEMENT_TYPE_WEATHER_FLASH = 0x05,
DVB_ANNOUNCEMENT_TYPE_EVENT_ANNOUNCEMENT = 0x06,
- DVB_ANNOUNCEMENT_TYPE_PERSONAL_CALL = 0x07
+ DVB_ANNOUNCEMENT_TYPE_PERSONAL_CALL = 0x07,
};
/**
@@ -65,7 +65,7 @@ enum {
DVB_REFERENCE_TYPE_AUDIO = 0x00,
DVB_REFERENCE_TYPE_OTHER_AUDIO = 0x01,
DVB_REFERENCE_TYPE_OTHER_SERVICE = 0x02,
- DVB_REFERENCE_TYPE_OTHER_TS = 0x03
+ DVB_REFERENCE_TYPE_OTHER_TS = 0x03,
};
/**
@@ -83,7 +83,7 @@ struct dvb_announcement_support_descriptor {
struct dvb_announcement_support_entry {
EBIT3(uint8_t announcement_type : 4; ,
uint8_t reserved : 1; ,
- uint8_t reference_type : 3; )
+ uint8_t reference_type : 3; );
/* Only if reference_type == 1, 2 or 3:
* struct dvb_announcement_support_reference reference */
} __ucsi_packed;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/application_signalling_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/application_signalling_descriptor.h
index c1d50ff..78211cf 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/application_signalling_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/application_signalling_descriptor.h
@@ -45,7 +45,7 @@ struct dvb_application_signalling_descriptor {
struct dvb_application_signalling_entry {
uint16_t application_type;
EBIT2(uint8_t reserved : 3; ,
- uint8_t AIT_version_number : 5; )
+ uint8_t AIT_version_number : 5; );
} __ucsi_packed;
/**
@@ -105,8 +105,8 @@ static inline struct dvb_application_signalling_entry*
}
static inline struct dvb_application_signalling_entry*
- dvb_application_signalling_descriptor_countries_next(struct dvb_application_signalling_descriptor *d,
- struct dvb_application_signalling_entry *pos)
+ dvb_application_signalling_descriptor_entries_next(struct dvb_application_signalling_descriptor *d,
+ struct dvb_application_signalling_entry *pos)
{
uint8_t *end = (uint8_t*) d + 2 + d->d.len;
uint8_t *next = (uint8_t *) pos + sizeof(struct dvb_application_signalling_entry);
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/bat_section.c b/kaffeine/src/input/dvb/lib/libucsi/dvb/bat_section.c
index afbeb0f..99e5cf6 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/bat_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/bat_section.c
@@ -24,8 +24,8 @@
struct dvb_bat_section * dvb_bat_section_codec(struct section_ext * ext)
{
uint8_t * buf = (uint8_t *) ext;
- unsigned int pos = sizeof(struct section_ext);
- unsigned int len = section_ext_length(ext);
+ size_t pos = sizeof(struct section_ext);
+ size_t len = section_ext_length(ext);
struct dvb_bat_section * ret = (struct dvb_bat_section *) ext;
if (len < sizeof(struct dvb_bat_section))
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/bat_section.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/bat_section.h
index 277d5ab..94ed8a4 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/bat_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/bat_section.h
@@ -71,7 +71,7 @@ struct dvb_bat_section *dvb_bat_section_codec(struct section_ext *section);
/**
* Accessor for the bouquet_id field of a BAT.
- *
+ *
* @param bat BAT pointer.
* @return The bouquet_id.
*/
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/cable_delivery_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/cable_delivery_descriptor.h
index 70b0c98..f0f92f3 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/cable_delivery_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/cable_delivery_descriptor.h
@@ -38,10 +38,10 @@ struct dvb_cable_delivery_descriptor {
uint32_t frequency; // BCD, units 100Hz
EBIT2(uint16_t reserved : 12; ,
- uint16_t fec_outer : 4; )
+ uint16_t fec_outer : 4; );
uint8_t modulation;
EBIT2(uint32_t symbol_rate : 28; , // BCD, units 100Hz
- uint32_t fec_inner : 4; )
+ uint32_t fec_inner : 4; );
} __ucsi_packed;
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/cell_frequency_link_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/cell_frequency_link_descriptor.h
index b6285bd..63f7fd2 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/cell_frequency_link_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/cell_frequency_link_descriptor.h
@@ -160,7 +160,7 @@ static inline struct dvb_cell_frequency_link_cell*
}
static inline struct dvb_cell_frequency_link_cell_subcell*
- dvb_cell_frequency_cell_subcells_first(struct dvb_cell_frequency_link_cell *d)
+ dvb_cell_frequency_link_cell_subcells_first(struct dvb_cell_frequency_link_cell *d)
{
if (d->subcell_loop_info_length == 0)
return NULL;
@@ -170,7 +170,7 @@ static inline struct dvb_cell_frequency_link_cell_subcell*
}
static inline struct dvb_cell_frequency_link_cell_subcell*
- dvb_cell_frequency_cell_subcells_next(struct dvb_cell_frequency_link_cell *cell,
+ dvb_cell_frequency_link_cell_subcells_next(struct dvb_cell_frequency_link_cell *cell,
struct dvb_cell_frequency_link_cell_subcell *pos)
{
uint8_t *end = (uint8_t*) cell + cell->subcell_loop_info_length;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/cell_list_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/cell_list_descriptor.h
index 6a42ce4..ddbaf2c 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/cell_list_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/cell_list_descriptor.h
@@ -48,7 +48,7 @@ struct dvb_cell_list_entry {
uint16_t cell_longitude;
EBIT3(uint32_t cell_extend_of_latitude :12; ,
uint32_t cell_extend_of_longitude :12; ,
- uint32_t subcell_info_loop_length : 8; )
+ uint32_t subcell_info_loop_length : 8; );
/* struct dvb_subcell_list_entry subcells[] */
} __ucsi_packed;
@@ -60,7 +60,7 @@ struct dvb_subcell_list_entry {
uint16_t subcell_latitude;
uint16_t subcell_longitude;
EBIT2(uint32_t subcell_extend_of_latitude :12; ,
- uint32_t subcell_extend_of_longitude :12; )
+ uint32_t subcell_extend_of_longitude :12; );
} __ucsi_packed;
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/component_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/component_descriptor.h
index 154e235..31d38e1 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/component_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/component_descriptor.h
@@ -38,7 +38,7 @@ enum {
DVB_STREAM_CONTENT_VIDEO = 0x01,
DVB_STREAM_CONTENT_AUDIO = 0x02,
DVB_STREAM_CONTENT_SUBTITLE = 0x03,
- DVB_STREAM_CONTENT_AC3 = 0x04
+ DVB_STREAM_CONTENT_AC3 = 0x04,
};
/**
@@ -84,7 +84,7 @@ enum {
DVB_COMPONENT_TYPE_SUBTITLE_DVB_HARDHEAR = 0x20,
DVB_COMPONENT_TYPE_SUBTITLE_DVB_HARDHEAR_43 = 0x21,
DVB_COMPONENT_TYPE_SUBTITLE_DVB_HARDHEAR_169 = 0x22,
- DVB_COMPONENT_TYPE_SUBTITLE_DVB_HARDHEAR_2211 = 0x23
+ DVB_COMPONENT_TYPE_SUBTITLE_DVB_HARDHEAR_2211 = 0x23,
};
/**
@@ -94,7 +94,7 @@ struct dvb_component_descriptor {
struct descriptor d;
EBIT2(uint8_t reserved : 4; ,
- uint8_t stream_content : 4; )
+ uint8_t stream_content : 4; );
uint8_t component_type;
uint8_t component_tag;
iso639lang_t language_code;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/content_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/content_descriptor.h
index 5cc16dc..d2a63a0 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/content_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/content_descriptor.h
@@ -46,9 +46,9 @@ struct dvb_content_descriptor {
*/
struct dvb_content_nibble {
EBIT2(uint8_t content_nibble_level_1 : 4; ,
- uint8_t content_nibble_level_2 : 4; )
+ uint8_t content_nibble_level_2 : 4; );
EBIT2(uint8_t user_nibble_1 : 4; ,
- uint8_t user_nibble_2 : 4; )
+ uint8_t user_nibble_2 : 4; );
} __ucsi_packed;
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/content_identifier_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/content_identifier_descriptor.h
index 63d24a1..c2cf9ea 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/content_identifier_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/content_identifier_descriptor.h
@@ -39,7 +39,7 @@ enum {
DVB_CRID_TYPE_NONE = 0x00,
DVB_CRID_TYPE_ITEM = 0x01,
DVB_CRID_TYPE_SERIES = 0x02,
- DVB_CRID_TYPE_RECOMMENDATION = 0x03
+ DVB_CRID_TYPE_RECOMMENDATION = 0x03,
};
/**
@@ -47,7 +47,7 @@ enum {
*/
enum {
DVB_CRID_LOCATION_THIS_DESCRIPTOR = 0x00,
- DVB_CRID_LOCATION_CIT = 0x01
+ DVB_CRID_LOCATION_CIT = 0x01,
};
/**
@@ -64,7 +64,7 @@ struct dvb_content_identifier_descriptor {
*/
struct dvb_content_identifier_entry {
EBIT2(uint8_t crid_type : 6; ,
- uint8_t crid_location : 2; )
+ uint8_t crid_location : 2; );
/* struct dvb_content_identifier_data_00 data0 */
/* struct dvb_content_identifier_data_01 data1 */
} __ucsi_packed;
@@ -154,6 +154,17 @@ static inline struct dvb_content_identifier_entry_data_0*
return (struct dvb_content_identifier_entry_data_0*)
((uint8_t*) d + sizeof(struct dvb_content_identifier_entry));
}
+/**
+ * Accessor for the data field of a dvb_content_identifier_entry_data_0.
+ *
+ * @param d dvb_content_identifier_entry_data_0 pointer.
+ * @return Pointer, or NULL on error.
+ */
+static inline uint8_t*
+ dvb_content_identifier_entry_data_0_data(struct dvb_content_identifier_entry_data_0 *d)
+{
+ return ((uint8_t*) d + sizeof(struct dvb_content_identifier_entry_data_0));
+}
/**
* Accessor for the data1 field of a dvb_content_identifier_entry.
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/country_availability_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/country_availability_descriptor.h
index 29a6b9a..65b1661 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/country_availability_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/country_availability_descriptor.h
@@ -38,7 +38,7 @@ struct dvb_country_availability_descriptor {
struct descriptor d;
EBIT2(uint8_t country_availability_flag : 1; ,
- uint8_t reserved : 7; )
+ uint8_t reserved : 7; );
/* struct dvb_country_availability_entry countries[] */
} __ucsi_packed;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/data_broadcast_id_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/data_broadcast_id_descriptor.h
index 8547d8f..446927c 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/data_broadcast_id_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/data_broadcast_id_descriptor.h
@@ -31,6 +31,23 @@ extern "C"
#include <libucsi/endianops.h>
/**
+ * Possible values for data_broadcast_id.
+ */
+enum {
+ DVB_BROADCAST_ID_DATA_PIPE = 0X0001,
+ DVB_BROADCAST_ID_ASYNCHRONOUS_DATA_STREAM = 0X0002,
+ DVB_BROADCAST_ID_SYNCHRONOUS_DATA_STREAM = 0X0003,
+ DVB_BROADCAST_ID_SYNCHRONISED_DATA_STREAM = 0X0004,
+ DVB_BROADCAST_ID_MULTI_PROTOCOL_ENCAPSULATION = 0X0005,
+ DVB_BROADCAST_ID_DATA_CAROUSEL = 0X0006,
+ DVB_BROADCAST_ID_OBJECT_CAROUSEL = 0X0007,
+ DVB_BROADCAST_ID_DVB_ATM_STREAMS = 0X0008,
+ DVB_BROADCAST_ID_HIGHER_PROTOCOLS = 0X0009,
+ DVB_BROADCAST_ID_SOFTWARE_UPDATE = 0x000A,
+ DVB_BROADCAST_ID_IP_MAC_NOTIFICATION_TABLE = 0x000B,
+};
+
+/**
* dvb_data_broadcast_id_descriptor structure.
*/
struct dvb_data_broadcast_id_descriptor {
@@ -41,6 +58,26 @@ struct dvb_data_broadcast_id_descriptor {
} __ucsi_packed;
/**
+ * id_selector_byte for 0x000b data_broadcast_id (IP/MAC Notification Table).
+ */
+struct dvb_id_selector_byte_000b {
+ uint8_t platform_id_data_length;
+ /* struct dvb_ip_mac_notification_info infos[] */
+ /* uint8_t private_data[] */
+} __ucsi_packed;
+
+/**
+ * Entries in the infos field of a dvb_id_selector_byte_0b.
+ */
+struct dvb_ip_mac_notification_info {
+ EBIT2(uint32_t platform_id : 24; ,
+ uint8_t action_type : 8; );
+ EBIT3(uint8_t reserved : 2; ,
+ uint8_t INT_versioning_flag : 1; ,
+ uint8_t INT_version : 5; );
+} __ucsi_packed;
+
+/**
* Process a dvb_data_broadcast_id_descriptor.
*
* @param d Generic descriptor structure.
@@ -81,6 +118,100 @@ static inline int
return d->d.len - 2;
}
+/**
+ * Accessor for a dvb_id_selector_byte_000b pointer.
+ *
+ * @param d dvb_data_broadcast_id_descriptor pointer.
+ * @return Pointer to the data field.
+ */
+static inline struct dvb_id_selector_byte_000b *
+ dvb_id_selector_byte_000b(struct dvb_data_broadcast_id_descriptor *d)
+{
+ if (d->data_broadcast_id != DVB_BROADCAST_ID_IP_MAC_NOTIFICATION_TABLE)
+ return NULL;
+ return (struct dvb_id_selector_byte_000b *) dvb_data_broadcast_id_descriptor_id_selector_byte(d);
+}
+
+/**
+ * Iterator for the dvb_ip_mac_notification_info field of a dvb_id_selector_byte_000b.
+ *
+ * @param id_selector_byte dvb_id_selector_byte_000b pointer.
+ * @param pos Variable containing a pointer to the current dvb_ip_mac_notification_info.
+ */
+#define dvb_id_selector_byte_000b_ip_mac_notification_info_for_each(id_selector_byte, pos) \
+ for ((pos) = dvb_ip_mac_notification_info_first(id_selector_byte); \
+ (pos); \
+ (pos) = dvb_ip_mac_notification_info_next(id_selector_byte, pos))
+
+/**
+ * Length of the private_data field of a dvb_id_selector_byte_000b.
+ *
+ * @param d descriptor pointer.
+ * @param i dvb_id_selector_byte_000b pointer.
+ * @return Length of the field.
+ */
+static inline uint8_t
+ dvb_id_selector_byte_000b_private_data_length(struct descriptor *d,
+ struct dvb_id_selector_byte_000b *i)
+{
+ return (uint8_t) (d->len -
+ sizeof(struct descriptor) -
+ i->platform_id_data_length -
+ sizeof(struct dvb_id_selector_byte_000b));
+}
+
+/**
+ * Accessor for the private_data field of a dvb_id_selector_byte_000b.
+ *
+ * @param d descriptor pointer.
+ * @param i dvb_id_selector_byte_000b pointer.
+ * @return Pointer to the field.
+ */
+static inline uint8_t *
+ dvb_id_selector_byte_000b_private_data(struct descriptor *d,
+ struct dvb_id_selector_byte_000b *i)
+{
+ if (dvb_id_selector_byte_000b_private_data_length(d, i) <= 0)
+ return NULL;
+
+ return (uint8_t *) i + i->platform_id_data_length + sizeof(struct dvb_id_selector_byte_000b);
+}
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct dvb_ip_mac_notification_info *
+ dvb_ip_mac_notification_info_first(struct dvb_id_selector_byte_000b *d)
+{
+ if (d->platform_id_data_length == 0)
+ return NULL;
+
+ bswap32((uint8_t *) d + sizeof(struct dvb_id_selector_byte_000b));
+
+ return (struct dvb_ip_mac_notification_info *) ((uint8_t *) d + sizeof(struct dvb_id_selector_byte_000b));
+}
+
+static inline struct dvb_ip_mac_notification_info *
+ dvb_ip_mac_notification_info_next(struct dvb_id_selector_byte_000b *d,
+ struct dvb_ip_mac_notification_info *pos)
+{
+ uint8_t *end = (uint8_t *) d + d->platform_id_data_length;
+ uint8_t *next = (uint8_t *) pos +
+ sizeof(struct dvb_id_selector_byte_000b) +
+ sizeof(struct dvb_ip_mac_notification_info);
+
+ if (next >= end)
+ return NULL;
+
+ bswap32(next);
+
+ return (struct dvb_ip_mac_notification_info *) next;
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/descriptor.h
index 0772601..345f6f0 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/descriptor.h
@@ -47,6 +47,9 @@ extern "C"
#include <libucsi/dvb/dsng_descriptor.h>
#include <libucsi/dvb/extended_event_descriptor.h>
#include <libucsi/dvb/frequency_list_descriptor.h>
+#include <libucsi/dvb/ip_mac_platform_name_descriptor.h>
+#include <libucsi/dvb/ip_mac_platform_provider_name_descriptor.h>
+#include <libucsi/dvb/ip_mac_stream_location_descriptor.h>
#include <libucsi/dvb/linkage_descriptor.h>
#include <libucsi/dvb/local_time_offset_descriptor.h>
#include <libucsi/dvb/mosaic_descriptor.h>
@@ -74,15 +77,28 @@ extern "C"
#include <libucsi/dvb/stream_identifier_descriptor.h>
#include <libucsi/dvb/stuffing_descriptor.h>
#include <libucsi/dvb/subtitling_descriptor.h>
+#include <libucsi/dvb/target_ip_address_descriptor.h>
+#include <libucsi/dvb/target_ipv6_address_descriptor.h>
+#include <libucsi/dvb/target_ip_slash_descriptor.h>
+#include <libucsi/dvb/target_ip_source_slash_descriptor.h>
+#include <libucsi/dvb/target_ipv6_slash_descriptor.h>
+#include <libucsi/dvb/target_ipv6_source_slash_descriptor.h>
#include <libucsi/dvb/telephone_descriptor.h>
#include <libucsi/dvb/teletext_descriptor.h>
#include <libucsi/dvb/terrestrial_delivery_descriptor.h>
#include <libucsi/dvb/time_shifted_event_descriptor.h>
#include <libucsi/dvb/time_shifted_service_descriptor.h>
+#include <libucsi/dvb/time_slice_fec_identifier_descriptor.h>
#include <libucsi/dvb/transport_stream_descriptor.h>
#include <libucsi/dvb/tva_id_descriptor.h>
#include <libucsi/dvb/vbi_data_descriptor.h>
#include <libucsi/dvb/vbi_teletext_descriptor.h>
+#include <libucsi/endianops.h>
+
+/**
+ * The following are disabled because support is incomplete just now.
+ */
+/*
#include <libucsi/dvb/rnt_rar_over_dvb_stream_descriptor.h>
#include <libucsi/dvb/rnt_rar_over_ip_descriptor.h>
#include <libucsi/dvb/rnt_rnt_scan_descriptor.h>
@@ -90,7 +106,7 @@ extern "C"
#include <libucsi/dvb/ait_application_name_descriptor.h>
#include <libucsi/dvb/ait_external_application_authorisation_descriptor.h>
#include <libucsi/dvb/ait_application_icons_descriptor.h>
-#include <libucsi/endianops.h>
+*/
/**
* The following are not implemented just now
@@ -169,6 +185,10 @@ enum dvb_descriptor_tag {
dtag_dvb_time_slice_fec_identifier = 0x77,
dtag_dvb_ecm_repetition_rate = 0x78,
dtag_dvb_s2_satellite_delivery_descriptor= 0x79,
+ dtag_dvb_enhanced_ac3_descriptor = 0x7a,
+ dtag_dvb_dts_descriptor = 0x7b,
+ dtag_dvb_aac_descriptor = 0x7c,
+ dtag_dvb_extension_descriptor = 0x7f,
/* descriptors which may only appear in an RNT */
dtag_dvb_rnt_rar_over_dvb_stream = 0x40,
@@ -188,8 +208,20 @@ enum dvb_descriptor_tag {
dtag_dvb_ait_application_icons = 0x0b,
dtag_dvb_ait_prefetch = 0x0c,
dtag_dvb_ait_dii_location = 0x0d,
- dtag_dvb_ait_ip_signalling = 0x11
-};/*__ucsi_packed;*/
+ dtag_dvb_ait_ip_signalling = 0x11,
+
+ /* descriptors which may only appear in INT */
+ dtag_dvb_target_ip_address = 0x09,
+ dtag_dvb_target_ipv6_address = 0x0a,
+ dtag_dvb_ip_mac_platform_name = 0x0c,
+ dtag_dvb_ip_mac_platform_provider_name = 0x0d,
+ dtag_dvb_target_ip_slash = 0x0f,
+ dtag_dvb_target_ip_source_slash = 0x10,
+ dtag_dvb_target_ipv6_slash = 0x11,
+ dtag_dvb_target_ipv6_source_slash = 0x12,
+ dtag_dvb_ip_mac_stream_location = 0x13,
+
+};
#ifdef __cplusplus
}
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/eit_section.c b/kaffeine/src/input/dvb/lib/libucsi/dvb/eit_section.c
index ce22a58..97b0261 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/eit_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/eit_section.c
@@ -24,9 +24,9 @@
struct dvb_eit_section *dvb_eit_section_codec(struct section_ext * ext)
{
uint8_t * buf = (uint8_t *) ext;
- unsigned int pos = sizeof(struct section_ext);
- unsigned int len = section_ext_length(ext);
-
+ size_t pos = sizeof(struct section_ext);
+ size_t len = section_ext_length(ext);
+
if (len < sizeof(struct dvb_eit_section))
return NULL;
@@ -34,14 +34,14 @@ struct dvb_eit_section *dvb_eit_section_codec(struct section_ext * ext)
pos += 2;
bswap16(buf + pos);
pos += 4;
-
+
while (pos < len) {
struct dvb_eit_event * event =
(struct dvb_eit_event *) (buf + pos);
if ((pos + sizeof(struct dvb_eit_event)) > len)
return NULL;
-
+
bswap16(buf + pos);
bswap16(buf + pos + 10);
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/eit_section.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/eit_section.h
index 9064224..a2f3e4f 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/eit_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/eit_section.h
@@ -67,7 +67,7 @@ struct dvb_eit_section *dvb_eit_section_codec(struct section_ext *section);
/**
* Accessor for the service_id field of an EIT.
- *
+ *
* @param eit EIT pointer.
* @return The service_id.
*/
@@ -111,7 +111,7 @@ static inline uint16_t dvb_eit_section_service_id(struct dvb_eit_section *eit)
static inline struct dvb_eit_event *
dvb_eit_section_events_first(struct dvb_eit_section *eit)
{
- int pos = sizeof(struct dvb_eit_section);
+ size_t pos = sizeof(struct dvb_eit_section);
if (pos >= section_ext_length(&eit->head))
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/extended_event_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/extended_event_descriptor.h
index 82d580b..bba04b0 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/extended_event_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/extended_event_descriptor.h
@@ -38,7 +38,7 @@ struct dvb_extended_event_descriptor {
struct descriptor d;
EBIT2(uint8_t descriptor_number : 4; ,
- uint8_t last_descriptor_number : 4; )
+ uint8_t last_descriptor_number : 4; );
iso639lang_t language_code;
uint8_t length_of_items;
/* struct dvb_extended_event_item items[] */
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/frequency_list_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/frequency_list_descriptor.h
index 4fca751..4c18cec 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/frequency_list_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/frequency_list_descriptor.h
@@ -36,7 +36,7 @@ extern "C"
enum {
DVB_CODING_TYPE_SATELLITE = 0x01,
DVB_CODING_TYPE_CABLE = 0x02,
- DVB_CODING_TYPE_TERRESTRIAL = 0x03
+ DVB_CODING_TYPE_TERRESTRIAL = 0x03,
};
/**
@@ -46,7 +46,7 @@ struct dvb_frequency_list_descriptor {
struct descriptor d;
EBIT2(uint8_t reserved : 6; ,
- uint8_t coding_type : 2; )
+ uint8_t coding_type : 2; );
/* uint32_t centre_frequencies [] */
} __ucsi_packed;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/int_section.c b/kaffeine/src/input/dvb/lib/libucsi/dvb/int_section.c
index a6ddd6e..c2bb15f 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/int_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/int_section.c
@@ -26,16 +26,15 @@ struct dvb_int_section * dvb_int_section_codec(struct section_ext *ext)
{
uint8_t *buf = (uint8_t *) ext;
struct dvb_int_section *in = (struct dvb_int_section *) ext;
-
- unsigned int pos = sizeof(struct section_ext);
- unsigned int len = section_ext_length(ext);
+ size_t pos = sizeof(struct section_ext);
+ size_t len = section_ext_length(ext);
if (len < sizeof(struct dvb_int_section))
return NULL;
bswap32(buf+8);
bswap16(buf+12);
- pos += 9;
+ pos += 6;
if (len - pos < in->platform_descriptors_length)
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/int_section.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/int_section.h
index 71ba1e8..932c0e8 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/int_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/int_section.h
@@ -72,7 +72,7 @@ extern struct dvb_int_section * dvb_int_section_codec(struct section_ext *sectio
/**
* Accessor for the action_type field of an INT.
- *
+ *
* @param intp INT pointer.
* @return The action_type.
*/
@@ -83,7 +83,7 @@ static inline uint8_t dvb_int_section_action_type(struct dvb_int_section *intp)
/**
* Accessor for the platform_id_hash field of an INT.
- *
+ *
* @param intp INT pointer.
* @return The platform_id_hash.
*/
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_platform_name_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_platform_name_descriptor.h
new file mode 100644
index 0000000..c470e89
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_platform_name_descriptor.h
@@ -0,0 +1,87 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2006 Stephane Este-Gracias (sestegra@free.fr)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_DVB_IP_MAC_PLATFORM_NAME_DESCRIPTOR
+#define _UCSI_DVB_IP_MAC_PLATFORM_NAME_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/types.h>
+
+/**
+ * dvb_ip_platform_name_descriptor structure.
+ */
+struct dvb_ip_platform_name_descriptor {
+ struct descriptor d;
+
+ iso639lang_t language_code;
+ /* uint8_t text[] */
+} __ucsi_packed;
+
+/**
+ * Process a dvb_ip_platform_name_descriptor.
+ *
+ * @param d Pointer to a generic descriptor.
+ * @return dvb_ip_platform_name_descriptor pointer, or NULL on error.
+ */
+static inline struct dvb_ip_platform_name_descriptor*
+ dvb_ip_platform_name_descriptor_codec(struct descriptor* d)
+{
+ if (d->len < (sizeof(struct dvb_ip_platform_name_descriptor) - 2))
+ return NULL;
+
+ return (struct dvb_ip_platform_name_descriptor*) d;
+}
+
+/**
+ * Accessor for the text field of a dvb_ip_platform_name_descriptor.
+ *
+ * @param d dvb_ip_platform_name_descriptor pointer.
+ * @return Pointer to the field.
+ */
+static inline uint8_t *
+ dvb_ip_platform_name_descriptor_text(struct dvb_ip_platform_name_descriptor *d)
+{
+ return (uint8_t *) d + sizeof(struct dvb_ip_platform_name_descriptor);
+}
+
+/**
+ * Determine the length of the text field of a dvb_ip_platform_name_descriptor.
+ *
+ * @param d dvb_ip_platform_name_descriptor pointer.
+ * @return Length of the field in bytes.
+ */
+static inline int
+ dvb_ip_platform_name_descriptor_text_length(struct dvb_ip_platform_name_descriptor *d)
+{
+ return d->d.len - 3;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_platform_provider_name_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_platform_provider_name_descriptor.h
new file mode 100644
index 0000000..ba95b8f
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_platform_provider_name_descriptor.h
@@ -0,0 +1,87 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2006 Stephane Este-Gracias (sestegra@free.fr)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_DVB_IP_MAC_PLATFORM_PROVIDER_NAME_DESCRIPTOR
+#define _UCSI_DVB_IP_MAC_PLATFORM_PROVIDER_NAME_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/types.h>
+
+/**
+ * dvb_ip_platform_provider_name_descriptor structure.
+ */
+struct dvb_ip_platform_provider_name_descriptor {
+ struct descriptor d;
+
+ iso639lang_t language_code;
+ /* uint8_t text[] */
+} __ucsi_packed;
+
+/**
+ * Process a dvb_ip_platform_provider_name_descriptor.
+ *
+ * @param d Pointer to a generic descriptor.
+ * @return dvb_ip_platform_provider_name_descriptor pointer, or NULL on error.
+ */
+static inline struct dvb_ip_platform_provider_name_descriptor*
+ dvb_ip_platform_provider_name_descriptor_codec(struct descriptor* d)
+{
+ if (d->len < (sizeof(struct dvb_ip_platform_provider_name_descriptor) - 2))
+ return NULL;
+
+ return (struct dvb_ip_platform_provider_name_descriptor*) d;
+}
+
+/**
+ * Accessor for the text field of a dvb_ip_platform_provider_name_descriptor.
+ *
+ * @param d dvb_ip_platform_provider_name_descriptor pointer.
+ * @return Pointer to the field.
+ */
+static inline uint8_t *
+ dvb_ip_platform_provider_name_descriptor_text(struct dvb_ip_platform_provider_name_descriptor *d)
+{
+ return (uint8_t *) d + sizeof(struct dvb_ip_platform_provider_name_descriptor);
+}
+
+/**
+ * Determine the length of the text field of a dvb_ip_platform_provider_name_descriptor.
+ *
+ * @param d dvb_ip_platform_provider_name_descriptor pointer.
+ * @return Length of the field in bytes.
+ */
+static inline int
+ dvb_ip_platform_provider_name_descriptor_text_length(struct dvb_ip_platform_provider_name_descriptor *d)
+{
+ return d->d.len - 3;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_stream_location_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_stream_location_descriptor.h
new file mode 100644
index 0000000..36216d6
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/ip_mac_stream_location_descriptor.h
@@ -0,0 +1,73 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2006 Stephane Este-Gracias (sestegra@free.fr)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_DVB_IP_MAC_STREAM_LOCATION_DESCRIPTOR
+#define _UCSI_DVB_IP_MAC_PLATFORM_PROVIDER_NAME_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/types.h>
+
+/**
+ * dvb_ip_mac_stream_location_descriptor structure.
+ */
+struct dvb_ip_mac_stream_location_descriptor {
+ struct descriptor d;
+
+ uint16_t network_id;
+ uint16_t original_network_id;
+ uint16_t transport_stream_id;
+ uint16_t service_id;
+ uint8_t component_tag;
+} __ucsi_packed;
+
+/**
+ * Process a dvb_ip_mac_stream_location_descriptor.
+ *
+ * @param d Generic descriptor pointer.
+ * @return dvb_ip_mac_stream_location_descriptor pointer, or NULL on error.
+ */
+static inline struct dvb_ip_mac_stream_location_descriptor*
+ dvb_ip_mac_stream_location_descriptor_codec(struct descriptor* d)
+{
+ uint8_t* buf = (uint8_t*) d + 2;
+
+ if (d->len != (sizeof(struct dvb_ip_mac_stream_location_descriptor) - 2))
+ return NULL;
+
+ bswap16(buf);
+ bswap16(buf+2);
+ bswap16(buf+4);
+ bswap16(buf+6);
+
+ return (struct dvb_ip_mac_stream_location_descriptor*) d;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/linkage_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/linkage_descriptor.h
index f3370c8..d2be789 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/linkage_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/linkage_descriptor.h
@@ -46,7 +46,7 @@ enum {
DVB_LINKAGE_TYPE_SOFTWARE_UPDATE = 0x09,
DVB_LINKAGE_TYPE_TS_WITH_SSU_BAT_NIT = 0x0a,
DVB_LINKAGE_TYPE_IP_MAC_NOTIFICATION = 0x0b,
- DVB_LINKAGE_TYPE_TS_WITH_INT_BAT_NIT = 0x0c
+ DVB_LINKAGE_TYPE_TS_WITH_INT_BAT_NIT = 0x0c,
};
/**
@@ -55,7 +55,7 @@ enum {
enum {
DVB_HAND_OVER_TYPE_IDENTICAL_NEIGHBOURING_COUNTRY = 0x01,
DVB_HAND_OVER_TYPE_LOCAL_VARIATION = 0x02,
- DVB_HAND_OVER_TYPE_ASSOCIATED_SERVICE = 0x03
+ DVB_HAND_OVER_TYPE_ASSOCIATED_SERVICE = 0x03,
};
/**
@@ -63,7 +63,7 @@ enum {
*/
enum {
DVB_ORIGIN_TYPE_NIT = 0x00,
- DVB_ORIGIN_TYPE_SDT = 0x01
+ DVB_ORIGIN_TYPE_SDT = 0x01,
};
/**
@@ -85,7 +85,7 @@ struct dvb_linkage_descriptor {
struct dvb_linkage_data_08 {
EBIT3(uint8_t hand_over_type : 4; ,
uint8_t reserved : 3; ,
- uint8_t origin_type : 1; )
+ uint8_t origin_type : 1; );
/* uint16_t network_id if hand_over_type == 1,2,3 */
/* uint16_t initial_service_id if origin_type = 0 */
/* uint8_t data[] */
@@ -104,7 +104,7 @@ struct dvb_linkage_data_0b {
*/
struct dvb_platform_id {
EBIT2(uint32_t platform_id : 24; ,
- uint32_t platform_name_loop_length : 8; )
+ uint8_t platform_name_loop_length : 8; );
/* struct platform_name names[] */
} __ucsi_packed;
@@ -187,6 +187,8 @@ static inline struct dvb_linkage_descriptor*
return NULL;
while (pos2 < l_0b->platform_id_data_length) {
+ bswap32(buf + pos + pos2);
+
struct dvb_platform_id *p_id = (struct dvb_platform_id *) (buf + pos + pos2);
if ((len - pos - pos2) < p_id->platform_name_loop_length)
return NULL;
@@ -359,7 +361,7 @@ static inline struct dvb_linkage_data_0b *
* @param linkage dvb_linkage_data_0b pointer.
* @param pos Variable containing a pointer to the current dvb_platform_id.
*/
-#define dvb_dvb_linkage_data_0b_platform_id_for_each(linkage, pos) \
+#define dvb_linkage_data_0b_platform_id_for_each(linkage, pos) \
for ((pos) = dvb_platform_id_first(linkage); \
(pos); \
(pos) = dvb_platform_id_next(linkage, pos))
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/local_time_offset_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/local_time_offset_descriptor.h
index 94932ff..d0eebb3 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/local_time_offset_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/local_time_offset_descriptor.h
@@ -48,7 +48,7 @@ struct dvb_local_time_offset {
iso639country_t country_code;
EBIT3(uint8_t country_region_id : 6; ,
uint8_t reserved : 1; ,
- uint8_t local_time_offset_polarity : 1; )
+ uint8_t local_time_offset_polarity : 1; );
dvbhhmm_t local_time_offset;
dvbdate_t time_of_change;
dvbhhmm_t next_time_offset;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/mhp_data_broadcast_id_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/mhp_data_broadcast_id_descriptor.h
index d5cf435..d79b48c 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/mhp_data_broadcast_id_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/mhp_data_broadcast_id_descriptor.h
@@ -36,7 +36,7 @@ extern "C"
*/
enum {
DVB_BROADCAST_ID_MHP_OBJECT_CAROUSEL = 0x00f0,
- DVB_BROADCAST_ID_MHP_MPE = 0x00f1
+ DVB_BROADCAST_ID_MHP_MPE = 0x00f1,
};
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/mosaic_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/mosaic_descriptor.h
index 28838de..6da1e95 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/mosaic_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/mosaic_descriptor.h
@@ -39,7 +39,7 @@ struct dvb_mosaic_descriptor {
EBIT4(uint8_t mosaic_entry_point : 1; ,
uint8_t number_of_horiz_elementary_cells: 3; ,
uint8_t reserved : 1; ,
- uint8_t number_of_vert_elementary_cells : 3; )
+ uint8_t number_of_vert_elementary_cells : 3; );
/* struct dvb_mosaic_info infos[] */
} __ucsi_packed;
@@ -49,7 +49,7 @@ struct dvb_mosaic_descriptor {
struct dvb_mosaic_info {
EBIT3(uint16_t logical_cell_id : 6; ,
uint16_t reserved : 7; ,
- uint16_t logical_cell_presentation_info : 3; )
+ uint16_t logical_cell_presentation_info : 3; );
uint8_t elementary_cell_field_length;
/* struct dvb_mosaic_elementary_cell_field fields[] */
/* struct dvb_mosaic_info_part2 part2 */
@@ -61,7 +61,7 @@ struct dvb_mosaic_info {
*/
struct dvb_mosaic_elementary_cell_field {
EBIT2(uint8_t reserved : 2; ,
- uint8_t elementary_cell_id : 6; )
+ uint8_t elementary_cell_id : 6; );
} __ucsi_packed;
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/mpe_fec_section.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/mpe_fec_section.h
new file mode 100644
index 0000000..6db0a47
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/mpe_fec_section.h
@@ -0,0 +1,73 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2008 Patrick Boettcher (pb@linuxtv.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_DVB_MPE_FEC_SECTION_H
+#define _UCSI_DVB_MPE_FEC_SECTION_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/mpeg/section.h>
+
+/**
+ * mpe_fec_section structure. TODO
+ */
+struct mpe_fec_section {
+ struct section head;
+};
+
+
+/**
+ * real_time_paramters
+ * can also be found in datagram_section in MAC4-1-bytes */
+struct real_time_parameters {
+ EBIT4(uint32_t delta_t : 12; ,
+ uint32_t table_boundary : 1; ,
+ uint32_t frame_boundary : 1; ,
+ uint32_t address : 18; )
+};
+
+
+static inline struct real_time_parameters * datagram_section_real_time_parameters_codec(struct datagram_section *d)
+{
+ struct real_time_parameters *rt = (struct real_time_parameters *) &d->MAC_address_4;
+ uint8_t b[4];
+ b[0] = d->MAC_address_4;
+ b[1] = d->MAC_address_3;
+ b[2] = d->MAC_address_2;
+ b[3] = d->MAC_address_1;
+
+ rt->delta_t = (b[0] << 4) | ((b[1] >> 4) & 0x0f);
+ rt->table_boundary = (b[1] >> 3) & 0x1;
+ rt->frame_boundary = (b[1] >> 2) & 0x1;
+ rt->address = ((b[1] & 0x3) << 16) | (b[2] << 8) | b[3];
+
+ return rt;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/nit_section.c b/kaffeine/src/input/dvb/lib/libucsi/dvb/nit_section.c
index d931926..664a0cb 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/nit_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/nit_section.c
@@ -25,8 +25,8 @@ struct dvb_nit_section *dvb_nit_section_codec(struct section_ext * ext)
{
uint8_t * buf = (uint8_t *) ext;
struct dvb_nit_section * ret = (struct dvb_nit_section *) ext;
- unsigned int pos = sizeof(struct section_ext);
- unsigned int len = section_ext_length(ext);
+ size_t pos = sizeof(struct section_ext);
+ size_t len = section_ext_length(ext);
if (len < sizeof(struct dvb_nit_section))
return NULL;
@@ -76,4 +76,3 @@ struct dvb_nit_section *dvb_nit_section_codec(struct section_ext * ext)
return ret;
}
-
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/parental_rating_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/parental_rating_descriptor.h
index 9acbcb0..72ecd0a 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/parental_rating_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/parental_rating_descriptor.h
@@ -49,7 +49,7 @@ enum {
DVB_PARENTAL_RATING_MIN_14YEARS = 0x0c,
DVB_PARENTAL_RATING_MIN_15YEARS = 0x0d,
DVB_PARENTAL_RATING_MIN_16YEARS = 0x0e,
- DVB_PARENTAL_RATING_MIN_17YEARS = 0x0f
+ DVB_PARENTAL_RATING_MIN_17YEARS = 0x0f,
};
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/partial_transport_stream_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/partial_transport_stream_descriptor.h
index c8ba441..6e3aa96 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/partial_transport_stream_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/partial_transport_stream_descriptor.h
@@ -41,7 +41,7 @@ struct dvb_partial_transport_stream_descriptor {
uint64_t reserved_2 : 2; ,
uint64_t minimum_overall_smoothing_rate :22; ,
uint64_t reserved_3 : 2; ,
- uint64_t maximum_overall_smoothing_rate :14; )
+ uint64_t maximum_overall_smoothing_rate :14; );
} __ucsi_packed;
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/pdc_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/pdc_descriptor.h
index 49cc187..68190be 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/pdc_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/pdc_descriptor.h
@@ -37,7 +37,7 @@ struct dvb_pdc_descriptor {
struct descriptor d;
EBIT2(uint32_t reserved : 4; ,
- uint32_t programme_id_label :20; )
+ uint32_t programme_id_label :20; );
} __ucsi_packed;
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/rnt_rar_over_dvb_stream_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/rnt_rar_over_dvb_stream_descriptor.h
index b67b0d9..ba42d12 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/rnt_rar_over_dvb_stream_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/rnt_rar_over_dvb_stream_descriptor.h
@@ -40,7 +40,7 @@ struct dvb_rnt_rar_over_dvb_stream_descriptor {
dvbdate_t last_valid_date;
EBIT3(uint8_t weighting : 6; ,
uint8_t complete_flag : 1; ,
- uint8_t scheduled_flag : 1; )
+ uint8_t scheduled_flag : 1; );
uint16_t transport_stream_id;
uint16_t original_network_id;
uint16_t service_id;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/rnt_rar_over_ip_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/rnt_rar_over_ip_descriptor.h
index cc0ed58..b1f2da4 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/rnt_rar_over_ip_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/rnt_rar_over_ip_descriptor.h
@@ -40,7 +40,7 @@ struct dvb_rnt_rar_over_ip_descriptor {
dvbdate_t last_valid_date;
EBIT3(uint8_t weighting : 6; ,
uint8_t complete_flag : 1; ,
- uint8_t reserved : 1; )
+ uint8_t reserved : 1; );
uint8_t url_length;
/* uint8_t url[] */
} __ucsi_packed;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/rst_section.c b/kaffeine/src/input/dvb/lib/libucsi/dvb/rst_section.c
index 67fa0d3..259d2b0 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/rst_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/rst_section.c
@@ -24,8 +24,8 @@
struct dvb_rst_section * dvb_rst_section_codec(struct section *section)
{
uint8_t * buf = (uint8_t *) section;
- int pos = sizeof(struct section);
- int len = section_length(section);
+ size_t pos = sizeof(struct section);
+ size_t len = section_length(section);
struct dvb_rst_section * ret = (struct dvb_rst_section *) section;
while (pos < len) {
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/rst_section.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/rst_section.h
index b4269b8..4b3360b 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/rst_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/rst_section.h
@@ -82,7 +82,7 @@ struct dvb_rst_section *dvb_rst_section_codec(struct section *section);
static inline struct dvb_rst_status *
dvb_rst_section_statuses_first(struct dvb_rst_section *rst)
{
- int pos = sizeof(struct dvb_rst_section);
+ size_t pos = sizeof(struct dvb_rst_section);
if (pos >= section_length(&rst->head))
return NULL;
@@ -108,4 +108,3 @@ static inline struct dvb_rst_status *
#endif
#endif
-
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/s2_satellite_delivery_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/s2_satellite_delivery_descriptor.h
index 66c9288..8f9fea8 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/s2_satellite_delivery_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/s2_satellite_delivery_descriptor.h
@@ -39,7 +39,7 @@ struct dvb_s2_satellite_delivery_descriptor {
EBIT4(uint8_t scrambling_sequence_selector : 1; ,
uint8_t multiple_input_stream : 1; ,
uint8_t backwards_compatability : 1; ,
- uint8_t reserved : 5; )
+ uint8_t reserved : 5; );
/* uint32_t scrambling_sequence_index if scrambling_sequence_selector = 1 */
/* uint8_t input_stream_id if multiple_input_stream = 1 */
} __ucsi_packed;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/satellite_delivery_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/satellite_delivery_descriptor.h
index 23be76e..b93d052 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/satellite_delivery_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/satellite_delivery_descriptor.h
@@ -42,9 +42,9 @@ struct dvb_satellite_delivery_descriptor {
uint8_t polarization : 2; ,
uint8_t roll_off : 2; ,
uint8_t modulation_system : 1; ,
- uint8_t modulation_type : 2; )
+ uint8_t modulation_type : 2; );
EBIT2(uint32_t symbol_rate : 28; , // BCD, units 100Hz
- uint32_t fec_inner : 4; )
+ uint32_t fec_inner : 4; );
} __ucsi_packed;
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/sdt_section.c b/kaffeine/src/input/dvb/lib/libucsi/dvb/sdt_section.c
index bdc8ce1..4c7824c 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/sdt_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/sdt_section.c
@@ -24,8 +24,8 @@
struct dvb_sdt_section * dvb_sdt_section_codec(struct section_ext * ext)
{
uint8_t * buf = (uint8_t *) ext;
- unsigned int pos = sizeof(struct section_ext);
- unsigned int len = section_ext_length(ext);
+ size_t pos = sizeof(struct section_ext);
+ size_t len = section_ext_length(ext);
if (len < sizeof(struct dvb_sdt_section))
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/sdt_section.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/sdt_section.h
index 0130fe7..03a8569 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/sdt_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/sdt_section.h
@@ -109,7 +109,7 @@ static inline uint16_t dvb_sdt_section_transport_stream_id(struct dvb_sdt_sectio
static inline struct dvb_sdt_service *
dvb_sdt_section_services_first(struct dvb_sdt_section * sdt)
{
- int pos = sizeof(struct dvb_sdt_section);
+ size_t pos = sizeof(struct dvb_sdt_section);
if (pos >= section_ext_length(&sdt->head))
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/section.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/section.h
index 8488d71..70e0880 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/section.h
@@ -39,6 +39,7 @@ extern "C"
#include <libucsi/dvb/tot_section.h>
#include <libucsi/dvb/tva_container_section.h>
#include <libucsi/dvb/int_section.h>
+#include <libucsi/dvb/mpe_fec_section.h>
/**
* The following are not implemented just now.
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/service_availability_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/service_availability_descriptor.h
index f16781b..64def75 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/service_availability_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/service_availability_descriptor.h
@@ -37,7 +37,7 @@ struct dvb_service_availability_descriptor {
struct descriptor d;
EBIT2(uint8_t availability_flag : 1; ,
- uint8_t reserved : 7; )
+ uint8_t reserved : 7; );
/* uint16_t cell_ids[] */
} __ucsi_packed;
@@ -73,10 +73,10 @@ static inline struct dvb_service_availability_descriptor*
* @param d dvb_service_availability_descriptor pointer.
* @return Pointer to the field.
*/
-static inline uint32_t *
+static inline uint16_t *
dvb_service_availability_descriptor_cell_ids(struct dvb_service_availability_descriptor *d)
{
- return (uint32_t *) ((uint8_t *) d + sizeof(struct dvb_service_availability_descriptor));
+ return (uint16_t *) ((uint8_t *) d + sizeof(struct dvb_service_availability_descriptor));
}
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/service_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/service_descriptor.h
index e116ffc..dd0f0ec 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/service_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/service_descriptor.h
@@ -49,7 +49,14 @@ enum {
DVB_SERVICE_TYPE_EN50221 = 0x0d,
DVB_SERVICE_TYPE_RCS_MAP = 0x0e,
DVB_SERVICE_TYPE_RCS_FLS = 0x0f,
- DVB_SERVICE_TYPE_MHP = 0x10
+ DVB_SERVICE_TYPE_MHP = 0x10,
+ DVB_SERVICE_TYPE_MPEG2_HD_DIGITAL_TV = 0x11,
+ DVB_SERVICE_TYPE_ADVANCED_CODEC_SD_DIGITAL_TV = 0x16,
+ DVB_SERVICE_TYPE_ADVANCED_CODEC_SD_NVOD_TIMESHIFT = 0x17,
+ DVB_SERVICE_TYPE_ADVANCED_CODEC_SD_NVOD_REF = 0x18,
+ DVB_SERVICE_TYPE_ADVANCED_CODEC_HD_DIGITAL_TV = 0x19,
+ DVB_SERVICE_TYPE_ADVANCED_CODEC_HD_NVOD_TIMESHIFT = 0x1a,
+ DVB_SERVICE_TYPE_ADVANCED_CODEC_HD_NVOD_REF = 0x1b,
};
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/short_smoothing_buffer_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/short_smoothing_buffer_descriptor.h
index 7deab9b..e52d20a 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/short_smoothing_buffer_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/short_smoothing_buffer_descriptor.h
@@ -37,7 +37,7 @@ struct dvb_short_smoothing_buffer_descriptor {
struct descriptor d;
EBIT2(uint8_t sb_size : 2; ,
- uint8_t sb_leak_rate : 6; )
+ uint8_t sb_leak_rate : 6; );
/* uint8_t reserved [] */
} __ucsi_packed;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/sit_section.c b/kaffeine/src/input/dvb/lib/libucsi/dvb/sit_section.c
index 61134d0..06c228c 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/sit_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/sit_section.c
@@ -25,8 +25,8 @@ struct dvb_sit_section * dvb_sit_section_codec(struct section_ext * ext)
{
uint8_t * buf = (uint8_t *) ext;
struct dvb_sit_section * ret = (struct dvb_sit_section *) ext;
- unsigned int pos = sizeof(struct section_ext);
- unsigned int len = section_ext_length(ext);
+ size_t pos = sizeof(struct section_ext);
+ size_t len = section_ext_length(ext);
if (len < sizeof(struct dvb_sit_section))
return NULL;
@@ -67,4 +67,3 @@ struct dvb_sit_section * dvb_sit_section_codec(struct section_ext * ext)
return ret;
}
-
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/sit_section.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/sit_section.h
index d05989f..e06d596 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/sit_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/sit_section.h
@@ -125,7 +125,7 @@ static inline struct descriptor *
static inline struct dvb_sit_service *
dvb_sit_section_services_first(struct dvb_sit_section *sit)
{
- int pos = sizeof(struct dvb_sit_section) + sit->transmission_info_loop_length;
+ size_t pos = sizeof(struct dvb_sit_section) + sit->transmission_info_loop_length;
if (pos >= section_ext_length(&sit->head))
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_address_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_address_descriptor.h
new file mode 100644
index 0000000..c08b60e
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_address_descriptor.h
@@ -0,0 +1,116 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2006 Stephane Este-Gracias (sestegra@free.fr)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_DVB_TARGET_IP_ADDRESS_DESCRIPTOR
+#define _UCSI_DVB_TARGET_IP_ADDRESS_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/types.h>
+
+/**
+ * dvb_target_ip_address_descriptor structure.
+ */
+struct dvb_target_ip_address_descriptor {
+ struct descriptor d;
+
+ uint8_t ipv4_addr_mask[4];
+ /* struct dvb_ipv4_addr ipv4_addr[] */
+} __ucsi_packed;
+
+/**
+ * An entry in the ipv4_addr field of a dvb_target_ip_address_descriptor.
+ */
+struct dvb_ipv4_addr {
+ uint8_t ipv4_addr[4];
+} __ucsi_packed;
+
+/**
+ * Process a dvb_target_ip_address_descriptor.
+ *
+ * @param d Generic descriptor structure pointer.
+ * @return dvb_target_ip_address_descriptor pointer, or NULL on error.
+ */
+static inline struct dvb_target_ip_address_descriptor*
+ dvb_target_ip_address_descriptor_codec(struct descriptor* d)
+{
+ uint32_t len = d->len - 4;
+
+ if (len % sizeof(struct dvb_ipv4_addr))
+ return NULL;
+
+ return (struct dvb_target_ip_address_descriptor*) d;
+}
+
+/**
+ * Iterator for entries in the ipv4_addr field of a dvb_target_ip_address_descriptor.
+ *
+ * @param d dvb_target_ip_address_descriptor pointer.
+ * @param pos Variable containing a pointer to the current dvb_ipv4_addr.
+ */
+#define dvb_target_ip_address_descriptor_ipv4_addr_for_each(d, pos) \
+ for ((pos) = dvb_target_ip_address_descriptor_ipv4_addr_first(d); \
+ (pos); \
+ (pos) = dvb_target_ip_address_descriptor_ipv4_addr_next(d, pos))
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct dvb_ipv4_addr*
+ dvb_target_ip_address_descriptor_ipv4_addr_first(struct dvb_target_ip_address_descriptor *d)
+{
+ if (d->d.len == 4)
+ return NULL;
+
+ return (struct dvb_ipv4_addr *)
+ ((uint8_t*) d + sizeof(struct dvb_target_ip_address_descriptor));
+}
+
+static inline struct dvb_ipv4_addr*
+ dvb_target_ip_address_descriptor_ipv4_addr_next(struct dvb_target_ip_address_descriptor *d,
+ struct dvb_ipv4_addr *pos)
+{
+ uint8_t *end = (uint8_t*) d + 2 + d->d.len - 4;
+ uint8_t *next = (uint8_t *) pos + sizeof(struct dvb_ipv4_addr);
+
+ if (next >= end)
+ return NULL;
+
+ return (struct dvb_ipv4_addr *) next;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_slash_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_slash_descriptor.h
new file mode 100644
index 0000000..e5bc76a
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_slash_descriptor.h
@@ -0,0 +1,116 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2006 Stephane Este-Gracias (sestegra@free.fr)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_DVB_TARGET_IP_SLASH_DESCRIPTOR
+#define _UCSI_DVB_TARGET_IP_SLASH_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/types.h>
+
+/**
+ * dvb_target_ip_slash_descriptor structure.
+ */
+struct dvb_target_ip_slash_descriptor {
+ struct descriptor d;
+
+ /* struct dvb_ipv4_slash ipv4_slash[] */
+} __ucsi_packed;
+
+/**
+ * An entry in the ipv4_slash field of a dvb_target_ip_slash_descriptor.
+ */
+struct dvb_ipv4_slash {
+ uint8_t ipv4_addr[4];
+ uint8_t ipv4_slash;
+} __ucsi_packed;
+
+/**
+ * Process a dvb_target_ip_slash_descriptor.
+ *
+ * @param d Generic descriptor structure pointer.
+ * @return dvb_target_ip_slash_descriptor pointer, or NULL on error.
+ */
+static inline struct dvb_target_ip_slash_descriptor*
+ dvb_target_ip_slash_descriptor_codec(struct descriptor* d)
+{
+ uint32_t len = d->len;
+
+ if (len % sizeof(struct dvb_ipv4_slash))
+ return NULL;
+
+ return (struct dvb_target_ip_slash_descriptor*) d;
+}
+
+/**
+ * Iterator for entries in the ipv4_slash field of a dvb_target_ip_slash_descriptor.
+ *
+ * @param d dvb_target_ip_slash_descriptor pointer.
+ * @param pos Variable containing a pointer to the current dvb_ipv4_slash.
+ */
+#define dvb_target_ip_slash_descriptor_ipv4_slash_for_each(d, pos) \
+ for ((pos) = dvb_target_ip_slash_descriptor_ipv4_slash_first(d); \
+ (pos); \
+ (pos) = dvb_target_ip_slash_descriptor_ipv4_slash_next(d, pos))
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct dvb_ipv4_slash*
+ dvb_target_ip_slash_descriptor_ipv4_slash_first(struct dvb_target_ip_slash_descriptor *d)
+{
+ if (d->d.len == 0)
+ return NULL;
+
+ return (struct dvb_ipv4_slash *)
+ ((uint8_t*) d + sizeof(struct dvb_target_ip_slash_descriptor));
+}
+
+static inline struct dvb_ipv4_slash*
+ dvb_target_ip_slash_descriptor_ipv4_slash_next(struct dvb_target_ip_slash_descriptor *d,
+ struct dvb_ipv4_slash *pos)
+{
+ uint8_t *end = (uint8_t*) d + 2 + d->d.len;
+ uint8_t *next = (uint8_t *) pos + sizeof(struct dvb_ipv4_slash);
+
+ if (next >= end)
+ return NULL;
+
+ return (struct dvb_ipv4_slash *) next;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_source_slash_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_source_slash_descriptor.h
new file mode 100644
index 0000000..8cade48
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ip_source_slash_descriptor.h
@@ -0,0 +1,118 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2006 Stephane Este-Gracias (sestegra@free.fr)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_DVB_TARGET_IP_SOURCE_SLASH_DESCRIPTOR
+#define _UCSI_DVB_TARGET_IP_SOURCE_SLASH_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/types.h>
+
+/**
+ * dvb_target_ip_source_slash_descriptor structure.
+ */
+struct dvb_target_ip_source_slash_descriptor {
+ struct descriptor d;
+
+ /* struct dvb_ipv4_source_slash ipv4_source_slash[] */
+} __ucsi_packed;
+
+/**
+ * An entry in the ipv4_source_slash field of a dvb_target_ip_source_slash_descriptor.
+ */
+struct dvb_ipv4_source_slash {
+ uint8_t ipv4_source_addr[4];
+ uint8_t ipv4_source_slash;
+ uint8_t ipv4_dest_addr[4];
+ uint8_t ipv4_dest_slash;
+} __ucsi_packed;
+
+/**
+ * Process a dvb_target_ip_source_slash_descriptor.
+ *
+ * @param d Generic descriptor structure pointer.
+ * @return dvb_target_ip_source_slash_descriptor pointer, or NULL on error.
+ */
+static inline struct dvb_target_ip_source_slash_descriptor*
+ dvb_target_ip_source_slash_descriptor_codec(struct descriptor* d)
+{
+ uint32_t len = d->len;
+
+ if (len % sizeof(struct dvb_ipv4_source_slash))
+ return NULL;
+
+ return (struct dvb_target_ip_source_slash_descriptor*) d;
+}
+
+/**
+ * Iterator for entries in the ipv4_source_slash field of a dvb_target_ip_source_slash_descriptor.
+ *
+ * @param d dvb_target_ip_source_slash_descriptor pointer.
+ * @param pos Variable containing a pointer to the current dvb_ipv4_source_slash.
+ */
+#define dvb_target_ip_source_slash_descriptor_ipv4_source_slash_for_each(d, pos) \
+ for ((pos) = dvb_target_ip_source_slash_descriptor_ipv4_source_slash_first(d); \
+ (pos); \
+ (pos) = dvb_target_ip_source_slash_descriptor_ipv4_source_slash_next(d, pos))
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct dvb_ipv4_source_slash*
+ dvb_target_ip_source_slash_descriptor_ipv4_source_slash_first(struct dvb_target_ip_source_slash_descriptor *d)
+{
+ if (d->d.len == 0)
+ return NULL;
+
+ return (struct dvb_ipv4_source_slash *)
+ ((uint8_t*) d + sizeof(struct dvb_target_ip_source_slash_descriptor));
+}
+
+static inline struct dvb_ipv4_source_slash*
+ dvb_target_ip_source_slash_descriptor_ipv4_source_slash_next(struct dvb_target_ip_source_slash_descriptor *d,
+ struct dvb_ipv4_source_slash *pos)
+{
+ uint8_t *end = (uint8_t*) d + 2 + d->d.len;
+ uint8_t *next = (uint8_t *) pos + sizeof(struct dvb_ipv4_source_slash);
+
+ if (next >= end)
+ return NULL;
+
+ return (struct dvb_ipv4_source_slash *) next;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_address_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_address_descriptor.h
new file mode 100644
index 0000000..1b28b48
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_address_descriptor.h
@@ -0,0 +1,116 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2006 Stephane Este-Gracias (sestegra@free.fr)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_DVB_TARGET_IPV6_ADDRESS_DESCRIPTOR
+#define _UCSI_DVB_TARGET_IPV6_ADDRESS_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/types.h>
+
+/**
+ * dvb_target_ipv6_address_descriptor structure.
+ */
+struct dvb_target_ipv6_address_descriptor {
+ struct descriptor d;
+
+ uint8_t ipv6_addr_mask[16];
+ /* struct dvb_ipv6_addr ipv6_addr[] */
+} __ucsi_packed;
+
+/**
+ * An entry in the ipv6_addr field of a dvb_target_ipv6_address_descriptor.
+ */
+struct dvb_ipv6_addr {
+ uint8_t ipv6_addr[16];
+} __ucsi_packed;
+
+/**
+ * Process a dvb_target_ipv6_address_descriptor.
+ *
+ * @param d Generic descriptor structure pointer.
+ * @return dvb_target_ipv6_address_descriptor pointer, or NULL on error.
+ */
+static inline struct dvb_target_ipv6_address_descriptor*
+ dvb_target_ipv6_address_descriptor_codec(struct descriptor* d)
+{
+ uint32_t len = d->len - 16;
+
+ if (len % sizeof(struct dvb_ipv6_addr))
+ return NULL;
+
+ return (struct dvb_target_ipv6_address_descriptor*) d;
+}
+
+/**
+ * Iterator for entries in the ipv6_addr field of a dvb_target_ipv6_address_descriptor.
+ *
+ * @param d dvb_target_ipv6_address_descriptor pointer.
+ * @param pos Variable containing a pointer to the current dvb_ipv6_addr.
+ */
+#define dvb_target_ipv6_address_descriptor_ipv6_addr_for_each(d, pos) \
+ for ((pos) = dvb_target_ipv6_address_descriptor_ipv6_addr_first(d); \
+ (pos); \
+ (pos) = dvb_target_ipv6_address_descriptor_ipv6_addr_next(d, pos))
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct dvb_ipv6_addr*
+ dvb_target_ipv6_address_descriptor_ipv6_addr_first(struct dvb_target_ipv6_address_descriptor *d)
+{
+ if (d->d.len == 16)
+ return NULL;
+
+ return (struct dvb_ipv6_addr *)
+ ((uint8_t*) d + sizeof(struct dvb_target_ipv6_address_descriptor));
+}
+
+static inline struct dvb_ipv6_addr*
+ dvb_target_ipv6_address_descriptor_ipv6_addr_next(struct dvb_target_ipv6_address_descriptor *d,
+ struct dvb_ipv6_addr *pos)
+{
+ uint8_t *end = (uint8_t*) d + 2 + d->d.len - 16;
+ uint8_t *next = (uint8_t *) pos + sizeof(struct dvb_ipv6_addr);
+
+ if (next >= end)
+ return NULL;
+
+ return (struct dvb_ipv6_addr *) next;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_slash_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_slash_descriptor.h
new file mode 100644
index 0000000..3dc6d75
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_slash_descriptor.h
@@ -0,0 +1,116 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2006 Stephane Este-Gracias (sestegra@free.fr)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_DVB_TARGET_IPV6_SLASH_DESCRIPTOR
+#define _UCSI_DVB_TARGET_IPV6_SLASH_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/types.h>
+
+/**
+ * dvb_target_ipv6_slash_descriptor structure.
+ */
+struct dvb_target_ipv6_slash_descriptor {
+ struct descriptor d;
+
+ /* struct dvb_ipv6_slash ipv6_slash[] */
+} __ucsi_packed;
+
+/**
+ * An entry in the ipv6_slash field of a dvb_target_ipv6_slash_descriptor.
+ */
+struct dvb_ipv6_slash {
+ uint8_t ipv6_addr[16];
+ uint8_t ipv6_slash;
+} __ucsi_packed;
+
+/**
+ * Process a dvb_target_ipv6_slash_descriptor.
+ *
+ * @param d Generic descriptor structure pointer.
+ * @return dvb_target_ipv6_slash_descriptor pointer, or NULL on error.
+ */
+static inline struct dvb_target_ipv6_slash_descriptor*
+ dvb_target_ipv6_slash_descriptor_codec(struct descriptor* d)
+{
+ uint32_t len = d->len;
+
+ if (len % sizeof(struct dvb_ipv6_slash))
+ return NULL;
+
+ return (struct dvb_target_ipv6_slash_descriptor*) d;
+}
+
+/**
+ * Iterator for entries in the ipv6_slash field of a dvb_target_ipv6_slash_descriptor.
+ *
+ * @param d dvb_target_ipv6_slash_descriptor pointer.
+ * @param pos Variable containing a pointer to the current dvb_ipv6_slash.
+ */
+#define dvb_target_ipv6_slash_descriptor_ipv6_slash_for_each(d, pos) \
+ for ((pos) = dvb_target_ipv6_slash_descriptor_ipv6_slash_first(d); \
+ (pos); \
+ (pos) = dvb_target_ipv6_slash_descriptor_ipv6_slash_next(d, pos))
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct dvb_ipv6_slash*
+ dvb_target_ipv6_slash_descriptor_ipv6_slash_first(struct dvb_target_ipv6_slash_descriptor *d)
+{
+ if (d->d.len == 0)
+ return NULL;
+
+ return (struct dvb_ipv6_slash *)
+ ((uint8_t*) d + sizeof(struct dvb_target_ipv6_slash_descriptor));
+}
+
+static inline struct dvb_ipv6_slash*
+ dvb_target_ipv6_slash_descriptor_ipv6_slash_next(struct dvb_target_ipv6_slash_descriptor *d,
+ struct dvb_ipv6_slash *pos)
+{
+ uint8_t *end = (uint8_t*) d + 2 + d->d.len;
+ uint8_t *next = (uint8_t *) pos + sizeof(struct dvb_ipv6_slash);
+
+ if (next >= end)
+ return NULL;
+
+ return (struct dvb_ipv6_slash *) next;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_source_slash_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_source_slash_descriptor.h
new file mode 100644
index 0000000..3a4b38e
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/target_ipv6_source_slash_descriptor.h
@@ -0,0 +1,118 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2006 Stephane Este-Gracias (sestegra@free.fr)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_DVB_TARGET_IPV6_SOURCE_SLASH_DESCRIPTOR
+#define _UCSI_DVB_TARGET_IPV6_SOURCE_SLASH_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/types.h>
+
+/**
+ * dvb_target_ipv6_source_slash_descriptor structure.
+ */
+struct dvb_target_ipv6_source_slash_descriptor {
+ struct descriptor d;
+
+ /* struct dvb_ipv6_source_slash ipv6_source_slash[] */
+} __ucsi_packed;
+
+/**
+ * An entry in the ipv6_source_slash field of a dvb_target_ipv6_source_slash_descriptor.
+ */
+struct dvb_ipv6_source_slash {
+ uint8_t ipv6_source_addr[16];
+ uint8_t ipv6_source_slash;
+ uint8_t ipv6_dest_addr[16];
+ uint8_t ipv6_dest_slash;
+} __ucsi_packed;
+
+/**
+ * Process a dvb_target_ipv6_source_slash_descriptor.
+ *
+ * @param d Generic descriptor structure pointer.
+ * @return dvb_target_ipv6_source_slash_descriptor pointer, or NULL on error.
+ */
+static inline struct dvb_target_ipv6_source_slash_descriptor*
+ dvb_target_ipv6_source_slash_descriptor_codec(struct descriptor* d)
+{
+ uint32_t len = d->len;
+
+ if (len % sizeof(struct dvb_ipv6_source_slash))
+ return NULL;
+
+ return (struct dvb_target_ipv6_source_slash_descriptor*) d;
+}
+
+/**
+ * Iterator for entries in the ipv6_source_slash field of a dvb_target_ipv6_source_slash_descriptor.
+ *
+ * @param d dvb_target_ipv6_source_slash_descriptor pointer.
+ * @param pos Variable containing a pointer to the current dvb_ipv6_source_slash.
+ */
+#define dvb_target_ipv6_source_slash_descriptor_ipv6_source_slash_for_each(d, pos) \
+ for ((pos) = dvb_target_ipv6_source_slash_descriptor_ipv6_source_slash_first(d); \
+ (pos); \
+ (pos) = dvb_target_ipv6_source_slash_descriptor_ipv6_source_slash_next(d, pos))
+
+
+
+
+
+
+
+
+
+
+/******************************** PRIVATE CODE ********************************/
+static inline struct dvb_ipv6_source_slash*
+ dvb_target_ipv6_source_slash_descriptor_ipv6_source_slash_first(struct dvb_target_ipv6_source_slash_descriptor *d)
+{
+ if (d->d.len == 0)
+ return NULL;
+
+ return (struct dvb_ipv6_source_slash *)
+ ((uint8_t*) d + sizeof(struct dvb_target_ipv6_source_slash_descriptor));
+}
+
+static inline struct dvb_ipv6_source_slash*
+ dvb_target_ipv6_source_slash_descriptor_ipv6_source_slash_next(struct dvb_target_ipv6_source_slash_descriptor *d,
+ struct dvb_ipv6_source_slash *pos)
+{
+ uint8_t *end = (uint8_t*) d + 2 + d->d.len;
+ uint8_t *next = (uint8_t *) pos + sizeof(struct dvb_ipv6_source_slash);
+
+ if (next >= end)
+ return NULL;
+
+ return (struct dvb_ipv6_source_slash *) next;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/tdt_section.c b/kaffeine/src/input/dvb/lib/libucsi/dvb/tdt_section.c
index 30a23cf..ba64fe9 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/tdt_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/tdt_section.c
@@ -23,7 +23,7 @@
struct dvb_tdt_section * dvb_tdt_section_codec(struct section * section)
{
- int len = section->length + sizeof(struct section);
+ size_t len = section_length(section);
struct dvb_tdt_section * ret = (struct dvb_tdt_section *) section;
if (len != sizeof(struct dvb_tdt_section))
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/telephone_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/telephone_descriptor.h
index 46b39e4..3dc43a1 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/telephone_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/telephone_descriptor.h
@@ -38,14 +38,14 @@ struct dvb_telephone_descriptor {
EBIT3(uint8_t reserved_1 : 2; ,
uint8_t foreign_availability : 1; ,
- uint8_t connection_type : 5; )
+ uint8_t connection_type : 5; );
EBIT4(uint8_t reserved_2 : 1; ,
uint8_t country_prefix_length : 2; ,
uint8_t international_area_code_length : 3; ,
- uint8_t operator_code_length : 2; )
+ uint8_t operator_code_length : 2; );
EBIT3(uint8_t reserved_3 : 1; ,
uint8_t national_area_code_length : 3; ,
- uint8_t core_number_length : 4; )
+ uint8_t core_number_length : 4; );
/* uint8_t country_prefix[] */
/* uint8_t international_area_code[] */
/* uint8_t operator_code[] */
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/teletext_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/teletext_descriptor.h
index 280b6eb..424c1cb 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/teletext_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/teletext_descriptor.h
@@ -39,7 +39,7 @@ enum {
DVB_TELETEXT_TYPE_SUBTITLE = 0x02,
DVB_TELETEXT_TYPE_ADDITIONAL = 0x03,
DVB_TELETEXT_TYPE_SCHEDULE = 0x04,
- DVB_TELETEXT_TYPE_SUBTITLE_HEARING_IMPAIRED= 0x05
+ DVB_TELETEXT_TYPE_SUBTITLE_HEARING_IMPAIRED= 0x05,
};
/**
@@ -57,7 +57,7 @@ struct dvb_teletext_descriptor {
struct dvb_teletext_entry {
iso639lang_t language_code;
EBIT2(uint8_t type : 5; ,
- uint8_t magazine_number: 3; )
+ uint8_t magazine_number: 3; );
uint8_t page_number;
} __ucsi_packed;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/terrestrial_delivery_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/terrestrial_delivery_descriptor.h
index b890178..c624dab 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/terrestrial_delivery_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/terrestrial_delivery_descriptor.h
@@ -41,14 +41,14 @@ struct dvb_terrestrial_delivery_descriptor {
uint8_t priority : 1; ,
uint8_t time_slicing_indicator : 1; ,
uint8_t mpe_fec_indicator : 1; ,
- uint8_t reserved_1 : 2; )
+ uint8_t reserved_1 : 2; );
EBIT3(uint8_t constellation : 2; ,
uint8_t hierarchy_information : 3; ,
- uint8_t code_rate_hp_stream : 3; )
+ uint8_t code_rate_hp_stream : 3; );
EBIT4(uint8_t code_rate_lp_stream : 3; ,
uint8_t guard_interval : 2; ,
uint8_t transmission_mode : 2; ,
- uint8_t other_frequency_flag : 1; )
+ uint8_t other_frequency_flag : 1; );
uint32_t reserved_2;
} __ucsi_packed;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/time_slice_fec_identifier_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/time_slice_fec_identifier_descriptor.h
new file mode 100644
index 0000000..00f3048
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/time_slice_fec_identifier_descriptor.h
@@ -0,0 +1,94 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2008 Patrick Boettcher (pb@linuxtv.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_DVB_TIME_SLICE_FEC_IDENTIFIER_DESCRIPTOR
+#define _UCSI_DVB_TIME_SLICE_FEC_IDENTIFIER_DESCRIPTOR 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/descriptor.h>
+#include <libucsi/types.h>
+
+/*
+ * dvb_time_slice_fec_identifier_descriptor structure.
+ */
+struct dvb_time_slice_fec_identifier_descriptor {
+ struct descriptor d;
+
+ EBIT4(uint8_t time_slicing :1; ,
+ uint8_t mpe_fec :2; ,
+ uint8_t reserved :2; ,
+ uint8_t frame_size :3; );
+
+ uint8_t max_burst_duration;
+
+ EBIT2(uint8_t max_average_rate :4; ,
+ uint8_t time_slice_fec_id :4; );
+ /* id_selector_bytes[] */
+};
+
+static inline struct dvb_time_slice_fec_identifier_descriptor *
+ dvb_time_slice_fec_identifier_descriptor_codec(struct descriptor* d)
+{
+ if (d->len < 3)
+ return NULL;
+ return (struct dvb_time_slice_fec_identifier_descriptor *) d;
+}
+
+static inline uint8_t dvb_time_slice_fec_identifier_selector_byte_length(struct dvb_time_slice_fec_identifier_descriptor *d)
+{
+ return d->d.len - 3;
+}
+
+static inline uint8_t * dvb_time_slice_fec_identifier_selector_bytes(struct dvb_time_slice_fec_identifier_descriptor *d)
+{
+ if (d->d.len < 3)
+ return NULL;
+ else
+ return ((uint8_t *) d) + 2 + 3;
+}
+
+static inline uint16_t dvb_time_slice_fec_identifier_max_burst_duration_msec(struct dvb_time_slice_fec_identifier_descriptor *d)
+{
+ return (d->max_burst_duration + 1) * 20;
+}
+
+static inline uint16_t dvb_time_slice_fec_identifier_frame_size_kbits(struct dvb_time_slice_fec_identifier_descriptor *d)
+{
+ if (d->frame_size > 3)
+ return 0;
+ return (d->frame_size+1) * 512;
+}
+
+static inline uint16_t dvb_time_slice_fec_identifier_frame_size_rows(struct dvb_time_slice_fec_identifier_descriptor *d)
+{
+ return dvb_time_slice_fec_identifier_frame_size_kbits(d) / 2;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/tot_section.c b/kaffeine/src/input/dvb/lib/libucsi/dvb/tot_section.c
index 3ce2c6d..5dc7890 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/tot_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/tot_section.c
@@ -24,8 +24,8 @@
struct dvb_tot_section *dvb_tot_section_codec(struct section *section)
{
uint8_t * buf = (uint8_t *)section;
- int pos = sizeof(struct section);
- int len = section->length + sizeof(struct section) - CRC_SIZE;
+ size_t pos = sizeof(struct section);
+ size_t len = section_length(section) - CRC_SIZE;
struct dvb_tot_section * ret = (struct dvb_tot_section *)section;
if (len < sizeof(struct dvb_tot_section))
@@ -34,7 +34,7 @@ struct dvb_tot_section *dvb_tot_section_codec(struct section *section)
pos += 5;
bswap16(buf + pos);
pos += 2;
-
+
if ((pos + ret->descriptors_loop_length) > len)
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_container_section.c b/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_container_section.c
index 32a5795..f526efc 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_container_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_container_section.c
@@ -23,7 +23,7 @@
struct dvb_tva_container_section *dvb_tva_container_section_codec(struct section_ext *ext)
{
- int len = section_ext_length(ext);
+ size_t len = section_ext_length(ext);
struct dvb_tva_container_section* ret = (struct dvb_tva_container_section*) ext;
if (len < sizeof(struct dvb_tva_container_section))
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_container_section.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_container_section.h
index 6519ded..7d0abb1 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_container_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_container_section.h
@@ -59,7 +59,7 @@ static inline uint16_t dvb_tva_container_section_container_id(struct dvb_tva_con
}
/**
- * Accessor for the selector_byte field of a dvb_data_broadcast_id_descriptor.
+ * Accessor for the data field of a dvb_data_broadcast_id_descriptor.
*
* @param d dvb_data_broadcast_id_descriptor pointer.
* @return Pointer to the field.
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_id_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_id_descriptor.h
index c830259..3b4f3e8 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_id_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/tva_id_descriptor.h
@@ -45,7 +45,7 @@ struct dvb_tva_id_descriptor {
struct dvb_tva_id_entry {
uint16_t tva_id;
EBIT2(uint8_t reserved : 5; ,
- uint8_t running_status : 3; )
+ uint8_t running_status : 3; );
} __ucsi_packed;
/**
@@ -105,7 +105,7 @@ static inline struct dvb_tva_id_entry*
}
static inline struct dvb_tva_id_entry*
- dvb_tva_id_descriptor_countries_next(struct dvb_tva_id_descriptor *d,
+ dvb_tva_id_descriptor_entries_next(struct dvb_tva_id_descriptor *d,
struct dvb_tva_id_entry *pos)
{
uint8_t *end = (uint8_t*) d + 2 + d->d.len;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/types.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/types.h
index f26ea6b..437c7c3 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/types.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/types.h
@@ -40,7 +40,7 @@ enum {
DVB_RUNNING_STATUS_NOT_RUNNING = 0x01,
DVB_RUNNING_STATUS_FEW_SECONDS = 0x02,
DVB_RUNNING_STATUS_PAUSING = 0x03,
- DVB_RUNNING_STATUS_RUNNING = 0x04
+ DVB_RUNNING_STATUS_RUNNING = 0x04,
};
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/vbi_data_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/vbi_data_descriptor.h
index 9d41e0c..b1d8703 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/vbi_data_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/vbi_data_descriptor.h
@@ -39,7 +39,7 @@ enum {
DVB_VBI_DATA_SERVICE_ID_VPS = 0x04,
DVB_VBI_DATA_SERVICE_ID_WSS = 0x05,
DVB_VBI_DATA_SERVICE_ID_CC = 0x06,
- DVB_VBI_DATA_SERVICE_ID_MONO_422 = 0x07
+ DVB_VBI_DATA_SERVICE_ID_MONO_422 = 0x07,
};
/**
@@ -66,7 +66,7 @@ struct dvb_vbi_data_entry {
struct dvb_vbi_data_x {
EBIT3(uint8_t reserved : 2; ,
uint8_t field_parity : 1; ,
- uint8_t line_offset : 5; )
+ uint8_t line_offset : 5; );
} __ucsi_packed;
/**
diff --git a/kaffeine/src/input/dvb/lib/libucsi/dvb/vbi_teletext_descriptor.h b/kaffeine/src/input/dvb/lib/libucsi/dvb/vbi_teletext_descriptor.h
index 6ae9791..fd779d7 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/dvb/vbi_teletext_descriptor.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/dvb/vbi_teletext_descriptor.h
@@ -46,7 +46,7 @@ struct dvb_vbi_teletext_descriptor {
struct dvb_vbi_teletext_entry {
iso639lang_t language_code;
EBIT2(uint8_t type : 5; ,
- uint8_t magazine_number: 3; )
+ uint8_t magazine_number: 3; );
uint8_t page_number;
} __ucsi_packed;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/cat_section.c b/kaffeine/src/input/dvb/lib/libucsi/mpeg/cat_section.c
index c72973e..8c974b8 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/cat_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/cat_section.c
@@ -24,7 +24,7 @@
struct mpeg_cat_section * mpeg_cat_section_codec(struct section_ext * ext)
{
uint8_t * buf = (uint8_t *)ext;
- int pos = sizeof(struct section_ext);
+ size_t pos = sizeof(struct section_ext);
if (verify_descriptors(buf + pos,
section_ext_length(ext) - sizeof(struct mpeg_cat_section)))
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/cat_section.h b/kaffeine/src/input/dvb/lib/libucsi/mpeg/cat_section.h
index 864b19e..7ed34a3 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/cat_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/cat_section.h
@@ -69,7 +69,7 @@ extern struct mpeg_cat_section *mpeg_cat_section_codec(struct section_ext *secti
static inline struct descriptor *
mpeg_cat_section_descriptors_first(struct mpeg_cat_section *cat)
{
- int pos = sizeof(struct mpeg_cat_section);
+ size_t pos = sizeof(struct mpeg_cat_section);
if (pos >= section_ext_length(&cat->head))
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/datagram_section.h b/kaffeine/src/input/dvb/lib/libucsi/mpeg/datagram_section.h
new file mode 100644
index 0000000..769773a
--- /dev/null
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/datagram_section.h
@@ -0,0 +1,81 @@
+/*
+ * section and descriptor parser
+ *
+ * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
+ * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
+ * Copyright (C) 2008 Patrick Boettcher (pb@linuxtv.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _UCSI_MPEG_DATAGRAM_SECTION_H
+#define _UCSI_MPEG_DATAGRAM_SECTION_H 1
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libucsi/section.h>
+
+/**
+ * datagram_section structure.
+ */
+struct datagram_section {
+ struct section head;
+
+ uint8_t MAC_address_6;
+ uint8_t MAC_address_5;
+ EBIT5(uint8_t reserved : 2; ,
+ uint8_t payload_scrambling_control : 2; ,
+ uint8_t address_scrambling_control : 2; ,
+ uint8_t LLC_SNAP_flag : 1; ,
+ uint8_t current_next_indicator : 1; );
+ uint8_t section_number;
+ uint8_t last_section_number;
+ uint8_t MAC_address_4;
+ uint8_t MAC_address_3;
+ uint8_t MAC_address_2;
+ uint8_t MAC_address_1;
+
+ /* LLC_SNAP or IP-data */
+ /* if last section stuffing */
+ /* CRC */
+} __ucsi_packed;
+
+/**
+ */
+static inline struct datagram_section *datagram_section_codec(struct section *section)
+{
+ /* something to do here ? */
+ return (struct datagram_section *) section;
+}
+
+static inline uint8_t *datagram_section_ip_data(struct datagram_section *d)
+{
+ return (uint8_t *) d + sizeof(struct section) + 2 + 1 + 1 + 1 + 4;
+}
+
+static inline size_t datagram_section_ip_data_length(struct datagram_section *d)
+{
+ return section_length(&d->head) - (sizeof(struct section) + 2 + 1 + 1 + 1 + 4) - CRC_SIZE;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/metadata_section.c b/kaffeine/src/input/dvb/lib/libucsi/mpeg/metadata_section.c
index 9af1d96..c1ce019 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/metadata_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/metadata_section.c
@@ -25,4 +25,3 @@ struct mpeg_metadata_section * mpeg_metadata_section_codec(struct section_ext *
{
return (struct mpeg_metadata_section *)ext;
}
-
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/odsmt_section.c b/kaffeine/src/input/dvb/lib/libucsi/mpeg/odsmt_section.c
index c56ccb1..07407f2 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/odsmt_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/odsmt_section.c
@@ -25,8 +25,8 @@ struct mpeg_odsmt_section *mpeg_odsmt_section_codec(struct section_ext * ext)
{
struct mpeg_odsmt_section * odsmt = (struct mpeg_odsmt_section *)ext;
uint8_t * buf = (uint8_t *)ext;
- int pos = sizeof(struct section_ext);
- int len = section_ext_length(ext);
+ size_t pos = sizeof(struct section_ext);
+ size_t len = section_ext_length(ext);
int i;
if (len < sizeof(struct mpeg_odsmt_section))
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/odsmt_section.h b/kaffeine/src/input/dvb/lib/libucsi/mpeg/odsmt_section.h
index 2e5302d..4e01085 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/odsmt_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/odsmt_section.h
@@ -61,9 +61,9 @@ struct mpeg_odsmt_stream_multi
*/
struct mpeg_odsmt_stream {
union {
- struct mpeg_odsmt_stream_single single __ucsi_packed;
- struct mpeg_odsmt_stream_multi multi __ucsi_packed;
- } u __ucsi_packed;
+ struct mpeg_odsmt_stream_single single;
+ struct mpeg_odsmt_stream_multi multi;
+ } u;
} __ucsi_packed;
/**
@@ -118,7 +118,7 @@ static inline uint16_t mpeg_odsmt_section_pid(struct mpeg_odsmt_section *odsmt)
*/
static inline uint8_t*
mpeg_odsmt_section_object_descriptors(struct mpeg_odsmt_section * odsmt,
- uint32_t* len);
+ size_t* len);
@@ -133,7 +133,7 @@ static inline uint8_t*
static inline struct mpeg_odsmt_stream *
mpeg_odsmt_section_streams_first(struct mpeg_odsmt_section *odsmt)
{
- int pos = sizeof(struct mpeg_odsmt_section);
+ size_t pos = sizeof(struct mpeg_odsmt_section);
if (pos >= section_ext_length(&odsmt->head))
return NULL;
@@ -144,12 +144,12 @@ static inline struct mpeg_odsmt_stream *
static inline struct mpeg_odsmt_stream *
mpeg_odsmt_section_streams_next(struct mpeg_odsmt_section *odsmt,
struct mpeg_odsmt_stream *pos,
- int index)
+ int _index)
{
uint8_t *end = (uint8_t*) odsmt + section_ext_length(&odsmt->head);
uint8_t *next;
- if (index > odsmt->stream_count)
+ if (_index > odsmt->stream_count)
return NULL;
next = (uint8_t *) pos + sizeof(struct mpeg_odsmt_stream_multi) +
@@ -198,13 +198,13 @@ static inline struct descriptor *
static inline uint8_t*
mpeg_odsmt_section_object_descriptors(struct mpeg_odsmt_section * odsmt,
- uint32_t* len)
+ size_t* len)
{
struct mpeg_odsmt_stream* pos;
- int size = sizeof(struct mpeg_odsmt_section);
- int index;
+ size_t size = sizeof(struct mpeg_odsmt_section);
+ int _index;
- mpeg_odsmt_section_streams_for_each(odsmt, pos, index) {
+ mpeg_odsmt_section_streams_for_each(odsmt, pos, _index) {
if (odsmt->stream_count == 0)
size += sizeof(struct mpeg_odsmt_stream_single) +
pos->u.single.es_info_length;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/pat_section.c b/kaffeine/src/input/dvb/lib/libucsi/mpeg/pat_section.c
index 80b28d5..2e4c2cc 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/pat_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/pat_section.c
@@ -24,8 +24,8 @@
struct mpeg_pat_section *mpeg_pat_section_codec(struct section_ext * ext)
{
uint8_t *buf = (uint8_t *)ext;
- int pos = sizeof(struct section_ext);
- int len = section_ext_length(ext);
+ size_t pos = sizeof(struct section_ext);
+ size_t len = section_ext_length(ext);
if (len < sizeof(struct mpeg_pat_section))
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/pat_section.h b/kaffeine/src/input/dvb/lib/libucsi/mpeg/pat_section.h
index 20b3f7a..eadfe28 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/pat_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/pat_section.h
@@ -44,7 +44,7 @@ struct mpeg_pat_section {
struct mpeg_pat_program {
uint16_t program_number;
EBIT2(uint16_t reserved : 3; ,
- uint16_t pid :13; )
+ uint16_t pid :13; );
} __ucsi_packed;
/**
@@ -90,7 +90,7 @@ static inline uint16_t mpeg_pat_section_transport_stream_id(struct mpeg_pat_sect
static inline struct mpeg_pat_program *
mpeg_pat_section_programs_first(struct mpeg_pat_section * pat)
{
- int pos = sizeof(struct mpeg_pat_section);
+ size_t pos = sizeof(struct mpeg_pat_section);
if (pos >= section_ext_length(&pat->head))
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/pmt_section.c b/kaffeine/src/input/dvb/lib/libucsi/mpeg/pmt_section.c
index 6ff4fac..e5aec6a 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/pmt_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/pmt_section.c
@@ -25,8 +25,8 @@ struct mpeg_pmt_section * mpeg_pmt_section_codec(struct section_ext * ext)
{
uint8_t * buf = (uint8_t *) ext;
struct mpeg_pmt_section * pmt = (struct mpeg_pmt_section *) ext;
- unsigned int pos = sizeof(struct section_ext);
- unsigned int len = section_ext_length(ext);
+ size_t pos = sizeof(struct section_ext);
+ size_t len = section_ext_length(ext);
if (len < sizeof(struct mpeg_pmt_section))
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/pmt_section.h b/kaffeine/src/input/dvb/lib/libucsi/mpeg/pmt_section.h
index 73bba1d..03dea1b 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/pmt_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/pmt_section.h
@@ -36,9 +36,9 @@ struct mpeg_pmt_section {
struct section_ext head;
EBIT2(uint16_t reserved_1 : 3; ,
- uint16_t pcr_pid :13; )
+ uint16_t pcr_pid :13; );
EBIT2(uint16_t reserved_2 : 4; ,
- uint16_t program_info_length :12; )
+ uint16_t program_info_length :12; );
/* struct descriptor descriptors[] */
/* struct mpeg_pmt_stream streams[] */
} __ucsi_packed;
@@ -49,9 +49,9 @@ struct mpeg_pmt_section {
struct mpeg_pmt_stream {
uint8_t stream_type;
EBIT2(uint16_t reserved_1 : 3; ,
- uint16_t pid :13; )
+ uint16_t pid :13; );
EBIT2(uint16_t reserved_2 : 4; ,
- uint16_t es_info_length :12; )
+ uint16_t es_info_length :12; );
/* struct descriptor descriptors[] */
} __ucsi_packed;
@@ -66,7 +66,7 @@ extern struct mpeg_pmt_section *mpeg_pmt_section_codec(struct section_ext *secti
/**
* Accessor for program_number field of a PMT.
- *
+ *
* @param pmt PMT pointer.
* @return The program_number.
*/
@@ -140,7 +140,7 @@ static inline struct descriptor *
static inline struct mpeg_pmt_stream *
mpeg_pmt_section_streams_first(struct mpeg_pmt_section * pmt)
{
- int pos = sizeof(struct mpeg_pmt_section) + pmt->program_info_length;
+ size_t pos = sizeof(struct mpeg_pmt_section) + pmt->program_info_length;
if (pos >= section_ext_length(&pmt->head))
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/section.h b/kaffeine/src/input/dvb/lib/libucsi/mpeg/section.h
index 6215e95..f71f95e 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/section.h
@@ -33,6 +33,7 @@ extern "C"
#include <libucsi/mpeg/pmt_section.h>
#include <libucsi/mpeg/tsdt_section.h>
#include <libucsi/mpeg/metadata_section.h>
+#include <libucsi/mpeg/datagram_section.h>
#define TRANSPORT_PAT_PID 0x00
#define TRANSPORT_CAT_PID 0x01
@@ -48,7 +49,8 @@ enum mpeg_section_tag {
stag_mpeg_transport_stream_description = 0x03,
stag_mpeg_iso14496_scene_description = 0x04,
stag_mpeg_iso14496_object_description = 0x05,
- stag_mpeg_metadata = 0x06
+ stag_mpeg_metadata = 0x06,
+ stag_mpeg_datagram = 0x3e,
};
#ifdef __cplusplus
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/tsdt_section.c b/kaffeine/src/input/dvb/lib/libucsi/mpeg/tsdt_section.c
index fbbbe3c..fec9dd7 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/tsdt_section.c
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/tsdt_section.c
@@ -24,7 +24,7 @@
struct mpeg_tsdt_section * mpeg_tsdt_section_codec(struct section_ext * ext)
{
uint8_t * buf = (uint8_t *)ext;
- int pos = sizeof(struct section_ext);
+ size_t pos = sizeof(struct section_ext);
if (verify_descriptors(buf + pos,
section_ext_length(ext) - sizeof(struct mpeg_tsdt_section)))
@@ -32,4 +32,3 @@ struct mpeg_tsdt_section * mpeg_tsdt_section_codec(struct section_ext * ext)
return (struct mpeg_tsdt_section *)ext;
}
-
diff --git a/kaffeine/src/input/dvb/lib/libucsi/mpeg/tsdt_section.h b/kaffeine/src/input/dvb/lib/libucsi/mpeg/tsdt_section.h
index 9039278..2bbae02 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/mpeg/tsdt_section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/mpeg/tsdt_section.h
@@ -70,7 +70,7 @@ extern struct mpeg_tsdt_section *mpeg_tsdt_section_codec(struct section_ext *sec
static inline struct descriptor *
mpeg_tsdt_section_descriptors_first(struct mpeg_tsdt_section * tsdt)
{
- int pos = sizeof(struct mpeg_tsdt_section);
+ size_t pos = sizeof(struct mpeg_tsdt_section);
if (pos >= section_ext_length(&tsdt->head))
return NULL;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/section.h b/kaffeine/src/input/dvb/lib/libucsi/section.h
index e2f7551..53ad07f 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/section.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/section.h
@@ -43,7 +43,7 @@ struct section {
EBIT4(uint16_t syntax_indicator : 1; ,
uint16_t private_indicator : 1; , /* 2.4.4.10 */
uint16_t reserved : 2; ,
- uint16_t length :12; )
+ uint16_t length :12; );
} __ucsi_packed;
/**
@@ -54,12 +54,12 @@ struct section_ext {
EBIT4(uint16_t syntax_indicator : 1; ,
uint16_t private_indicator : 1; , /* 2.4.4.10 */
uint16_t reserved : 2; ,
- uint16_t length :12; )
+ uint16_t length :12; );
uint16_t table_id_ext;
EBIT3(uint8_t reserved1 : 2; ,
uint8_t version_number : 5; ,
- uint8_t current_next_indicator : 1; )
+ uint8_t current_next_indicator : 1; );
uint8_t section_number;
uint8_t last_section_number;
} __ucsi_packed;
@@ -76,13 +76,36 @@ struct psi_table_state {
/**
+ * Determine the total length of a section, including the header.
+ *
+ * @param section The parsed section structure.
+ * @return The length.
+ */
+static inline size_t section_length(struct section *section)
+{
+ return section->length + sizeof(struct section);
+}
+
+/**
+ * Determine the total length of an extended section, including the header,
+ * but omitting the CRC.
+ *
+ * @param section The parsed section_ext structure.
+ * @return The length.
+ */
+static inline size_t section_ext_length(struct section_ext * section)
+{
+ return section->length + sizeof(struct section) - CRC_SIZE;
+}
+
+/**
* Process a section structure in-place.
*
* @param buf Pointer to the data.
* @param len Length of data.
* @return Pointer to the section structure, or NULL if invalid.
*/
-static inline struct section * section_codec(uint8_t * buf, int len)
+static inline struct section * section_codec(uint8_t * buf, size_t len)
{
struct section * ret = (struct section *)buf;
@@ -91,7 +114,7 @@ static inline struct section * section_codec(uint8_t * buf, int len)
bswap16(buf+1);
- if (len != ret->length + 3)
+ if (len != ret->length + 3U)
return NULL;
return ret;
@@ -107,7 +130,7 @@ static inline struct section * section_codec(uint8_t * buf, int len)
static inline int section_check_crc(struct section *section)
{
uint8_t * buf = (uint8_t *) section;
- int len = sizeof(struct section) + section->length;
+ size_t len = section_length(section);
uint32_t crc;
/* the crc check has to be performed on the unswapped data */
@@ -167,12 +190,9 @@ static inline struct section_ext * section_ext_encode(struct section_ext* sectio
int len = sizeof(struct section) + section->length;
uint32_t crc;
- /* zap the current CRC value */
- memset(buf+len-4, 0, 4);
-
/* the crc has to be performed on the swapped data */
bswap16(buf+1);
- crc = crc32(CRC32_INIT, buf, len);
+ crc = crc32(CRC32_INIT, buf, len-4);
bswap16(buf+1);
/* update the CRC */
@@ -184,29 +204,6 @@ static inline struct section_ext * section_ext_encode(struct section_ext* sectio
}
/**
- * Determine the total length of a section, including the header.
- *
- * @param section The parsed section structure.
- * @return The length.
- */
-static inline int section_length(struct section *section)
-{
- return section->length + sizeof(struct section);
-}
-
-/**
- * Determine the total length of an extended section, including the header,
- * but omitting the CRC.
- *
- * @param section The parsed section_ext structure.
- * @return The length.
- */
-static inline int section_ext_length(struct section_ext * section)
-{
- return section->length + sizeof(struct section) - CRC_SIZE;
-}
-
-/**
* Reset a psi_table_state structure.
*
* @param tstate The structure to reset.
@@ -227,7 +224,10 @@ static inline int section_ext_useful(struct section_ext *section, struct psi_tab
{
if ((section->version_number == tstate->version_number) && tstate->complete)
return 0;
- if ((section->version_number != tstate->version_number) && (section->section_number == 0)) {
+ if (section->version_number != tstate->version_number) {
+ if (section->section_number != 0)
+ return 0;
+
tstate->next_section_number = 0;
tstate->complete = 0;
tstate->version_number = section->version_number;
diff --git a/kaffeine/src/input/dvb/lib/libucsi/section_buf.h b/kaffeine/src/input/dvb/lib/libucsi/section_buf.h
index e15cc1d..52d2f84 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/section_buf.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/section_buf.h
@@ -54,11 +54,10 @@ struct section_buf {
extern int section_buf_init(struct section_buf *section, int max);
/**
- * Initialise a section_buf structure.
+ * Reset a section_buf structure (e.g. if a discontinuity occurred). The
+ * section_buf will wait for the first PDU start indicator.
*
- * @param section The section_buf to initialise.
- * @param max Maximum number of bytes in section (must be > 3)
- * @return 0 on success, nonzero on error.
+ * @param section The section_buf to reset.
*/
static inline void section_buf_reset(struct section_buf *section)
{
diff --git a/kaffeine/src/input/dvb/lib/libucsi/transport_packet.h b/kaffeine/src/input/dvb/lib/libucsi/transport_packet.h
index 7dfbd78..6314eca 100644
--- a/kaffeine/src/input/dvb/lib/libucsi/transport_packet.h
+++ b/kaffeine/src/input/dvb/lib/libucsi/transport_packet.h
@@ -145,7 +145,7 @@ static inline int transport_packet_pid(struct transport_packet *pkt)
/**
* Process a buffer into a transport packet.
*
- * @param buf Raw buffer.
+ * @param buf Raw buffer. Note, this function assumes there are 188 bytes available.
* @return transport_packet pointer, or NULL on error.
*/
static inline struct transport_packet *transport_packet_init(unsigned char *buf)
diff --git a/kaffeine/src/input/dvb/plugins/epg/kaffeinedvbsection.cpp b/kaffeine/src/input/dvb/plugins/epg/kaffeinedvbsection.cpp
index d6170e8..54c912e 100644
--- a/kaffeine/src/input/dvb/plugins/epg/kaffeinedvbsection.cpp
+++ b/kaffeine/src/input/dvb/plugins/epg/kaffeinedvbsection.cpp
@@ -141,6 +141,9 @@ bool KaffeineDVBsection::doIconv( QCString &s, QCString table, char *buffer, int
if ( inSize<1 )
return false;
cd = iconv_open( "UTF8", table );
+ //check if charset unknown
+ if( cd == (iconv_t)(-1) )
+ return false;
inBuf = s.data();
outBuf = buffer;
outBuf[0] = 0;
diff --git a/kaffeine/src/input/dvb/scandialog.cpp b/kaffeine/src/input/dvb/scandialog.cpp
index 2399c74..4e1a14c 100644
--- a/kaffeine/src/input/dvb/scandialog.cpp
+++ b/kaffeine/src/input/dvb/scandialog.cpp
@@ -109,13 +109,15 @@ ScanDialog::ScanDialog( QPtrList<DvbStream> *d, QPtrList<ChannelDesc> *ch, QSize
foundList->clear();
foundList->setAllColumnsShowFocus( true );
foundList->setSelectionMode( QListView::Extended );
- channelsList->setSorting( 0 );
+ channelsList->setSorting( 1 ); // sort by source 1st than channel name
+ channelsList->setAllColumnsShowFocus( true );
+ channelsList->setSelectionMode( QListView::Extended );
ChannelDesc *chan;
QListViewItem *it;
for ( int i=0; i<(int)chandesc->count(); i++ ) {
chan = chandesc->at(i);
- it = new QListViewItem( channelsList, chan->name );
+ it = new QListViewItem( channelsList, chan->name, chan->tp.source );
if ( !chan->pix.isNull() )
it->setPixmap( 0, chan->pix );
else {
@@ -425,7 +427,11 @@ void ScanDialog::parseTp( QString s, fe_type_t type, QString src )
trans->type=FE_QAM;
trans->source = "Cable";
}
- else {
+ else if ( s.left(pos)=="A" ) {
+ trans->type=FE_ATSC;
+ trans->source = "ATSC Terrestrial";
+ }
+ else if ( s.left(pos)=="S" ) {
trans->type=FE_QPSK;
trans->source = src;
}
@@ -439,14 +445,15 @@ void ScanDialog::parseTp( QString s, fe_type_t type, QString src )
trans->freq = s.left(pos).toULong()/1000;
s = s.right( s.length()-pos-1 );
s = s.stripWhiteSpace();
- pos = s.find(" ");
+ if ( trans->type!=FE_ATSC )
+ pos = s.find(" ");
if ( trans->type==FE_QPSK ) {
trans->pol = s.left(pos).lower()[0].latin1();
s = s.right( s.length()-pos-1 );
s = s.stripWhiteSpace();
pos = s.find(" ");
}
- if ( trans->type!=FE_OFDM ) {
+ if ( trans->type!=FE_OFDM && trans->type!=FE_ATSC ) {
trans->sr = s.left(pos).toULong()/1000;
}
else {
@@ -459,6 +466,27 @@ void ScanDialog::parseTp( QString s, fe_type_t type, QString src )
else
trans->bandwidth = BANDWIDTH_AUTO;
}
+ if ( trans->type==FE_ATSC ) {
+ if ( s.left(pos)=="8VSB" )
+ trans->modulation = VSB_8;
+ else if ( s.left(pos)=="16VSB" )
+ trans->modulation = VSB_16;
+ else if ( s.left(pos)=="QAM16" )
+ trans->modulation = QAM_16;
+ else if ( s.left(pos)=="QAM32" )
+ trans->modulation = QAM_32;
+ else if ( s.left(pos)=="QAM64" )
+ trans->modulation = QAM_64;
+ else if ( s.left(pos)=="QAM128" )
+ trans->modulation = QAM_128;
+ else if ( s.left(pos)=="QAM256" )
+ trans->modulation = QAM_256;
+ else
+ trans->modulation = QAM_AUTO;
+ transponders.append( trans );
+ return;
+ }
+
s = s.right( s.length()-pos-1 );
s = s.stripWhiteSpace();
pos = s.find(" ");
@@ -584,7 +612,17 @@ bool ScanDialog::getTransData()
if ( searchComb->currentText().startsWith("AUTO") ) {
int i;
- for ( i=402; i<900; i+=8 ) {
+ for ( i=177; i<227; i+=7 ) {
+ if ( offset07->isChecked() ) {
+ s = QString("T %1 7MHz AUTO AUTO AUTO AUTO AUTO AUTO").arg( (i*1000000)+500000 );
+ parseTp( s, ds->getType(), "" );
+ }
+ if ( offset125p->isChecked() ) {
+ s = QString("T %1 7MHz AUTO AUTO AUTO AUTO AUTO AUTO").arg( (i*1000000)+500000+125000 );
+ parseTp( s, ds->getType(), "" );
+ }
+ }
+ for ( i=474; i<859; i+=8 ) {
if ( offset167m->isChecked() ) {
s = QString("T %1 8MHz AUTO AUTO AUTO AUTO AUTO AUTO").arg( (i*1000000)-167000 );
parseTp( s, ds->getType(), "" );
@@ -605,7 +643,9 @@ bool ScanDialog::getTransData()
case FE_QPSK : s += "dvb-s/"; break;
case FE_QAM : s += "dvb-c/"; break;
case FE_OFDM : s += "dvb-t/"; break;
- case FE_ATSC : return false;
+ case FE_ATSC : s += "atsc/"; break;
+ default:
+ return false;
}
s += searchComb->currentText();
QFile f( s );
@@ -713,7 +753,9 @@ void ScanDialog::addSelected()
if(checkChannUpdate(chan)){
checkDuplicateName( chan );
- chan->num = chandesc->count()+1;
+ if (chan->num == 0) {
+ chan->num = chandesc->count()+1;
+ }
chandesc->append( new ChannelDesc( *chan ) );
it = new QListViewItem( channelsList, chan->name );
if ( chan->type==1 ) {
diff --git a/kaffeine/src/input/dvb/scandialogui.ui b/kaffeine/src/input/dvb/scandialogui.ui
index 04cbdd1..cdc1059 100644
--- a/kaffeine/src/input/dvb/scandialogui.ui
+++ b/kaffeine/src/input/dvb/scandialogui.ui
@@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>725</width>
- <height>560</height>
+ <width>790</width>
+ <height>578</height>
</rect>
</property>
<property name="caption">
@@ -21,7 +21,7 @@
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
- <cstring>layout10</cstring>
+ <cstring>layout9</cstring>
</property>
<vbox>
<property name="name">
@@ -29,7 +29,7 @@
</property>
<widget class="QLayoutWidget">
<property name="name">
- <cstring>layout9</cstring>
+ <cstring>layout8</cstring>
</property>
<hbox>
<property name="name">
@@ -66,9 +66,28 @@
<bool>true</bool>
</property>
</column>
+ <column>
+ <property name="text">
+ <string>Source</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
<property name="name">
<cstring>channelsList</cstring>
</property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
@@ -123,38 +142,51 @@
<property name="title">
<string>Search On</string>
</property>
- <vbox>
+ <grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QComboBox">
+ <widget class="QComboBox" row="0" column="0">
<property name="name">
<cstring>searchComb</cstring>
</property>
</widget>
- <widget class="QGroupBox">
+ <widget class="QGroupBox" row="1" column="0">
<property name="name">
<cstring>offsetGroup</cstring>
</property>
<property name="title">
<string>Offset (KHz)</string>
</property>
- <hbox>
+ <grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QCheckBox">
+ <widget class="QCheckBox" row="1" column="3">
<property name="name">
- <cstring>offset0</cstring>
+ <cstring>offset167m</cstring>
</property>
<property name="text">
- <string>0</string>
+ <string>-167</string>
</property>
- <property name="checked">
- <bool>true</bool>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>(7MHz)</string>
</property>
</widget>
- <widget class="QCheckBox">
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>(8MHz)</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="2">
<property name="name">
<cstring>offset167p</cstring>
</property>
@@ -162,17 +194,39 @@
<string>+167</string>
</property>
</widget>
- <widget class="QCheckBox">
+ <widget class="QCheckBox" row="0" column="2" rowspan="1" colspan="2">
<property name="name">
- <cstring>offset167m</cstring>
+ <cstring>offset125p</cstring>
</property>
<property name="text">
- <string>-167</string>
+ <string>+125</string>
</property>
</widget>
- </hbox>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>offset0</cstring>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>offset07</cstring>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
</widget>
- </vbox>
+ </grid>
</widget>
<widget class="QPushButton">
<property name="name">
@@ -206,7 +260,7 @@
<property name="sizeHint">
<size>
<width>20</width>
- <height>20</height>
+ <height>18</height>
</size>
</property>
</spacer>
@@ -231,210 +285,190 @@
<property name="sizeHint">
<size>
<width>21</width>
- <height>20</height>
+ <height>19</height>
</size>
</property>
</spacer>
- <widget class="QLayoutWidget">
+ <widget class="QGroupBox">
<property name="name">
- <cstring>layout38</cstring>
+ <cstring>filtersGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Filters</string>
</property>
- <vbox>
+ <grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QGroupBox">
+ <widget class="QCheckBox" row="2" column="0">
<property name="name">
- <cstring>filtersGroup</cstring>
+ <cstring>radioCb</cstring>
</property>
- <property name="title">
- <string>Filters</string>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Radio</string>
</property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>ftaCb</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>4</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Free to air</string>
- </property>
- </widget>
- <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>radioCb</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>4</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Radio</string>
- </property>
- </widget>
- <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>tvCb</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>4</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>TV</string>
- </property>
- </widget>
- <widget class="QCheckBox" row="3" column="0">
- <property name="name">
- <cstring>providerCb</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Provider:</string>
- </property>
- </widget>
- <widget class="QComboBox" row="3" column="1">
- <property name="name">
- <cstring>providerComb</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>3</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </grid>
</widget>
- <widget class="QPushButton">
+ <widget class="QCheckBox" row="1" column="0">
<property name="name">
- <cstring>addselectedBtn</cstring>
+ <cstring>tvCb</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
- <hsizetype>1</hsizetype>
+ <hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
- <string>&lt;&lt; Add Selected</string>
+ <string>TV</string>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="QCheckBox" row="3" column="0">
<property name="name">
- <cstring>addfilteredBtn</cstring>
+ <cstring>providerCb</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
- <hsizetype>1</hsizetype>
+ <hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
- <string>&lt;&lt; Add Filtered</string>
+ <string>Provider:</string>
</property>
</widget>
- </vbox>
- </widget>
- </vbox>
- </widget>
- <widget class="QGroupBox">
- <property name="name">
- <cstring>groupBox11</cstring>
- </property>
- <property name="title">
- <string>Found</string>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout8</cstring>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QListView">
- <column>
- <property name="text">
- <string>SNR</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Name</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
+ <widget class="QComboBox" row="3" column="1">
<property name="name">
- <cstring>foundList</cstring>
+ <cstring>providerComb</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>3</vsizetype>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>selectallBtn</cstring>
+ <cstring>ftaCb</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
<property name="text">
- <string>Select All</string>
+ <string>Free to air</string>
</property>
</widget>
- </vbox>
+ </grid>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addselectedBtn</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;&lt; Add Selected</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addfilteredBtn</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;&lt; Add Filtered</string>
+ </property>
</widget>
</vbox>
</widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox11</cstring>
+ </property>
+ <property name="title">
+ <string>Found</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>SNR</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>foundList</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>selectallBtn</cstring>
+ </property>
+ <property name="text">
+ <string>Select All</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
</hbox>
</widget>
<widget class="Line">
diff --git a/kaffeine/src/input/dvb/ts2rtp.cpp b/kaffeine/src/input/dvb/ts2rtp.cpp
index 9f87a84..4784122 100644
--- a/kaffeine/src/input/dvb/ts2rtp.cpp
+++ b/kaffeine/src/input/dvb/ts2rtp.cpp
@@ -345,7 +345,12 @@ void Ts2Rtp::psiTables( QPtrList<ChannelDesc> *channels )
buf[off++] = 0x01; // current_next_indicator
buf[off++] = 0x00; // section_number
buf[off++] = 0x00; // last_section_number
- buf[off++] = desc->vpid>>8; buf[off++] = desc->vpid&0xff; // PCR pid
+ if ( desc->vpid ) {
+ buf[off++] = desc->vpid>>8; buf[off++] = desc->vpid&0xff; // PCR pid
+ }
+ else if ( desc->napid ) {
+ buf[off++] = desc->apid[0].pid>>8; buf[off++] = desc->apid[0].pid&0xff; // PCR pid
+ }
buf[off++] = 0x00; buf[off++] = 0x00; // infos_length
if ( desc->vpid ) {
buf[off++] = desc->vType; // stream_type
diff --git a/kaffeine/src/kaffeine.cpp b/kaffeine/src/kaffeine.cpp
index 1aa2d79..4411f27 100644
--- a/kaffeine/src/kaffeine.cpp
+++ b/kaffeine/src/kaffeine.cpp
@@ -158,14 +158,13 @@ Kaffeine::Kaffeine() : DCOPObject("KaffeineIface"),
//statusBar()->insertItem(i18n("Entries: %1, Playtime: %2").arg("0").arg("0:00:00"), 9, 0, true);
//statusBar()->insertItem(i18n("No player"), 10, 0, true);
- QString stamp = locate("appdata", "wizard_stamp_v0.7.1");
- QString localStamp = locateLocal("appdata", "wizard_stamp_v0.7.1");
+ QString stamp = locateLocal("appdata", "wizard_stamp_v0.7.1");
if ((!QFile::exists(stamp)) || args->isSet("wizard"))
{
InstWizard::showWizard();
KProcess process;
- process << "touch" << localStamp;
+ process << "touch" << stamp;
process.start(KProcess::Block, KProcess::Stderr);
process.clearArguments();
}
@@ -308,8 +307,10 @@ void Kaffeine::updateArgs()
}
loadTMP(urls);
- if (args->isSet("fullscreen"))
+ if (args->isSet("fullscreen")) {
+ inplug->showPlayer();
fullscreen();
+ }
if (args->isSet("minimal"))
minimal();
@@ -360,7 +361,7 @@ void Kaffeine::slotLoadPart(const QString& desktopName)
{
kdDebug() << "Kaffeine:: Try to load service: " << desktopName << endl;
- if (desktopName == m_currentPartService && m_mediaPart != NULL)
+ if (desktopName == m_currentPartService)
return;
KService::Ptr service = KService::serviceByDesktopName(desktopName);
@@ -443,7 +444,6 @@ void Kaffeine::slotLoadPart(const QString& desktopName)
}
}
inplug->setPlayerContainer( m_playerContainer );
- m_playerContainer->show();
}
void Kaffeine::slotLoadingCanceled(const QString& message)
@@ -694,7 +694,7 @@ void Kaffeine::setupActions()
QStringList mediaParts;
// check for kaffeine parts
- KTrader::OfferList offers = KTrader::self()->query("application/x-mplayer2", "'KaffeinePart' in ServiceTypes");
+ KTrader::OfferList offers = KTrader::self()->query("audio/x-mp3", "'KaffeinePart' in ServiceTypes");
KTrader::OfferList::Iterator end(offers.end());
for(KTrader::OfferList::Iterator it = offers.begin(); it != end; ++it)
{
@@ -1899,15 +1899,3 @@ int Kaffeine::dvbSNR( int device )
#endif
return -1;
}
-
-void Kaffeine::reloadEngine()
-{
- bool isPlaying = m_mediaPart ? m_mediaPart->isPlaying() : false;
-
- unloadCurrentPart();
- kapp->config()->setGroup("Player Part");
- slotLoadPart(kapp->config()->readEntry("Last Service Desktop Name", DEFAULT_PLAYER_PART));
-
- if (isPlaying)
- slotPlaylistPlay();
-}
diff --git a/kaffeine/src/kaffeine.desktop b/kaffeine/src/kaffeine.desktop
index 59ba9fc..7306778 100644
--- a/kaffeine/src/kaffeine.desktop
+++ b/kaffeine/src/kaffeine.desktop
@@ -1,8 +1,6 @@
[Desktop Entry]
-Categories=Qt;KDE;Application;AudioVideo;Player;
-X-KDE-Protocols=file,http,audiocd,smb
+Categories=Qt;KDE;AudioVideo;Player;
DocPath=kaffeine/index.html
-Encoding=UTF-8
Exec=kaffeine %U
GenericName=Media Player
GenericName[af]=Media Speler
@@ -43,13 +41,13 @@ GenericName[sr@Latn]=Medija plejer
GenericName[sv]=Mediaspelare
GenericName[tg]=Навозишгари Медиа
GenericName[th]=โปรแกรมเล่นสื่อ
-GenericName[tr]=Oynatıcı
+GenericName[tr]=Çokluortam Oynatıcı
GenericName[uk]=Програвач медіа
GenericName[xx]=xxMedia Playerxx
GenericName[zh_CN]=媒体播放器
GenericName[zh_TW]=媒體播放程式
Icon=kaffeine
-MimeType=application/x-ogg;video/x-matroska;audio/x-matroska;video/mpeg;video/msvideo;video/quicktime;video/vnd.rn-realvideo;video/x-avi;video/x-fli;video/x-flic;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;application/x-mplayer2;application/smil;application/x-kaffeine;audio/x-musepack;
+MimeType=application/x-ogg;audio/basic;audio/vnd.rn-realaudio;audio/x-aiff;audio/x-mp3;audio/x-mpeg;audio/x-mpegurl;audio/x-ms-wma;audio/x-ogg;audio/x-pn-realaudio;audio/x-pn-realaudio-plugin;audio/x-scpls;audio/x-wav;audio/x-flac;video/x-matroska;audio/x-matroska;video/mpeg;video/msvideo;video/quicktime;video/vnd.rn-realvideo;video/x-avi;video/x-fli;video/x-flic;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;application/x-mplayer2;application/smil;application/x-kaffeine;audio/x-musepack;audio/x-mod;audio/x-stm;
Name=Kaffeine
Name[bn]=ক্যাফিন
Name[pa]=ਕੈਫ਼ੀਨ
diff --git a/kaffeine/src/kaffeine.h b/kaffeine/src/kaffeine.h
index 2176e5b..2a0ad72 100644
--- a/kaffeine/src/kaffeine.h
+++ b/kaffeine/src/kaffeine.h
@@ -121,7 +121,6 @@ private:
void dvbOSDPreviousProgram();
void dvbOSDZap();
void playDvb();
- void reloadEngine();
public slots:
void slotPlay(const MRL&);
diff --git a/kaffeine/src/kaffeine.profile.xml b/kaffeine/src/kaffeine.profile.xml
index c95f19d..bf1d3b2 100644
--- a/kaffeine/src/kaffeine.profile.xml
+++ b/kaffeine/src/kaffeine.profile.xml
@@ -109,10 +109,6 @@
<name>Recall</name>
<comment>Recall last DVB channel.</comment>
</action>
- <action objid="KaffeineIface" prototype="void reloadEngine()">
- <name>reloadEngine</name>
- <comment>Reload current engine</comment>
- </action>
<action objid="XinePartIface" prototype="void dvdMenuSelect()">
<name>dvdMenuSelect</name>
<comment>Select Dvd Menu.</comment>
diff --git a/kaffeine/src/kaffeineiface.h b/kaffeine/src/kaffeineiface.h
index 6552a67..0443c0b 100644
--- a/kaffeine/src/kaffeineiface.h
+++ b/kaffeine/src/kaffeineiface.h
@@ -134,8 +134,6 @@ k_dcop:
virtual void dvbOSDZap() = 0;
virtual void playDvb() = 0;
-
- virtual void reloadEngine() = 0;
};
#endif /* KAFFEINEIFACE_H */
diff --git a/kaffeine/src/main.cpp b/kaffeine/src/main.cpp
index 18a248a..8224556 100644
--- a/kaffeine/src/main.cpp
+++ b/kaffeine/src/main.cpp
@@ -77,6 +77,7 @@ int main(int argc, char *argv[])
/* FIXME: what about the other contributors listed in CREDITS? --pfister */
+ aboutData.addCredit("Devin J. Heitmuelle", I18N_NOOP("ATSC scanning."), "devin.heitmueller@gmail.com");
aboutData.addCredit("Eldon Tyrell", I18N_NOOP("DVB patches."), "dr.e.tyrell@gmail.com");
aboutData.addCredit("Michael Hoertnagl", I18N_NOOP("Various patches."), "mtron@a1.net");
aboutData.addCredit("Ricardo Manuel Santos Rodrigues", I18N_NOOP("Various patches."), "madinfo@cadaval.net");
@@ -89,7 +90,6 @@ int main(int argc, char *argv[])
aboutData.addCredit("Miguel Freitas", I18N_NOOP("xine post plugin handling. Many patches."), "miguel@cetuc.puc-rio.br");
aboutData.addCredit("Giorgos Gousios", I18N_NOOP("Subtitle file import."), "gousiosg@cs.man.ac.uk");
aboutData.addCredit("Michael Rolf", I18N_NOOP("M3U import. Testing."), "mi.rolf@gmx.net");
- aboutData.addCredit("Sergey Rudchenko", I18N_NOOP("Automatic codec installation"), "sergey.rudchenko@gmail.com");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineArgs::addCmdLineOptions(cmdLineOptions);
diff --git a/kaffeine/src/player-parts/dummy-part/Makefile b/kaffeine/src/player-parts/dummy-part/Makefile
new file mode 100644
index 0000000..d86818c
--- /dev/null
+++ b/kaffeine/src/player-parts/dummy-part/Makefile
@@ -0,0 +1,825 @@
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# KDE tags expanded automatically by am_edit - $Revision: 483858 $
+# kaffeine/src/player-parts/dummy-part/Makefile. Generated from Makefile.in by configure.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+srcdir = .
+top_srcdir = ../../../..
+
+pkgdatadir = $(datadir)/kaffeine-0.8.8
+pkglibdir = $(libdir)/kaffeine-0.8.8
+pkgincludedir = $(includedir)/kaffeine-0.8.8
+top_builddir = ../../../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /usr/bin/install -c -p
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = i686-pc-linux-gnu
+host_triplet = i686-pc-linux-gnu
+target_triplet = i686-pc-linux-gnu
+ACLOCAL = ${SHELL} /partage/Linux/site/tmp/kaffeine-0.8.8/admin/missing --run aclocal-1.7
+AMDEP_FALSE = #
+AMDEP_TRUE =
+AMTAR = ${SHELL} /partage/Linux/site/tmp/kaffeine-0.8.8/admin/missing --run tar
+AR = ar
+ARTSCCONFIG =
+AUTOCONF = $(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure
+AUTODIRS =
+AUTOHEADER = ${SHELL} /partage/Linux/site/tmp/kaffeine-0.8.8/admin/missing --run autoheader
+AUTOMAKE = ${SHELL} /partage/Linux/site/tmp/kaffeine-0.8.8/admin/missing --run automake-1.7
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -O2 -Wformat-security -Wmissing-format-attribute
+CFLAGS_DPMS =
+CFLAGS_GSTREAMER =
+CFLAGS_OGGVORBIS =
+CFLAGS_XCB =
+CFLAGS_XINE =
+CFLAGS_XINERAMA =
+CFLAGS_XTEST =
+CONF_FILES = $(top_srcdir)/./admin/configure.in.min $(top_srcdir)/configure.in.in $(top_srcdir)/./kaffeine/configure.in.bot $(top_srcdir)/./kaffeine/configure.in.in
+CPP = gcc -E
+CPPFLAGS = -DQT_THREAD_SUPPORT -D_REENTRANT
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -Wno-long-long -Wundef -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -O2 -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION
+CYGPATH_W = echo
+DCOPIDL = /usr/bin/dcopidl
+DCOPIDL2CPP = /usr/bin/dcopidl2cpp
+DCOPIDLNG = /usr/bin/dcopidlng
+DCOP_DEPENDENCIES = $(DCOPIDL) $(DCOPIDLNG)
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DOXYGEN =
+DOXYGEN_PROJECT_NAME = The API Reference
+DOXYGEN_PROJECT_NUMBER = Version 3.5.7
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /bin/grep -E
+ENABLE_PERMISSIVE_FLAG = -fpermissive
+EXEEXT =
+F77 =
+FFLAGS =
+FRAMEWORK_COREAUDIO =
+GMSGFMT = /usr/bin/msgfmt
+GREP = /bin/grep
+HAVE_GCC_VISIBILITY = 0
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL} $(INSTALL_STRIP_FLAG)
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+KCFG_DEPENDENCIES = $(KCONFIG_COMPILER)
+KCONFIG_COMPILER = /usr/bin/kconfig_compiler
+KDECONFIG = /usr/bin/kde-config
+KDE_CHECK_PLUGIN = $(KDE_PLUGIN) -rpath $(libdir)
+KDE_EXTRA_RPATH =
+KDE_HAS_DOXYGEN = no
+KDE_HAVE_DOT = NO
+KDE_INCLUDES = -I/usr/include/kde
+KDE_LDFLAGS = -L/usr/lib
+KDE_MT_LDFLAGS =
+KDE_MT_LIBS = -lpthread
+KDE_NO_UNDEFINED = -Wl,--no-undefined -Wl,--allow-shlib-undefined
+KDE_PLUGIN = -avoid-version -module -no-undefined $(KDE_NO_UNDEFINED) $(KDE_RPATH) $(KDE_MT_LDFLAGS)
+KDE_RPATH = -R $(libdir) -R $(kde_libraries) -R $(qt_libraries)
+KDE_USE_CLOSURE_FALSE =
+KDE_USE_CLOSURE_TRUE = #
+KDE_USE_FINAL_FALSE =
+KDE_USE_FINAL_TRUE = #
+KDE_USE_FPIE = -fPIE
+KDE_USE_NMCHECK_FALSE =
+KDE_USE_NMCHECK_TRUE = #
+KDE_USE_PIE = -pie
+KDE_XSL_STYLESHEET = /usr/share/apps/ksgmltools2/customization/kde-chunk.xsl
+LDFLAGS =
+LDFLAGS_AS_NEEDED =
+LDFLAGS_NEW_DTAGS =
+LIBCOMPAT =
+LIBCRYPT = -lcrypt
+LIBDL = -ldl
+LIBJPEG = -ljpeg
+LIBOBJS =
+LIBPNG = -lpng -lz -lm
+LIBPTHREAD = -lpthread
+LIBRESOLV = -lresolv
+LIBS =
+LIBSM = -lSM -lICE
+LIBSOCKET =
+LIBTOOL = $(SHELL) $(top_builddir)/libtool --silent
+LIBUCB =
+LIBUTIL = -lutil
+LIBZ = -lz
+LIB_ARTS =
+LIB_DPMS = -lXext
+LIB_GSTREAMER =
+LIB_KAB = -lkab
+LIB_KABC = -lkabc
+LIB_KDECORE = -lkdecore
+LIB_KDED =
+LIB_KDEPIM = -lkdepim
+LIB_KDEPRINT = -lkdeprint
+LIB_KDEUI = -lkdeui
+LIB_KDNSSD = -lkdnssd
+LIB_KFILE = -lkio
+LIB_KFM =
+LIB_KHTML = -lkhtml
+LIB_KIMPROXY = -lkimproxy
+LIB_KIO = -lkio
+LIB_KJS = -lkjs
+LIB_KNEWSTUFF = -lknewstuff
+LIB_KPARTS = -lkparts
+LIB_KSPELL = -lkspell
+LIB_KSYCOCA = -lkio
+LIB_KUNITTEST = -lkunittest
+LIB_KUTILS = -lkutils
+LIB_LAME = -lmp3lame
+LIB_OGGVORBIS = -lvorbisenc -lvorbis -lm -logg
+LIB_POLL =
+LIB_QPE =
+LIB_QT = -lqt-mt $(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM) -lpthread
+LIB_SMB = -lsmb
+LIB_X11 = -lX11 $(LIBSOCKET)
+LIB_XCB =
+LIB_XEXT = -lXext
+LIB_XINE = -lxine
+LIB_XINERAMA = -lXinerama
+LIB_XRENDER =
+LIB_XTEST = -lXtst
+LN_S = ln -s
+LTLIBOBJS =
+MAKEINFO = ${SHELL} /partage/Linux/site/tmp/kaffeine-0.8.8/admin/missing --run makeinfo
+MAKEKDEWIDGETS = /usr/bin/makekdewidgets
+MCOPIDL =
+MEINPROC = /usr/bin/meinproc
+MOC = /usr/share/qt3/bin/moc
+MSGFMT = /usr/bin/msgfmt
+NOOPT_CFLAGS = -O0
+NOOPT_CXXFLAGS = -O0
+OBJEXT = o
+PACKAGE = kaffeine-0.8.8
+PACKAGE_BUGREPORT =
+PACKAGE_NAME =
+PACKAGE_STRING =
+PACKAGE_TARNAME =
+PACKAGE_VERSION =
+PATH_SEPARATOR = :
+PERL = /usr/bin/perl
+PKG_CONFIG = pkg-config
+QTDOCDIR = /usr/share/qt3/doc/html
+QTE_NORTTI =
+QT_INCLUDES = -I/usr/share/qt3/include
+QT_LDFLAGS = -L/usr/share/qt3/lib
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/bash
+STRIP = strip
+TOPSUBDIRS = doc kaffeine po
+UIC = /usr/share/qt3/bin/uic -L $(kde_widgetdir) -nounload
+UIC_TR = tr2i18n
+USER_INCLUDES =
+USER_LDFLAGS =
+USE_EXCEPTIONS = -fexceptions
+USE_RTTI =
+USE_THREADS =
+VERSION = 3.5.7
+WOVERLOADED_VIRTUAL =
+XGETTEXT = /usr/bin/xgettext
+XMKMF =
+XMLLINT = /usr/bin/xmllint
+X_EXTRA_LIBS =
+X_INCLUDES = -I.
+X_LDFLAGS =
+X_PRE_LIBS =
+X_RPATH =
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_F77 =
+all_includes = -I/usr/include/kde -I/usr/share/qt3/include -I.
+all_libraries = -L/usr/share/qt3/lib
+am__fastdepCC_FALSE = #
+am__fastdepCC_TRUE =
+am__fastdepCXX_FALSE = #
+am__fastdepCXX_TRUE =
+am__include = include
+am__leading_dot = .
+am__quote =
+bindir = ${exec_prefix}/bin
+build = i686-pc-linux-gnu
+build_alias =
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = pc
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+doc_SUBDIR_included_FALSE = #
+doc_SUBDIR_included_TRUE =
+docdir = ${datarootdir}/doc/${PACKAGE}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = i686-pc-linux-gnu
+host_alias =
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = pc
+htmldir = ${docdir}
+include_ARTS_FALSE =
+include_ARTS_TRUE = #
+include_x11_FALSE = #
+include_x11_TRUE =
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = /partage/Linux/site/tmp/kaffeine-0.8.8/admin/install-sh
+kaffeine_SUBDIR_included_FALSE = #
+kaffeine_SUBDIR_included_TRUE =
+kde_appsdir = ${datadir}/applnk
+kde_bindir = ${exec_prefix}/bin
+kde_confdir = ${datadir}/config
+kde_datadir = ${datadir}/apps
+kde_htmldir = ${datadir}/doc/HTML
+kde_icondir = ${datadir}/icons
+kde_includes = /usr/include/kde
+kde_kcfgdir = ${datadir}/config.kcfg
+kde_libraries = /usr/lib
+kde_libs_htmldir = /usr/share/doc/kde/HTML
+kde_libs_prefix = /usr
+kde_locale = ${datadir}/locale
+kde_mimedir = ${datadir}/mimelnk
+kde_moduledir = ${libdir}/kde3
+kde_qtver = 3
+kde_servicesdir = ${datadir}/services
+kde_servicetypesdir = ${datadir}/servicetypes
+kde_sounddir = ${datadir}/sounds
+kde_styledir = ${libdir}/kde3/plugins/styles
+kde_templatesdir = ${datadir}/templates
+kde_wallpaperdir = ${datadir}/wallpapers
+kde_widgetdir = /usr/lib/kde3/plugins/designer
+kdeinitdir = $(kde_moduledir)
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+po_SUBDIR_included_FALSE = #
+po_SUBDIR_included_TRUE =
+prefix = /usr
+program_transform_name = s,x,x,
+psdir = ${docdir}
+qt_includes = /usr/share/qt3/include
+qt_libraries = /usr/share/qt3/lib
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+sysconfdir = ${prefix}/etc
+target = i686-pc-linux-gnu
+target_alias =
+target_cpu = i686
+target_os = linux-gnu
+target_vendor = pc
+unsermake_enable_pch_FALSE =
+unsermake_enable_pch_TRUE = #
+with_dvb_FALSE = #
+with_dvb_TRUE =
+with_gstreamer_FALSE =
+with_gstreamer_TRUE = #
+with_lame_FALSE = #
+with_lame_TRUE =
+with_oggvorbis_FALSE = #
+with_oggvorbis_TRUE =
+with_xcb_FALSE =
+with_xcb_TRUE = #
+x_includes = .
+x_libraries = /usr/lib
+xdg_appsdir = ${datadir}/applications/kde
+xdg_directorydir = ${datadir}/desktop-directories
+xdg_menudir = ${sysconfdir}/xdg/menus
+
+kde_module_LTLIBRARIES = libdummypart.la
+
+INCLUDES = -I$(top_srcdir)/kaffeine/src/player-parts/ $(all_includes)
+
+#>- METASOURCES = AUTO
+
+noinst_HEADERS = dummy_part.h
+
+libdummypart_la_SOURCES = dummy_part.cpp
+libdummypart_la_LIBADD = $(LIB_KPARTS) $(LIB_KFILE) ../libkaffeinepart.la
+#>- libdummypart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -avoid-version -no-undefined
+#>+ 1
+libdummypart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -avoid-version -no-undefined $(KDE_NO_UNDEFINED)
+
+# this is where the desktop file will go
+partdesktopdir = $(kde_servicesdir)
+partdesktop_DATA = dummy_part.desktop
+
+# this is where the part's XML-GUI resource file goes
+partrcdir = $(kde_datadir)/dummypart
+partrc_DATA = dummy_part.rc
+subdir = kaffeine/src/player-parts/dummy-part
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(kde_module_LTLIBRARIES)
+
+libdummypart_la_DEPENDENCIES = ../libkaffeinepart.la
+am_libdummypart_la_OBJECTS = dummy_part.lo
+#>- libdummypart_la_OBJECTS = $(am_libdummypart_la_OBJECTS)
+#>+ 5
+libdummypart_la_final_OBJECTS = libdummypart_la.all_cpp.lo
+libdummypart_la_nofinal_OBJECTS = dummy_part.lo\
+dummy_part.moc.lo
+libdummypart_la_OBJECTS = $(libdummypart_la_nofinal_OBJECTS)
+#libdummypart_la_OBJECTS = $(libdummypart_la_final_OBJECTS)
+
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
+am__depfiles_maybe = depfiles
+#>- DEP_FILES = ./$(DEPDIR)/dummy_part.Plo
+#>+ 2
+#DEP_FILES = $(DEPDIR)/dummy_part.moc.P $(DEPDIR)/libdummypart_la.all_cpp.P ./$(DEPDIR)/dummy_part.Plo
+DEP_FILES = $(DEPDIR)/dummy_part.moc.P ./$(DEPDIR)/dummy_part.Plo
+#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+#>+ 2
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS)
+#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+#>- $(AM_CXXFLAGS) $(CXXFLAGS)
+#>+ 3
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS)
+CXXLD = $(CXX)
+#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@
+#>+ 2
+CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(libdummypart_la_SOURCES)
+DATA = $(partdesktop_DATA) $(partrc_DATA)
+
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in \
+ Makefile.am
+SOURCES = $(libdummypart_la_SOURCES)
+
+#>- all: all-am
+#>+ 1
+all: docs-am all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+#>- cd $(top_srcdir) && \
+#>- $(AUTOMAKE) --gnu kaffeine/src/player-parts/dummy-part/Makefile
+#>+ 3
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu kaffeine/src/player-parts/dummy-part/Makefile
+ cd $(top_srcdir) && perl admin/am_edit kaffeine/src/player-parts/dummy-part/Makefile.in
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+kde_moduleLTLIBRARIES_INSTALL = $(INSTALL)
+install-kde_moduleLTLIBRARIES: $(kde_module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(kde_moduledir)
+ @list='$(kde_module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(kde_moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(kde_moduledir)/$$f"; \
+ $(LIBTOOL) --mode=install $(kde_moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(kde_moduledir)/$$f; \
+ else :; fi; \
+ done
+
+uninstall-kde_moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(kde_module_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(kde_moduledir)/$$p"; \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(kde_moduledir)/$$p; \
+ done
+
+clean-kde_moduleLTLIBRARIES:
+ -test -z "$(kde_module_LTLIBRARIES)" || rm -f $(kde_module_LTLIBRARIES)
+ @list='$(kde_module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" = "$$p" && dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+#>- libdummypart.la: $(libdummypart_la_OBJECTS) $(libdummypart_la_DEPENDENCIES)
+#>+ 2
+#libdummypart.la: libdummypart.la.closure $(libdummypart_la_OBJECTS) $(libdummypart_la_DEPENDENCIES)
+libdummypart.la: $(libdummypart_la_OBJECTS) $(libdummypart_la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(kde_moduledir) $(libdummypart_la_LDFLAGS) $(libdummypart_la_OBJECTS) $(libdummypart_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/dummy_part.Plo
+
+.cpp.o:
+ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CXXDEPMODE) $(depcomp) \
+# $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+.cpp.obj:
+ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ fi
+# source='$<' object='$@' libtool=no \
+# depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+# $(CXXDEPMODE) $(depcomp) \
+# $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+
+.cpp.lo:
+ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
+ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ fi
+# source='$<' object='$@' libtool=yes \
+# depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
+# $(CXXDEPMODE) $(depcomp) \
+# $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+partdesktopDATA_INSTALL = $(INSTALL_DATA)
+install-partdesktopDATA: $(partdesktop_DATA)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(partdesktopdir)
+ @list='$(partdesktop_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(partdesktopDATA_INSTALL) $$d$$p $(DESTDIR)$(partdesktopdir)/$$f"; \
+ $(partdesktopDATA_INSTALL) $$d$$p $(DESTDIR)$(partdesktopdir)/$$f; \
+ done
+
+uninstall-partdesktopDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(partdesktop_DATA)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f $(DESTDIR)$(partdesktopdir)/$$f"; \
+ rm -f $(DESTDIR)$(partdesktopdir)/$$f; \
+ done
+partrcDATA_INSTALL = $(INSTALL_DATA)
+install-partrcDATA: $(partrc_DATA)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(partrcdir)
+ @list='$(partrc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(partrcDATA_INSTALL) $$d$$p $(DESTDIR)$(partrcdir)/$$f"; \
+ $(partrcDATA_INSTALL) $$d$$p $(DESTDIR)$(partrcdir)/$$f; \
+ done
+
+uninstall-partrcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(partrc_DATA)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f $(DESTDIR)$(partrcdir)/$$f"; \
+ rm -f $(DESTDIR)$(partrcdir)/$$f; \
+ done
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+#>+ 1
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST)
+
+top_distdir = ../../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
+
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(kde_moduledir) $(DESTDIR)$(partdesktopdir) $(DESTDIR)$(partrcdir)
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+#>- clean: clean-am
+#>+ 1
+clean: kde-rpo-clean clean-am
+
+#>- clean-am: clean-generic clean-kde_moduleLTLIBRARIES clean-libtool \
+#>- mostlyclean-am
+#>+ 2
+clean-am: clean-metasources clean-closures clean-bcheck clean-final clean-generic clean-kde_moduleLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+#>- install-data-am: install-kde_moduleLTLIBRARIES install-partdesktopDATA \
+#>- install-partrcDATA
+#>+ 2
+install-data-am: install-partdesktopDATA \
+ install-partrcDATA
+
+#>- install-exec-am:
+#>+ 1
+install-exec-am: install-kde_moduleLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-kde_moduleLTLIBRARIES \
+ uninstall-partdesktopDATA uninstall-partrcDATA
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-kde_moduleLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am \
+ install-kde_moduleLTLIBRARIES install-man \
+ install-partdesktopDATA install-partrcDATA install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-kde_moduleLTLIBRARIES uninstall-partdesktopDATA \
+ uninstall-partrcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
+
+#>+ 8
+libdummypart.la.closure: $(libdummypart_la_OBJECTS) $(libdummypart_la_DEPENDENCIES)
+ @echo "int main() {return 0;}" > libdummypart_la_closure.cpp
+ @$(LTCXXCOMPILE) -c libdummypart_la_closure.cpp
+ $(CXXLINK) libdummypart_la_closure.lo $(libdummypart_la_LDFLAGS) $(libdummypart_la_OBJECTS) $(libdummypart_la_LIBADD) $(LIBS)
+ @rm -f libdummypart_la_closure.* libdummypart.la.closure
+ @echo "timestamp" > libdummypart.la.closure
+
+
+#>+ 3
+dummy_part.moc.cpp: $(srcdir)/dummy_part.h
+ $(MOC) $(srcdir)/dummy_part.h -o dummy_part.moc.cpp
+
+#>+ 2
+mocs: dummy_part.moc.cpp
+
+#>+ 3
+clean-metasources:
+ -rm -f dummy_part.moc.cpp
+
+#>+ 2
+KDE_DIST=dummy_part.desktop Makefile.in dummy_part.rc
+
+#>+ 3
+clean-closures:
+ -rm -f libdummypart.la.closure
+
+#>+ 2
+docs-am:
+
+#>+ 6
+force-reedit:
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu kaffeine/src/player-parts/dummy-part/Makefile
+ cd $(top_srcdir) && perl admin/am_edit kaffeine/src/player-parts/dummy-part/Makefile.in
+
+
+#>+ 21
+clean-bcheck:
+ rm -f *.bchecktest.cc *.bchecktest.cc.class a.out
+
+bcheck: bcheck-am
+
+bcheck-am:
+ @for i in ; do \
+ if test $(srcdir)/$$i -nt $$i.bchecktest.cc; then \
+ echo "int main() {return 0;}" > $$i.bchecktest.cc ; \
+ echo "#include \"$$i\"" >> $$i.bchecktest.cc ; \
+ echo "$$i"; \
+ if ! $(CXXCOMPILE) --dump-class-hierarchy -c $$i.bchecktest.cc; then \
+ rm -f $$i.bchecktest.cc; exit 1; \
+ fi ; \
+ echo "" >> $$i.bchecktest.cc.class; \
+ perl $(top_srcdir)/admin/bcheck.pl $$i.bchecktest.cc.class || { rm -f $$i.bchecktest.cc; exit 1; }; \
+ rm -f a.out; \
+ fi ; \
+ done
+
+
+#>+ 11
+libdummypart_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/dummy_part.cpp dummy_part.moc.cpp
+ @echo 'creating libdummypart_la.all_cpp.cpp ...'; \
+ rm -f libdummypart_la.all_cpp.files libdummypart_la.all_cpp.final; \
+ echo "#define KDE_USE_FINAL 1" >> libdummypart_la.all_cpp.final; \
+ for file in dummy_part.cpp dummy_part.moc.cpp ; do \
+ echo "#include \"$$file\"" >> libdummypart_la.all_cpp.files; \
+ test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libdummypart_la.all_cpp.final; \
+ done; \
+ cat libdummypart_la.all_cpp.final libdummypart_la.all_cpp.files > libdummypart_la.all_cpp.cpp; \
+ rm -f libdummypart_la.all_cpp.final libdummypart_la.all_cpp.files
+
+#>+ 3
+clean-final:
+ -rm -f libdummypart_la.all_cpp.cpp
+
+#>+ 3
+final:
+ $(MAKE) libdummypart_la_OBJECTS="$(libdummypart_la_final_OBJECTS)" all-am
+
+#>+ 3
+final-install:
+ $(MAKE) libdummypart_la_OBJECTS="$(libdummypart_la_final_OBJECTS)" install-am
+
+#>+ 3
+no-final:
+ $(MAKE) libdummypart_la_OBJECTS="$(libdummypart_la_nofinal_OBJECTS)" all-am
+
+#>+ 3
+no-final-install:
+ $(MAKE) libdummypart_la_OBJECTS="$(libdummypart_la_nofinal_OBJECTS)" install-am
+
+#>+ 3
+kde-rpo-clean:
+ -rm -f *.rpo
+
+#>+ 3
+nmcheck:
+nmcheck-am: nmcheck
diff --git a/kaffeine/src/player-parts/gstreamer-part/Makefile.am b/kaffeine/src/player-parts/gstreamer-part/Makefile.am
index c5a446c..3d058be 100644
--- a/kaffeine/src/player-parts/gstreamer-part/Makefile.am
+++ b/kaffeine/src/player-parts/gstreamer-part/Makefile.am
@@ -8,7 +8,7 @@ noinst_HEADERS = gstreamer_part.h timer.h video.h videosettings.h gstreamerconf
libgstreamerpart_la_SOURCES = gstreamer_part.cpp video.cpp timer.cpp videosettings.cpp gstreamerconfig.cpp
libgstreamerpart_la_LIBADD = $(LIB_KPARTS) $(LIB_KFILE) ../kaffeine-part/libkaffeinepart.la
-libgstreamerpart_la_LDFLAGS = -module $(KDE_PLUGIN) $(LIB_QT) -lDCOP $(KDE_PLUGIN) $(LIB_KPARTS) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KIO) $(LIB_GSTREAMER) -lgstinterfaces-0.10 $(all_libraries) -avoid-version -no-undefined
+libgstreamerpart_la_LDFLAGS = -module $(KDE_PLUGIN) $(LIB_GSTREAMER) -lgstinterfaces-0.10 $(all_libraries) -avoid-version -no-undefined
# this is where the desktop file will go
partdesktopdir = $(kde_servicesdir)
diff --git a/kaffeine/src/player-parts/gstreamer-part/gstreamer_part.desktop b/kaffeine/src/player-parts/gstreamer-part/gstreamer_part.desktop
index 8a2015a..6c0e55a 100644
--- a/kaffeine/src/player-parts/gstreamer-part/gstreamer_part.desktop
+++ b/kaffeine/src/player-parts/gstreamer-part/gstreamer_part.desktop
@@ -16,12 +16,15 @@ Comment[cs]=Část přehrávače založená na GStreameru.
Comment[da]=En Kaffeine-grænseflade baseret på Gstreamer.
Comment[de]=Ein auf GStreamer basierendes Programmmodul.
Comment[el]=Μία μηχανή του Kaffeine βασισμένη στο GStreamer.
+Comment[es]=Un motor de Kaffeine basado en GStreamer.
Comment[et]=Kaffeine mootor GStreameri põhjal.
+Comment[fi]=GStreamer-kirjastoa käyttävä toistoydin.
Comment[ga]=Inneall Kaffeine bunaithe ar GStreamer.
Comment[gl]=Un motor para Kaffeine baseado en GStreamer.
Comment[hu]=GStreamer-alapú Kaffeine-alrendszer.
Comment[it]=Un motore di Kaffeine basato su GStreamer.
Comment[ja]=GStreamer に基づく Kaffeine エンジン
+Comment[km]=ម៉ាស៊ីន​ Kaffeine មាន​មូលដ្ឋាន​លើ GStreamer ។
Comment[lt]=Kaffeine variklis, paremtas GStreamer.
Comment[nb]=En spillermotor basert på GStreamer.
Comment[nl]=Een Kaffeine-engine gebaseerd op GStreamer.
@@ -38,7 +41,7 @@ Comment[th]=โปรแกรมประมวลผลของ Kaffeine โ
Comment[tr]=GStreamer tabanlı bir Kaffeine motoru.
Comment[uk]=Рушій Kaffeine, оснований на GStreamer.
Comment[xx]=xxA Kaffeine engine based on GStreamer.xx
-MimeType=application/x-ogg;video/x-matroska;audio/x-matroska;video/mpeg;video/msvideo;video/quicktime;video/vnd.rn-realvideo;video/x-avi;video/x-fli;video/x-flic;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;application/x-mplayer2;application/smil;application/x-kaffeine;audio/x-musepack;
+MimeType=application/x-ogg;audio/basic;audio/vnd.rn-realaudio;audio/x-aiff;audio/x-mp3;audio/x-mpeg;audio/x-mpegurl;audio/x-ms-wma;audio/x-ogg;audio/x-pn-realaudio;audio/x-pn-realaudio-plugin;audio/x-scpls;audio/x-wav;audio/x-flac;video/x-matroska;audio/x-matroska;video/mpeg;video/msvideo;video/quicktime;video/vnd.rn-realvideo;video/x-avi;video/x-fli;video/x-flic;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;application/x-mplayer2;application/smil;application/x-kaffeine;audio/x-musepack;
ServiceTypes=KParts/ReadOnlyPart,KaffeinePart
Type=Service
X-KDE-Library=libgstreamerpart
diff --git a/kaffeine/src/player-parts/kaffeine-part/kaffeinepart.cpp b/kaffeine/src/player-parts/kaffeine-part/kaffeinepart.cpp
index 4be8b73..feaec12 100644
--- a/kaffeine/src/player-parts/kaffeine-part/kaffeinepart.cpp
+++ b/kaffeine/src/player-parts/kaffeine-part/kaffeinepart.cpp
@@ -19,12 +19,6 @@
*/
#include "kaffeinepart.h"
-#include <kapplication.h>
-#include <kservice.h>
-#include <ktrader.h>
-#include <kmessagebox.h>
-#include <krun.h>
-#include <klocale.h>
#include "kaffeinepart.moc"
@@ -36,23 +30,3 @@ KaffeinePart::KaffeinePart(QObject* parent, const char* name)
KaffeinePart::~KaffeinePart()
{
}
-
-bool KaffeinePart::installDistroCodec(QWidget* parent, const QString& engine, const QString& codec)
-{
- QString query = QString("[X-KDE-Kaffeine-codec] == '%1' and \
- [X-KDE-Kaffeine-engine] == '%2'").arg(codec).arg(engine);
-
- KService::Ptr service = KTrader::self()->query( "Kaffeine/CodecInstall", query).first();
-
- if (!service)
- return false;
-
- QString installScript = service->exec();
-
- if (installScript.isNull())
- return false;
-
- KRun::runCommand(installScript);
- return true;
-}
-
diff --git a/kaffeine/src/player-parts/kaffeine-part/kaffeinepart.h b/kaffeine/src/player-parts/kaffeine-part/kaffeinepart.h
index e569ead..4281c93 100644
--- a/kaffeine/src/player-parts/kaffeine-part/kaffeinepart.h
+++ b/kaffeine/src/player-parts/kaffeine-part/kaffeinepart.h
@@ -199,11 +199,6 @@ public slots:
virtual void slotMute()
{}
- /*
- * Execute distro-dependent actions to install codecs
- */
- static bool installDistroCodec(QWidget* parent, const QString& engine, const QString& codec);
-
private:
/*
* Don't reimplement this, a player should be able to stream media
diff --git a/kaffeine/src/player-parts/xine-part/Makefile.am b/kaffeine/src/player-parts/xine-part/Makefile.am
index 7187e66..0325e1d 100644
--- a/kaffeine/src/player-parts/xine-part/Makefile.am
+++ b/kaffeine/src/player-parts/xine-part/Makefile.am
@@ -14,7 +14,7 @@ libxinepart_la_SOURCES = xine_part.cpp kxinewidget.cpp postfilter.cpp deinterlac
videosettings.cpp filterdialog.cpp screenshotpreview.cpp xineconfig.cpp positionslider.cpp \
equalizer.cpp xine_part_iface.skel
libxinepart_la_LIBADD = $(LIB_XINERAMA) $(LIB_XINE) $(LIB_XCB) ../kaffeine-part/libkaffeinepart.la
-libxinepart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) $(LIB_QT) -lDCOP $(KDE_PLUGIN) $(LIB_KPARTS) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KIO) $(LIB_KDEPRINT) -avoid-version -no-undefined
+libxinepart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -avoid-version -no-undefined
# this is where the desktop file will go
diff --git a/kaffeine/src/player-parts/xine-part/kxinewidget.cpp b/kaffeine/src/player-parts/xine-part/kxinewidget.cpp
index 77f26e2..f6b032a 100644
--- a/kaffeine/src/player-parts/xine-part/kxinewidget.cpp
+++ b/kaffeine/src/player-parts/xine-part/kxinewidget.cpp
@@ -36,7 +36,6 @@
#include <cmath>
#include "kxinewidget.h"
-#include "kaffeinepart.h"
#ifdef HAVE_XINERAMA
#include <X11/extensions/Xinerama.h>
@@ -636,8 +635,7 @@ void KXineWidget::xineEventListener(void *p, const xine_event_t* xineEvent)
message = i18n("The source can't be read.\nMaybe you don't have enough rights for this, or source doesn't contain data (e.g: no disc in drive). ");
if(data->explanation)
message = message + "(" + ((char *) data + data->parameters) + ")";
- debugOut(message);
- return; // This error is handled by autoinstallation
+ break;
}
case XINE_MSG_LIBRARY_LOAD_ERROR:
{
@@ -650,11 +648,7 @@ void KXineWidget::xineEventListener(void *p, const xine_event_t* xineEvent)
{
message = i18n("The source seems encrypted, and can't be read. ");
if (vw->m_trackURL.contains("dvd:/"))
- {
- if (KaffeinePart::installDistroCodec(vw, "xine-engine", "dvdcss"))
- return;
message = message + i18n("\nYour DVD is probably crypted. According to your country laws, you can or can't use libdvdcss to be able to read this disc. ");
- }
if(data->explanation)
message = message + "(" + ((char *) data + data->parameters) + ")";
break;
@@ -1683,7 +1677,7 @@ void KXineWidget::dvbShowOSD()
int h = m_videoFrameHeight;
if ( !w || !h )
return;
- if ( w<800 ) {
+ if ( w<1921 ) {
if ( dvbCurrentNext[0]=="E" ) {
dvbOSDHideTimer.stop();
dvbOSD = xine_osd_new( m_xineStream, border, border, w-(2*border), h-(2/border) );
@@ -1864,7 +1858,7 @@ void KXineWidget::setDvbCurrentNext( const QString &channelName, const QStringLi
void KXineWidget::setDvb( const QString &pipeName, const QString &chanName, int haveVideo )
{
- m_trackURL = pipeName;
+ m_trackURL = /*"fifo://"+*/pipeName;
m_trackTitle = chanName;
dvbHaveVideo = haveVideo;
}
@@ -1916,15 +1910,6 @@ void KXineWidget::slotPlayTimeShift()
m_posTimer.start(1000);
}
-bool KXineWidget::unhandledStreamsPresent()
-{
- unsigned int hasAudio = xine_get_stream_info(m_xineStream, XINE_STREAM_INFO_HAS_AUDIO);
- unsigned int hasVideo = xine_get_stream_info(m_xineStream, XINE_STREAM_INFO_HAS_VIDEO);
-
- return (hasAudio && !xine_get_stream_info(m_xineStream, XINE_STREAM_INFO_AUDIO_HANDLED)) ||
- (hasVideo && !xine_get_stream_info(m_xineStream, XINE_STREAM_INFO_VIDEO_HANDLED));
-}
-
void KXineWidget::slotPlay()
{
if ((!isXineReady()) || (isQueueEmpty()))
@@ -2007,13 +1992,6 @@ void KXineWidget::slotPlay()
return;
}
- if (unhandledStreamsPresent())
- {
- errorOut("No codecs to handle media");
- sendXineError();
- return;
- }
-
/**** use visualization ? ****/
#ifndef USE_QT_ONLY
unwireAudioFilters();
@@ -2232,17 +2210,6 @@ void KXineWidget::sendXineError()
case XINE_ERROR_NO_INPUT_PLUGIN:
case XINE_ERROR_NO_DEMUX_PLUGIN:
{
- if (m_trackURL.startsWith("dvd:/"))
- {
- if (KaffeinePart::installDistroCodec(this, "xine-engine", "dvdcss"))
- return;
- }
- else
- {
- if (KaffeinePart::installDistroCodec(this, "xine-engine", "ffmpeg"))
- return;
- }
-
error = i18n("No plugin found to handle this resource") + " " + addInfo;
break;
}
@@ -2263,9 +2230,6 @@ void KXineWidget::sendXineError()
}
default:
{
- if (unhandledStreamsPresent() && KaffeinePart::installDistroCodec(this, "xine-engine", "ffmpeg"))
- return;
-
error = i18n("Generic error") + " (" + m_trackURL + ")";
break;
}
@@ -2895,7 +2859,13 @@ void KXineWidget::slotStop()
if ( m_lengthInfoTimer.isActive() ) m_lengthInfoTimer.stop();
//emit signalNewPosition(0, QTime());
- xine_stop(m_xineStream);
+ if ((m_logoFile.isNull()) && (isPlaying()))
+ xine_stop(m_xineStream);
+ else
+ {
+ appendToQueue(m_logoFile);
+ QTimer::singleShot(0, this, SLOT(slotPlay()));
+ }
emit signalXineStatus(i18n("Stop"));
}
diff --git a/kaffeine/src/player-parts/xine-part/kxinewidget.h b/kaffeine/src/player-parts/xine-part/kxinewidget.h
index aac81b4..91f3ebc 100644
--- a/kaffeine/src/player-parts/xine-part/kxinewidget.h
+++ b/kaffeine/src/player-parts/xine-part/kxinewidget.h
@@ -321,7 +321,6 @@ private:
#else
void paintEvent(QPaintEvent *);
#endif
- bool unhandledStreamsPresent();
/********* callbacks and threads ************/
static void destSizeCallback(void* p, int video_width, int video_height, double video_aspect,
diff --git a/kaffeine/src/player-parts/xine-part/xine_part.desktop b/kaffeine/src/player-parts/xine-part/xine_part.desktop
index ce9f2ab..7cf698c 100644
--- a/kaffeine/src/player-parts/xine-part/xine_part.desktop
+++ b/kaffeine/src/player-parts/xine-part/xine_part.desktop
@@ -1,7 +1,7 @@
[Desktop Entry]
Encoding=UTF-8
Icon=kaffeine
-MimeType=application/x-ogg;video/x-matroska;audio/x-matroska;video/mpeg;video/msvideo;video/quicktime;video/vnd.rn-realvideo;video/x-avi;video/x-fli;video/x-flic;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;application/x-mplayer2;application/smil;application/x-kaffeine;audio/x-musepack;
+MimeType=application/x-ogg;audio/basic;audio/vnd.rn-realaudio;audio/x-aiff;audio/x-mp3;audio/x-mpeg;audio/x-mpegurl;audio/x-ms-wma;audio/x-ogg;audio/x-pn-realaudio;audio/x-pn-realaudio-plugin;audio/x-scpls;audio/x-wav;audio/x-flac;video/x-matroska;audio/x-matroska;video/mpeg;video/msvideo;video/quicktime;video/vnd.rn-realvideo;video/x-avi;video/x-fli;video/x-flic;video/x-ms-asf;video/x-ms-asf-plugin;video/x-ms-wmv;video/x-msvideo;application/x-mplayer2;application/smil;application/x-kaffeine;audio/x-musepack;
Name=Kaffeine-Xine
Name[nb]=Kaffeine Xine
Name[pa]=ਕੈਫੀਨ-ਜ਼ਾਇਨ
@@ -15,12 +15,15 @@ Comment[cs]=Část přehrávače založená na xine.
Comment[da]=En Kaffeine-grænseflade baseret på Xine.
Comment[de]=Ein auf Xine basierendes Programmmodul.
Comment[el]=Μία μηχανή του Kaffeine βασισμένη στο xine.
+Comment[es]=Un motor de Kaffeine basado en xine.
Comment[et]=Kaffeine mootor xine põhjal.
+Comment[fi]=xine-kirjastoa käyttävä toistoydin.
Comment[ga]=Inneall Kaffeine bunaithe ar xine.
Comment[gl]=Un motor para Kaffeine baseado en Xine.
Comment[hu]=Xine-alapú Kaffeine-alrendszer.
Comment[it]=Un motore di Kaffeine basato su xine.
Comment[ja]=xine に基づく Kaffeine エンジン
+Comment[km]=ម៉ាស៊ីន​ Kaffeine មាន​មូលដ្ឋាន​លើ xine ។
Comment[lt]=Kaffeine variklis, paremtas Xine.
Comment[nb]=En spillermotor basert på xine.
Comment[nl]=Een Kaffeine-engine gebaseerd op xine.
diff --git a/kaffeine/src/version.h b/kaffeine/src/version.h
index 86a51d0..b7b467b 100644
--- a/kaffeine/src/version.h
+++ b/kaffeine/src/version.h
@@ -1 +1 @@
-#define KAFFEINE_VERSION "0.8.6"
+#define KAFFEINE_VERSION "0.8.8"