I'll look at this next week.
Seems very busy with the new release but maybe this is a time for a few comments about my feature request.
I read the sourcecode in recent vorbis-tools-1.2.0.7z and your code in oggenc2.85srcs.zip and, of course, I see your code is more advanced (WAVE_FORMAT_EXTENSIBLE, 32 int, wrong channel mapping matrix, others formats, ...), then I will try persuade you about this little changes.
1) A new parameter for instance with NeroAacEnc style (in oggenc.c):
{"ignorelength", 0, 0, 0},
...
enc_opts.ignorelength = opt.ignorelength;
...
if(!strcmp(long_options[option_index].name, "ignorelength")) {
if(!opt->ignorelength){
if(!opt->quiet)
fprintf(stderr,
_("Ignoring datalength in header\n"));
opt->ignorelength = 1;
}
}
...
fprintf(stdout, _( " --ignorelength Ignore the datalength in wav headers. This will allow\n"));
fprintf(stdout, _( " support for files > 4GB and STDIN data streams. \n"));
2) Changes in wav_open subroutine (audio.c) like:
int wav_open(FILE *in, oe_enc_opt *opt, unsigned char *oldbuf, int buflen)
{
//... ok until line 524
opt->total_samples_per_channel = 0; /* Give up, like raw format */
if(!opt->ignorelength) { // if a new parameter NeroAacEnc style is included
if(len)
opt->total_samples_per_channel = len/(format.channels*samplesize);
else {
long pos;
pos = ftell(in);
if(fseek(in, 0, SEEK_END) != -1) {
// if(fseek(in, 0, SEEK_END) == -1)
// opt->total_samples_per_channel = 0; /* Give up */
// else {
opt->total_samples_per_channel = (ftell(in) - pos)/(format.channels*samplesize);
fseek(in,pos, SEEK_SET);
}
}
}
wav->totalsamples = opt->total_samples_per_channel;
opt->readdata = (void *)wav;
wav->channel_permute = malloc(wav->channels * sizeof(int));
// if (wav->channel_map)
/* Where we know the mappings, use them. */
memcpy(wav->channel_permute, wav_permute_matrix[wav->channels-1], sizeof(int) * wav->channels);
// else
// /* Use a default 1-1 mapping */
// for (i=0; i < wav->channels; i++)
// wav->channel_permute[i] = i;
/* A common error is to have a channel order different than wav
* standard. This is incorrect, but not fatal.
* Please, if you have a program that's creating wav channel order
* other than FL, FR, FC, LFE, BL, BR ...
* report a bug to the author.
*/
return 1;
//... ok the rest
}
I think all your code related to channel_map is useless if we can't include the info inside the ogg format. If only one channel map is allowed for a number of channels is better ignore the channelmask in WAVE_FORMAT_EXTENSIBLE until the ogg specs support this issue.
Of course you can put other parameter for the channel mapping like I put in my first post and change the permute_matrix but I prefer:
"* Please, if you have a program that's creating wav channel order other than FL, FR, FC, LFE, BL, BR, report a bug to the author."