[FFmpeg-devel] [PATCH 3/6] libavformat/dnxhd: add dnxhr probe and raw muxer
Mark Reid
mindmark at gmail.com
Tue Jul 5 04:06:59 EEST 2016
---
libavformat/allformats.c | 1 +
libavformat/dnxhddec.c | 22 ++++++++++++++++++++--
libavformat/rawenc.c | 11 +++++++++++
libavformat/version.h | 2 +-
4 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d490cc4..0ee3b85 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -107,6 +107,7 @@ void av_register_all(void)
REGISTER_DEMUXER (DFA, dfa);
REGISTER_MUXDEMUX(DIRAC, dirac);
REGISTER_MUXDEMUX(DNXHD, dnxhd);
+ REGISTER_MUXDEMUX(DNXHR, dnxhr);
REGISTER_DEMUXER (DSF, dsf);
REGISTER_DEMUXER (DSICIN, dsicin);
REGISTER_DEMUXER (DSS, dss);
diff --git a/libavformat/dnxhddec.c b/libavformat/dnxhddec.c
index 48c890d..081daaa 100644
--- a/libavformat/dnxhddec.c
+++ b/libavformat/dnxhddec.c
@@ -25,12 +25,13 @@
#include "rawdec.h"
#include "libavcodec/dnxhddata.h"
-static int dnxhd_probe(AVProbeData *p)
+static uint64_t dnxhd_probe_header(AVProbeData *p)
{
int w, h, compression_id;
+ uint64_t header_prefix;
if (p->buf_size < 0x2c)
return 0;
- if (avpriv_dnxhd_parse_header_prefix(p->buf) == 0)
+ if ((header_prefix = avpriv_dnxhd_parse_header_prefix(p->buf)) == 0)
return 0;
h = AV_RB16(p->buf + 0x18);
w = AV_RB16(p->buf + 0x1a);
@@ -40,7 +41,24 @@ static int dnxhd_probe(AVProbeData *p)
if ((compression_id < 1235 || compression_id > 1260) &&
(compression_id < 1270 || compression_id > 1274))
return 0;
+ return header_prefix;
+}
+
+static int dnxhd_probe(AVProbeData *p)
+{
+ uint64_t header_prefix = dnxhd_probe_header(p);
+ if(header_prefix == DNXHD_HEADER_INITIAL || header_prefix == DNXHD_HEADER_444)
+ return AVPROBE_SCORE_MAX;
+ return 0;
+}
+
+static int dnxhr_probe(AVProbeData *p)
+{
+ uint64_t header_prefix = dnxhd_probe_header(p);
+ if(header_prefix == DNXHD_HEADER_HR1 || header_prefix == DNXHD_HEADER_HR2)
return AVPROBE_SCORE_MAX;
+ return 0;
}
FF_DEF_RAWVIDEO_DEMUXER(dnxhd, "raw DNxHD (SMPTE VC-3)", dnxhd_probe, NULL, AV_CODEC_ID_DNXHD)
+FF_DEF_RAWVIDEO_DEMUXER(dnxhr, "raw DNxHR", dnxhr_probe, NULL, AV_CODEC_ID_DNXHR)
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 4b8b41c..271400d 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -135,6 +135,17 @@ AVOutputFormat ff_dnxhd_muxer = {
.write_packet = ff_raw_write_packet,
.flags = AVFMT_NOTIMESTAMPS,
};
+
+AVOutputFormat ff_dnxhr_muxer = {
+ .name = "dnxhr",
+ .long_name = NULL_IF_CONFIG_SMALL("raw DNxHR"),
+ .extensions = "dnxhr",
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_DNXHR,
+ .write_header = force_one_stream,
+ .write_packet = ff_raw_write_packet,
+ .flags = AVFMT_NOTIMESTAMPS,
+};
#endif
#if CONFIG_DTS_MUXER
diff --git a/libavformat/version.h b/libavformat/version.h
index 47a8afb..3921ee5 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you belive might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 57
-#define LIBAVFORMAT_VERSION_MINOR 41
+#define LIBAVFORMAT_VERSION_MINOR 42
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
--
2.7.3
More information about the ffmpeg-devel
mailing list