forked from roc-streaming/roc-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
roc-streaminggh-608 Rework pcm format helpers
- Loading branch information
Showing
38 changed files
with
3,602 additions
and
2,386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
src/internal_modules/roc_audio/pcm_mapper_func.h | ||
src/internal_modules/roc_audio/pcm_funcs.h | ||
src/internal_modules/roc_core/target_libatomic_ops/roc_core/atomic_ops.h | ||
src/tests/roc_audio/test_samples/*.h | ||
src/tests/roc_rtp/test_packets/*.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2023 Roc Streaming authors | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
#include "roc_audio/pcm_format.h" | ||
#include "roc_audio/pcm_funcs.h" | ||
#include "roc_core/panic.h" | ||
|
||
namespace roc { | ||
namespace audio { | ||
|
||
const char* pcm_format_to_str(const PcmFormat& fmt) { | ||
return pcm_to_str(fmt.code, fmt.endian); | ||
} | ||
|
||
bool pcm_format_parse(const char* str, PcmFormat& fmt) { | ||
if (!str) { | ||
roc_panic("pcm: string is null"); | ||
} | ||
return pcm_from_str(str, fmt.code, fmt.endian); | ||
} | ||
|
||
PcmTraits pcm_format_traits(const PcmFormat& fmt) { | ||
PcmTraits traits; | ||
|
||
traits.bit_depth = pcm_bit_depth(fmt.code); | ||
traits.bit_width = pcm_bit_width(fmt.code); | ||
traits.is_integer = pcm_is_integer(fmt.code); | ||
traits.is_signed = pcm_is_signed(fmt.code); | ||
|
||
return traits; | ||
} | ||
|
||
} // namespace audio | ||
} // namespace roc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.