mxfdemux: Use KLV for position/content tracking

* For pull-based, this avoids pulling content if it's not needed (ex: skipping filler
packet, not downloading the content if we only need to know if/where an essence
packet is, etc...). Allows reducing i/o usage to the minimum.

* This also allows doing sub-klv position tracking, and opens the way for
non-frame-wrapping handling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
This commit is contained in:
Edward Hervey 2021-07-15 10:45:46 +02:00 committed by Edward Hervey
parent 40d3690054
commit 38ec61c586
2 changed files with 464 additions and 348 deletions

File diff suppressed because it is too large Load diff

View file

@ -49,6 +49,24 @@ typedef struct _GstMXFDemuxClass GstMXFDemuxClass;
typedef struct _GstMXFDemuxPad GstMXFDemuxPad;
typedef struct _GstMXFDemuxPadClass GstMXFDemuxPadClass;
/*
* GstMXFKLV is used to pass around information about a KLV.
*
* It optionally contains the content of the klv (data field).
*/
typedef struct {
MXFUL key;
guint64 offset; /* absolute offset of K */
gsize length; /* Size of data (i.e. V) */
guint64 data_offset; /* relative offset of data (i.e. size of 'KL') */
GstBuffer *data; /* Can be NULL in pull-mode. */
/* For partial reads (ex: clip/custom wrapping essence), the amount of data
* already consumed within. If 0, all of length+data_offset was consumed */
guint64 consumed;
} GstMXFKLV;
typedef struct _GstMXFDemuxPartition GstMXFDemuxPartition;
typedef struct _GstMXFDemuxEssenceTrack GstMXFDemuxEssenceTrack;