diff --git a/examples/encoder_example.c b/examples/encoder_example.c index 6978ffe7..39dbdd99 100644 --- a/examples/encoder_example.c +++ b/examples/encoder_example.c @@ -493,10 +493,11 @@ int fetch_and_process_video(av_input *avin, ogg_page *page, /*Pull the packets from the previous frame, now that we know whether or not we can read the current one. This is used to set the e_o_s bit on the final packet.*/ - while (daala_encode_packet_out(dd, last, &dp)) { + while (daala_encode_packet_out(dd, &dp)) { ogg_packet op; daala_to_ogg_packet(&op, &dp); + op.e_o_s = last; ogg_stream_packetin(vo, &op); } diff --git a/include/daala/daalaenc.h b/include/daala/daalaenc.h index 60be2dc5..b3187ba1 100644 --- a/include/daala/daalaenc.h +++ b/include/daala/daalaenc.h @@ -55,10 +55,10 @@ typedef struct daala_enc_ctx daala_enc_ctx; * The basic steps are: * - Fill in a #daala_info structure with details on the format of the video * you wish to encode. - * - Allocate a #daala_enc_ctx handle with daala_encode_alloc(). + * - Allocate a #daala_enc_ctx handle with daala_encode_create(). * - Perform any additional encoder configuration required with * daala_encode_ctl(). - * - Repeatedly call daala_encode_flusheader() to retrieve all the header + * - Repeatedly call daala_encode_flush_header() to retrieve all the header * packets. * - For each uncompressed frame: * - Submit the compressed frame via daala_encode_img_in(). @@ -121,9 +121,6 @@ int daala_encode_img_in(daala_enc_ctx *enc, od_img *img, int duration); * manner. * However, this may be changed in the future. * \param enc A #daala_enc_ctx handle. - * \param last Set this flag to a non-zero value if no more uncompressed - * frames will be submitted. - * This ensures that a proper EOS flag is set on the last packet. * \param dp A daala_packet structure to fill. * All of the elements of this structure will be set, including a * pointer to the video data. @@ -133,8 +130,7 @@ int daala_encode_img_in(daala_enc_ctx *enc, od_img *img, int duration); * \retval 0 No packet was produced, and no more encoded video data * remains. * \retval OD_EFAULT \a enc or \a op was NULL.*/ -int daala_encode_packet_out(daala_enc_ctx *enc, - int last, daala_packet *dp); +int daala_encode_packet_out(daala_enc_ctx *enc, daala_packet *dp); /**Frees an allocated encoder instance. * \param enc A #daala_enc_ctx handle.*/ void daala_encode_free(daala_enc_ctx *enc); diff --git a/src/encode.c b/src/encode.c index 6e7384bf..4188800f 100644 --- a/src/encode.c +++ b/src/encode.c @@ -2657,7 +2657,6 @@ int daala_encode_img_in(daala_enc_ctx *enc, od_img *img, int duration) { od_mb_enc_ctx mbctx; od_img *ref_img; if (enc == NULL || img == NULL) return OD_EFAULT; - if (enc->packet_state == OD_PACKET_DONE) return OD_EINVAL; /*Check the input image dimensions to make sure they're compatible with the declared video size.*/ nplanes = enc->state.info.nplanes; @@ -2862,10 +2861,10 @@ static void daala_encoder_check(daala_enc_ctx *ctx, od_img *img, } #endif -int daala_encode_packet_out(daala_enc_ctx *enc, int last, daala_packet *op) { +int daala_encode_packet_out(daala_enc_ctx *enc, daala_packet *op) { uint32_t nbytes; if (enc == NULL || op == NULL) return OD_EFAULT; - else if (enc->packet_state <= 0 || enc->packet_state == OD_PACKET_DONE) { + else if (enc->packet_state <= 0) { return 0; } op->packet = od_ec_enc_done(&enc->ec, &nbytes); @@ -2873,11 +2872,10 @@ int daala_encode_packet_out(daala_enc_ctx *enc, int last, daala_packet *op) { OD_LOG((OD_LOG_ENCODER, OD_LOG_INFO, "Output Bytes: %ld (%ld Kbits)", op->bytes, op->bytes*8/1024)); op->b_o_s = 0; - op->e_o_s = last; + op->e_o_s = 0; op->packetno = 0; op->granulepos = enc->state.cur_time; - if (last) enc->packet_state = OD_PACKET_DONE; - else enc->packet_state = OD_PACKET_EMPTY; + enc->packet_state = OD_PACKET_EMPTY; #if defined(OD_ENCODER_CHECK) /*Compare reconstructed frame against decoded frame.*/