Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/internal_modules/roc_audio/sample_spec_parse.rl
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,10 @@ bool parse_sample_spec_imp(const char* str, SampleSpec& sample_spec) {
sample_spec.set_sample_rate(rate);
}

delimiter = [,_\.] | space;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the idea of multiple separators. The spec already has 4 special symbols: / @ - ,.

Now we want to allow +3 more different special symbols equivalent to one of these 4. That looks pretty WTF and also may create ambiguity if we'll need more special symbols in future (though I hope not).

If we can't prevent gengetopt from doing this, I suggest to choose single separator.

I think + instead of , would look logical:

--packet-encoding 101:pcm@s18/48000/FL+FR+FC

surround_mask = ([a-z] [a-z0-9.]+) >start_token %set_surround_mask;
surround_channel = [A-Z]+ >start_token %set_surround_channel;
surround_list = surround_channel (',' surround_channel)*;
surround_list = surround_channel (delimiter surround_channel)*;

surround = (surround_mask | surround_list) %set_surround;

Expand All @@ -312,15 +313,14 @@ bool parse_sample_spec_imp(const char* str, SampleSpec& sample_spec) {
mtr_range_end = [0-9]+ >start_token %set_mtr_range_end;
mtr_range = (mtr_range_begin '-' mtr_range_end) >start_token %set_mtr_range;
mtr_channel = mtr_number | mtr_range;
mtr_list = mtr_channel (',' mtr_channel)*;
mtr_list = mtr_channel (delimiter mtr_channel)*;

mtr = (mtr_mask | mtr_list) %set_mtr;

format = [a-z0-9_]+ >start_token %set_format;
subformat = [a-z0-9_]+ >start_token %set_subformat;
rate = [0-9]+ >start_token %set_rate;
channels_DISABLED = surround | mtr;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surround and MTR are disabled in CLI because sndio backends don't have support yet:

(They are available in API, though. That's fine because API does not expose access to sndio).

channels = ('stereo' | 'mono') >start_token %set_surround_mask %set_surround;
channels = surround | mtr;

main := ( ('-' | format ('@' subformat)?) '/' ('-' | rate) '/' ('-' | channels) )
%{ success = true; }
Expand Down
2 changes: 1 addition & 1 deletion src/tests/roc_audio/test_sample_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ TEST(sample_spec, parse_format) {
}
}

IGNORE_TEST(sample_spec, parse_channels) {
TEST(sample_spec, parse_channels) {
{ // surround stereo
SampleSpec sample_spec;
CHECK(parse_sample_spec("pcm@s16/48000/stereo", sample_spec));
Expand Down
2 changes: 1 addition & 1 deletion src/tests/roc_rtp/test_encoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace rtp {

TEST_GROUP(encoding) {};

IGNORE_TEST(encoding, parse) {
TEST(encoding, parse) {
Encoding enc;
CHECK(parse_encoding("101:pcm@s18/48000/surround4.1", enc));

Expand Down
Loading