mirror of https://git.ffmpeg.org/ffmpeg.git
- Versions defined for libav/libavcodec.
- Bug fix in wav muxer for MP2 audio. - ffmpeg/libavcodec version in MPEG-4 user data. Originally committed as revision 400 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
101bea5f22
commit
4b1f4f236b
|
@ -1,4 +1,8 @@
|
|||
|
||||
#define LIBAV_VERSION_INT 0x000406
|
||||
#define LIBAV_VERSION "0.4.6"
|
||||
#define LIBAV_BUILD 4600
|
||||
|
||||
#include "avcodec.h"
|
||||
|
||||
#include "avio.h"
|
||||
|
|
22
libav/wav.c
22
libav/wav.c
|
@ -20,9 +20,8 @@
|
|||
#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 */
|
||||
|
@ -39,7 +38,7 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
|
|||
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 ||
|
||||
|
@ -52,9 +51,10 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
|
|||
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) {
|
||||
|
@ -65,13 +65,23 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
|
|||
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 */
|
||||
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
|
||||
#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,
|
||||
|
@ -70,7 +75,7 @@ enum Motion_Est_ID {
|
|||
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 */
|
||||
|
@ -229,6 +234,7 @@ extern AVCodec mpeg_decoder;
|
|||
extern AVCodec h263i_decoder;
|
||||
extern AVCodec rv10_decoder;
|
||||
extern AVCodec mjpeg_decoder;
|
||||
extern AVCodec mp2_decoder;
|
||||
extern AVCodec mp3_decoder;
|
||||
|
||||
/* pcm codecs */
|
||||
|
|
|
@ -873,7 +873,8 @@ static void put_string(PutBitContext * pbc, char *s)
|
|||
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 */
|
||||
|
@ -926,7 +927,8 @@ static void mpeg4_encode_vol_header(MpegEncContext * s)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -2393,9 +2393,9 @@ static int decode_frame(AVCodecContext * avctx,
|
|||
return buf_ptr - buf;
|
||||
}
|
||||
|
||||
AVCodec mp3_decoder =
|
||||
AVCodec mp2_decoder =
|
||||
{
|
||||
"mpegaudio",
|
||||
"mp2",
|
||||
CODEC_TYPE_AUDIO,
|
||||
CODEC_ID_MP2,
|
||||
sizeof(MPADecodeContext),
|
||||
|
@ -2404,3 +2404,15 @@ AVCodec mp3_decoder =
|
|||
NULL,
|
||||
decode_frame,
|
||||
};
|
||||
|
||||
AVCodec mp3_decoder =
|
||||
{
|
||||
"mp3",
|
||||
CODEC_TYPE_AUDIO,
|
||||
CODEC_ID_MP3LAME,
|
||||
sizeof(MPADecodeContext),
|
||||
decode_init,
|
||||
NULL,
|
||||
NULL,
|
||||
decode_frame,
|
||||
};
|
||||
|
|
|
@ -454,6 +454,7 @@ void avcodec_register_all(void)
|
|||
register_avcodec(&h263i_decoder);
|
||||
register_avcodec(&rv10_decoder);
|
||||
register_avcodec(&mjpeg_decoder);
|
||||
register_avcodec(&mp2_decoder);
|
||||
register_avcodec(&mp3_decoder);
|
||||
#ifdef CONFIG_AC3
|
||||
register_avcodec(&ac3_decoder);
|
||||
|
|
Loading…
Reference in New Issue