Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable encoding (format/rate/channels) #608

Closed
28 tasks done
gavv opened this issue Oct 10, 2023 · 1 comment
Closed
28 tasks done

Configurable encoding (format/rate/channels) #608

gavv opened this issue Oct 10, 2023 · 1 comment
Assignees
Labels
c api Task affects public C API enhancement
Milestone

Comments

@gavv
Copy link
Member

gavv commented Oct 10, 2023

Allow specifying format/rate/channels of:

  • input frames (sender API)
  • input device (sender CLI)
  • output frames (receiver API)
  • output device (receiver CLI)
  • network packets (sender API, receiver API)
  • network packets (sender CLI, receiver CLI)

Internals:

API:

  • roc_packet_encoding
  • roc_format: native (raw)
  • roc_format: other formats
  • roc_channel_layout: mono, stereo, multitrack
  • roc_media_encoding
  • roc_sender_config: frame_encoding, packet_encoding
  • roc_receiver_config: frame_encoding
  • roc_context_register_encoding

CLI:

  • sample spec parser
  • packet encoding parser
  • remove --rate
  • add --io-encoding SPEC
  • add --packet-encoding ID:SPEC
  • --print-supported
@gavv gavv added enhancement c api Task affects public C API labels Oct 10, 2023
@gavv gavv self-assigned this Oct 10, 2023
@gavv gavv added this to the next milestone Oct 10, 2023
@gavv gavv mentioned this issue Oct 10, 2023
24 tasks
@gavv
Copy link
Member Author

gavv commented Oct 10, 2023

gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 16, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 17, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 17, 2023
@gavv gavv modified the milestones: 0.3.0, next Nov 17, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 19, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 19, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 19, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 19, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 19, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 23, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 23, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 25, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 25, 2023
gavv added a commit that referenced this issue Nov 25, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Nov 29, 2023
gavv added a commit to gavv/roc-toolkit that referenced this issue Jan 30, 2024
@gavv gavv changed the title Configurable encoding Configurable encoding (format/rate/channels) Apr 26, 2024
@gavv gavv removed this from the 0.4.0 milestone Jun 12, 2024
@gavv gavv added this to the next milestone Jun 12, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Jul 6, 2024
This commit removes support for direct PCM mapping between
non-raw formats (e.g. int16 <=> int32). Now it's only allowed
to map from raw to non-raw, or vice versa, where "raw" format
is native-endian 32-bit floats.

This change significantly reduces code size (on x86_64/release
.o file is reduced from 5 MB to 80 KB), as well as simplifies
code generator script.

We did not actually use mapping between non-raw formats, except
tests, so the code is mostly unaffected. If we'll need that,
we can create a pair of mappers, first to map input format to
raw format, then to map raw format to output format.

Tests and comments are reworked as well.
gavv added a commit to gavv/roc-toolkit that referenced this issue Jul 6, 2024
Packer/unpacker for non-byte aligned formats (e.g. 20-bit ints)
had a bug due to a missing type cast.
@gavv gavv added this to Roc Toolkit Jul 6, 2024
@gavv gavv moved this to In work in Roc Toolkit Jul 6, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Jul 20, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 7, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 7, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 8, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 8, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 20, 2024
- introduce "default endian" instead of "native endian"
- replace boolean with flags
- add default/le/ne format variants to traits
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 20, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 22, 2024
- introduce "default endian" instead of "native endian"
- replace boolean with flags
- add default/le/ne format variants to traits
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 22, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 22, 2024
Surround and multitrack layouts will be completed and enabled
in future releases. For now they're hidden from CLI.
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 22, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 22, 2024
- move to roc_dbgio
- add flags to enable specific sections
- print related cli options
- print pcm formats
- print channel masks
- print fec schemes
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 22, 2024
New options:

- Add --packet-encoding to roc-send and roc-recv.
- Add --fec-encoding to roc-send.
- Add --miface to roc-send.

Rename options:

- Rename --nbsrc/--nbrpr to --fec-block-src/--fec-block-rpr.
- Rename --frame-len to --io-frame-len.
- Rename --profile to --prof.

Improvements:

- Group options into sections.
- Update --help messages.

Refactoring:

- Split main() into smaller function.
- Hide sox frame size configuration inside sox backend.
gavv added a commit to gavv/roc-toolkit that referenced this issue Aug 23, 2024
New options:

- Add --packet-encoding to roc-send and roc-recv.
- Add --fec-encoding to roc-send.
- Add --miface to roc-send.

Rename options:

- Rename --nbsrc/--nbrpr to --fec-block-src/--fec-block-rpr.
- Rename --frame-len to --io-frame-len.
- Rename --profile to --prof.

Improvements:

- Group options into sections.
- Update --help messages.

Refactoring:

- Split main() into smaller function.
- Hide sox frame size configuration inside sox backend.
gavv added a commit to gavv/roc-toolkit that referenced this issue Sep 11, 2024
API
---

  TODO

CLI
---

  1. --io-encoding option now has form
    <format>@<subformat>/<rate>/<channels>

  E.g.: pcm@s16/44100/stereo
  (whether sub-format is allowed or required depends
   on format)

  2. --input-format/--output-format options are removed,
     their function is now handled by <format> field
     of --io-encoding

  E.g.:
    --output file://- --io-encoding wav@s24/48000/stereo
     or
    --input file://- --io-encoding wav/-/-

  3. --print-supported is updated to discover and list all
     available sub-formats (divided into logical groups).

Docs
----

  TODO

Internals
---------

Introduce concept of format (e.g. PCM, FLAC) and sub-format
(e.g. s16). Support formats and sub-formats in all sndio
backends.

roc_audio:

- SampleFormat => Format
- Formats: Format_Pcm, Format_Wav, Format_Custom
- PcmFormat => PcmSubformat
- SampleSpec: set_format(), set_custom_format(),
  set_pcm_subformat(), set_custom_subformat()
- SampleSpec: is_valid() => is_complete()
- Sample_RawFormat => PcmSubformat_Raw

roc_sndio:

- File formats are now *not* drivers. All file formats
  are handles by special "file://" driver, i.e.
  URI scheme is now always equal to driver.
- Supported file formats and sub-formats are
  discovered from backends separately from drivers.
- For discovery, we use DriverInfo and FormatInfo
  structs.

- IoConfig is empty by default; frame length and latency
  are zero.
- Each backend may use its own defaults for IoConfig.
- We can retrieve actually selected config using
  sample_spec() and frame_length() methods of IDevice.

- SoxBackend: remove file support, allow only devices
  (now we use sndfile for files)
- SoxBackend: support PCM format and sub-formats
- PulseaudioBackend: support PCM format and sub-formats
- SndfileBackend: support formats and sub-formats,
  map to sndfile major type and sub-type
- WavBackend: support WAV format and PCM sub-formats

- Unification of sndio backends
- Bug-fixes in format handling in sndfile backend
gavv added a commit to gavv/roc-toolkit that referenced this issue Sep 11, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Sep 11, 2024
API
---

  TODO

CLI
---

  1. --io-encoding option now has form
    <format>@<subformat>/<rate>/<channels>

  E.g.: pcm@s16/44100/stereo
  (whether sub-format is allowed or required depends
   on format)

  2. --input-format/--output-format options are removed,
     their function is now handled by <format> field
     of --io-encoding

  E.g.:
    --output file://- --io-encoding wav@s24/48000/stereo
     or
    --input file://- --io-encoding wav/-/-

  3. --print-supported is updated to discover and list all
     available sub-formats (divided into logical groups).

Docs
----

  TODO

Internals
---------

Introduce concept of format (e.g. PCM, FLAC) and sub-format
(e.g. s16). Support formats and sub-formats in all sndio
backends.

roc_audio:

- SampleFormat => Format
- Formats: Format_Pcm, Format_Wav, Format_Custom
- PcmFormat => PcmSubformat
- SampleSpec: set_format(), set_custom_format(),
  set_pcm_subformat(), set_custom_subformat()
- SampleSpec: is_valid() => is_complete()
- Sample_RawFormat => PcmSubformat_Raw

roc_sndio:

- File formats are now *not* drivers. All file formats
  are handles by special "file://" driver, i.e.
  URI scheme is now always equal to driver.
- Supported file formats and sub-formats are
  discovered from backends separately from drivers.
- For discovery, we use DriverInfo and FormatInfo
  structs.

- IoConfig is empty by default; frame length and latency
  are zero.
- Each backend may use its own defaults for IoConfig.
- We can retrieve actually selected config using
  sample_spec() and frame_length() methods of IDevice.

- SoxBackend: remove file support, allow only devices
  (now we use sndfile for files)
- SoxBackend: support PCM format and sub-formats
- PulseaudioBackend: support PCM format and sub-formats
- SndfileBackend: support formats and sub-formats,
  map to sndfile major type and sub-type
- WavBackend: support WAV format and PCM sub-formats

- Unification of sndio backends
- Bug-fixes in format handling in sndfile backend
gavv added a commit to gavv/roc-toolkit that referenced this issue Sep 11, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Sep 11, 2024
API
---

  1. roc_format: the only supported format (currently)
     is now ROC_FORMAT_PCM.

  2. roc_subformat: defines various PCM variants
     (sint, uint, float, endian).

  3. roc_media_encoding: format+subformat define
     sample coding together.

CLI
---

  1. --io-encoding and --packet-encoding options now have form
    <format>[@<subformat>]/<rate>/<channels>

  E.g.: pcm@s16/44100/stereo
  (whether sub-format is allowed or required depends
   on format)

  2. --input-format/--output-format options are removed,
     their function is now handled by <format> field
     of --io-encoding

  E.g.:
    --output file://- --io-encoding wav@s24/48000/stereo
     or
    --input file://- --io-encoding wav/-/-

  3. --print-supported is updated to discover and list all
     available sub-formats (divided into logical groups).

Docs
----

  1. Update --help messages of CLI tools.
  2. Update manual pages of CLI tools.

Internals
---------

Introduce concept of format (e.g. PCM, FLAC) and sub-format
(e.g. s16). Support formats and sub-formats in all sndio
backends.

roc_audio:

- SampleFormat => Format
- Formats: Format_Pcm, Format_Wav, Format_Custom
- PcmFormat => PcmSubformat
- SampleSpec: set_format(), set_custom_format(),
  set_pcm_subformat(), set_custom_subformat()
- SampleSpec: is_valid() => is_complete()
- Sample_RawFormat => PcmSubformat_Raw

roc_sndio:

- File formats are now *not* drivers. All file formats
  are handles by special "file://" driver, i.e.
  URI scheme is now always equal to driver.
- Supported file formats and sub-formats are
  discovered from backends separately from drivers.
- For discovery, we use DriverInfo and FormatInfo
  structs.

- IoConfig is empty by default; frame length and latency
  are zero.
- Each backend may use its own defaults for IoConfig.
- We can retrieve actually selected config using
  sample_spec() and frame_length() methods of IDevice.

- SoxBackend: remove file support, allow only devices
  (now we use sndfile for files)
- SoxBackend: support PCM format and sub-formats
- PulseaudioBackend: support PCM format and sub-formats
- SndfileBackend: support formats and sub-formats,
  map to sndfile major type and sub-type
- WavBackend: support WAV format and PCM sub-formats

- Refactoring & unification in sndio backends
- Bug-fixes in format handling in sndfile backend
gavv added a commit to gavv/roc-toolkit that referenced this issue Sep 11, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Sep 11, 2024
@gavv gavv closed this as completed Sep 12, 2024
@github-project-automation github-project-automation bot moved this from In work to Done in Roc Toolkit Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c api Task affects public C API enhancement
Projects
Status: Done
Development

No branches or pull requests

1 participant