#include "avi.h"
CodecTag codec_wav_tags[] = {
- { CODEC_ID_MP2, 0x55 },
- { CODEC_ID_MP3LAME, 0x55 },
{ CODEC_ID_MP2, 0x50 },
+ { CODEC_ID_MP3LAME, 0x55 },
{ CODEC_ID_AC3, 0x2000 },
{ CODEC_ID_PCM_S16LE, 0x01 },
{ CODEC_ID_PCM_U8, 0x01 }, /* must come after s16le in this list */
tag = codec_get_tag(codec_wav_tags, enc->codec_id);
if (tag == 0)
return -1;
- put_le16(pb, tag);
+ put_le16(pb, tag);
put_le16(pb, enc->channels);
put_le32(pb, enc->sample_rate);
if (enc->codec_id == CODEC_ID_PCM_U8 ||
bps = 16;
}
- if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3LAME)
+ if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3LAME) {
blkalign = 1;
- else
+ //blkalign = 144 * enc->bit_rate/enc->sample_rate;
+ } else
blkalign = enc->channels*bps >> 3;
if (enc->codec_id == CODEC_ID_PCM_U8 ||
enc->codec_id == CODEC_ID_PCM_S16LE) {
put_le32(pb, bytespersec); /* bytes per second */
put_le16(pb, blkalign); /* block align */
put_le16(pb, bps); /* bits per sample */
- if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3LAME) {
+ if (enc->codec_id == CODEC_ID_MP3LAME) {
put_le16(pb, 12); /* wav_extra_size */
put_le16(pb, 1); /* wID */
put_le32(pb, 2); /* fdwFlags */
put_le16(pb, 1152); /* nBlockSize */
put_le16(pb, 1); /* nFramesPerBlock */
put_le16(pb, 1393); /* nCodecDelay */
+ } else if (enc->codec_id == CODEC_ID_MP2) {
+ put_le16(pb, 22); /* wav_extra_size */
+ put_le16(pb, 2); /* fwHeadLayer */
+ put_le32(pb, enc->bit_rate); /* dwHeadBitrate */
+ put_le16(pb, enc->channels == 2 ? 1 : 8); /* fwHeadMode */
+ put_le16(pb, 0); /* fwHeadModeExt */
+ put_le16(pb, 1); /* wHeadEmphasis */
+ put_le16(pb, 16); /* fwHeadFlags */
+ put_le32(pb, 0); /* dwPTSLow */
+ put_le32(pb, 0); /* dwPTSHigh */
} else
put_le16(pb, 0); /* wav_extra_size */
#include "common.h"
+#define LIBAVCODEC_VERSION_INT 0x000406
+#define LIBAVCODEC_VERSION "0.4.6"
+#define LIBAVCODEC_BUILD 4600
+#define LIBAVCODEC_BUILD_STR "4600"
+
enum CodecID {
CODEC_ID_NONE,
CODEC_ID_MPEG1VIDEO,
extern int motion_estimation_method;
/* ME algos sorted by quality */
-static const int Motion_Est_QTab[] = { -4, -1, -2, 1, 0, -3 };
+static const int Motion_Est_QTab[] = { 1, 4, 3, 6, 5, 2 };
/* encoding support */
/* note not everything is supported yet */
extern AVCodec h263i_decoder;
extern AVCodec rv10_decoder;
extern AVCodec mjpeg_decoder;
+extern AVCodec mp2_decoder;
extern AVCodec mp3_decoder;
/* pcm codecs */
static void mpeg4_encode_vol_header(MpegEncContext * s)
{
int vo_ver_id=1; //must be 2 if we want GMC or q-pel
-
+ char buf[255];
+
if(get_bit_count(&s->pb)!=0) mpeg4_stuffing(&s->pb);
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x100); /* video obj */
mpeg4_stuffing(&s->pb);
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x1B2); /* user_data */
- put_string(&s->pb, "ffmpeg"); //FIXME append some version ...
+ sprintf(buf, "FFmpeg v%s / libavcodec build: %s", FFMPEG_VERSION, LIBAVCODEC_BUILD_STR);
+ put_string(&s->pb, buf);
s->no_rounding = 0;
}