int dca_block (dca_state_t * state) { /* Sanity check */ if (state->current_subframe >= state->subframes) { fprintf (stderr, "check failed: %i>%i", state->current_subframe, state->subframes); return -1; } if (!state->current_subsubframe) { #ifdef DEBUG fprintf (stderr, "DSYNC dca_subframe_header\n"); #endif /* Read subframe header */ if (dca_subframe_header (state)) return -1; } /* Read subsubframe */ #ifdef DEBUG fprintf (stderr, "DSYNC dca_subsubframe\n"); #endif if (dca_subsubframe (state)) return -1; /* Update state */ state->current_subsubframe++; if (state->current_subsubframe >= state->subsubframes) { state->current_subsubframe = 0; state->current_subframe++; } if (state->current_subframe >= state->subframes) { #ifdef DEBUG fprintf(stderr, "DSYNC dca_subframe_footer\n"); #endif /* Read subframe footer */ if (dca_subframe_footer (state)) return -1; } return 0; }
static int dca_decode_block(DCAContext * s) { /* Sanity check */ if (s->current_subframe >= s->subframes) { av_log(s->avctx, AV_LOG_DEBUG, "check failed: %i>%i", s->current_subframe, s->subframes); return -1; } if (!s->current_subsubframe) { #ifdef TRACE av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_header\n"); #endif /* Read subframe header */ if (dca_subframe_header(s)) return -1; } /* Read subsubframe */ #ifdef TRACE av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subsubframe\n"); #endif if (dca_subsubframe(s)) return -1; /* Update state */ s->current_subsubframe++; if (s->current_subsubframe >= s->subsubframes) { s->current_subsubframe = 0; s->current_subframe++; } if (s->current_subframe >= s->subframes) { #ifdef TRACE av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_footer\n"); #endif /* Read subframe footer */ if (dca_subframe_footer(s)) return -1; } return 0; }