Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-3.0-only
SDK ?= ../osos-lab/rvx-sdk
OUT ?= build
extensions := balance crossfeed dsp night-shift playback-log
extensions := balance crossfeed dsp night-shift playback-log progress-indicator

.PHONY: all $(extensions)
all: $(extensions)
Expand All @@ -16,6 +16,7 @@ check:
$(PYTHON) extensions/balance/tests/run.py "$(abspath $(SDK))"
$(PYTHON) extensions/crossfeed/tests/run.py "$(abspath $(SDK))"
$(PYTHON) extensions/dsp/tests/run.py "$(abspath $(SDK))"
$(PYTHON) extensions/progress-indicator/tests/run.py "$(abspath $(SDK))"
@mkdir -p "$(OUT)"
$(CC) $(TEST_FLAGS) extensions/night-shift/test.c -o "$(OUT)/test-night-shift"
"$(OUT)/test-night-shift"
Expand Down
5 changes: 4 additions & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Balance, Crossfeed, DSP and the Night Shift scheduling and gamma code are from
RevolaOS extensions, revision 36d197b180e55a304ea0468de4330c0d07fe715f.
Night Shift derives from kayboll’s RepriseOS work. Playback Log derives from
the work of brilliant-alien and lgreitis in osos-lab. Its Settings artwork is
from osos-lab commit 10485fa. The original RevolaOS notice follows.
from osos-lab commit 10485fa. Progress Indicator is from RevolaOS extensions,
revision 72562b52fe7e4074a3479caac86b84ec1d285966. Its catalog icon is a
Cupertino Icons glyph (MIT), see the LICENSE.cupertino-icons beside it. The
original RevolaOS notice follows.

RevolaOS
Copyright (C) 2026 The RevolaOS Authors. GPL-3.0-only.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ This repository hosts the source for these RepriseOS extensions and accepts prop
- [Night Shift](extensions/night-shift/) warms the display manually or automatically from sunset to sunrise.
- [Playback Log](extensions/playback-log/) records listening history for scrobbling and optional detailed reports.
- [Crossfeed](extensions/crossfeed/) blends a little of each stereo channel into the other for headphone listening. It uses the included [DSP library](extensions/dsp/).
- [Progress Indicator](extensions/progress-indicator/) shows a half-filled status circle for partially played podcasts and iTunes U items.

To add your extension to the catalog, open a PR following the [submission guide](catalog/README.md). Later releases are picked up automatically.
5 changes: 5 additions & 0 deletions catalog/sources.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ tag_prefix = "playback-log/v"
repo = "RepriseOS/repriseos-extensions"
path = "extensions/dsp"
tag_prefix = "dsp/v"

[progress-indicator]
repo = "RepriseOS/repriseos-extensions"
path = "extensions/progress-indicator"
tag_prefix = "progress-indicator/v"
3 changes: 3 additions & 0 deletions extensions/progress-indicator/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-3.0-only
main_SOURCES := main.c bitmap.c
include $(SDK)/rv.mk
9 changes: 9 additions & 0 deletions extensions/progress-indicator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Progress Indicator

Shows a half-filled status circle for partially played podcasts and iTunes U items in Apple's item lists, including an unfinished replay. Unplayed and completed items, group rows and All rows keep the stock look. The circle follows the saved resume position, or the live one while the item plays, and keeps the stock outline and colours.

| | |
|---|---|
| Default | on |
| Memory | image, plus 16 bytes per list model it has drawn in, freed with the model or on disable |
| Settings | none |
20 changes: 20 additions & 0 deletions extensions/progress-indicator/assets/LICENSE.cupertino-icons
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2016 Vladimir Kharlampidi

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions extensions/progress-indicator/bitmap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/* SPDX-License-Identifier: GPL-3.0-only */

#include "bitmap.h"
#include "osos-2.0.5.h"
#include <stddef.h>

enum {
icon_width = 13,
icon_height = 29,
palette_capacity = 70,
output_pixels = BMap_payload + 4 + palette_capacity * 4,
output_size = output_pixels + icon_width * icon_height,
};

/* Drawables borrow module-lifetime, word-aligned BMaps for each icon variant. */
static uint32_t half_icons[4][(output_size + 3) / 4];
static const uint16_t icon_sizes[] = {537, 597, 533, 593};
_Static_assert(sizeof half_icons[0] >= output_size, "Half-circle bitmap capacity");

/* Inner semicircle coverage, out of 64 samples per pixel. Rows start at y=0
* for video and y=10 for audio; columns start at x=6. The 23 partial pixels
* require at most 23 additional palette entries. */
static const uint8_t inner_coverage[9][5] = {
{12, 11, 0, 0, 0}, {48, 64, 49, 6, 0}, {48, 64, 64, 52, 1},
{48, 64, 64, 64, 19}, {48, 64, 64, 64, 32}, {48, 64, 64, 64, 26},
{48, 64, 64, 61, 6}, {48, 64, 63, 21, 0}, {30, 35, 10, 0, 0},
};

static uint32_t icon_word(const uint8_t *p)
{
return p[0] | (uint32_t)p[1] << 8 | (uint32_t)p[2] << 16 | (uint32_t)p[3] << 24;
}

/* Derive from the current themed pixels. Only the interior of the right half
* changes; the native antialiased outline and the video glyph stay intact. */
const void *progress_bitmap(const uint8_t *source, unsigned variant)
{
if (variant >= 4)
return NULL;
unsigned size = icon_sizes[variant];
if (!source || source[BMap_format] != BMapFormat_Indexed8 ||
source[BMap_format + 1] || source[BMap_stride] != icon_width ||
source[BMap_stride + 1] || source[BMap_depth] != 8 || source[BMap_depth + 1] ||
icon_word(source + BMap_bounds) || icon_word(source + BMap_bounds + 4) ||
icon_word(source + BMap_bounds + 8) != icon_height ||
icon_word(source + BMap_bounds + 12) != icon_width ||
icon_word(source + BMap_payload_bytes) != size - BMap_payload)
return NULL;
unsigned colors = icon_word(source + BMap_payload);
unsigned pixels = BMap_payload + 4 + colors * 4;
if (colors > 256 || pixels + 13 * 29 != size)
return NULL;
unsigned transparent = 0;
while (transparent < colors && source[BMap_payload + 4 + transparent * 4 + 3])
transparent++;
if (transparent == colors)
return NULL;

/* Validate before modifying storage that an earlier drawable may borrow.
* Each partially covered pixel can add at most one palette entry; fully
* cleared pixels use the existing transparent entry. */
enum { extra = 23 };

if (colors + extra > palette_capacity)
return NULL;
for (unsigned i = 0; i < icon_width * icon_height; i++)
if (source[pixels + i] >= colors)
return NULL;

uint8_t *image = (void *)half_icons[variant];
for (unsigned i = 0; i < output_pixels; i++)
image[i] = i < pixels ? source[i] : 0;
for (unsigned i = 0; i < icon_width * icon_height; i++)
image[output_pixels + i] = source[pixels + i];
half_icons[variant][BMap_payload_bytes / 4] = output_size - BMap_payload;
half_icons[variant][BMap_payload / 4] = palette_capacity;

unsigned top = variant < 2 ? 0 : 10;
unsigned used = colors;
for (unsigned y = 0; y < 9; y++) {
for (unsigned x = 0; x < 5; x++) {
unsigned clear = inner_coverage[y][x];
if (!clear)
continue;
unsigned pixel = output_pixels + (top + y) * icon_width + x + 6;
const uint8_t *color = source + BMap_payload + 4 + image[pixel] * 4;
unsigned alpha = (color[3] * (64 - clear) + 32) / 64;
if (!alpha) {
image[pixel] = transparent;
continue;
}
unsigned match = 0;
for (; match < used; match++) {
const uint8_t *candidate = image + BMap_payload + 4 + match * 4;
if (candidate[0] == color[0] && candidate[1] == color[1] &&
candidate[2] == color[2] && candidate[3] == alpha)
break;
}
if (match == used) {
uint8_t *added = image + BMap_payload + 4 + used++ * 4;
for (unsigned i = 0; i < 3; i++)
added[i] = color[i];
added[3] = alpha;
}
image[pixel] = match;
}
}
return image;
}

int progress_bitmap_owns(const void *payload)
{
for (unsigned i = 0; i < 4; i++)
if (payload == (const uint8_t *)half_icons[i] + BMap_payload)
return 1;
return 0;
}
8 changes: 8 additions & 0 deletions extensions/progress-indicator/bitmap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* SPDX-License-Identifier: GPL-3.0-only */
#ifndef PROGRESS_BITMAP_H
#define PROGRESS_BITMAP_H
#include <stdint.h>
/* Four word-aligned variants, borrowed until the next rebuild or unload. */
const void *progress_bitmap(const uint8_t *source, unsigned variant);
int progress_bitmap_owns(const void *payload);
#endif
7 changes: 7 additions & 0 deletions extensions/progress-indicator/listing.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
details = "Podcast and iTunes U lists show a half-filled circle next to an item you have started but not finished; unplayed items keep the full dot and finished ones none. The circle follows the saved position, or the live one while the item plays."

icon = "assets/settings-progress-indicator.png"

[[screenshots]]
file = "screenshots/podcast-list.png"
alt = "A podcast's episode list: a full dot before the unplayed episode, a half-filled circle before the partly played one and none before the finished one."
160 changes: 160 additions & 0 deletions extensions/progress-indicator/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/* SPDX-License-Identifier: GPL-3.0-only */

#include "bitmap.h"
#include "osos-2.0.5.h"
#include "rv_api.h"
#include "rv_media.h"
#include "rv_sites.h"
#include "rv_ui.h"
#include <stddef.h>

static const struct rv_api *api;
static rv_extension_handle self;
static int stopping;

/* The UI task owns models and this list. Both native destructor routes remove
* their model before its embedded bitmaps are destroyed. */
struct borrower {
struct borrower *next;
void *model;
const void *native[2];
};
static struct borrower *borrowers;

static void *icon_of(void *model, unsigned selected)
{
return (uint8_t *)model + (selected ? MediaListModel_selected_status_icon
: MediaListModel_status_icon);
}

/* Player locked. */
static int in_progress(struct MediaItem *item, void *player)
{
if (!rv_item_valid(item) ||
!rv_item_value(item, MediaItem_remembers_position_method))
return 0;
uint32_t start = rv_item_value(item, MediaItem_start_time_method);
uint32_t end = rv_item_value(item, MediaItem_stop_time_method);
if (!end)
end = rv_item_value(item, MediaItem_duration_method);
if (end <= start)
return 0;
uint32_t position = rv_item_value(item, MediaItem_bookmark_method);
if (RV_FIELD(player, MediaPlayer_current_track, void *))
rv_player_position_of(player, item, &position);
return position > start && position < end;
}

static struct borrower *remember(void *model)
{
for (struct borrower *b = borrowers; b; b = b->next)
if (b->model == model)
return b;
struct borrower *b = api->alloc(self, sizeof *b);
if (b) {
*b = (struct borrower){.next = borrowers, .model = model};
borrowers = b;
}
return b;
}

static uint32_t destroy(uintptr_t model, const void *next)
{
for (struct borrower **link = &borrowers; *link; link = &(*link)->next) {
struct borrower *b = *link;
if (b->model == (void *)model) {
*link = b->next;
api->free(self, b);
break;
}
}
return api->hook_next(next, model, 0, 0, 0, 0, 0);
}

static uint32_t property(uintptr_t model_address, uint32_t type, uint32_t property,
uint32_t row, const void *next, uintptr_t *out)
{
uint32_t handled =
api->hook_next(next, model_address, type, property, row, (uintptr_t)out, 0);
if (!handled || stopping || type != Property_Drawable || (int32_t)row < 0 ||
(property != Property_PodcastStatus &&
property != Property_PodcastStatusSelected &&
property != Property_ITunesUStatus &&
property != Property_ITunesUStatusSelected))
return handled;
void *model = (void *)model_address;
if (RV_FIELD(model, MediaListModel_all_row, uint8_t)) {
if (!row)
return handled;
row--;
}
void *player = MediaPlayer_GetInstance();
void *source = LibraryModelRef_Get((uint8_t *)model + MediaListModel_source);
if (!player || !source)
return handled;
uint32_t storage[MediaItem_bytes / 4];
struct MediaItem *item = (void *)storage;
Mutex_Lock((uint8_t *)player + MediaPlayer_mutex);
rv_model_item(source, (int32_t)row, item);
int partial = in_progress(item, player);
int video = partial && MediaItem_HasKind8062(item);
MediaItem_Destroy(item);
Mutex_Unlock((uint8_t *)player + MediaPlayer_mutex);
if (!partial)
return handled;
unsigned selected = property == Property_PodcastStatusSelected ||
property == Property_ITunesUStatusSelected;
unsigned variant = (video ? 0 : 2) + (selected ? 0 : 1);
const void *native = ResourceService_GetBitmap(
UI_GetResourceService(), RES_MediaStatus_VideoSelected_Bitmap + variant);
const void *bitmap = progress_bitmap(native, variant);
if (!bitmap)
return handled;
void *icon = icon_of(model, selected);
const uint8_t *payload = RV_FIELD(icon, Bitmap_pixels, const uint8_t *);
if (!payload || progress_bitmap_owns(payload) ||
RV_FIELD(icon, Bitmap_owns_pixels, uint8_t))
return handled;
struct borrower *b = remember(model);
if (!b)
return handled;
/* Preserve the native glyph, including its empty state during a replay. */
b->native[selected] = payload - BMap_payload;
Bitmap_LoadResource(icon, bitmap, 0, 0);
*out = (uintptr_t)icon;
return handled;
}

static void unload(void)
{
stopping = 1;
while (borrowers) {
struct borrower *b = borrowers;
borrowers = b->next;
for (unsigned selected = 0; selected < 2; selected++) {
void *icon = icon_of(b->model, selected);
if (progress_bitmap_owns(RV_FIELD(icon, Bitmap_pixels, const void *)))
Bitmap_LoadResource(icon, b->native[selected], 0, 0);
}
api->free(self, b);
}
}

static const struct rv_hook hooks[] = {
RV_HOOK_FILTER(RV_SITE_MediaListModel_IndexedProperty_slot, property),
RV_HOOK_FILTER(RV_SITE_MediaListModel_Destroy_slot, destroy),
RV_HOOK_FILTER(RV_SITE_MediaListModel_Destroy_call, destroy),
};
static const struct rv_descriptor descriptor = {
.size = sizeof descriptor,
RV_HOOKS(hooks),
.unload = unload,
};

const struct rv_descriptor *rv_module_entry(const struct rv_api *core,
rv_extension_handle handle)
{
api = core;
self = handle;
return &descriptor;
}
13 changes: 13 additions & 0 deletions extensions/progress-indicator/manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
id = "progress-indicator"
name = "Progress Indicator"
description = "Show half-filled status circles for partially played podcasts and iTunes U items."
version = "0.1.0"
author = "RevolaOS"
license = "GPL-3.0-only"
api = "1.82"
stability = "beta"
category = "media"

[[module]]
name = "main"
trigger = "always"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading