Skip to content

Commit

Permalink
[CHORE] Prettify ZSTD compression logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nots1dd committed Feb 24, 2025
1 parent a007dae commit fb6e4f4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ extern "C"
#endif

#define HEADER_FUNCTION static UNUSED_ATTR

constexpr double bytes_to_mib(std::size_t bytes) {
return static_cast<double>(bytes) / (1024 * 1024);
}

/*
* Define the returned error code from utility functions.
Expand Down
4 changes: 2 additions & 2 deletions include/compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ static void printTotalSizeComparison(size_t totalOriginalSize, size_t totalCompr
double reduction = (1.0 - ((double)totalCompressedSize / (double)totalOriginalSize)) * 100.0;

printf("--------------- ZSTD Total Compression Statistics ---------------\n");
printf("> Original size: %u bytes\n", (unsigned)totalOriginalSize);
printf("> Compressed size: %u bytes\n", (unsigned)totalCompressedSize);
printf("> Original size: %.3f MiB\n", bytes_to_mib((unsigned)totalOriginalSize));
printf("> Compressed size: %.3f MiB\n", bytes_to_mib((unsigned)totalCompressedSize));
printf("> Total reduction: %.2f%%\n", reduction);
printf("--------------- ZSTD Total Compression Statistics ---------------\n");
}
Expand Down
2 changes: 1 addition & 1 deletion include/decompression.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ extern "C"
}

fclose(outFile);
printf("Successfully decompressed: %s -> %s\n", fname, outputFilename);
/*printf("Successfully decompressed: %s -> %s\n", fname, outputFilename);*/

// Clean up and free memory
free(rBuff);
Expand Down
5 changes: 1 addition & 4 deletions include/encode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ class HLS_Encoder
*
* This constructor initializes the FFmpeg network stack and sets the log level for debugging.
*/
HLS_Encoder()
{
avformat_network_init();
}
HLS_Encoder() { avformat_network_init(); }

/**
* @brief Cleans up resources and deinitializes FFmpeg network stack.
Expand Down
1 change: 1 addition & 0 deletions include/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
X(PLAYLIST_GLOBAL_HEADER, "#EXTM3U") \
X(MASTER_PLAYLIST, "index.m3u8") \
X(TRANSPORT_STREAM_EXT, ".ts") \
X(MP4_FILE_EXT, ".mp4") \
X(M4S_FILE_EXT, ".m4s") \
X(ZSTD_FILE_EXT, "zst") \
X(COMPRESSED_ARCHIVE_EXT, ".tar.gz") \
Expand Down

0 comments on commit fb6e4f4

Please sign in to comment.