summaryrefslogtreecommitdiff
path: root/gst/mxf
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-07-24 17:00:02 +0300
committerSebastian Dröge <sebastian@centricular.com>2017-07-24 17:00:02 +0300
commitde7985d46abd382b64a6f11ccf3c5a9c57d43e9e (patch)
tree27baefb179532081947b628c87e809aea31b8209 /gst/mxf
parent59f9bc05d29038e498ed4c96311adc567fe57bfd (diff)
downloadgstreamer-plugins-bad-de7985d46abd382b64a6f11ccf3c5a9c57d43e9e.tar.gz
mxfdemux: Correctly consider frame reordering for timecode calculation
Diffstat (limited to 'gst/mxf')
-rw-r--r--gst/mxf/mxfdemux.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c
index 1118d1f6d..bed7e59b8 100644
--- a/gst/mxf/mxfdemux.c
+++ b/gst/mxf/mxfdemux.c
@@ -1940,10 +1940,26 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux,
if (pad->material_track->parent.type == MXF_METADATA_TRACK_PICTURE_ESSENCE
&& pad->start_timecode.config.fps_n != 0
&& pad->start_timecode.config.fps_d != 0) {
- GstVideoTimeCode timecode = pad->start_timecode;
- gst_video_time_code_add_frames (&timecode,
- pad->current_material_track_position);
- gst_buffer_add_video_time_code_meta (outbuf, &timecode);
+ if (etrack->intra_only) {
+ GstVideoTimeCode timecode = pad->start_timecode;
+
+ gst_video_time_code_add_frames (&timecode,
+ pad->current_material_track_position);
+ gst_buffer_add_video_time_code_meta (outbuf, &timecode);
+ } else if (pts != G_MAXUINT64) {
+ GstVideoTimeCode timecode = pad->start_timecode;
+
+ gst_video_time_code_add_frames (&timecode,
+ pad->current_component_start_position);
+ gst_video_time_code_add_frames (&timecode,
+ gst_util_uint64_scale (pts,
+ pad->material_track->edit_rate.n *
+ pad->current_essence_track->source_track->edit_rate.d,
+ pad->material_track->edit_rate.d *
+ pad->current_essence_track->source_track->edit_rate.n));
+ gst_buffer_add_video_time_code_meta (outbuf, &timecode);
+ }
+
}
/* Update accumulated error and compensate */