Skip to content

Instantly share code, notes, and snippets.

@oneman
Created December 1, 2010 05:18
Show Gist options
  • Select an option

  • Save oneman/722998 to your computer and use it in GitHub Desktop.

Select an option

Save oneman/722998 to your computer and use it in GitHub Desktop.
aspect->samples_since_last_flush += samples;
printf("Samples at the moment: %d\n", samples);
printf("Samples since last flush: %d\n", aspect->samples_since_last_flush);
if (aspect->samples_since_last_flush >= (4096 * 4)) {
printf("Flushing since we got %d samples\n", aspect->samples_since_last_flush);
while(ogg_stream_flush(&aspect->stream_state, &aspect->page) != 0) {
printf("did a flush - ");
if(write_callback(encoder, aspect->page.header, aspect->page.header_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
if(write_callback(encoder, aspect->page.body, aspect->page.body_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
}
printf("done flushing part\n");
aspect->samples_since_last_flush = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment