@@ -195,10 +195,7 @@ use capi::pa_source_info as SourceInfoInternal;
195
195
use capi:: pa_server_info as ServerInfoInternal ;
196
196
use capi:: pa_module_info as ModuleInfoInternal ;
197
197
use capi:: pa_client_info as ClientInfoInternal ;
198
- #[ cfg( not( any( doc, feature = "pa_v5" ) ) ) ]
199
- use capi:: pa_card_profile_info as CardProfileInfoInternal ;
200
- #[ cfg( any( doc, feature = "pa_v5" ) ) ]
201
- use capi:: pa_card_profile_info2 as CardProfileInfo2Internal ;
198
+ use capi:: pa_card_profile_info2 as CardProfileInfoInternal ;
202
199
use capi:: pa_card_port_info as CardPortInfoInternal ;
203
200
use capi:: pa_card_info as CardInfoInternal ;
204
201
use capi:: pa_sink_input_info as SinkInputInfoInternal ;
@@ -1455,35 +1452,16 @@ fn get_client_info_list_cb_proxy(_: *mut ContextInternal, i: *const ClientInfoIn
1455
1452
// Card info
1456
1453
////////////////////////////////////////////////////////////////////////////////////////////////////
1457
1454
1458
- /// Stores information about a specific profile of a card.
1459
- ///
1460
- /// Please note that this structure can be extended as part of evolutionary API updates at any time
1461
- /// in any new release.
1462
- ///
1463
- /// Replaced with `CardProfileInfo2` in PA version 5+.
1464
- #[ derive( Debug ) ]
1465
- #[ cfg( not( any( doc, feature = "pa_v5" ) ) ) ]
1466
- pub struct CardProfileInfo < ' a > {
1467
- /// Name of this profile.
1468
- pub name : Option < Cow < ' a , str > > ,
1469
- /// Description of this profile.
1470
- pub description : Option < Cow < ' a , str > > ,
1471
- /// Number of sinks this profile would create.
1472
- pub n_sinks : u32 ,
1473
- /// Number of sources this profile would create.
1474
- pub n_sources : u32 ,
1475
- /// The higher this value is, the more useful this profile is as a default.
1476
- pub priority : u32 ,
1477
- }
1455
+ /// Backwards compatable alias
1456
+ #[ deprecated = "Use the name CardProfileInfo instead" ]
1457
+ pub type CardProfileInfo2 < ' a > = CardProfileInfo < ' a > ;
1478
1458
1479
1459
/// Stores information about a specific profile of a card.
1480
1460
///
1481
1461
/// Please note that this structure can be extended as part of evolutionary API updates at any time
1482
1462
/// in any new release.
1483
1463
#[ derive( Debug ) ]
1484
- #[ cfg( any( doc, feature = "pa_v5" ) ) ]
1485
- #[ cfg_attr( docsrs, doc( cfg( feature = "pa_v5" ) ) ) ]
1486
- pub struct CardProfileInfo2 < ' a > {
1464
+ pub struct CardProfileInfo < ' a > {
1487
1465
/// Name of this profile.
1488
1466
pub name : Option < Cow < ' a , str > > ,
1489
1467
/// Description of this profile.
@@ -1501,7 +1479,6 @@ pub struct CardProfileInfo2<'a> {
1501
1479
pub available : bool ,
1502
1480
}
1503
1481
1504
- #[ cfg( not( any( doc, feature = "pa_v5" ) ) ) ]
1505
1482
impl < ' a > CardProfileInfo < ' a > {
1506
1483
fn new_from_raw ( p : * const CardProfileInfoInternal ) -> Self {
1507
1484
assert ! ( !p. is_null( ) ) ;
@@ -1519,29 +1496,6 @@ impl<'a> CardProfileInfo<'a> {
1519
1496
n_sinks : src. n_sinks ,
1520
1497
n_sources : src. n_sources ,
1521
1498
priority : src. priority ,
1522
- }
1523
- }
1524
- }
1525
- }
1526
-
1527
- #[ cfg( any( doc, feature = "pa_v5" ) ) ]
1528
- impl < ' a > CardProfileInfo2 < ' a > {
1529
- fn new_from_raw ( p : * const CardProfileInfo2Internal ) -> Self {
1530
- assert ! ( !p. is_null( ) ) ;
1531
- let src = unsafe { & * p } ;
1532
- unsafe {
1533
- CardProfileInfo2 {
1534
- name : match src. name . is_null ( ) {
1535
- false => Some ( CStr :: from_ptr ( src. name ) . to_string_lossy ( ) ) ,
1536
- true => None ,
1537
- } ,
1538
- description : match src. description . is_null ( ) {
1539
- false => Some ( CStr :: from_ptr ( src. description ) . to_string_lossy ( ) ) ,
1540
- true => None ,
1541
- } ,
1542
- n_sinks : src. n_sinks ,
1543
- n_sources : src. n_sources ,
1544
- priority : src. priority ,
1545
1499
available : match src. available {
1546
1500
0 => false ,
1547
1501
_ => true ,
@@ -1573,12 +1527,7 @@ pub struct CardPortInfo<'a> {
1573
1527
/// active.
1574
1528
pub latency_offset : i64 ,
1575
1529
/// Set of available profiles.
1576
- #[ cfg( not( any( doc, feature = "pa_v5" ) ) ) ]
1577
1530
pub profiles : Vec < CardProfileInfo < ' a > > ,
1578
- /// Set of available profiles.
1579
- #[ cfg( any( doc, feature = "pa_v5" ) ) ]
1580
- #[ cfg_attr( docsrs, doc( cfg( feature = "pa_v5" ) ) ) ]
1581
- pub profiles : Vec < CardProfileInfo2 < ' a > > ,
1582
1531
/// An indentifier for the group of ports that share their availability status with each other.
1583
1532
///
1584
1533
/// This is meant especially for handling cases where one 3.5 mm connector is used for
@@ -1612,24 +1561,12 @@ impl<'a> CardPortInfo<'a> {
1612
1561
1613
1562
let mut profiles_vec = Vec :: with_capacity ( src. n_profiles as usize ) ;
1614
1563
1615
- #[ cfg( not( any( doc, feature = "pa_v5" ) ) ) ]
1616
- assert ! ( src. n_profiles == 0 || !src. profiles. is_null( ) ) ;
1617
- #[ cfg( not( any( doc, feature = "pa_v5" ) ) ) ]
1618
- for i in 0 ..src. n_profiles as isize {
1619
- let indexed_ptr = unsafe { ( * src. profiles . offset ( i) ) as * mut CardProfileInfoInternal } ;
1620
- if !indexed_ptr. is_null ( ) {
1621
- profiles_vec. push ( CardProfileInfo :: new_from_raw ( indexed_ptr) ) ;
1622
- }
1623
- }
1624
-
1625
- #[ cfg( any( doc, feature = "pa_v5" ) ) ]
1626
1564
assert ! ( src. n_profiles == 0 || !src. profiles2. is_null( ) ) ;
1627
- #[ cfg( any( doc, feature = "pa_v5" ) ) ]
1628
1565
for i in 0 ..src. n_profiles as isize {
1629
1566
let indexed_ptr =
1630
- unsafe { ( * src. profiles2 . offset ( i) ) as * mut CardProfileInfo2Internal } ;
1567
+ unsafe { ( * src. profiles2 . offset ( i) ) as * mut CardProfileInfoInternal } ;
1631
1568
if !indexed_ptr. is_null ( ) {
1632
- profiles_vec. push ( CardProfileInfo2 :: new_from_raw ( indexed_ptr) ) ;
1569
+ profiles_vec. push ( CardProfileInfo :: new_from_raw ( indexed_ptr) ) ;
1633
1570
}
1634
1571
}
1635
1572
@@ -1680,19 +1617,9 @@ pub struct CardInfo<'a> {
1680
1617
/// Set of ports.
1681
1618
pub ports : Vec < CardPortInfo < ' a > > ,
1682
1619
/// Set of available profiles.
1683
- #[ cfg( not( any( doc, feature = "pa_v5" ) ) ) ]
1684
1620
pub profiles : Vec < CardProfileInfo < ' a > > ,
1685
1621
/// Pointer to active profile in the set, or `None`.
1686
- #[ cfg( not( any( doc, feature = "pa_v5" ) ) ) ]
1687
1622
pub active_profile : Option < Box < CardProfileInfo < ' a > > > ,
1688
- /// Set of available profiles.
1689
- #[ cfg( any( doc, feature = "pa_v5" ) ) ]
1690
- #[ cfg_attr( docsrs, doc( cfg( feature = "pa_v5" ) ) ) ]
1691
- pub profiles : Vec < CardProfileInfo2 < ' a > > ,
1692
- /// Pointer to active profile in the set, or `None`.
1693
- #[ cfg( any( doc, feature = "pa_v5" ) ) ]
1694
- #[ cfg_attr( docsrs, doc( cfg( feature = "pa_v5" ) ) ) ]
1695
- pub active_profile : Option < Box < CardProfileInfo2 < ' a > > > ,
1696
1623
}
1697
1624
1698
1625
impl < ' a > CardInfo < ' a > {
@@ -1710,24 +1637,12 @@ impl<'a> CardInfo<'a> {
1710
1637
}
1711
1638
let mut profiles_vec = Vec :: with_capacity ( src. n_profiles as usize ) ;
1712
1639
1713
- #[ cfg( not( any( doc, feature = "pa_v5" ) ) ) ]
1714
- assert ! ( src. n_profiles == 0 || !src. profiles. is_null( ) ) ;
1715
- #[ cfg( not( any( doc, feature = "pa_v5" ) ) ) ]
1716
- for i in 0 ..src. n_profiles as isize {
1717
- let indexed_ptr = unsafe { src. profiles . offset ( i) as * mut CardProfileInfoInternal } ;
1718
- if !indexed_ptr. is_null ( ) {
1719
- profiles_vec. push ( CardProfileInfo :: new_from_raw ( indexed_ptr) ) ;
1720
- }
1721
- }
1722
-
1723
- #[ cfg( any( doc, feature = "pa_v5" ) ) ]
1724
1640
assert ! ( src. n_profiles == 0 || !src. profiles2. is_null( ) ) ;
1725
- #[ cfg( any( doc, feature = "pa_v5" ) ) ]
1726
1641
for i in 0 ..src. n_profiles as isize {
1727
1642
let indexed_ptr =
1728
- unsafe { ( * src. profiles2 . offset ( i) ) as * mut CardProfileInfo2Internal } ;
1643
+ unsafe { ( * src. profiles2 . offset ( i) ) as * mut CardProfileInfoInternal } ;
1729
1644
if !indexed_ptr. is_null ( ) {
1730
- profiles_vec. push ( CardProfileInfo2 :: new_from_raw ( indexed_ptr) ) ;
1645
+ profiles_vec. push ( CardProfileInfo :: new_from_raw ( indexed_ptr) ) ;
1731
1646
}
1732
1647
}
1733
1648
@@ -1749,15 +1664,9 @@ impl<'a> CardInfo<'a> {
1749
1664
proplist : Proplist :: from_raw_weak ( src. proplist ) ,
1750
1665
ports : ports_vec,
1751
1666
profiles : profiles_vec,
1752
- #[ cfg( not( any( doc, feature = "pa_v5" ) ) ) ]
1753
- active_profile : match src. active_profile . is_null ( ) {
1754
- true => None ,
1755
- false => Some ( Box :: new ( CardProfileInfo :: new_from_raw ( src. active_profile ) ) ) ,
1756
- } ,
1757
- #[ cfg( any( doc, feature = "pa_v5" ) ) ]
1758
1667
active_profile : match src. active_profile2 . is_null ( ) {
1759
1668
true => None ,
1760
- false => Some ( Box :: new ( CardProfileInfo2 :: new_from_raw ( src. active_profile2 ) ) ) ,
1669
+ false => Some ( Box :: new ( CardProfileInfo :: new_from_raw ( src. active_profile2 ) ) ) ,
1761
1670
} ,
1762
1671
}
1763
1672
}
0 commit comments