Skip to content

Commit c8dd0c2

Browse files
[#46] Extract CD/SACD (ISO)
1 parent 7b2b0cf commit c8dd0c2

31 files changed

Lines changed: 4777 additions & 199 deletions

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ else()
9999
message(FATAL_ERROR "gtk3 needed")
100100
endif()
101101

102+
pkg_check_modules(CDIO REQUIRED libcdio)
103+
if (CDIO_FOUND)
104+
message(STATUS "libcdio found")
105+
else()
106+
message(FATAL_ERROR "libcdio needed")
107+
endif()
108+
102109
find_package(Rst2man)
103110
if (RST2MAN_FOUND)
104111
message(STATUS "rst2man found")

doc/CLI.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Options:
1919
-I, --sample-configuration Generate a sample configuration
2020
-i, --interactive Text UI mode
2121
-m, --metadata Display metadata of the files
22+
-e, --extract Extract ISO file
2223
-s, --status Status of the devices
2324
--dop Use DSD over PCM
2425
-q, --quiet Quiet the player
@@ -97,6 +98,22 @@ Display metadata information about the files
9798
hrmp -m
9899
```
99100

101+
## -e
102+
103+
Extract supported disc images or devices instead of playing them.
104+
105+
Currently this mode accepts:
106+
107+
* device paths under `/dev/...` for Red Book extraction
108+
* `.iso` files for Scarlet Book extraction
109+
110+
Any other input is rejected as unsupported.
111+
112+
```sh
113+
hrmp -e /dev/sr0
114+
hrmp -e my-disc.iso
115+
```
116+
100117
## -s
101118

102119
Show the status of the configured devices

doc/GETTING_STARTED.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Options:
2020
-I, --sample-configuration Generate a sample configuration
2121
-i, --interactive Text UI mode
2222
-m, --metadata Display metadata of the files
23+
-e, --extract Extract ISO file
2324
-s, --status Status of the devices
2425
--dop Use DSD over PCM
2526
-q, --quiet Quiet the player

doc/man/hrmp.1.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ OPTIONS
4545
-m, --metadata
4646
Display metadata of the files
4747

48+
-e, --extract
49+
Extract supported disc devices or ``.iso`` files instead of playing them
50+
4851
-s, --status
4952
Status of the devices
5053

doc/manual/04-getting_started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Options:
2222
-I, --sample-configuration Generate a sample configuration
2323
-i, --interactive Text UI mode
2424
-m, --metadata Display metadata of the files
25+
-e, --extract Extract ISO file
2526
-s, --status Status of the devices
2627
--dop Use DSD over PCM
2728
-q, --quiet Quiet the player

doc/manual/05-cli.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Options:
2121
-I, --sample-configuration Generate a sample configuration
2222
-i, --interactive Text UI mode
2323
-m, --metadata Display metadata of the files
24+
-e, --extract Extract ISO file
2425
-s, --status Status of the devices
2526
--dop Use DSD over PCM
2627
-q, --quiet Quiet the player
@@ -99,6 +100,22 @@ Display metadata information about the files
99100
hrmp -m
100101
```
101102

103+
## -e
104+
105+
Extract supported disc images or devices instead of playing them.
106+
107+
Currently this mode accepts:
108+
109+
* device paths under `/dev/...` for Red Book extraction
110+
* `.iso` files for Scarlet Book extraction
111+
112+
Any other input is rejected as unsupported.
113+
114+
```sh
115+
hrmp -e /dev/sr0
116+
hrmp -e my-disc.iso
117+
```
118+
102119
## -s
103120

104121
Show the status of the configured devices

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ include_directories(
2323
${LIBSNDFILE_INCLUDE_DIR}
2424
${OPUS_INCLUDE_DIRS}
2525
${FAAD2_INCLUDE_DIRS}
26+
${CDIO_INCLUDE_DIRS}
2627
)
2728

2829
#
@@ -34,6 +35,7 @@ link_libraries(
3435
${LIBSNDFILE_LIBRARY}
3536
${OPUS_LIBRARIES}
3637
${FAAD2_LIBRARIES}
38+
${CDIO_LIBRARIES}
3739
)
3840

3941
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")

src/include/extract.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (C) 2026 The HighResMusicPlayer community
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
#ifndef HRMP_EXTRACT_H
19+
#define HRMP_EXTRACT_H
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
#include <hrmp.h>
26+
27+
#include <stdbool.h>
28+
#include <stddef.h>
29+
#include <stdlib.h>
30+
31+
/**
32+
* Extract a device or a file
33+
* @param d The device
34+
* @return 0 upon success, otherwise 1
35+
*/
36+
int
37+
hrmp_extract(char* d);
38+
39+
#ifdef __cplusplus
40+
}
41+
#endif
42+
43+
#endif

src/include/hrmp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ extern "C" {
4343
#define UPDATE_PROCESS_TITLE_MINIMAL 2
4444
#define UPDATE_PROCESS_TITLE_VERBOSE 3
4545

46-
#define HRMP_CACHE_FILES_OFF 0
47-
#define HRMP_CACHE_FILES_MINIMAL 1
48-
#define HRMP_CACHE_FILES_ALL 2
46+
#define HRMP_CACHE_FILES_OFF 0
47+
#define HRMP_CACHE_FILES_MINIMAL 1
48+
#define HRMP_CACHE_FILES_ALL 2
4949

5050
#define DEFAULT_BUFFER_SIZE 131072
5151
#define ALIGNMENT_SIZE 512

src/include/redbook.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (C) 2026 The HighResMusicPlayer community
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
#ifndef HRMP_REDBOOK_H
19+
#define HRMP_REDBOOK_H
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
#include <hrmp.h>
26+
27+
#include <stdbool.h>
28+
#include <stddef.h>
29+
#include <stdlib.h>
30+
31+
/**
32+
* Extract a device
33+
* @param d The device
34+
* @return 0 upon success, otherwise 1
35+
*/
36+
int
37+
hrmp_extract_redbook(char* d);
38+
39+
#ifdef __cplusplus
40+
}
41+
#endif
42+
43+
#endif

0 commit comments

Comments
 (0)