Skip to content

Commit

Permalink
Better error messages when encoder cannot be created
Browse files Browse the repository at this point in the history
The vorbis encoder cannot be initialized for very low bitrates. In
these cases a meaningful error message is printed to the console.
This is still not the best solution, but better than nothing.

git-svn-id: https://svn.code.sf.net/p/aqualung/code/trunk@1291 3cd24cdc-1f22-0410-b8b1-dcf80e670293
  • Loading branch information
Tom Szilagyi committed May 2, 2014
1 parent eb5625a commit efd2b37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/encoder/enc_vorbis.c
Expand Up @@ -88,8 +88,11 @@ vorbisenc_encoder_open(encoder_t * enc, encoder_mode_t * mode) {
vorbis_encode_ctl(&pd->vi, OV_ECTL_RATEMANAGE2_SET, NULL) ||
vorbis_encode_setup_init(&pd->vi));

if (ret)
if (ret) {
fprintf(stdout, "vorbisenc_encoder_open(): cannot setup encoding with set params (bps=%d)\n",
mode->bps);
return -1;
}

vorbis_comment_init(&pd->vc);
if (mode->write_meta) {
Expand Down
6 changes: 3 additions & 3 deletions src/encoder/file_encoder.c
Expand Up @@ -76,18 +76,18 @@ file_encoder_open(file_encoder_t * fenc, encoder_mode_t * mode) {
encoder_t * enc;

if (mode->filename == NULL) {
fprintf(stderr, "Warning: filename == NULL passed to file_encoder_open()\n");
fprintf(stderr, "error: filename == NULL passed to file_encoder_open()\n");
return 1;
}

enc = encoder_init_v[mode->file_lib](fenc);
if (!enc) {
fprintf(stderr, "Warning: error initializing encoder %d.\n", mode->file_lib);
fprintf(stderr, "error initializing encoder %d.\n", mode->file_lib);
return 1;
}

if (enc->open(enc, mode) != 0) {
fprintf(stderr, "Warning: error opening encoder %d.\n", mode->file_lib);
fprintf(stderr, "error opening encoder %d.\n", mode->file_lib);
return 1;
}

Expand Down

0 comments on commit efd2b37

Please sign in to comment.