Commit fc4cbc16 authored by Baptiste Coudurier's avatar Baptiste Coudurier

DNxHD (SMPTE VC-3) encoder

Originally committed as revision 10682 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 69cea75f
......@@ -97,6 +97,7 @@ version <next>
- Monkey's Audio demuxer and decoder
- additional SPARC (VIS) optimizations
- AMV audio and video decoder
- DNxHD encoder
version 0.4.9-pre1:
......
......@@ -118,7 +118,7 @@ Codecs:
cook.c, cookdata.h Benjamin Larsson
cscd.c Reimar Doeffinger
dca.c Kostya Shishkov
dnxhddec.c Baptiste Coudurier
dnxhd* Baptiste Coudurier
dpcm.c Mike Melanson
dxa.c Kostya Shishkov
dv.c Roman Shaposhnik
......
......@@ -226,7 +226,7 @@ following image formats are supported:
@item Cin Video @tab @tab X @tab Codec used in Delphine Software games.
@item Tiertex Seq Video @tab @tab X @tab Codec used in DOS CDROM FlashBack game.
@item DXA Video @tab @tab X @tab Codec originally used in Feeble Files game.
@item AVID DNxHD @tab @tab X @tab aka SMPTE VC3
@item AVID DNxHD @tab X @tab X @tab aka SMPTE VC3
@item C93 Video @tab @tab X @tab Codec used in Cyberia game.
@item THP @tab @tab X @tab Used on the Nintendo GameCube.
@item Bethsoft VID @tab @tab X @tab Used in some games from Bethesda Softworks.
......
......@@ -56,6 +56,7 @@ OBJS-$(CONFIG_CSCD_DECODER) += cscd.o
OBJS-$(CONFIG_CYUV_DECODER) += cyuv.o
OBJS-$(CONFIG_DCA_DECODER) += dca.o
OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o
OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o
OBJS-$(CONFIG_DSICINVIDEO_DECODER) += dsicinav.o
OBJS-$(CONFIG_DSICINAUDIO_DECODER) += dsicinav.o
OBJS-$(CONFIG_DVBSUB_DECODER) += dvbsubdec.o
......
......@@ -73,7 +73,7 @@ void avcodec_register_all(void)
REGISTER_DECODER (CLJR, cljr);
REGISTER_DECODER (CSCD, cscd);
REGISTER_DECODER (CYUV, cyuv);
REGISTER_DECODER (DNXHD, dnxhd);
REGISTER_ENCDEC (DNXHD, dnxhd);
REGISTER_DECODER (DSICINVIDEO, dsicinvideo);
REGISTER_ENCDEC (DVVIDEO, dvvideo);
REGISTER_DECODER (DXA, dxa);
......
......@@ -33,8 +33,8 @@
#define AV_STRINGIFY(s) AV_TOSTRING(s)
#define AV_TOSTRING(s) #s
#define LIBAVCODEC_VERSION_INT ((51<<16)+(44<<8)+0)
#define LIBAVCODEC_VERSION 51.44.0
#define LIBAVCODEC_VERSION_INT ((51<<16)+(45<<8)+0)
#define LIBAVCODEC_VERSION 51.45.0
#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
......
This diff is collapsed.
......@@ -516,6 +516,51 @@ static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos);
}
/* also used by all avid codecs (dv, imx, meridien) and their variants */
static int mov_write_avid_tag(ByteIOContext *pb, MOVTrack *track)
{
int i;
put_be32(pb, 24); /* size */
put_tag(pb, "ACLR");
put_tag(pb, "ACLR");
put_tag(pb, "0001");
put_be32(pb, 1); /* yuv 1 / rgb 2 ? */
put_be32(pb, 0); /* unknown */
put_be32(pb, 24); /* size */
put_tag(pb, "APRG");
put_tag(pb, "APRG");
put_tag(pb, "0001");
put_be32(pb, 1); /* unknown */
put_be32(pb, 0); /* unknown */
put_be32(pb, 120); /* size */
put_tag(pb, "ARES");
put_tag(pb, "ARES");
put_tag(pb, "0001");
put_be32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */
put_be32(pb, track->enc->width);
/* values below are based on samples created with quicktime and avid codecs */
if (track->vosData[5] & 2) { // interlaced
put_be32(pb, track->enc->height/2);
put_be32(pb, 2); /* unknown */
put_be32(pb, 0); /* unknown */
put_be32(pb, 4); /* unknown */
} else {
put_be32(pb, track->enc->height);
put_be32(pb, 1); /* unknown */
put_be32(pb, 0); /* unknown */
put_be32(pb, 5); /* unknown */
}
/* padding */
for (i = 0; i < 10; i++)
put_be64(pb, 0);
/* extra padding for stsd needed */
put_be32(pb, 0);
return 0;
}
static int mov_find_video_codec_tag(AVFormatContext *s, MOVTrack *track)
{
int tag = track->enc->codec_tag;
......@@ -623,6 +668,8 @@ static int mov_write_video_tag(ByteIOContext *pb, MOVTrack* track)
mov_write_svq3_tag(pb);
else if(track->enc->codec_id == CODEC_ID_H264)
mov_write_avcc_tag(pb, track);
else if(track->enc->codec_id == CODEC_ID_DNXHD)
mov_write_avid_tag(pb, track);
return updateSize (pb, pos);
}
......@@ -1561,6 +1608,13 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
avc_parse_nal_units(&pkt->data, &pkt->size);
assert(pkt->size);
size = pkt->size;
} else if (enc->codec_id == CODEC_ID_DNXHD && !trk->vosLen) {
/* copy frame header to create needed atoms */
if (size < 640)
return -1;
trk->vosLen = 640;
trk->vosData = av_malloc(trk->vosLen);
memcpy(trk->vosData, pkt->data, 640);
}
if (!(trk->entry % MOV_INDEX_CLUSTER_SIZE)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment