Lines Matching refs:protected_
365 FLAC__StreamMetadata_SeekTable *seek_table; /* pointer into encoder->protected_->metadata_ where the seek table is */
534 encoder->protected_ = (FLAC__StreamEncoderProtected*)calloc(1, sizeof(FLAC__StreamEncoderProtected));
535 if(encoder->protected_ == 0) {
542 free(encoder->protected_);
550 free(encoder->protected_);
589 encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED;
599 FLAC__ASSERT(0 != encoder->protected_);
623 free(encoder->protected_);
649 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
660 if(encoder->protected_->channels == 0 || encoder->protected_->channels > FLAC__MAX_CHANNELS)
663 if(encoder->protected_->channels != 2) {
664 encoder->protected_->do_mid_side_stereo = false;
665 encoder->protected_->loose_mid_side_stereo = false;
667 else if(!encoder->protected_->do_mid_side_stereo)
668 encoder->protected_->loose_mid_side_stereo = false;
670 if(encoder->protected_->bits_per_sample >= 32)
671 encoder->protected_->do_mid_side_stereo = false; /* since we currenty do 32-bit math, the side channel would have 33 bps and overflow */
673 if(encoder->protected_->bits_per_sample < FLAC__MIN_BITS_PER_SAMPLE || encoder->protected_->bits_per_sample > FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE)
676 if(!FLAC__format_sample_rate_is_valid(encoder->protected_->sample_rate))
679 if(encoder->protected_->blocksize == 0) {
680 if(encoder->protected_->max_lpc_order == 0)
681 encoder->protected_->blocksize = 1152;
683 encoder->protected_->blocksize = 4096;
686 if(encoder->protected_->blocksize < FLAC__MIN_BLOCK_SIZE || encoder->protected_->blocksize > FLAC__MAX_BLOCK_SIZE)
689 if(encoder->protected_->max_lpc_order > FLAC__MAX_LPC_ORDER)
692 if(encoder->protected_->blocksize < encoder->protected_->max_lpc_order)
695 if(encoder->protected_->qlp_coeff_precision == 0) {
696 if(encoder->protected_->bits_per_sample < 16) {
699 encoder->protected_->qlp_coeff_precision = max(FLAC__MIN_QLP_COEFF_PRECISION, 2 + encoder->protected_->bits_per_sample / 2);
701 else if(encoder->protected_->bits_per_sample == 16) {
702 if(encoder->protected_->blocksize <= 192)
703 encoder->protected_->qlp_coeff_precision = 7;
704 else if(encoder->protected_->blocksize <= 384)
705 encoder->protected_->qlp_coeff_precision = 8;
706 else if(encoder->protected_->blocksize <= 576)
707 encoder->protected_->qlp_coeff_precision = 9;
708 else if(encoder->protected_->blocksize <= 1152)
709 encoder->protected_->qlp_coeff_precision = 10;
710 else if(encoder->protected_->blocksize <= 2304)
711 encoder->protected_->qlp_coeff_precision = 11;
712 else if(encoder->protected_->blocksize <= 4608)
713 encoder->protected_->qlp_coeff_precision = 12;
715 encoder->protected_->qlp_coeff_precision = 13;
718 if(encoder->protected_->blocksize <= 384)
719 encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION-2;
720 else if(encoder->protected_->blocksize <= 1152)
721 encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION-1;
723 encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION;
725 FLAC__ASSERT(encoder->protected_->qlp_coeff_precision <= FLAC__MAX_QLP_COEFF_PRECISION);
727 else if(encoder->protected_->qlp_coeff_precision < FLAC__MIN_QLP_COEFF_PRECISION || encoder->protected_->qlp_coeff_precision > FLAC__MAX_QLP_COEFF_PRECISION)
730 if(encoder->protected_->streamable_subset) {
732 encoder->protected_->blocksize != 192 &&
733 encoder->protected_->blocksize != 576 &&
734 encoder->protected_->blocksize != 1152 &&
735 encoder->protected_->blocksize != 2304 &&
736 encoder->protected_->blocksize != 4608 &&
737 encoder->protected_->blocksize != 256 &&
738 encoder->protected_->blocksize != 512 &&
739 encoder->protected_->blocksize != 1024 &&
740 encoder->protected_->blocksize != 2048 &&
741 encoder->protected_->blocksize != 4096 &&
742 encoder->protected_->blocksize != 8192 &&
743 encoder->protected_->blocksize != 16384
746 if(!FLAC__format_sample_rate_is_subset(encoder->protected_->sample_rate))
749 encoder->protected_->bits_per_sample != 8 &&
750 encoder->protected_->bits_per_sample != 12 &&
751 encoder->protected_->bits_per_sample != 16 &&
752 encoder->protected_->bits_per_sample != 20 &&
753 encoder->protected_->bits_per_sample != 24
756 if(encoder->protected_->max_residual_partition_order > FLAC__SUBSET_MAX_RICE_PARTITION_ORDER)
759 encoder->protected_->sample_rate <= 48000 &&
761 encoder->protected_->blocksize > FLAC__SUBSET_MAX_BLOCK_SIZE_48000HZ ||
762 encoder->protected_->max_lpc_order > FLAC__SUBSET_MAX_LPC_ORDER_48000HZ
769 if(encoder->protected_->max_residual_partition_order >= (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN))
770 encoder->protected_->max_residual_partition_order = (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN) - 1;
771 if(encoder->protected_->min_residual_partition_order >= encoder->protected_->max_residual_partition_order)
772 encoder->protected_->min_residual_partition_order = encoder->protected_->max_residual_partition_order;
776 if(is_ogg && 0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 1) {
778 for(i = 1; i < encoder->protected_->num_metadata_blocks; i++) {
779 if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
780 FLAC__StreamMetadata *vc = encoder->protected_->metadata[i];
782 encoder->protected_->metadata[i] = encoder->protected_->metadata[i-1];
783 encoder->protected_->metadata[0] = vc;
790 if(0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0) {
792 for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) {
793 if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_SEEKTABLE) {
794 encoder->private_->seek_table = &encoder->protected_->metadata[i]->data.seek_table;
801 if(0 == encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0)
807 for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) {
808 const FLAC__StreamMetadata *m = encoder->protected_->metadata[i];
854 for(i = 0; i < encoder->protected_->channels; i++) {
867 for(i = 0; i < encoder->protected_->num_apodizations; i++)
871 for(i = 0; i < encoder->protected_->channels; i++) {
884 encoder->private_->loose_mid_side_stereo_frames = (unsigned)((FLAC__double)encoder->protected_->sample_rate * 0.4 / (FLAC__double)encoder->protected_->blocksize + 0.5);
890 FLAC__ASSERT(encoder->protected_->sample_rate <= 655350);
891 FLAC__ASSERT(encoder->protected_->blocksize <= 65535);
892 encoder->private_->loose_mid_side_stereo_frames = (unsigned)FLAC__fixedpoint_trunc((((FLAC__uint64)(encoder->protected_->sample_rate) * (FLAC__uint64)(26214)) << 16) / (encoder->protected_->blocksize<<16) + FLAC__FP_ONE_HALF);
900 encoder->private_->use_wide_by_block = (encoder->protected_->bits_per_sample + FLAC__bitmath_ilog2(encoder->protected_->blocksize)+1 > 30);
901 encoder->private_->use_wide_by_order = (encoder->protected_->bits_per_sample + FLAC__bitmath_ilog2(max(encoder->protected_->max_lpc_order, FLAC__MAX_FIXED_ORDER))+1 > 30); /*@@@ need to use this? */
926 if(encoder->protected_->max_lpc_order < 4)
928 else if(encoder->protected_->max_lpc_order < 8)
930 else if(encoder->protected_->max_lpc_order < 12)
960 encoder->protected_->state = FLAC__STREAM_ENCODER_OK;
964 if(is_ogg && !FLAC__ogg_encoder_aspect_init(&encoder->protected_->ogg_encoder_aspect)) {
965 encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
977 if(!resize_buffers_(encoder, encoder->protected_->blocksize)) {
983 encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
990 if(encoder->protected_->verify) {
995 encoder->private_->verify.input_fifo.size = encoder->protected_->blocksize+OVERREAD_;
996 for(i = 0; i < encoder->protected_->channels; i++) {
998 encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
1009 encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;
1014 encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;
1031 encoder->protected_->streaminfo_offset = 0;
1032 encoder->protected_->seektable_offset = 0;
1033 encoder->protected_->audio_offset = 0;
1038 if(encoder->protected_->verify)
1041 encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
1052 if(encoder->protected_->verify)
1057 encoder->private_->streaminfo.data.stream_info.min_blocksize = encoder->protected_->blocksize; /* this encoder uses the same blocksize for the whole stream */
1058 encoder->private_->streaminfo.data.stream_info.max_blocksize = encoder->protected_->blocksize;
1061 encoder->private_->streaminfo.data.stream_info.sample_rate = encoder->protected_->sample_rate;
1062 encoder->private_->streaminfo.data.stream_info.channels = encoder->protected_->channels;
1063 encoder->private_->streaminfo.data.stream_info.bits_per_sample = encoder->protected_->bits_per_sample;
1064 encoder->private_->streaminfo.data.stream_info.total_samples = encoder->protected_->total_samples_estimate; /* we will replace this later with the real total */
1066 if(encoder->protected_->do_md5)
1069 encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
1098 vorbis_comment.is_last = (encoder->protected_->num_metadata_blocks == 0);
1105 encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
1117 for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) {
1118 encoder->protected_->metadata[i]->is_last = (i == encoder->protected_->num_metadata_blocks - 1);
1119 if(!FLAC__add_metadata_block(encoder->protected_->metadata[i], encoder->private_->frame)) {
1120 encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
1130 if(encoder->private_->tell_callback && encoder->private_->tell_callback(encoder, &encoder->protected_->audio_offset, encoder->private_->client_data) == FLAC__STREAM_ENCODER_TELL_STATUS_ERROR) { /* FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED just means we didn't get the offset; no error */
1131 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
1135 if(encoder->protected_->verify)
1197 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1202 encoder->protected_->state = FLAC__STREAM_ENCODER_IO_ERROR;
1283 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1289 encoder->protected_->state = FLAC__STREAM_ENCODER_IO_ERROR;
1322 FLAC__ASSERT(0 != encoder->protected_);
1324 if(encoder->protected_->state == FLAC__STREAM_ENCODER_UNINITIALIZED)
1327 if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK && !encoder->private_->is_being_deleted) {
1329 const FLAC__bool is_fractional_block = encoder->protected_->blocksize != encoder->private_->current_sample_number;
1330 encoder->protected_->blocksize = encoder->private_->current_sample_number;
1336 if(encoder->protected_->do_md5)
1340 if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK) {
1350 if(encoder->protected_->state != FLAC__STREAM_ENCODER_OK)
1357 if(encoder->protected_->verify && 0 != encoder->private_->verify.decoder && !FLAC__stream_decoder_finish(encoder->private_->verify.decoder)) {
1359 encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA;
1372 FLAC__ogg_encoder_aspect_finish(&encoder->protected_->ogg_encoder_aspect);
1379 encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED;
1388 FLAC__ASSERT(0 != encoder->protected_);
1389 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1393 FLAC__ogg_encoder_aspect_set_serial_number(&encoder->protected_->ogg_encoder_aspect, value);
1405 FLAC__ASSERT(0 != encoder->protected_);
1406 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1409 encoder->protected_->verify = value;
1418 FLAC__ASSERT(0 != encoder->protected_);
1419 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1421 encoder->protected_->streamable_subset = value;
1429 FLAC__ASSERT(0 != encoder->protected_);
1430 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1432 encoder->protected_->do_md5 = value;
1440 FLAC__ASSERT(0 != encoder->protected_);
1441 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1443 encoder->protected_->channels = value;
1451 FLAC__ASSERT(0 != encoder->protected_);
1452 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1454 encoder->protected_->bits_per_sample = value;
1462 FLAC__ASSERT(0 != encoder->protected_);
1463 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1465 encoder->protected_->sample_rate = value;
1474 FLAC__ASSERT(0 != encoder->protected_);
1475 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1487 encoder->protected_->num_apodizations = 1;
1488 encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY;
1489 encoder->protected_->apodizations[0].parameters.tukey.p = 0.5;
1507 FLAC__ASSERT(0 != encoder->protected_);
1508 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1510 encoder->protected_->blocksize = value;
1518 FLAC__ASSERT(0 != encoder->protected_);
1519 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1521 encoder->protected_->do_mid_side_stereo = value;
1529 FLAC__ASSERT(0 != encoder->protected_);
1530 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1532 encoder->protected_->loose_mid_side_stereo = value;
1541 FLAC__ASSERT(0 != encoder->protected_);
1543 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1548 encoder->protected_->num_apodizations = 0;
1553 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BARTLETT;
1555 encoder->protected_protected_->num_apodizations++].type = FLAC__APODIZATION_BARTLETT_HANN;
1557 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BLACKMAN;
1559 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE;
1561 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_CONNES;
1563 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_FLATTOP;
1567 encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.gauss.stddev = stddev;
1568 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_GAUSS;
1572 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_HAMMING;
1574 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_HANN;
1576 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_KAISER_BESSEL;
1578 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_NUTTALL;
1580 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_RECTANGLE;
1582 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_TRIANGLE;
1586 encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.tukey.p = p;
1587 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_TUKEY;
1591 encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_WELCH;
1592 if (encoder->protected_->num_apodizations == 32)
1599 if(encoder->protected_->num_apodizations == 0) {
1600 encoder->protected_->num_apodizations = 1;
1601 encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY;
1602 encoder->protected_->apodizations[0].parameters.tukey.p = 0.5;
1612 FLAC__ASSERT(0 != encoder->protected_);
1613 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1615 encoder->protected_->max_lpc_order = value;
1623 FLAC__ASSERT(0 != encoder->protected_);
1624 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1626 encoder->protected_->qlp_coeff_precision = value;
1634 FLAC__ASSERT(0 != encoder->protected_);
1635 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1637 encoder->protected_->do_qlp_coeff_prec_search = value;
1645 FLAC__ASSERT(0 != encoder->protected_);
1646 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1650 encoder->protected_->do_escape_coding = value;
1661 FLAC__ASSERT(0 != encoder->protected_);
1662 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1664 encoder->protected_->do_exhaustive_model_search = value;
1672 FLAC__ASSERT(0 != encoder->protected_);
1673 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1675 encoder->protected_->min_residual_partition_order = value;
1683 FLAC__ASSERT(0 != encoder->protected_);
1684 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1686 encoder->protected_->max_residual_partition_order = value;
1694 FLAC__ASSERT(0 != encoder->protected_);
1695 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1699 encoder->protected_->rice_parameter_search_dist = value;
1710 FLAC__ASSERT(0 != encoder->protected_);
1711 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1713 encoder->protected_->total_samples_estimate = value;
1721 FLAC__ASSERT(0 != encoder->protected_);
1722 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1729 if(encoder->protected_->metadata) {
1730 free(encoder->protected_->metadata);
1731 encoder->protected_->metadata = 0;
1732 encoder->protected_->num_metadata_blocks = 0;
1739 encoder->protected_->metadata = m;
1740 encoder->protected_->num_metadata_blocks = num_blocks;
1743 if(!FLAC__ogg_encoder_aspect_set_num_metadata(&encoder->protected_->ogg_encoder_aspect, num_blocks))
1757 FLAC__ASSERT(0 != encoder->protected_);
1758 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1768 FLAC__ASSERT(0 != encoder->protected_);
1769 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1779 FLAC__ASSERT(0 != encoder->protected_);
1780 if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
1790 FLAC__ASSERT(0 != encoder->protected_);
1791 return encoder->protected_->state;
1798 FLAC__ASSERT(0 != encoder->protected_);
1799 if(encoder->protected_->verify)
1809 FLAC__ASSERT(0 != encoder->protected_);
1810 if(encoder->protected_->state != FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR)
1811 return FLAC__StreamEncoderStateString[encoder->protected_->state];
1820 FLAC__ASSERT(0 != encoder->protected_);
1839 FLAC__ASSERT(0 != encoder->protected_);
1840 return encoder->protected_->verify;
1847 FLAC__ASSERT(0 != encoder->protected_);
1848 return encoder->protected_->streamable_subset;
1855 FLAC__ASSERT(0 != encoder->protected_);
1856 return encoder->protected_->do_md5;
1863 FLAC__ASSERT(0 != encoder->protected_);
1864 return encoder->protected_->channels;
1871 FLAC__ASSERT(0 != encoder->protected_);
1872 return encoder->protected_->bits_per_sample;
1879 FLAC__ASSERT(0 != encoder->protected_);
1880 return encoder->protected_->sample_rate;
1887 FLAC__ASSERT(0 != encoder->protected_);
1888 return encoder->protected_->blocksize;
1895 FLAC__ASSERT(0 != encoder->protected_);
1896 return encoder->protected_->do_mid_side_stereo;
1903 FLAC__ASSERT(0 != encoder->protected_);
1904 return encoder->protected_->loose_mid_side_stereo;
1911 FLAC__ASSERT(0 != encoder->protected_);
1912 return encoder->protected_->max_lpc_order;
1919 FLAC__ASSERT(0 != encoder->protected_);
1920 return encoder->protected_->qlp_coeff_precision;
1927 FLAC__ASSERT(0 != encoder->protected_);
1928 return encoder->protected_->do_qlp_coeff_prec_search;
1935 FLAC__ASSERT(0 != encoder->protected_);
1936 return encoder->protected_->do_escape_coding;
1943 FLAC__ASSERT(0 != encoder->protected_);
1944 return encoder->protected_->do_exhaustive_model_search;
1951 FLAC__ASSERT(0 != encoder->protected_);
1952 return encoder->protected_->min_residual_partition_order;
1959 FLAC__ASSERT(0 != encoder->protected_);
1960 return encoder->protected_->max_residual_partition_order;
1967 FLAC__ASSERT(0 != encoder->protected_);
1968 return encoder->protected_->rice_parameter_search_dist;
1975 FLAC__ASSERT(0 != encoder->protected_);
1976 return encoder->protected_->total_samples_estimate;
1982 const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize;
1986 FLAC__ASSERT(0 != encoder->protected_);
1987 FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
1992 if(encoder->protected_->verify)
1998 if(encoder->protected_->do_mid_side_stereo) {
2020 if(encoder->protected_->do_mid_side_stereo) {
2035 const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize;
2039 FLAC__ASSERT(0 != encoder->protected_);
2040 FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
2047 if(encoder->protected_->do_mid_side_stereo && channels == 2) {
2052 if(encoder->protected_->verify)
2087 if(encoder->protected_->verify)
2124 encoder->protected_->verify = true;
2126 encoder->protected_->verify = false;
2128 encoder->protected_->streamable_subset = true;
2129 encoder->protected_->do_md5 = true;
2130 encoder->protected_->do_mid_side_stereo = false;
2131 encoder->protected_->loose_mid_side_stereo = false;
2132 encoder->protected_->channels = 2;
2133 encoder->protected_->bits_per_sample = 16;
2134 encoder->protected_->sample_rate = 44100;
2135 encoder->protected_->blocksize = 0;
2137 encoder->protected_->num_apodizations = 1;
2138 encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY;
2139 encoder->protected_->apodizations[0].parameters.tukey.p = 0.5;
2141 encoder->protected_->max_lpc_order = 0;
2142 encoder->protected_->qlp_coeff_precision = 0;
2143 encoder->protected_->do_qlp_coeff_prec_search = false;
2144 encoder->protected_->do_exhaustive_model_search = false;
2145 encoder->protected_->do_escape_coding = false;
2146 encoder->protected_->min_residual_partition_order = 0;
2147 encoder->protected_->max_residual_partition_order = 0;
2148 encoder->protected_->rice_parameter_search_dist = 0;
2149 encoder->protected_->total_samples_estimate = 0;
2150 encoder->protected_->metadata = 0;
2151 encoder->protected_->num_metadata_blocks = 0;
2169 FLAC__ogg_encoder_aspect_set_defaults(&encoder->protected_->ogg_encoder_aspect);
2178 if(encoder->protected_->metadata) {
2179 free(encoder->protected_->metadata);
2180 encoder->protected_->metadata = 0;
2181 encoder->protected_->num_metadata_blocks = 0;
2183 for(i = 0; i < encoder->protected_->channels; i++) {
2208 for(i = 0; i < encoder->protected_->num_apodizations; i++) {
2219 for(channel = 0; channel < encoder->protected_->channels; channel++) {
2243 if(encoder->protected_->verify) {
2244 for(i = 0; i < encoder->protected_->channels; i++) {
2260 FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
2275 for(i = 0; ok && i < encoder->protected_->channels; i++) {
2281 if(encoder->protected_->max_lpc_order > 0)
2292 if(encoder->protected_->max_lpc_order > 0)
2298 if(ok && encoder->protected_->max_lpc_order > 0) {
2299 for(i = 0; ok && i < encoder->protected_->num_apodizations; i++)
2304 for(channel = 0; ok && channel < encoder->protected_->channels; channel++) {
2317 if(encoder->protected_->do_escape_coding)
2322 if(ok && new_blocksize != encoder->private_->input_capacity && encoder->protected_->max_lpc_order > 0) {
2323 for(i = 0; ok && i < encoder->protected_->num_apodizations; i++) {
2324 switch(encoder->protected_->apodizations[i].type) {
2344 FLAC__window_gauss(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.gauss.stddev);
2365 FLAC__window_tukey(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.tukey.p);
2383 encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
2396 encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
2400 if(encoder->protected_->verify) {
2410 if(encoder->protected_->state != FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA)
2411 encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;
2420 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
2442 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
2452 encoder->protected_->streaminfo_offset = output_position;
2453 else if(type == FLAC__METADATA_TYPE_SEEKTABLE && encoder->protected_->seektable_offset == 0)
2454 encoder->protected_->seektable_offset = output_position;
2462 if(0 != encoder->private_->seek_table && encoder->protected_->audio_offset > 0 && encoder->private_->seek_table->num_points > 0) {
2475 encoder->private_->seek_table->points[i].stream_offset = output_position - encoder->protected_->audio_offset;
2494 &encoder->protected_->ogg_encoder_aspect,
2519 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
2559 if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + md5_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
2561 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
2565 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
2592 if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + total_samples_byte_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
2594 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
2598 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
2620 if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + min_framesize_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
2622 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
2626 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
2634 if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0) {
2641 if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->seektable_offset + FLAC__STREAM_METADATA_HEADER_LENGTH, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
2643 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
2672 encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
2717 if(!simple_ogg_page__get_at(encoder, encoder->protected_->streaminfo_offset, &page, encoder->private_->seek_callback, encoder->private_->read_callback, encoder->private_->client_data)) {
2741 encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
2767 encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
2793 encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
2805 if(!simple_ogg_page__set_at(encoder, encoder->protected_->streaminfo_offset, &page, encoder->private_->seek_callback, encoder->private_->write_callback, encoder->private_->client_data)) {
2814 if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0) {
2823 if(!simple_ogg_page__get_at(encoder, encoder->protected_->seektable_offset, &page, encoder->private_->seek_callback, encoder->private_->read_callback, encoder->private_->client_data)) {
2829 encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
2861 if(!simple_ogg_page__set_at(encoder, encoder->protected_->seektable_offset, &page, encoder->private_->seek_callback, encoder->private_->write_callback, encoder->private_->client_data)) {
2873 FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
2878 if(encoder->protected_->do_md5 && !FLAC__MD5Accumulate(&encoder->private_->md5context, (const FLAC__int32 * const *)encoder->private_->integer_signal, encoder->protected_->channels, encoder->protected_->blocksize, (encoder->protected_->bits_per_sample+7) / 8)) {
2879 encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
2895 encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
2907 encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
2914 if(!write_bitbuffer_(encoder, encoder->protected_->blocksize, is_last_block)) {
2924 encoder->private_->streaminfo.data.stream_info.total_samples += (FLAC__uint64)encoder->protected_->blocksize;
2932 unsigned channel, min_partition_order = encoder->protected_->min_residual_partition_order, max_partition_order;
2942 max_partition_order = FLAC__format_get_max_rice_partition_order_from_blocksize(encoder->protected_->blocksize);
2943 max_partition_order = min(max_partition_order, encoder->protected_->max_residual_partition_order);
2950 frame_header.blocksize = encoder->protected_->blocksize;
2951 frame_header.sample_rate = encoder->protected_->sample_rate;
2952 frame_header.channels = encoder->protected_->channels;
2954 frame_header.bits_per_sample = encoder->protected_->bits_per_sample;
2961 if(encoder->protected_->do_mid_side_stereo) {
2962 if(encoder->protected_->loose_mid_side_stereo) {
2988 for(channel = 0; channel < encoder->protected_->channels; channel++) {
2989 const unsigned w = get_wasted_bits_(encoder->private_->integer_signal[channel], encoder->protected_->blocksize);
2991 encoder->private_->subframe_bps[channel] = encoder->protected_->bits_per_sample - w;
2995 FLAC__ASSERT(encoder->protected_->channels == 2);
2997 const unsigned w = get_wasted_bits_(encoder->private_->integer_signal_mid_side[channel], encoder->protected_->blocksize);
2999 encoder->private_->subframe_bps_mid_side[channel] = encoder->protected_->bits_per_sample - w + (channel==0? 0:1);
3007 for(channel = 0; channel < encoder->protected_->channels; channel++) {
3031 FLAC__ASSERT(encoder->protected_->channels == 2);
3061 FLAC__ASSERT(encoder->protected_->channels == 2);
3063 if(encoder->protected_->loose_mid_side_stereo && encoder->private_->loose_mid_side_stereo_frame_count > 0) {
3096 encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
3150 encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
3154 for(channel = 0; channel < encoder->protected_->channels; channel++) {
3162 if(encoder->protected_->loose_mid_side_stereo) {
3194 FLAC__real autoc[FLAC__MAX_LPC_ORDER+1]; /* WATCHOUT: the size is important even though encoder->protected_->max_lpc_order might be less; some asm routines need all the space */
3245 if(!encoder->private_->disable_fixed_subframes || (encoder->protected_->max_lpc_order == 0 && _best_bits == UINT_MAX)) {
3247 if(encoder->protected_->do_exhaustive_model_search) {
3287 encoder->protected_->do_escape_coding,
3288 encoder->protected_->rice_parameter_search_dist,
3301 if(encoder->protected_->max_lpc_order > 0) {
3302 if(encoder->protected_->max_lpc_order >= frame_header->blocksize)
3305 max_lpc_order = encoder->protected_->max_lpc_order;
3308 for (a = 0; a < encoder->protected_->num_apodizations; a++) {
3314 if(encoder->protected_->do_exhaustive_model_search) {
3324 encoder->protected_->do_qlp_coeff_prec_search?
3326 encoder->protected_->qlp_coeff_precision
3345 if(encoder->protected_->do_qlp_coeff_prec_search) {
3356 min_qlp_coeff_precision = max_qlp_coeff_precision = encoder->protected_->qlp_coeff_precision;
3375 encoder->protected_->do_escape_coding,
3376 encoder->protected_->rice_parameter_search_dist,
3419 encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
3425 encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
3431 encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
3437 encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
4232 encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA;
4253 encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;