Skip to content

Commit

Permalink
Merge branch 'rsp_daap_format3'
Browse files Browse the repository at this point in the history
  • Loading branch information
ejurgensen committed Jun 17, 2024
2 parents c30f44f + 7dd3479 commit 4cbce79
Show file tree
Hide file tree
Showing 37 changed files with 2,122 additions and 934 deletions.
17 changes: 14 additions & 3 deletions docs/json-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ GET /api/outputs
| requires_auth | boolean | `true` if output requires authentication |
| needs_auth_key | boolean | `true` if output requires an authorization key (device verification) |
| volume | integer | Volume in percent (0 - 100) |
| format | string | Stream format |
| supported_formats | array | Array of formats supported by output |

**Example**

Expand All @@ -359,7 +361,9 @@ curl -X GET "http://localhost:3689/api/outputs"
"has_password": false,
"requires_auth": false,
"needs_auth_key": false,
"volume": 0
"volume": 0,
"format": "alac",
"supported_formats": [ "alac" ]
},
{
"id": "0",
Expand All @@ -369,7 +373,9 @@ curl -X GET "http://localhost:3689/api/outputs"
"has_password": false,
"requires_auth": false,
"needs_auth_key": false,
"volume": 19
"volume": 19,
"format": "pcm",
"supported_formats": [ "pcm" ]
},
{
"id": "100",
Expand All @@ -379,7 +385,9 @@ curl -X GET "http://localhost:3689/api/outputs"
"has_password": false,
"requires_auth": false,
"needs_auth_key": false,
"volume": 0
"volume": 0,
"format": "pcm",
"supported_formats": [ "pcm" ]
}
]
}
Expand Down Expand Up @@ -448,6 +456,8 @@ curl -X GET "http://localhost:3689/api/outputs/0"
"requires_auth": false,
"needs_auth_key": false,
"volume": 3
"format": "pcm",
"supported_formats": [ "pcm" ]
}
```

Expand All @@ -474,6 +484,7 @@ PUT /api/outputs/{id}
| selected | boolean | *(Optional)* `true` to enable and `false` to disable the output |
| volume | integer | *(Optional)* Volume in percent (0 - 100) |
| pin | string | *(Optional)* PIN for device verification |
| format | string | *(Optional)* Stream format |

**Response**

Expand Down
26 changes: 16 additions & 10 deletions owntone.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ general {
# IP addresses.
# bind_address = "::"

# Location of cache database
# cache_path = "@localstatedir@/cache/@PACKAGE@/cache.db"
# Directory where the server keeps cached data
# cache_dir = "@localstatedir@/cache/@PACKAGE@"

# DAAP requests that take longer than this threshold (in msec) get their
# replies cached for next time. Set to 0 to disable caching.
Expand Down Expand Up @@ -187,19 +187,25 @@ library {
# Should we import the content of iTunes smart playlists?
# itunes_smartpl = false

# Decoding options for DAAP and RSP clients
# Transcoding options for DAAP and RSP clients
# Since iTunes has native support for mpeg, mp4a, mp4v, alac and wav,
# such files will be sent as they are. Any other formats will be decoded
# to raw wav. If OwnTone detects a non-iTunes DAAP client, it is
# assumed to only support mpeg and wav, other formats will be decoded.
# Here you can change when to decode. Note that these settings only
# affect serving media to DAAP and RSP clients, they have no effect on
# such files will be sent as they are. Any other formats will be
# transcoded. Some other clients, including Roku/RSP, announce what
# formats they support, and the server will transcode to one of those if
# necessary. Clients that don't announce supported formats are assumed
# to support mpeg (mp3), wav and alac.
# Here you can change when and how to transcode. The settings *only*
# affect serving audio to DAAP and RSP clients, they have no effect on
# direct AirPlay, Chromecast and local audio playback.
# Formats: mp4a, mp4v, mpeg, alac, flac, mpc, ogg, wma, wmal, wmav, aif, wav
# Formats that should never be decoded
# Formats that should never be transcoded
# no_decode = { "format", "format" }
# Formats that should always be decoded
# Formats that should always be transcoded
# force_decode = { "format", "format" }
# Prefer transcode to wav (default), alac or mpeg (mp3 with the bit rate
# configured below in the streaming section). Note that alac requires
# precomputing and caching mp4 headers, which takes both cpu and disk.
# prefer_format = "format"

# Set ffmpeg filters (similar to 'ffmpeg -af xxx') that you want the
# server to use when decoding files from your library. Examples:
Expand Down
21 changes: 15 additions & 6 deletions src/artwork.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,8 @@ size_calculate(int *dst_w, int *dst_h, int src_w, int src_h, int max_w, int max_
static int
artwork_get(struct evbuffer *evbuf, char *path, struct evbuffer *in_buf, bool is_embedded, enum data_kind data_kind, struct artwork_req_params req_params)
{
struct transcode_decode_setup_args xcode_decode_args = { .profile = XCODE_JPEG }; // Covers XCODE_PNG too
struct transcode_encode_setup_args xcode_encode_args = { 0 };
struct decode_ctx *xcode_decode = NULL;
struct encode_ctx *xcode_encode = NULL;
struct transcode_evbuf_io xcode_evbuf_io = { 0 };
Expand Down Expand Up @@ -637,13 +639,16 @@ artwork_get(struct evbuffer *evbuf, char *path, struct evbuffer *in_buf, bool is
}

xcode_evbuf_io.evbuf = xcode_buf;
xcode_decode = transcode_decode_setup(XCODE_JPEG, NULL, data_kind, NULL, &xcode_evbuf_io, 0); // Covers XCODE_PNG too
xcode_decode_args.evbuf_io = &xcode_evbuf_io;
xcode_decode_args.is_http = (data_kind == DATA_KIND_HTTP);
}
else
{
xcode_decode = transcode_decode_setup(XCODE_JPEG, NULL, data_kind, path, NULL, 0); // Covers XCODE_PNG too
xcode_decode_args.path = path;
xcode_decode_args.is_http = (data_kind == DATA_KIND_HTTP);
}

xcode_decode = transcode_decode_setup(xcode_decode_args);
if (!xcode_decode)
{
if (path)
Expand Down Expand Up @@ -702,15 +707,19 @@ artwork_get(struct evbuffer *evbuf, char *path, struct evbuffer *in_buf, bool is
goto out;
}

xcode_encode_args.src_ctx = xcode_decode;
xcode_encode_args.width = dst_width;
xcode_encode_args.height = dst_height;
if (dst_format == ART_FMT_JPEG)
xcode_encode = transcode_encode_setup(XCODE_JPEG, NULL, xcode_decode, dst_width, dst_height);
xcode_encode_args.profile = XCODE_JPEG;
else if (dst_format == ART_FMT_PNG)
xcode_encode = transcode_encode_setup(XCODE_PNG, NULL, xcode_decode, dst_width, dst_height);
xcode_encode_args.profile = XCODE_PNG;
else if (dst_format == ART_FMT_VP8)
xcode_encode = transcode_encode_setup(XCODE_VP8, NULL, xcode_decode, dst_width, dst_height);
xcode_encode_args.profile = XCODE_VP8;
else
xcode_encode = transcode_encode_setup(XCODE_JPEG, NULL, xcode_decode, dst_width, dst_height);
xcode_encode_args.profile = XCODE_JPEG;

xcode_encode = transcode_encode_setup(xcode_encode_args);
if (!xcode_encode)
{
if (path)
Expand Down
Loading

0 comments on commit 4cbce79

Please sign in to comment.