[FFmpeg-devel] [PATCH 1/4] libavformat/movenc: add dnxhr compatibility for apple players
Mark Reid
mindmark at gmail.com
Sun Jul 17 05:37:36 EEST 2016
---
libavcodec/dnxhddec.c | 3 +++
libavformat/movenc.c | 19 ++++++++++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 5b60326..4c6f708 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -204,6 +204,9 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
}
cid = AV_RB32(buf + 0x28);
+ if (cid >= 1270 && cid <= 1274)
+ ctx->avctx->codec_tag = MKTAG('A','V','d','h');
+
if ((ret = dnxhd_init_vlc(ctx, cid, bitdepth)) < 0)
return ret;
if (ctx->mbaff && ctx->cid_table->cid != 1260)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index d614933..7906f83 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -32,6 +32,7 @@
#include "isom.h"
#include "avc.h"
#include "libavcodec/ac3_parser.h"
+#include "libavcodec/dnxhddata.h"
#include "libavcodec/get_bits.h"
#include "libavcodec/put_bits.h"
#include "libavcodec/vc1_common.h"
@@ -1070,11 +1071,7 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
int cid;
if (track->vos_data && track->vos_len > 0x29) {
- if (track->vos_data[0] == 0x00 &&
- track->vos_data[1] == 0x00 &&
- track->vos_data[2] == 0x02 &&
- track->vos_data[3] == 0x80 &&
- (track->vos_data[4] == 0x01 || track->vos_data[4] == 0x02)) {
+ if (avpriv_dnxhd_parse_header_prefix(track->vos_data) != 0) {
/* looks like a DNxHD bit stream */
interlaced = (track->vos_data[5] & 2);
cid = AV_RB32(track->vos_data + 0x28);
@@ -1099,6 +1096,18 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
}
avio_wb32(pb, 0); /* unknown */
+ if (track->tag == MKTAG('A','V','d','h')) {
+ avio_wb32(pb, 32);
+ ffio_wfourcc(pb, "ADHR");
+ ffio_wfourcc(pb, "0001");
+ avio_wb32(pb, cid);
+ avio_wb32(pb, 0); /* unknown */
+ avio_wb32(pb, 1); /* unknown */
+ avio_wb32(pb, 0); /* unknown */
+ avio_wb32(pb, 0); /* unknown */
+ return 0;
+ }
+
avio_wb32(pb, 24); /* size */
ffio_wfourcc(pb, "APRG");
ffio_wfourcc(pb, "APRG");
--
2.7.3
More information about the ffmpeg-devel
mailing list