From c8080a4fb3385d0547c81d1dea2ec50fa30e9a3f Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Thu, 16 Nov 2023 10:58:29 +0100 Subject: [PATCH] Reed-Solomon: pretty-print help - use bold to highlight - unindent options --- src/rtp/rs.cpp | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/rtp/rs.cpp b/src/rtp/rs.cpp index 904b68f88..a6bd74774 100644 --- a/src/rtp/rs.cpp +++ b/src/rtp/rs.cpp @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2013-2021 CESNET, z. s. p. o. + * Copyright (c) 2013-2023 CESNET, z. s. p. o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,21 +35,16 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#include "config_unix.h" -#include "config_win32.h" -#endif #include -#include +#include +#include +#include #include "debug.h" #include "rtp/rs.h" -#include "rtp/rtp_callback.h" -#include "transmit.h" #include "ug_runtime_error.hpp" -#include "video.h" +#include "utils/color_out.h" #define DEFAULT_K 200 #define DEFAULT_N 240 @@ -68,7 +63,7 @@ extern "C" { static void usage(); -using namespace std; +using std::shared_ptr; /** * Constructs RS state. Since this constructor is currently used only for the decoder, @@ -412,12 +407,14 @@ bool rs::decode(char *in, int in_len, char **out, int *len, } static void usage() { - printf("RS usage:\n" - "\t-f rs[::]\n" - "\n" - "\t\t - block length (default %d, max %d)\n" - "\t\t - length of block + parity (default %d, max %d)\n\t\t\tmust be > \n" - "\n", - DEFAULT_K, MAX_K, DEFAULT_N, MAX_N); + color_printf(TBOLD("Reed-Solomon") " usage:\n"); + color_printf("\t" TBOLD(TRED("-f rs") "[::]") "\n"); + color_printf("\nwhere:\n"); + color_printf("\t" TBOLD("") " - block length (default " + TBOLD("%d") ", max %d)\n" + "\t" TBOLD("") " - length of block + parity " + "(default " TBOLD("%d") ", max %d),\n" + "\t\t\tmust be > \n\n", + DEFAULT_K, MAX_K, DEFAULT_N, MAX_N); }