Skip to content

Commit b2798ab

Browse files
committed
chore: Rename headers in roc_sndio
Extract device_defs.h and driver_defs.h headers.
1 parent 79ed456 commit b2798ab

File tree

13 files changed

+42
-85
lines changed

13 files changed

+42
-85
lines changed

src/internal_modules/roc_pipeline/state_tracker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "roc_core/atomic.h"
1616
#include "roc_core/noncopyable.h"
1717
#include "roc_core/stddefs.h"
18-
#include "roc_sndio/device_state.h"
18+
#include "roc_sndio/device_defs.h"
1919

2020
namespace roc {
2121
namespace pipeline {

src/internal_modules/roc_sndio/backend_dispatcher.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include "roc_core/noncopyable.h"
2121
#include "roc_core/scoped_ptr.h"
2222
#include "roc_core/string_list.h"
23-
#include "roc_sndio/device_type.h"
24-
#include "roc_sndio/driver.h"
23+
#include "roc_sndio/device_defs.h"
24+
#include "roc_sndio/driver_defs.h"
2525
#include "roc_sndio/ibackend.h"
2626
#include "roc_sndio/isink.h"
2727
#include "roc_sndio/isource.h"

src/internal_modules/roc_sndio/backend_map.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "roc_core/noncopyable.h"
1616
#include "roc_core/optional.h"
1717
#include "roc_core/singleton.h"
18-
#include "roc_sndio/driver.h"
18+
#include "roc_sndio/driver_defs.h"
1919
#include "roc_sndio/ibackend.h"
2020

2121
#ifdef ROC_TARGET_PULSEAUDIO

src/internal_modules/roc_sndio/device_state.cpp renamed to src/internal_modules/roc_sndio/device_defs.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,23 @@
66
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
77
*/
88

9-
#include "roc_sndio/device_state.h"
9+
#include "roc_sndio/device_defs.h"
1010

1111
namespace roc {
1212
namespace sndio {
1313

14+
const char* device_type_to_str(DeviceType type) {
15+
switch (type) {
16+
case DeviceType_Sink:
17+
return "sink";
18+
19+
case DeviceType_Source:
20+
return "source";
21+
}
22+
23+
return "<invalid>";
24+
}
25+
1426
const char* device_state_to_str(DeviceState state) {
1527
switch (state) {
1628
case DeviceState_Active:
@@ -27,9 +39,6 @@ const char* device_state_to_str(DeviceState state) {
2739

2840
case DeviceState_Closed:
2941
return "closed";
30-
31-
default:
32-
break;
3342
}
3443

3544
return "<invalid>";

src/internal_modules/roc_sndio/device_state.h renamed to src/internal_modules/roc_sndio/device_defs.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,21 @@
66
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
77
*/
88

9-
//! @file roc_sndio/device_state.h
10-
//! @brief Device state.
9+
//! @file roc_sndio/device_defs.h
10+
//! @brief Device definitions.
1111

12-
#ifndef ROC_SNDIO_DEVICE_STATE_H_
13-
#define ROC_SNDIO_DEVICE_STATE_H_
12+
#ifndef ROC_SNDIO_DEVICE_DEFS_H_
13+
#define ROC_SNDIO_DEVICE_DEFS_H_
1414

1515
namespace roc {
1616
namespace sndio {
1717

18+
//! Device type.
19+
enum DeviceType {
20+
DeviceType_Sink, //!< Sink.
21+
DeviceType_Source //!< Source.
22+
};
23+
1824
//! Device state.
1925
enum DeviceState {
2026
//! Device is running and active.
@@ -38,10 +44,13 @@ enum DeviceState {
3844
DeviceState_Closed = (1 << 4)
3945
};
4046

47+
//! Convert device type to string.
48+
const char* device_type_to_str(DeviceType type);
49+
4150
//! Convert device state to string.
4251
const char* device_state_to_str(DeviceState state);
4352

4453
} // namespace sndio
4554
} // namespace roc
4655

47-
#endif // ROC_SNDIO_DEVICE_STATE_H_
56+
#endif // ROC_SNDIO_DEVICE_DEFS_H_

src/internal_modules/roc_sndio/device_type.cpp

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/internal_modules/roc_sndio/device_type.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/internal_modules/roc_sndio/driver.h renamed to src/internal_modules/roc_sndio/driver_defs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
77
*/
88

9-
//! @file roc_sndio/driver.h
10-
//! @brief Driver information.
9+
//! @file roc_sndio/driver_defs.h
10+
//! @brief Driver definitions.
1111

12-
#ifndef ROC_SNDIO_DRIVER_H_
13-
#define ROC_SNDIO_DRIVER_H_
12+
#ifndef ROC_SNDIO_DRIVER_DEFS_H_
13+
#define ROC_SNDIO_DRIVER_DEFS_H_
1414

1515
#include "roc_core/panic.h"
1616
#include "roc_core/stddefs.h"
@@ -115,4 +115,4 @@ struct FormatInfo {
115115
} // namespace sndio
116116
} // namespace roc
117117

118-
#endif // ROC_SNDIO_DRIVER_H_
118+
#endif // ROC_SNDIO_DRIVER_DEFS_H_

src/internal_modules/roc_sndio/ibackend.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#include "roc_core/attributes.h"
1818
#include "roc_core/iarena.h"
1919
#include "roc_core/string_list.h"
20-
#include "roc_sndio/device_type.h"
21-
#include "roc_sndio/driver.h"
20+
#include "roc_sndio/device_defs.h"
21+
#include "roc_sndio/driver_defs.h"
2222
#include "roc_sndio/idevice.h"
2323
#include "roc_sndio/io_config.h"
2424
#include "roc_status/status_code.h"

src/internal_modules/roc_sndio/idevice.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
#include "roc_core/attributes.h"
1717
#include "roc_core/stddefs.h"
1818
#include "roc_core/time.h"
19-
#include "roc_sndio/device_state.h"
20-
#include "roc_sndio/device_type.h"
19+
#include "roc_sndio/device_defs.h"
2120
#include "roc_status/status_code.h"
2221

2322
namespace roc {

0 commit comments

Comments
 (0)