create ogg.cc for libogg helpers

This commit is contained in:
Frédéric Mangano-Tarumi 2018-11-03 17:22:31 -04:00
parent 3c0aad169b
commit 3ba7ba8166
4 changed files with 20 additions and 8 deletions

View File

@ -17,6 +17,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(
opustags
src/ogg.cc
src/opus.cc
src/opustags.cc
)

12
src/ogg.cc Normal file
View File

@ -0,0 +1,12 @@
#include "opustags.h"
#include <cstdio>
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;
}

View File

@ -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 =

View File

@ -4,6 +4,7 @@
*/
#include <cstdint>
#include <cstdio>
#include <ogg/ogg.h>
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.