summaryrefslogtreecommitdiff
path: root/libavformat/mxfenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-16 19:59:18 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-18 10:49:28 +0200
commit58afb3128bc650dbc22ae0a8d167be24d8863dfe (patch)
tree5c9d513bdc78e8a8fb15b629167742b29311d8dc /libavformat/mxfenc.c
parent451be676f3ff2e30d34d48aebe59bd791ce4d48f (diff)
avformat/mxfenc: Set the component depth from the pixel format if available
Reviewed-by: tim nicholson <nichot20@yahoo.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mxfenc.c')
-rw-r--r--libavformat/mxfenc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 59667924f0..14449c9f19 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -39,6 +39,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/timecode.h"
#include "libavutil/avassert.h"
+#include "libavutil/pixdesc.h"
#include "libavutil/time_internal.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/dnxhddata.h"
@@ -2029,10 +2030,16 @@ static int mxf_write_header(AVFormatContext *s)
}
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+ const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(st->codec->pix_fmt);
// TODO: should be avg_frame_rate
AVRational rate, tbc = st->time_base;
// Default component depth to 8
sc->component_depth = 8;
+
+ if (pix_desc) {
+ sc->component_depth = pix_desc->comp[0].depth_minus1 + 1;
+ }
+
mxf->timecode_base = (tbc.den + tbc.num/2) / tbc.num;
spf = ff_mxf_get_samples_per_frame(s, tbc);
if (!spf) {