API changes, most recent first:
+2012-02-16 - xxxxxxx - libswr 0.7.100
+ Add swr_set_matrix() function.
+
+2012-02-09 - xxxxxxx - lavu 51.39.100
+ Add a new installed header libavutil/timestamp.h with timestamp
+ utilities.
+
+2012-02-06 - xxxxxxx - lavu 51.38.100
+ Add av_parse_ratio() function to parseutils.h.
+
+2012-02-06 - xxxxxxx - lavu 51.38.100
+ Add AV_LOG_MAX_OFFSET macro to log.h.
+
+2012-02-02 - xxxxxxx - lavu 51.37.100
+ Add public timecode helpers.
+
+2012-01-24 - xxxxxxx - lavfi 2.60.100
+ Add avfilter_graph_dump.
+
+ 2012-xx-xx - xxxxxxx - lavc 54.x.x
+ Add duration field to AVCodecParserContext
+
+ 2012-02-xx - xxxxxxx - lavu 51.23.1 - mathematics.h
+ Add av_rescale_q_rnd()
+
2012-02-xx - xxxxxxx - lavu 51.22.1 - pixdesc.h
Add PIX_FMT_PSEUDOPAL flag.
.id = CODEC_ID_HUFFYUV,
.priv_data_size = sizeof(HYuvContext),
.init = encode_init,
- .encode = encode_frame,
+ .encode2 = encode_frame,
.close = encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE},
+ .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"),
};
#endif
.id = CODEC_ID_FFVHUFF,
.priv_data_size = sizeof(HYuvContext),
.init = encode_init,
- .encode = encode_frame,
+ .encode2 = encode_frame,
.close = encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE},
+ .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"),
};
#endif
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "avcodec.h"
+ #include "internal.h"
#include "mpegaudio.h"
- #include <lame/lame.h>
+ #include "mpegaudiodecheader.h"
-#define BUFFER_SIZE (7200 + 2 * MPA_FRAME_SIZE + MPA_FRAME_SIZE / 4)
+#define BUFFER_SIZE (7200 + 2 * MPA_FRAME_SIZE + MPA_FRAME_SIZE / 4+1000) // FIXME: Buffer size to small? Adding 1000 to make up for it.
- typedef struct Mp3AudioContext {
+
+ typedef struct LAMEContext {
AVClass *class;
+ AVCodecContext *avctx;
lame_global_flags *gfp;
- int stereo;
uint8_t buffer[BUFFER_SIZE];
int buffer_index;
- struct {
- int *left;
- int *right;
- } s32_data;
int reservoir;
- } Mp3AudioContext;
+ void *planar_samples[2];
+ } LAMEContext;
+
- static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
+ static av_cold int mp3lame_encode_close(AVCodecContext *avctx)
{
- Mp3AudioContext *s = avctx->priv_data;
+ LAMEContext *s = avctx->priv_data;
+ av_freep(&avctx->coded_frame);
+ av_freep(&s->planar_samples[0]);
+ av_freep(&s->planar_samples[1]);
+
+ lame_close(s->gfp);
+ return 0;
+ }
+
+ static av_cold int mp3lame_encode_init(AVCodecContext *avctx)
+ {
+ LAMEContext *s = avctx->priv_data;
+ int ret;
+
+ s->avctx = avctx;
+
+ /* initialize LAME and get defaults */
+ if ((s->gfp = lame_init()) == NULL)
+ return AVERROR(ENOMEM);
+
+ /* channels */
if (avctx->channels > 2) {
- return AVERROR(EINVAL);
+ av_log(avctx, AV_LOG_ERROR,
+ "Invalid number of channels %d, must be <= 2\n", avctx->channels);
+ ret = AVERROR(EINVAL);
+ goto error;
}
+ lame_set_num_channels(s->gfp, avctx->channels);
+ lame_set_mode(s->gfp, avctx->channels > 1 ? JOINT_STEREO : MONO);
- s->stereo = avctx->channels > 1 ? 1 : 0;
-
- if ((s->gfp = lame_init()) == NULL)
- goto err;
- lame_set_in_samplerate(s->gfp, avctx->sample_rate);
+ /* sample rate */
+ lame_set_in_samplerate (s->gfp, avctx->sample_rate);
lame_set_out_samplerate(s->gfp, avctx->sample_rate);
- lame_set_num_channels(s->gfp, avctx->channels);
- if (avctx->compression_level == FF_COMPRESSION_DEFAULT) {
+
+ /* algorithmic quality */
+ if (avctx->compression_level == FF_COMPRESSION_DEFAULT)
lame_set_quality(s->gfp, 5);
- } else {
+ else
lame_set_quality(s->gfp, avctx->compression_level);
- }
- lame_set_mode(s->gfp, s->stereo ? JOINT_STEREO : MONO);
- lame_set_brate(s->gfp, avctx->bit_rate / 1000);
+
+ /* rate control */
if (avctx->flags & CODEC_FLAG_QSCALE) {
- lame_set_brate(s->gfp, 0);
lame_set_VBR(s->gfp, vbr_default);
lame_set_VBR_quality(s->gfp, avctx->global_quality / (float)FF_QP2LAMBDA);
+ } else {
+ if (avctx->bit_rate)
+ lame_set_brate(s->gfp, avctx->bit_rate / 1000);
}
- lame_set_bWriteVbrTag(s->gfp,0);
- lame_set_disable_reservoir(s->gfp, !s->reservoir);
- if (lame_init_params(s->gfp) < 0)
- goto err_close;
- avctx->frame_size = lame_get_framesize(s->gfp);
+ /* do not get a Xing VBR header frame from LAME */
+ lame_set_bWriteVbrTag(s->gfp,0);
- if(!(avctx->coded_frame= avcodec_alloc_frame())) {
- lame_close(s->gfp);
+ /* bit reservoir usage */
+ lame_set_disable_reservoir(s->gfp, !s->reservoir);
- return AVERROR(ENOMEM);
+ /* set specified parameters */
+ if (lame_init_params(s->gfp) < 0) {
+ ret = -1;
+ goto error;
}
- if(AV_SAMPLE_FMT_S32 == avctx->sample_fmt && s->stereo) {
- int nelem = 2 * avctx->frame_size;
-
- if(! (s->s32_data.left = av_malloc(nelem * sizeof(int)))) {
- av_freep(&avctx->coded_frame);
- lame_close(s->gfp);
+ avctx->frame_size = lame_get_framesize(s->gfp);
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
- return AVERROR(ENOMEM);
+ /* sample format */
+ if (avctx->sample_fmt == AV_SAMPLE_FMT_S32 ||
+ avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
+ int ch;
+ for (ch = 0; ch < avctx->channels; ch++) {
+ s->planar_samples[ch] = av_malloc(avctx->frame_size *
+ av_get_bytes_per_sample(avctx->sample_fmt));
+ if (!s->planar_samples[ch]) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
}
-
- s->s32_data.right = s->s32_data.left + avctx->frame_size;
}
return 0;
#include "avcodec.h"
#include "bytestream.h"
+#include "libavutil/imgutils.h"
+ #include "internal.h"
typedef struct PCXContext {
AVFrame picture;
{
PCXContext *s = avctx->priv_data;
AVFrame *const pict = &s->picture;
- const uint8_t *buf_start = buf;
- const uint8_t *buf_end = buf + buf_size;
+ const uint8_t *buf_end;
+ uint8_t *buf;
- int bpp, nplanes, i, y, line_bytes, written;
+ int bpp, nplanes, i, y, line_bytes, written, ret, max_pkt_size;
const uint32_t *pal = NULL;
+ uint32_t palette256[256];
const uint8_t *src;
- *pict = *(AVFrame *)data;
+ *pict = *frame;
pict->pict_type = AV_PICTURE_TYPE_I;
pict->key_frame = 1;
*/
#include "avcodec.h"
-#include "bytestream.h"
+ #include "internal.h"
#include "pnm.h"
{
SgiContext *s = avctx->priv_data;
AVFrame * const p = &s->picture;
- uint8_t *offsettab, *lengthtab, *in_buf, *encode_buf;
- int x, y, z, length, tablesize;
+ uint8_t *offsettab, *lengthtab, *in_buf, *encode_buf, *buf;
+ int x, y, z, length, tablesize, ret;
- unsigned int width, height, depth, dimension;
+ unsigned int width, height, depth, dimension, bytes_per_channel, pixmax, put_be;
- unsigned char *orig_buf = buf, *end_buf = buf + buf_size;
+ unsigned char *end_buf;
- *p = *(AVFrame*)data;
+ *p = *frame;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
.id = CODEC_ID_SGI,
.priv_data_size = sizeof(SgiContext),
.init = encode_init,
- .encode = encode_frame,
+ .encode2 = encode_frame,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGBA, PIX_FMT_GRAY8, PIX_FMT_NONE},
+ .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGBA,
+ PIX_FMT_RGB48LE, PIX_FMT_RGB48BE,
+ PIX_FMT_RGBA64LE, PIX_FMT_RGBA64BE,
+ PIX_FMT_GRAY16LE, PIX_FMT_GRAY16BE,
+ PIX_FMT_GRAY8, PIX_FMT_NONE},
.long_name= NULL_IF_CONFIG_SMALL("SGI image"),
};
/* fabricate frame pts from sample count.
this is needed because the avcodec_encode_audio() API does not have
a way for the user to provide pts */
- frame->pts = ff_samples_to_time_base(avctx,
- avctx->internal->sample_count);
+ if(avctx->sample_rate && avctx->time_base.num)
- frame->pts = av_rescale_q(avctx->internal->sample_count,
- (AVRational){ 1, avctx->sample_rate },
- avctx->time_base);
++ frame->pts = ff_samples_to_time_base(avctx,
++ avctx->internal->sample_count);
+ else
+ frame->pts = AV_NOPTS_VALUE;
avctx->internal->sample_count += frame->nb_samples;
} else {
frame = NULL;
if (var->needed && !var->pkt.data) {
while (1) {
int64_t ts_diff;
+ AVStream *st;
ret = av_read_frame(var->ctx, &var->pkt);
if (ret < 0) {
- if (!url_feof(&var->pb)) {
- if (!var->pb.eof_reached)
++ if (!url_feof(&var->pb))
return ret;
- } else {
- if ((var->cur_seq_no - var->start_seq_no) == (var->n_segments)) {
- return AVERROR_EOF;
- }
- }
reset_packet(&var->pkt);
+ break;
} else {
if (c->first_timestamp == AV_NOPTS_VALUE)
c->first_timestamp = var->pkt.dts;
compute_frame_duration(&num, &den, st, pc, pkt);
if (den && num) {
pkt->duration = av_rescale_rnd(1, num * (int64_t)st->time_base.den, den * (int64_t)st->time_base.num, AV_ROUND_DOWN);
--
-- if(pkt->duration != 0 && s->packet_buffer)
-- update_initial_durations(s, st, pkt);
}
}
++ if(pkt->duration != 0 && s->packet_buffer)
++ update_initial_durations(s, st, pkt);
/* correct timestamps with byte offset if demuxers only have timestamps
on packet boundaries */
*/
#define LIBAVUTIL_VERSION_MAJOR 51
- #define LIBAVUTIL_VERSION_MINOR 39
-#define LIBAVUTIL_VERSION_MINOR 23
-#define LIBAVUTIL_VERSION_MICRO 1
++#define LIBAVUTIL_VERSION_MINOR 40
+#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
#if HAVE_VIS
DECLARE_ALIGNED(8, uint64_t, sparc_coeffs)[10];
#endif
- int32_t alpMmxFilter[4 * MAX_FILTER_SIZE];
+ int use_mmx_vfilter;
/* function pointers for swScale() */
yuv2planar1_fn yuv2plane1;