From 3ba7ba81661fe8590f35aeaea77a9541112a5472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mangano-Tarumi?= Date: Sat, 3 Nov 2018 17:22:31 -0400 Subject: [PATCH] create ogg.cc for libogg helpers --- CMakeLists.txt | 1 + src/ogg.cc | 12 ++++++++++++ src/opustags.cc | 8 -------- src/opustags.h | 7 +++++++ 4 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 src/ogg.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 26f6ed6..82263d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable( opustags + src/ogg.cc src/opus.cc src/opustags.cc ) diff --git a/src/ogg.cc b/src/ogg.cc new file mode 100644 index 0000000..2b67e4e --- /dev/null +++ b/src/ogg.cc @@ -0,0 +1,12 @@ +#include "opustags.h" + +#include + +int ot::write_page(ogg_page *og, FILE *stream) +{ + if((ssize_t) fwrite(og->header, 1, og->header_len, stream) < og->header_len) + return -1; + if((ssize_t) fwrite(og->body, 1, og->body_len, stream) < og->body_len) + return -1; + return 0; +} diff --git a/src/opustags.cc b/src/opustags.cc index b9bcaa5..f3ecd77 100644 --- a/src/opustags.cc +++ b/src/opustags.cc @@ -13,14 +13,6 @@ using namespace ot; -int write_page(ogg_page *og, FILE *stream){ - if((ssize_t) fwrite(og->header, 1, og->header_len, stream) < og->header_len) - return -1; - if((ssize_t) fwrite(og->body, 1, og->body_len, stream) < og->body_len) - return -1; - return 0; -} - const char *version = PROJECT_NAME " version " PROJECT_VERSION "\n"; const char *usage = diff --git a/src/opustags.h b/src/opustags.h index c64fe86..5e82693 100644 --- a/src/opustags.h +++ b/src/opustags.h @@ -4,6 +4,7 @@ */ #include +#include #include namespace ot { @@ -11,8 +12,14 @@ namespace ot { /** * \defgroup ogg Ogg * \brief Helpers to work with libogg. + * + * \{ */ +int write_page(ogg_page *og, FILE *stream); + +/** \} */ + /** * \defgroup opus Opus * \brief Opus packet decoding and recoding.