Skip to content

Commit 90113ae

Browse files
jimmy-rubin-workJimmy Rubin
authored andcommitted
vdoencodeclient: Use the vdo_frame_take_chunk api
Co-authored-by: Jimmy Rubin <jimmyrn@axis.com>
1 parent 4de3a0c commit 90113ae

3 files changed

Lines changed: 26 additions & 12 deletions

File tree

.github/workflows/vdostream.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
axis-os: ["12.9.57"]
15+
axis-os: ["12.10.68"]
1616
arch: ["armv7hf", "aarch64"]
1717
vdo-format: ["h264", "h265", "y800", "jpeg", "nv12"]
1818
include:
19-
- axis-os: "12.9.57"
19+
- axis-os: "12.10.68"
2020
arch: "aarch64"
2121
vdo-format: "avif"
2222
chip: "artpec9"
23-
- axis-os: "12.9.57"
23+
- axis-os: "12.10.68"
2424
arch: "aarch64"
2525
vdo-format: "av1"
2626
chip: "artpec9"
27-
- axis-os: "12.9.57"
27+
- axis-os: "12.10.68"
2828
arch: "aarch64"
2929
vdo-format: "rgb"
3030
chip: "artpec9"
31-
- axis-os: "12.9.57"
31+
- axis-os: "12.10.68"
3232
arch: "aarch64"
3333
vdo-format: "rgb"
3434
chip: "cv25"

vdostream/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG ARCH=armv7hf
2-
ARG VERSION=12.9.0
2+
ARG VERSION=12.10.0
33
ARG UBUNTU_VERSION=24.04
44
ARG REPO=axisecp
55
ARG SDK=acap-native-sdk

vdostream/app/vdoencodeclient.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
// Needed for g_autoptr
5959
#include <glib-object.h>
6060
#include <signal.h>
61+
#include <stdbool.h>
6162
#include <stdlib.h>
6263
#include <syslog.h>
6364

@@ -135,20 +136,33 @@ static void set_format(VdoMap* settings, gchar* format) {
135136
} else {
136137
panic("%s: Format \"%s\" is not supported\n", __func__, format);
137138
}
139+
vdo_map_set_boolean(settings, "frame.chunks", true);
138140
}
139141

140142
static void save_frame_to_file(VdoBuffer* buffer, FILE* dest_f) {
143+
g_autoptr(GError) error = NULL;
141144
// Lifetimes of buffer and frame are linked, no need to free frame
142145
VdoFrame* frame = vdo_buffer_get_frame(buffer);
143146

144147
print_frame(frame);
145148

146-
gpointer data = vdo_buffer_get_data(buffer);
147-
if (!data)
148-
panic("%s: Failed to get data: %m", __func__);
149-
150-
if (!fwrite(data, vdo_frame_get_size(frame), 1, dest_f))
151-
panic("%s: Failed to write frame: %m", __func__);
149+
if (vdo_buffer_is_contiguous(frame)) {
150+
VdoChunk chunk = vdo_frame_take_chunk(frame, &error);
151+
if (chunk.type == VDO_CHUNK_ERROR)
152+
panic("%s: Failed to get chunk: %m", __func__);
153+
if (!fwrite(chunk.data, chunk.size, 1, dest_f))
154+
panic("%s: Failed to write frame: %m", __func__);
155+
} else {
156+
while (true) {
157+
VdoChunk chunk = vdo_frame_take_chunk(frame, &error);
158+
if (chunk.type == VDO_CHUNK_ERROR)
159+
panic("%s: Failed to get chunk: %m", __func__);
160+
if (chunk.size == 0u)
161+
break;
162+
if (!fwrite(chunk.data, chunk.size, 1, dest_f))
163+
panic("%s: Failed to write frame: %m", __func__);
164+
}
165+
}
152166
}
153167

154168
static int handle_vdo_failed(GError* error) {

0 commit comments

Comments
 (0)