On 02/23/2012 05:25 AM, Anton Khirnov wrote: > > On Wed, 22 Feb 2012 19:57:16 -0500, Justin Ruggles <[email protected]> > wrote: >> --- >> libavcodec/libvorbis.c | 49 >> ++++++++++++++++++++++++++++++----------------- >> 1 files changed, 31 insertions(+), 18 deletions(-) >> >> diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c >> index b60b1f0..60e0b0f 100644 >> --- a/libavcodec/libvorbis.c >> +++ b/libavcodec/libvorbis.c >> @@ -108,17 +108,36 @@ static int xiph_len(int l) >> return 1 + l / 255 + l; >> } >> >> +static av_cold int oggvorbis_encode_close(AVCodecContext *avccontext) >> +{ >> + OggVorbisContext *context = avccontext->priv_data; >> +/* ogg_packet op ; */ >> + >> + vorbis_analysis_wrote(&context->vd, 0); /* notify vorbisenc this is >> EOF */ >> + >> + vorbis_block_clear(&context->vb); >> + vorbis_dsp_clear(&context->vd); >> + vorbis_info_clear(&context->vi); >> + >> + av_freep(&avccontext->coded_frame); >> + av_freep(&avccontext->extradata); >> + >> + return 0; >> +} >> + >> static av_cold int oggvorbis_encode_init(AVCodecContext *avccontext) >> { >> OggVorbisContext *context = avccontext->priv_data; >> ogg_packet header, header_comm, header_code; >> uint8_t *p; >> unsigned int offset; >> + int ret; >> >> vorbis_info_init(&context->vi); >> if (oggvorbis_init_encoder(&context->vi, avccontext) < 0) { >> av_log(avccontext, AV_LOG_ERROR, "oggvorbis_encode_init: >> init_encoder failed\n"); >> - return -1; >> + ret = -1; >> + goto error; > > Perhaps we should introduce something like AVERROR_UNKNOWN. > > Looks ok otherwise.
Yeah, I think that might be good in general for library functions that only return -1 as an error code. -Justin _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
