On 03/30/2014 01:18 PM, Vittorio Giovara wrote:
> From: Paul B Mahol <[email protected]>
>
> ---
> Changelog | 1 +
> configure | 4 +
> doc/general.texi | 8 ++
> libavcodec/Makefile | 1 +
> libavcodec/allcodecs.c | 1 +
> libavcodec/libtwolame.c | 210
> ++++++++++++++++++++++++++++++++++++++++++++++++
> libavcodec/version.h | 2 +-
> 7 files changed, 226 insertions(+), 1 deletion(-)
> create mode 100644 libavcodec/libtwolame.c
>
[...]
> diff --git a/doc/general.texi b/doc/general.texi
> index f338efd..2fc9e58 100644
> --- a/doc/general.texi
> +++ b/doc/general.texi
> @@ -71,6 +71,14 @@ Go to @url{http://lame.sourceforge.net/} and follow the
> instructions for installing the library.
> Then pass @code{--enable-libmp3lame} to configure to enable it.
>
> +@section TwoLAME
> +
> +Libav can make use of the TwoLAME library for MP2 encoding.
> +
> +Go to @url{http://www.twolame.org/} and follow the
> +instructions for installing the library.
> +Then pass @code{--enable-libtwolame} to configure to enable it.
> +
> @section libvpx
>
Also update the table to add an E for external encoder for MP2 and a
note about libtwolame.
An entry in encoders.texi would be nice too, but not necessary before
pushing.
[...]
> + if (avctx->flags & CODEC_FLAG_QSCALE || !avctx->bit_rate) {
> + twolame_set_VBR(s->glopts, TRUE);
> + twolame_set_VBR_level(s->glopts, avctx->global_quality);
You have to divide global_quality by FF_QP2LAMBDA.
> + av_log(avctx, AV_LOG_WARNING, "VBR mode is experimental!\n");
> + } else {
> + twolame_set_bitrate(s->glopts, avctx->bit_rate / 1000);
> + }
> +
> + if ((ret = twolame_init_params(s->glopts)))
> + goto error;
> +
> + return 0;
> +error:
> + twolame_encode_close(avctx);
> + return ret;
Do not return twolame error codes directly.
[...]
> +
> + if (ret > 0) {
> + avpkt->duration = ff_samples_to_time_base(avctx, avctx->frame_size);
Although it should be the same anyway, frame->nb_samples seems more
appropriate here.
> + if (frame) {
> + if (frame->pts != AV_NOPTS_VALUE)
> + avpkt->pts = frame->pts;
> + } else {
> + avpkt->pts = s->next_pts;
> + }
> + if (avpkt->pts != AV_NOPTS_VALUE)
> + s->next_pts = avpkt->pts + avpkt->duration;
Add a comment that this is for setting pts for flushed packet(s).
> +
> + avpkt->size = ret;
> + *got_packet_ptr = 1;
> + return 0;
> + }
> +
> + return ret;
If ret is an error code, you need to convert it to a proper Libav error
code and not return something specific to twolame.
Thanks,
Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel