From a6ae1d2fb30551570bd2fee094e1eb9e5c632afe Mon Sep 17 00:00:00 2001 From: Oneric Date: Sat, 7 May 2022 01:45:57 +0200 Subject: profile, test: set storage size before rendering As programs provided with the library's source code they also serve as examples for how to correctly use the API, which usually means setting a storage size. compare already sets the storage size. profile can continue using a fixed size, it never outputs the rendering. test already had issues before if either the guessed storage size was incorrect or the frame size didn't match the intended aspect ratio. To fix both, add new optional arguments for storage and frame size. --- profile/profile.c | 1 + test/test.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/profile/profile.c b/profile/profile.c index b89d10b..3740a6c 100644 --- a/profile/profile.c +++ b/profile/profile.c @@ -57,6 +57,7 @@ static void init(int frame_w, int frame_h) exit(1); } + ass_set_storage_size(ass_renderer, frame_w, frame_h); ass_set_frame_size(ass_renderer, frame_w, frame_h); ass_set_fonts(ass_renderer, NULL, "Sans", 1, NULL, 1); } diff --git a/test/test.c b/test/test.c index b099a9a..f1de28f 100644 --- a/test/test.c +++ b/test/test.c @@ -107,6 +107,7 @@ static void init(int frame_w, int frame_h) exit(1); } + ass_set_storage_size(ass_renderer, frame_w, frame_h); ass_set_frame_size(ass_renderer, frame_w, frame_h); ass_set_fonts(ass_renderer, NULL, "sans-serif", ASS_FONTPROVIDER_AUTODETECT, NULL, 1); @@ -192,16 +193,26 @@ static void print_font_providers(ASS_Library *ass_library) int main(int argc, char *argv[]) { - const int frame_w = 1280; - const int frame_h = 720; + int frame_w = 1280; + int frame_h = 720; - if (argc < 4) { - printf("usage: %s