Commit graph

224 commits

Author SHA1 Message Date
Edward Hervey
dfee771afd mxfdemux: Handle temporal reordering shift
This is similar to how the same issue was handled in qtdemux.

In order for the "DTS <= PTS" constraint to be respected, we calculate the
maximum temporal reordering that can happen (via index tables).

If there is a non-0 temporal reordering, we:
* Shift all outgoing PTS by that amount
* Shift segment for that stream by that amount
* Don't modify DTS (i.e. they might end up having negative running-time, before
the start of the segment)

Also ensure all entries have a valid PTS set, previously this wouldn't be set
for entries with a temporal offset of 0.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/584

(and maybe a lot of other issues)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
49b061241e mxfdemux: Check validity of interleaved File Package
As specified by the S377 MXF core specification, if a file package has
interleaved content, then all tracks must be using the same Edit Rate

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2378>
2021-07-05 07:07:15 +00:00
Edward Hervey
162e7bd28b mxfvanc: Handle empty ANC essence
Not having any *actual* ANC is totally fine and common usage with several MXF
variants.

In order to properly advance the streams, the essence handler returns an empty
GAP buffer which gets converted to a GST_EVENT_GAP.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2345>
2021-07-01 11:04:03 +02:00
Stéphane Cerveau
eb96f50c45 mxf: check EOS cond with any segment's flag
The previous test was preventing the pad to be in EOS
when the segment position was greater than segment stop.
It ended up consuming all the data before getting in EOS.

Regarding GST_SEEK_FLAG_SEGMENT it seems to be
correctly handled later in the method.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2173>
2021-05-04 19:11:27 +00:00
Stéphane Cerveau
c32f455b7b mxfdemux: fix keyframe detection in index
An index entry should be considered as a keyframe
if the flags allow a random access only.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2173>
2021-05-04 19:11:27 +00:00
Stéphane Cerveau
891be51105 gst-plugins: allow per feature registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2110>
2021-04-11 16:16:55 +00:00
Thibault Saunier
ebb0527e75 mxfdemux: Avoid possible NULL caps 'dereferencing' 2019-03-21 00:40:53 +00:00
Edward Hervey
6c2fc31012 mxfdemux: Remove useless check
Any modification of ret in that "while (ret == GST_FLOW_OK)" loop will
break (and cause it to stop the iteration).

CID #1427095
2018-01-11 11:41:33 +01:00
Ponnam Srinivas
ff0ccc2a11 mxfdemux: Fix memory leak in error case
https://bugzilla.gnome.org/show_bug.cgi?id=788508
2017-10-06 18:15:38 +01:00
Sebastian Dröge
444776ae10 mxfdemux: Fix compilation with gcc 4.8.4
https://bugzilla.gnome.org/show_bug.cgi?id=785367
2017-07-25 10:03:25 +03:00
Sebastian Dröge
de7985d46a mxfdemux: Correctly consider frame reordering for timecode calculation 2017-07-24 17:00:02 +03:00
Sebastian Dröge
59f9bc05d2 mxfdemux: Use material track edit rate for component PTS offsetting 2017-07-24 16:57:19 +03:00
Sebastian Dröge
26d5ba42ea mxfdemux: Output timecodes for video streams 2017-07-24 16:49:19 +03:00
Sebastian Dröge
c2ef63a3bc mxfdemux: Keep track of component start positions and material track positions
This allows us to know exactly where in the material track we are, and
how to convert from a PTS for a source track to the actual PTS of the
material track (i.e. by adding the component start position).

https://bugzilla.gnome.org/show_bug.cgi?id=785119
2017-07-24 16:21:31 +03:00
Sebastian Dröge
16fc8541b5 mxfdemux: Create index table arrays with a big enough size 2017-07-11 20:57:24 +03:00
Sebastian Dröge
3a1912f88c mxfdemux: Initialize index table entries completely in all cases
When seeking backwards into a previously unseen location, we wouldn't
fully initialize them and playback would fail later.
2017-07-11 20:57:23 +03:00
Sebastian Dröge
08ac093b40 mxfdemux: For intra-only streams, always output DTS=PTS 2017-07-05 17:04:46 +03:00
Sebastian Dröge
9091e746e5 mxfdemux: Fix integer overflow in partition position comparison function 2017-07-05 15:48:57 +03:00
Sebastian Dröge
bd8809f9d7 mxfdemux: Print PTS and DTS in debug output when pushing buffers 2017-07-05 15:11:22 +03:00
Sebastian Dröge
37e0439e84 mxfdemux: Don't include any KLV packets between header metadata and index table segments in calculations
Minor fixup of last commit.
2017-07-05 00:49:25 +03:00
Sebastian Dröge
72b7794798 mxfdemux: Allow filler and other KLV packets between index table segments
While only filler packets should be allowed, for good measure also skip
any other KLV packets in the range where there could be index table
segments.

This fixes parsing of partitions with multiple index table segments,
which are separated by a filler packet, or other packets.
2017-07-04 20:17:53 +03:00
Sebastian Dröge
af6db6861e mxfdemux: Include duration in response to SEEKING query 2017-06-27 15:41:48 +03:00
Sebastian Dröge
830e89b7e9 mxfdemux: Take temporal reordering from the index table into account
This is needed to know the PTS, without that we only know the DTS and
using that also for the PTS is wrong unless we have an intra-only codec.

If we can't get the temporal reordering from the index table, don't set
any PTS for non-intra-only codecs and let decoders figure out something.

https://bugzilla.gnome.org/show_bug.cgi?id=784027
2017-06-27 10:47:44 +03:00
Thibault Saunier
fd3854c3e3 mxfdemux: Do not try to serialize unresolved metadatas
When retrieving the `mxfdemux.structure` property, it leads to an
assertion as metadatas need to be resolved for the call to
mxf_metadata_base_to_structure to be valid.
2017-06-15 14:18:20 -04:00
Thibault Saunier
78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Sebastian Dröge
08723e68df mxfdemux: Set stream tags to NULL after unreffing
Otherwise we might try to unref them a second time a little bit later.

https://bugzilla.gnome.org/show_bug.cgi?id=777503
2017-01-20 07:51:09 +02:00
Sebastian Dröge
88e060743a mxfdemux: Post an error message if we got EOS before having any source pads
Otherwise, sending an EOS event has no effect and the application waits
forever for something to happen.
2016-11-26 12:28:57 +02:00
Sebastian Dröge
d3b45a145f mxfdemux: Fix up another size check and prevent allocating too much memory 2016-11-25 16:46:45 +02:00
Sebastian Dröge
73e02f4553 mxfdemux: Fix various logic errors in error handling of footer partition parsing 2016-11-25 15:53:50 +02:00
Sebastian Dröge
9ff1ac59f3 mxfdemux: Don't try parsing empty metadata items 2016-11-25 15:53:36 +02:00
Sebastian Dröge
b5bb6e3b38 mxfdemux: Add various missing bounds checks, NULL checks and integer overflow protection for error cases 2016-11-24 23:40:21 +02:00
Thibault Saunier
2fb716409c Use the new API to post flow ERROR messages on the bus
https://bugzilla.gnome.org/show_bug.cgi?id=770158
2016-08-26 19:23:31 -03:00
Vineeth TM
8cdfb13658 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2016-03-24 14:56:51 +02:00
Jimmy Ohn
74a90087c1 mxfdemux: Fix query memory leak
Peer query isn't being freed in case of GST_QUERY_SEEKING.

https://bugzilla.gnome.org/show_bug.cgi?id=763974
2016-03-21 10:44:02 +02:00
Vineeth TM
7c42ba97d7 plugins-bad: Fix example pipelines
rename gst-launch --> gst-launch-1.0
replace old elements with new elements(ffmpegcolorspace -> videoconvert, ffenc_** -> avenc_**)
fix caps in examples

https://bugzilla.gnome.org/show_bug.cgi?id=759432
2015-12-15 10:30:49 +00:00
Sebastian Dröge
7ae23d13c8 mxfdemux: Only pre-set position for exactly the same essence track
The edit rate is only supposed to be the same in a source package, but there
might be multiple source packages with the same essence container. As such
just comparing the body/index SID is not sufficient.
2015-12-10 12:47:17 +02:00
Sebastian Dröge
39aa2aaa39 mxfdemux: Only pre-set the track position if it's for the same body/index SID 2015-12-10 12:27:04 +02:00
Sebastian Dröge
f2eaa68c90 mxfdemux: Only access the index table if it has enough elements 2015-12-09 16:55:00 +02:00
Sebastian Dröge
6e06f8c936 mxfdemux: Use keyframe information from index table segments if available
We don't implement keyframe detection for all codecs and this will allow us to
implement better seeking.
2015-12-09 16:49:30 +02:00
Sebastian Dröge
b504672fc4 mxfdemux: Collect all index table segments after finding the random index pack
That way we always have the index table information available, especially the
keyframe-ness of all buffers.
2015-12-09 16:33:39 +02:00
Sebastian Dröge
6d367d6b48 mxfdemux: Fix handling of IndexTableSegments
This was completely broken before and could only work on a very constrained
set of files. After these changes it should work except for situations where
PTS != DTS, which is not handled at all in mxfdemux currently.

https://bugzilla.gnome.org/show_bug.cgi?id=759118
2015-12-09 16:33:39 +02:00
Sebastian Dröge
01f0d16db3 mxfmux: Index table segments must not use the primer pack
According to S377-1-2009c 9.2 the local tags must not be resolved from the
primer pack, which as a result means that there can't be any other tags than
statically assigned ones.
2015-12-08 10:14:41 +02:00
Sebastian Dröge
41982e6ccf mxfdemux: If seeking to the remaining parts of the file fails on EOS, consider the stream done
Without this we would run this while loop forever, always seeking again for
the same stream.
2015-10-21 19:54:15 +03:00
Guillaume Desmottes
4d790dae67 mxfdemux: fix memory leak
Reset the internal segment before freeing it.

mxf_index_table_segment_parse() allocates data inside the segment
(like segment->delta_entries) which have to be freed using
mxf_index_table_segment_reset().

https://bugzilla.gnome.org/show_bug.cgi?id=746803
2015-04-04 19:47:40 +01:00
Mark Nauwelaerts
32e87b1024 mxfdemux: resurrect some flow return handling
https://bugzilla.gnome.org/show_bug.cgi?id=744572
2015-03-28 18:22:29 +01:00
Luis de Bethencourt
9909d1f770 mxfdemux: remove unneeded values
No need to store the GstFlowReturn when we can check if it is not OK directly
2015-02-18 19:27:46 +00:00
Luis de Bethencourt
4d43472c2b mxfdemux: renaming GstFlowReturn variable
Having a variable named ret in a static void function is very confusing since
this usually is to store what the function will return.
2015-02-18 19:26:43 +00:00
Luis de Bethencourt
b7e0c7a163 mxfdemux: remove ignored value
Value stored in ret will be ovewritten in the next iteration of the loop. Which
means it is never used.

Plus a style issue to make gst-indent happy and allow the commit.
2015-02-18 18:00:54 +00:00
Mathieu Duponchelle
631663b854 mxfdemux: Use IndexTableSegments.
This speeds up seeking drastically.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=732294
2014-12-14 12:53:55 +01:00
Vineeth T M
14acb6fb37 gst: remove unnecessary GLIB_DISABLE_DEPRECATION_WARNINGS
There are unnecessary definitions for disabling deprecation warnings.
Since GLIB_DISABLE_DEPRECATION_WARNINGS is not needed anymore in these files,
removing the same.

https://bugzilla.gnome.org/show_bug.cgi?id=737559
2014-10-02 10:51:35 +03:00