int ReliSock::perform_authenticate(bool with_key, KeyInfo *& key, const char* methods, CondorError* errstack, int auth_timeout, char **method_used) { int in_encode_mode; int result; if( method_used ) { *method_used = NULL; } if (!triedAuthentication()) { Authentication authob(this); setTriedAuthentication(true); // store if we are in encode or decode mode in_encode_mode = is_encode(); // actually perform the authentication if ( with_key ) { result = authob.authenticate( hostAddr, key, methods, errstack, auth_timeout ); } else { result = authob.authenticate( hostAddr, methods, errstack, auth_timeout ); } // restore stream mode (either encode or decode) if ( in_encode_mode && is_decode() ) { encode(); } else { if ( !in_encode_mode && is_encode() ) { decode(); } } setFullyQualifiedUser(authob.getFullyQualifiedUser()); if( authob.getMethodUsed() ) { setAuthenticationMethodUsed(authob.getMethodUsed()); if( method_used ) { *method_used = strdup(authob.getMethodUsed()); } } return result; } else { return 1; } }
int Stream::code(StartdRec &rec) { if( !code(rec.version_num) ) return FALSE; if( rec.version_num >=0 ) { /* we are talking with a startd of an old version which sends just two port numbers */ rec.ports.port1 = rec.version_num; if ( !code(rec.ports.port2) ) return FALSE; return TRUE; } if( !code(rec.ports) ) return FALSE; if( !code(rec.ip_addr) ) return FALSE; if( is_encode() ) { if( !code(rec.server_name) ) return FALSE; } else if ( is_decode() ) { if( !code(rec.server_name) ) return FALSE; } return TRUE; }
uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, element *cpe, int16_t *spec_data1, int16_t *spec_data2) { uint8_t retval; #ifdef PROFILE int64_t count = faad_get_ts(); #endif if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) { retval = allocate_channel_pair(hDecoder, cpe->channel, (uint8_t)cpe->paired_channel); if (retval > 0) return retval; hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; } /* dequantisation and scaling */ retval = quant_to_spec(hDecoder, ics1, spec_data1, spec_coef1, hDecoder->frameLength); if (retval > 0) return retval; retval = quant_to_spec(hDecoder, ics2, spec_data2, spec_coef2, hDecoder->frameLength); if (retval > 0) return retval; #ifdef PROFILE count = faad_get_ts() - count; hDecoder->requant_cycles += count; #endif /* pns decoding */ if (ics1->ms_mask_present) { pns_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength, 1, hDecoder->object_type); } else { pns_decode(ics1, NULL, spec_coef1, NULL, hDecoder->frameLength, 0, hDecoder->object_type); pns_decode(ics2, NULL, spec_coef2, NULL, hDecoder->frameLength, 0, hDecoder->object_type); } /* mid/side decoding */ ms_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength); #if 0 { int i; for (i = 0; i < 1024; i++) { //printf("%d\n", spec_coef1[i]); printf("0x%.8X\n", spec_coef1[i]); } for (i = 0; i < 1024; i++) { //printf("%d\n", spec_coef2[i]); printf("0x%.8X\n", spec_coef2[i]); } } #endif /* intensity stereo decoding */ is_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength); #if 0 { int i; for (i = 0; i < 1024; i++) { printf("%d\n", spec_coef1[i]); //printf("0x%.8X\n", spec_coef1[i]); } for (i = 0; i < 1024; i++) { printf("%d\n", spec_coef2[i]); //printf("0x%.8X\n", spec_coef2[i]); } } #endif #ifdef MAIN_DEC /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) { /* intra channel prediction */ ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength, hDecoder->sf_index); ic_prediction(ics2, spec_coef2, hDecoder->pred_stat[cpe->paired_channel], hDecoder->frameLength, hDecoder->sf_index); /* In addition, for scalefactor bands coded by perceptual noise substitution the predictors belonging to the corresponding spectral coefficients are reset. */ pns_reset_pred_state(ics1, hDecoder->pred_stat[cpe->channel]); pns_reset_pred_state(ics2, hDecoder->pred_stat[cpe->paired_channel]); } #endif #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { ltp_info *ltp1 = &(ics1->ltp); ltp_info *ltp2 = (cpe->common_window) ? &(ics2->ltp2) : &(ics2->ltp); #ifdef LD_DEC if (hDecoder->object_type == LD) { if (ltp1->data_present) { if (ltp1->lag_update) hDecoder->ltp_lag[cpe->channel] = ltp1->lag; } ltp1->lag = hDecoder->ltp_lag[cpe->channel]; if (ltp2->data_present) { if (ltp2->lag_update) hDecoder->ltp_lag[cpe->paired_channel] = ltp2->lag; } ltp2->lag = hDecoder->ltp_lag[cpe->paired_channel]; } #endif /* long term prediction */ lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb, ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); lt_prediction(ics2, ltp2, spec_coef2, hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->fb, ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel], hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); } #endif /* tns decoding */ tns_decode_frame(ics1, &(ics1->tns), hDecoder->sf_index, hDecoder->object_type, spec_coef1, hDecoder->frameLength); tns_decode_frame(ics2, &(ics2->tns), hDecoder->sf_index, hDecoder->object_type, spec_coef2, hDecoder->frameLength); /* drc decoding */ if (hDecoder->drc->present) { if (!hDecoder->drc->exclude_mask[cpe->channel] || !hDecoder->drc->excluded_chns_present) drc_decode(hDecoder->drc, spec_coef1); if (!hDecoder->drc->exclude_mask[cpe->paired_channel] || !hDecoder->drc->excluded_chns_present) drc_decode(hDecoder->drc, spec_coef2); } /* filter bank */ #ifdef SSR_DEC if (hDecoder->object_type != SSR) { #endif ifilter_bank(ics1->window_sequence,ics1->window_shape, hDecoder->window_shape_prev[cpe->channel],spec_coef1, hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel], hDecoder->object_type, hDecoder->frameLength); ifilter_bank(ics2->window_sequence,ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel], hDecoder->object_type, hDecoder->frameLength); #ifdef SSR_DEC } else { ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel], hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel], hDecoder->prev_fmd[cpe->channel], hDecoder->frameLength); ssr_decode(&(ics2->ssr), hDecoder->fb, ics2->window_sequence, ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel], hDecoder->ssr_overlap[cpe->paired_channel], hDecoder->ipqf_buffer[cpe->paired_channel], hDecoder->prev_fmd[cpe->paired_channel], hDecoder->frameLength); } #endif /* save window shape for next frame */ hDecoder->window_shape_prev[cpe->channel] = ics1->window_shape; hDecoder->window_shape_prev[cpe->paired_channel] = ics2->window_shape; #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { lt_update_state(hDecoder->lt_pred_stat[cpe->channel], hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel], hDecoder->frameLength, hDecoder->object_type); lt_update_state(hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel], hDecoder->frameLength, hDecoder->object_type); } #endif #ifdef SBR_DEC if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) && hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) { uint8_t ele = hDecoder->fr_ch_ele; uint8_t ch0 = cpe->channel; uint8_t ch1 = cpe->paired_channel; /* following case can happen when forceUpSampling == 1 */ if (hDecoder->sbr[ele] == NULL) { hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index), hDecoder->downSampledSBR #ifdef DRM , 0 #endif ); } if (cpe->ics1.window_sequence == EIGHT_SHORT_SEQUENCE) hDecoder->sbr[ele]->maxAACLine = 8*cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)]; else hDecoder->sbr[ele]->maxAACLine = cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)]; retval = sbrDecodeCoupleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch0], hDecoder->time_out[ch1], hDecoder->postSeekResetFlag, hDecoder->downSampledSBR); if (retval > 0) return retval; } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) { return 23; } #endif return 0; }