platform/upstream/gstreamer.git
3 years agodashdemux: copy ContentProtection element including xml namespaces
Alex Ashley [Tue, 24 Aug 2021 13:33:42 +0000 (14:33 +0100)]
dashdemux: copy ContentProtection element including xml namespaces

Commit bc09d8cc changed gstmpdparser to put the entire
<ContentProtection> element in the "value" field, so that DRMs
other than PlayReady could make use of the data inside this
element.

However, the data in the "value" field does not include any
XML namespace declarations that are used within the element. This
causes problems for a namespace aware XML parser that wants to
make use of this data.

This commit modifies the way the XML is converted to a string
so that XML namespaces are preserved in the output.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2487>

3 years agoerrorignore: Add ignore-eos mode
Vivia Nikolaidou [Thu, 26 Aug 2021 18:26:01 +0000 (21:26 +0300)]
errorignore: Add ignore-eos mode

It's otherwise very complicated to ignore GST_FLOW_EOS without a
ghostpad's chain function to rewrite.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2492>

3 years agogsth264parser: fix typo in debug message
Brad Hards [Fri, 27 Aug 2021 07:25:04 +0000 (17:25 +1000)]
gsth264parser: fix typo in debug message

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2493>

3 years agotimecodestamper: add support for closedcaption input
Mathieu Duponchelle [Thu, 26 Aug 2021 02:12:07 +0000 (04:12 +0200)]
timecodestamper: add support for closedcaption input

Some closedcaption elements like sccenc except input buffers
to have timecode metas. The original use case is to serialize
closed captions extracted from a video stream, in that case
ccextractor copies the video time code metas to the closed
caption buffers, but no such mechanism exists when creating
a CC stream ex nihilo.

Remedy that by having timecodestamper accept closedcaption
input caps, as long as they have a framerate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2490>

3 years agoaes: add aes encryption and decryption elements
Aaron Boxer [Tue, 6 Jul 2021 16:31:42 +0000 (12:31 -0400)]
aes: add aes encryption and decryption elements

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1505>

3 years agowebrtcbin: Return typed "sctp-transport"
Johan Sternerup [Mon, 10 May 2021 10:02:20 +0000 (12:02 +0200)]
webrtcbin: Return typed "sctp-transport"

With GstWebRTCSCTPTransport type exposed we can now define
"sctp-transport" property as being of this type.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2214>

3 years agowebrtc: Split sctptransport into lib and implementation parts
Johan Sternerup [Fri, 7 May 2021 06:12:25 +0000 (08:12 +0200)]
webrtc: Split sctptransport into lib and implementation parts

GstWebRTCSCTPTransport is now made into into an abstract base class
that only contains property specifications matching the
RTCSctpTransport interface of the W3C WebRTC specification, see
https://w3c.github.io/webrtc-pc/#rtcsctptransport-interface. This
class is put into the WebRTC library to expose it for applications and
to allow for generation of bindings for non-dynamic languages using
GObject introspection.

The actual implementation is moved to the subclass WebRTCSCTPTransport
located in the WebRTC plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2214>

3 years agowebrtcbin: Expose SCTP Transport
Johan Sternerup [Mon, 3 May 2021 08:45:42 +0000 (10:45 +0200)]
webrtcbin: Expose SCTP Transport

Being able to access the SCTP Transport object from the application
means the application can access the associated DTLS Transport object
and its ICE Transport object. This means we can observe the ICE state
also for a data-channel-only session. The collated
ice-connection-state on webrtcbin only includes the ICE Transport
objects that resides on the RTP transceivers (which is exactly how it
is specified in
https://w3c.github.io/webrtc-pc/#rtciceconnectionstate-enum).

For the consent freshness functionality (RFC 7675) to work the ICE
state must be accessible and consequently the SCTP transport must be
accessible for enabling consent freshness checking for a
data-channel-only session.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2214>

3 years agoopenh264enc: fix broken header AU emission by base class
Tim-Philipp Müller [Tue, 20 Apr 2021 19:04:33 +0000 (20:04 +0100)]
openh264enc: fix broken header AU emission by base class

This encoder advertises alignment=au as output format, which means
each output frame should contain a full decodable access unit.

The video encoder base class is not aware of our output alignment
and will output spurious buffers with just the SPS/PPS inside when
we call gst_video_encoder_set_headers(), which is broken because
each buffer is supposed to contain a full decodable access unit
in our case.

Just don't tell the base class about our headers, they will be
sent at the beginning of each IDR frame anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2178>

3 years agoopenh264enc: fix caps and header buffer leak
Tim-Philipp Müller [Tue, 20 Apr 2021 18:43:53 +0000 (19:43 +0100)]
openh264enc: fix caps and header buffer leak

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2178>

3 years agoopenh264enc: fix broken sps/pps header generation
Tim-Philipp Müller [Tue, 20 Apr 2021 18:11:12 +0000 (19:11 +0100)]
openh264enc: fix broken sps/pps header generation

This was putting a truncated SPS into the initial header instead
of the PPS because it was always reading from the beginning of the
bitstream buffer (pBsBuf) and not from the offset where the current
NAL is at in the bitstream buffer (psBsBuf + nal_offset).

This was broken in commit 17113695.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2178>

3 years agod3d11bufferpool: Hide buffer_size field from header
Seungha Yang [Sat, 21 Aug 2021 15:33:58 +0000 (00:33 +0900)]
d3d11bufferpool: Hide buffer_size field from header

User can get the required buffer size by using buffer pool config.
Since d3d11 implementation is a candidate for public library in the future,
we need to hide everything from header as much as possible.

Note that the total size of allocated d3d11 texture memory by GPU is not
controllable factor. It depends on hardware specific alignment/padding
requirement. So, GstD3D11 implementation updates actual buffer size
by allocating D3D11 texture, since there's no way to get CPU accessible
memory size without allocating real D3D11 texture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2482>

3 years agonvcodec: Fix various typos
Seungha Yang [Fri, 20 Aug 2021 17:20:11 +0000 (02:20 +0900)]
nvcodec: Fix various typos

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2481>

3 years agonvcodec: Get rid of G_GNUC_INTERNAL
Seungha Yang [Fri, 20 Aug 2021 17:10:37 +0000 (02:10 +0900)]
nvcodec: Get rid of G_GNUC_INTERNAL

Our default symbol visibility is hidden, so G_GNUC_INTERNAL
is pointless

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2481>

3 years agov4l2codecs: h264: Fix split field handling
Nicolas Dufresne [Thu, 19 Aug 2021 20:45:18 +0000 (16:45 -0400)]
v4l2codecs: h264: Fix split field handling

Split fields ends up on multiple picture and requires accessing the
other_field to complete the information (POC).

This also cleanup the DPB from non-reference (was not useful) and skips
properly merge field instead of keeping them duplicated. This fixes most
of interlace decoding seen in fluster.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2474>

3 years agov4l2codec: h264: Implement support for split fields
Nicolas Dufresne [Thu, 19 Aug 2021 15:40:22 +0000 (11:40 -0400)]
v4l2codec: h264: Implement support for split fields

When a frame is composed of two fields, the base class now split the
picture in two. In order to support this, we need to ensure that picture
buffer is held in VB2 queue so that the second field get decoded into
it. This also implements the new_field_picture() virtual and sets the
previous request on the new picture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2474>

3 years agov4l2codecs: h264: Fix filling weight factors
Nicolas Dufresne [Fri, 20 Aug 2021 15:23:57 +0000 (11:23 -0400)]
v4l2codecs: h264: Fix filling weight factors

This was a typo, the wrong index was used to set l1 weight (b-frames).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2480>

3 years agodashdemux: Properly initalize GError
Edward Hervey [Fri, 20 Aug 2021 12:34:53 +0000 (14:34 +0200)]
dashdemux: Properly initalize GError

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2476>

3 years agomfvideosrc: Fix for negative MF stride
Seungha Yang [Thu, 19 Aug 2021 12:56:05 +0000 (21:56 +0900)]
mfvideosrc: Fix for negative MF stride

Negative stride value can be used in MediaFoundation to inform
whether memory layout is top-down or bottom-up manner. Note that
negative stride is allowed only for RGB, system memory.

See also
https://docs.microsoft.com/en-us/windows/win32/medfound/image-stride

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1646
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2473>

3 years agov4l2slh264dec: Fix slice header bit size calculation
Nicolas Dufresne [Wed, 18 Aug 2021 15:14:37 +0000 (11:14 -0400)]
v4l2slh264dec: Fix slice header bit size calculation

The emulation bytes need to be removed as bytes, not bit. This fixes
decoding issues with files that have emulation bytes with the Cedrus
driver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2471>

3 years agoexample: va: Add skin tone enhancement.
Víctor Manuel Jáquez Leal [Thu, 12 Aug 2021 12:08:19 +0000 (14:08 +0200)]
example: va: Add skin tone enhancement.

If camera is used as input stream and skin tone parameter is available
in vapostproc, and no random changes are enabled, the skin tone will
be enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2470>

3 years agovapostproc: Use vapostproc as debug category name.
Víctor Manuel Jáquez Leal [Tue, 17 Aug 2021 12:04:41 +0000 (14:04 +0200)]
vapostproc: Use vapostproc as debug category name.

Otherwise is difficult to remember the different name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2470>

3 years agoexamples: va: Add random cropping.
Víctor Manuel Jáquez Leal [Thu, 12 Aug 2021 11:54:34 +0000 (13:54 +0200)]
examples: va: Add random cropping.

And remove unused caps filter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2443>

3 years agovapostproc: Disable cropping in pass-through mode.
Víctor Manuel Jáquez Leal [Wed, 28 Jul 2021 11:04:50 +0000 (13:04 +0200)]
vapostproc: Disable cropping in pass-through mode.

Originally, if a buffer arrives with crop meta but downstream doesn't
handle crop allocation meta, vapostproc tried to reconfigure itself to
non pass-through mode automatically. Sadly, this behavior was based on
the wrong assumption that propose_allocation() vmethod would bring
downstream allocation query, but it is not.

Now, if vapostproc is in pass-through mode, the cropping is passed to
downstream.  Pass-through mode can be disabled via a parameter.

Finally, if pass-through mode isn't enabled, it's assumed the buffer
is going to be processed and, if cropping, downstream already
negotiated the cropped frame size, thus it's required to do the
cropping inside vapostproc to avoid artifacts because of the size of
downstream allocated buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2443>

3 years agovapostproc: Update filters update_properties().
Víctor Manuel Jáquez Leal [Tue, 17 Aug 2021 12:54:21 +0000 (14:54 +0200)]
vapostproc: Update filters update_properties().

Right after instantiating the VA filter and changing the element
state, rebuild the image filters.

This will fix a regression from f20b3b815, where properties in a
gst-launch pipeline are not applied.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2443>

3 years agodecklinkvideosrc: Fix PAL/NTSC widescreen autodetection when switching back to non...
Sebastian Dröge [Wed, 18 Aug 2021 06:13:45 +0000 (09:13 +0300)]
decklinkvideosrc: Fix PAL/NTSC widescreen autodetection when switching back to non-widescreen

Previously it would only switch to widescreen but never back.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2469>

3 years agomsdkvpp: Fix frc from lower fps to higher fps
Mengkejiergeli Ba [Tue, 20 Jul 2021 10:15:11 +0000 (18:15 +0800)]
msdkvpp: Fix frc from lower fps to higher fps

There are three framerate conversion algorithms described in
<https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md>,
interpolation is not implemented so far and thus distributed timestamp algorihtm
is considered to be more practical which evenly distributes output timestamps
according to output framerate. In this case, newly generated frames are inserted
between current frame and previous one, timestamp is calculated by msdk API.

This implementation first pushes newly generated buffers(outbuf_new) forward and
the current buffer(outbuf) is handled at last round by base transform automatically.
A flag "create_new_surface" is used to indicate if new surfaces have been generated
and then push new outbuf forward accordingly.

Considering the upstream element may not be the msdk element, it is necessary to
always set the input surface timestamp as same as input buffer's timestamp and
convert it to msdk timestamp.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2418>

3 years agowebrtc: improve matching on the correct jitterbuffer
Matthew Waters [Thu, 6 May 2021 12:22:12 +0000 (22:22 +1000)]
webrtc: improve matching on the correct jitterbuffer

The mapping between an RTP session and the SDP m= line is not always the
same, especially when BUNDLEing is used.

This causes a failure in a specific case where if when bundling,
if mline 0 is a data channel, and mline 1 an audio/video section,
then retrieving the transceiver at mline 0 (rtp session used) will fail
and cause an assertion.

This fix is actually potentially a regression for cases where the remote
part does not provide the a=ssrc: media level SDP attributes as is now
becoming common, especially when simulcast is involved.

The correct fix actually requires reading out header extensions as used
with bundle for signalling in the actual data, what media and therefore
transceiver is being used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2467>

3 years agova: Use GST_CAPS_FEATURE_MEMORY_VA to replace "memory:VAMemory".
He Junyan [Mon, 16 Aug 2021 05:45:39 +0000 (13:45 +0800)]
va: Use GST_CAPS_FEATURE_MEMORY_VA to replace "memory:VAMemory".

"memory:VAMemory" is a commonly used string which notates our VA-kind
memory type. We now used a definition in va lib to replace the simply
string usage.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2466>

3 years agova: Use MEMORY_DMABUF definition to replace "memory:DMABuf" strings.
He Junyan [Mon, 16 Aug 2021 05:32:51 +0000 (13:32 +0800)]
va: Use MEMORY_DMABUF definition to replace "memory:DMABuf" strings.

GST_CAPS_FEATURE_MEMORY_DMABUF is already a common definition, we should
just use it rather than use the "memory:DMABuf" strings by ourselves.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2466>

3 years agofdkaacdec: Add Converter class to hint gst-validate
Thibault Saunier [Mon, 9 Aug 2021 23:02:56 +0000 (19:02 -0400)]
fdkaacdec: Add Converter class to hint gst-validate

fdkaacdec have minimal conversion capability, adding the Converter class allow
gst-validate to behave properly and not spit an error when it notice that the
number of channels or rate miss-match in and out.

Same logic as with opusdec, see: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1142>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2462>

3 years agowasapi2: Increase rank to primary + 1
Seungha Yang [Wed, 9 Jun 2021 14:29:43 +0000 (23:29 +0900)]
wasapi2: Increase rank to primary + 1

wasapi2 plugin should be preferred than old wasapi plugin if available because:
* wasapi2 supports automatic stream routing, and it's highly recommended
  feature for application by MS. See also
  https://docs.microsoft.com/en-us/windows/win32/coreaudio/automatic-stream-routing
* This implementation must be various COM threading issue free by design
  since wasapi2 plugin spawns a new dedicated COM thread and all COM objects'
  life-cycles are managed correctly.
  There are unsolved COM issues around old wasapi plugin. Such issues are
  very tricky to be solved unless old wasapi plugin's threading model
  is re-designed.

Note that, in case of UWP, wasapi2 plugin's rank is primary + 1 already

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2314>

3 years agoccconverter: fix overflow when not doing framerate conversion
Mathieu Duponchelle [Thu, 12 Aug 2021 18:39:24 +0000 (20:39 +0200)]
ccconverter: fix overflow when not doing framerate conversion

When converting from one framerate to another, counters are
reset periodically, however when not converting they never are
and can_genearte_output ends up making overflow-prone calculations
with large values for input_frames and output_frames.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2465>

3 years agowebrtcbin: Don't assume that non-audio medias are video medias when creating transceivers
Sebastian Dröge [Thu, 12 Aug 2021 12:26:27 +0000 (15:26 +0300)]
webrtcbin: Don't assume that non-audio medias are video medias when creating transceivers

And print the unknown media kind in the logs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2464>

3 years agowebrtcbin: Use the correct media for deciding the media kind when creating the transc...
Sebastian Dröge [Thu, 12 Aug 2021 12:25:50 +0000 (15:25 +0300)]
webrtcbin: Use the correct media for deciding the media kind when creating the transceiver from the SDP

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2464>

3 years agocodecs: h264dec: Output the picture directly if already a frame.
He Junyan [Thu, 29 Jul 2021 13:30:32 +0000 (21:30 +0800)]
codecs: h264dec: Output the picture directly if already a frame.

We forget one case that is the frame and field pictures may be mixed
together. For this case, the dpb is interlaced while the last picture
may be a complete frame. We do not need to cache that complete picture
and should output it directly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2448>

3 years agova: caps: Make the template raw video caps classified by features.
He Junyan [Fri, 6 Aug 2021 09:11:55 +0000 (17:11 +0800)]
va: caps: Make the template raw video caps classified by features.

The current output of raw video caps is not good. When we have multi
profiles and each profile support different formats, the output of
gst-inspect may like:

 SRC template: 'src'
 Availability: Always
 Capabilities:
   video/x-raw(memory:VAMemory)
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: NV12
   video/x-raw
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: NV12
   video/x-raw(memory:VAMemory)
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: P010_10LE
   video/x-raw
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: P010_10LE
   video/x-raw(memory:VAMemory)
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: P012_LE
   video/x-raw
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: P012_LE

The gst_caps_simplify does not classify the caps by same features, but
just leave them interweaved. We need to handle them manually here, the
result should be:

  SRC template: 'src'
  Availability: Always
  Capabilities:
    video/x-raw
          width: [ 1, 16384 ]
          height: [ 1, 16384 ]
          format: { (string)P010_10LE, (string)P012_LE, (string)NV12 }
    video/x-raw(memory:VAMemory)
          width: [ 1, 16384 ]
          height: [ 1, 16384 ]
          format: { (string)P010_10LE, (string)P012_LE, (string)NV12 }

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2456>

3 years agovapostproc: Inherit from GstVaBaseTransform.
Víctor Manuel Jáquez Leal [Tue, 27 Jul 2021 11:22:02 +0000 (13:22 +0200)]
vapostproc: Inherit from GstVaBaseTransform.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2442>

3 years agova: Add base transform class.
Víctor Manuel Jáquez Leal [Wed, 17 Feb 2021 16:15:22 +0000 (17:15 +0100)]
va: Add base transform class.

This base transform class is a derivable class for VA-based filters,
for example vapostproc right now, but it will be used also for
future elements such as vadeinterlace.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2442>

3 years agova: pool: Add gst_va_pool_new_with_config().
Víctor Manuel Jáquez Leal [Tue, 27 Jul 2021 11:03:37 +0000 (13:03 +0200)]
va: pool: Add gst_va_pool_new_with_config().

It is a function helper.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2442>

3 years agod3d11window: Misc code cleanup
Seungha Yang [Mon, 9 Aug 2021 17:48:01 +0000 (02:48 +0900)]
d3d11window: Misc code cleanup

* Remove unnecessary upcasting. We are now dealing with C++ class objects
  and don't need explicit C-style casting in C++ world
* Use helper macro IID_PPV_ARGS() everywhere. It will make code
  a little short.
* Use ComPtr smart pointer instead of calling manual IUnknown::Release()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2461>

3 years agod3d11compositor: Fix indent
Seungha Yang [Mon, 9 Aug 2021 17:48:45 +0000 (02:48 +0900)]
d3d11compositor: Fix indent

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2461>

3 years agoopenh264: Respect level set downstream
Thibault Saunier [Fri, 28 May 2021 21:36:15 +0000 (17:36 -0400)]
openh264: Respect level set downstream

We were not specifying the requested level to openh264  meaning that
it was choosing anything and was not respecting what was specified\
downstream

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2289>

3 years agox265: Fix a deadlock when failing to create the x265enc.
He Junyan [Wed, 4 Aug 2021 07:02:01 +0000 (15:02 +0800)]
x265: Fix a deadlock when failing to create the x265enc.

The GST_ELEMENT_ERROR will call the gst_object_get_path_string and
use gst_object_get_parent to get the full object path name, which
needs to lock the object. But we are already in a locked context and
so this will cause a deadlock, the pipeline can not exit normally.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2451>

3 years agortmpsrc: mention setting librtmp flags in docs
R S Nikhil Krishna [Thu, 22 Jul 2021 20:58:02 +0000 (20:58 +0000)]
rtmpsrc: mention setting librtmp flags in docs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2424>

3 years agompeg2enc: fix interlace-mode detection
Mathieu Duponchelle [Thu, 5 Aug 2021 21:11:26 +0000 (23:11 +0200)]
mpeg2enc: fix interlace-mode detection

Previously, the code was always assuming progressive input,
fix this by looking at the caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2455>

3 years agoUse g_memdup2() where available and add fallback for older GLib versions
Tim-Philipp Müller [Sun, 23 May 2021 18:15:25 +0000 (19:15 +0100)]
Use g_memdup2() where available and add fallback for older GLib versions

g_memdup() is deprecated since GLib 2.68 and we want to avoid
deprecation warnings with recent versions of GLib.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2280>

3 years agotimecodestamper: Fix latency calculation
Sebastian Dröge [Thu, 5 Aug 2021 10:02:00 +0000 (13:02 +0300)]
timecodestamper: Fix latency calculation

The LTC extra latency is in ms already and not in frames, so multiplying
with the framerate will end up with a wrong number.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2453>

3 years agomsdk: make sure child context is destroyed first
Haihao Xiang [Sat, 17 Jul 2021 16:51:04 +0000 (00:51 +0800)]
msdk: make sure child context is destroyed first

The parent context shares some resources with child context, so the
child context should be destroyed first, otherwise the command below
will trigger a segmentation fault

$> gst-launch-1.0 videotestsrc num-buffers=100 ! msdkh264enc ! \
msdkh264dec ! fakesink videotestsrc num-buffers=50 ! \
msdkh264enc ! msdkh264dec ! fakesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2435>

3 years agod3d11videosink: Fix warning around GstVideoOverlay::expose()
Seungha Yang [Mon, 2 Aug 2021 07:22:06 +0000 (16:22 +0900)]
d3d11videosink: Fix warning around GstVideoOverlay::expose()

When expose() is called, d3d11videosink needs to redraw using
cached buffer, so gst_d3d11_window_render() should allow null buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2450>

3 years agod3d11videosink: Forward navigation event without modification
Seungha Yang [Fri, 30 Jul 2021 16:05:47 +0000 (01:05 +0900)]
d3d11videosink: Forward navigation event without modification

Current implementation for translating native coordinate and
video coordinate is very wrong because d3d11videosink doesn't
understand native HWND's coordinate. That should be handled
by GstD3D11Window implementation as an enhancement.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2450>

3 years agod3d11videosink: Add support for GstVideoOverlay::set_render_rectangle
Seungha Yang [Fri, 30 Jul 2021 15:59:14 +0000 (00:59 +0900)]
d3d11videosink: Add support for GstVideoOverlay::set_render_rectangle

Inspired by an MR https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2382

The idea is that we can make use of MoveWindow() in WIN32 d3d11window
implementation safely because WIN32 d3d11window implementation creates
internal HWND even when external HWND is set and then subclassing is used to
draw on internal HWND in any case. So the coordinates passed to MoveWindow()
will be relative to parent HWND, and it meets well to the concept of
set_render_rectangle().

On MoveWindow() event, WM_SIZE event will be generated by OS and then
GstD3D11WindowWin32 implementation will update render area including swapchain
correspondingly, as if it's normal window move/resize case.

But in case of UWP (CoreWindow or SwapChainPanel), we need more research to
meet expected behavior of set_render_rectangle()

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1416
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2450>

3 years agova: vp8: fix the overflow in _fill_quant_matrix().
He Junyan [Thu, 29 Jul 2021 10:05:35 +0000 (18:05 +0800)]
va: vp8: fix the overflow in _fill_quant_matrix().

The gint8 of qi and qi_base may overflow when calculation the matrix
parameters and change the decoding result.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2447>

3 years agod3d11: Disable packed and subsampled YUV formats
Seungha Yang [Sun, 20 Jun 2021 15:19:17 +0000 (00:19 +0900)]
d3d11: Disable packed and subsampled YUV formats

Direct3D11 sampler doesn't support them very well, and conversion
outputs usually result in poor visual quality with our shader code.
Should disable support for such formats for now

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2344>

3 years agotsdemux: Notify when ignore_pcr is set
Jan Alexander Steffens (heftig) [Mon, 26 Jul 2021 14:43:47 +0000 (16:43 +0200)]
tsdemux: Notify when ignore_pcr is set

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2437>

3 years agocccombiner: fix CDP padding detection
Mathieu Duponchelle [Tue, 27 Jul 2021 21:53:06 +0000 (23:53 +0200)]
cccombiner: fix CDP padding detection

While a cc_data_pkt with cc_valid 0 should be considered padding,
it might be followed up by valid DTVCC packets, and should not
cause the whole CDP packet to get discarded.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2440>

3 years agocodecs: h264dec: Improve the find_first_field_picture().
He Junyan [Tue, 27 Jul 2021 04:51:08 +0000 (12:51 +0800)]
codecs: h264dec: Improve the find_first_field_picture().

We need to consider the first field of the last picture when the
last picture can not enter the DPB.

Another change is, when prev field's frame_num is not equal to the
current field's frame_num, we should also return FASLE because it
is also a case of losing some field.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2430>

3 years agocodecs: h264dec: consider the last field when add picture to DPB.
He Junyan [Tue, 27 Jul 2021 04:16:13 +0000 (12:16 +0800)]
codecs: h264dec: consider the last field when add picture to DPB.

There are cases that the first field of the last picture is not a
ref but the second field is a ref. We need to add both of them
because the bumping always needs a complete frame in the DPB.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2430>

3 years agocodecs: h264dec: Consider the field case when directly output.
He Junyan [Tue, 27 Jul 2021 02:51:03 +0000 (10:51 +0800)]
codecs: h264dec: Consider the field case when directly output.

For interlaced streams, it is also possible that the last frame is
not able to be inserted into DPB when the DPB is full and the last
frame is a non ref. For this case, we need to hold a extra ref for
the first field of the last frame and wait for the complete frame
with both top and bottom fields. For the progressive stream, the
behaviour is unchanged.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2430>

3 years agocodecs: h264dec: Fix a error print of dpb_add.
He Junyan [Sun, 25 Jul 2021 17:16:34 +0000 (01:16 +0800)]
codecs: h264dec: Fix a error print of dpb_add.

When the dpb is interlaced, the max size should be 2*dpb->max_num_frames,
correcting the error print info for that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2430>

3 years agodecklink: Don't print error for dlopen failure
Seungha Yang [Wed, 28 Jul 2021 07:11:36 +0000 (16:11 +0900)]
decklink: Don't print error for dlopen failure

This is not a fatal error on systems without decklink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2441>

3 years agoplayer: Add static keyword to _config_quark_table
Imanol Fernandez [Tue, 27 Jul 2021 10:21:41 +0000 (12:21 +0200)]
player: Add static keyword to _config_quark_table

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2439>

3 years agoapplemedia: silence a couple of MoltenVK warnings
Matthew Waters [Tue, 27 Jul 2021 04:52:38 +0000 (14:52 +1000)]
applemedia: silence a couple of MoltenVK warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2433>

3 years agodebugutils: Only proxy the properties once
Nicolas Dufresne [Tue, 27 Jul 2021 15:49:47 +0000 (11:49 -0400)]
debugutils: Only proxy the properties once

The needed once call was removed accidently during porting. This was catch by
the CI as memory leaks.

Related to !2426

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2438>

3 years agomxf: Handle D10 "picture only" variant
Edward Hervey [Tue, 27 Jul 2021 10:13:43 +0000 (12:13 +0200)]
mxf: Handle D10 "picture only" variant

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2436>

3 years agova: filter: refactor convert_surface() to process()
Víctor Manuel Jáquez Leal [Sat, 24 Jul 2021 11:19:39 +0000 (13:19 +0200)]
va: filter: refactor convert_surface() to process()

The idea of this change is to add, in the future,
process_with_generator(), when multiple input surfaces are processed,
for blending.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2431>

3 years agova: filter: Refactor set_formats() to set_video_info().
Víctor Manuel Jáquez Leal [Sun, 18 Jul 2021 10:46:08 +0000 (12:46 +0200)]
va: filter: Refactor set_formats() to set_video_info().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2431>

3 years agovapostproc: Don't add video alignment option in buffer pool.
Víctor Manuel Jáquez Leal [Sun, 18 Jul 2021 15:13:16 +0000 (17:13 +0200)]
vapostproc: Don't add video alignment option in buffer pool.

vapostproc will not call gst_buffer_pool_config_set_video_alignment(),
thus this option is not required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2431>

3 years agomxfvc3: Also accept clip-wrapped vc-3
Edward Hervey [Tue, 27 Jul 2021 07:37:49 +0000 (09:37 +0200)]
mxfvc3: Also accept clip-wrapped vc-3

We can now handle this fine

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2434>

3 years agomxfdemux: Handle EOS with non-frame wrapping
Edward Hervey [Tue, 27 Jul 2021 05:59:52 +0000 (07:59 +0200)]
mxfdemux: Handle EOS with non-frame wrapping

When reaching the end of non-frame wrapping track in pull mode, we want to force
the switch to the next non-eos pad. This is similar to when we exceed the
maximum drift.

Fixes issues on EOS where not everything would be drained out and stray errors
would pop out.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2434>

3 years agomxfdemux: More granular interleaved content handling
Edward Hervey [Sun, 25 Jul 2021 05:52:06 +0000 (07:52 +0200)]
mxfdemux: More granular interleaved content handling

An interleave of 500ms can be way too big for some downstream queueing
elements. Instead use a smaller 100ms interleave and silence the various
warnings about resyncing (it's normal)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2434>

3 years agodebugutils: De-duplicate proxy_properties function to a new utils module
Philippe Normand [Fri, 23 Jul 2021 08:36:10 +0000 (09:36 +0100)]
debugutils: De-duplicate proxy_properties function to a new utils module

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2426>

3 years agoIntroduce Steinberg ASIO (Audio Streaming Input/Output) plugin
Seungha Yang [Mon, 7 Jun 2021 16:40:34 +0000 (01:40 +0900)]
Introduce Steinberg ASIO (Audio Streaming Input/Output) plugin

Adds a new plugin for ASIO devices.

Although there is a standard low-level audio API, WASAPI, on Windows,
ASIO is still being broadly used for audio devices which are aiming to
professional use case. In case of such devices, ASIO API might be able
to show better quality and latency performance depending on manufacturer's
driver implementation.

In order to build this plugin, user should provide path to
ASIO SDK as a build option, "asio-sdk-path".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2309>

3 years agoaudiolatency: Expose samplesperbuffer property
Seungha Yang [Sun, 6 Jun 2021 13:32:08 +0000 (22:32 +0900)]
audiolatency: Expose samplesperbuffer property

... for user to be able to set the number of required samples.
For instance, our default value is 240 samples
(about 5ms latency in case that sample rate is 48000), which might
be larger than actual buffer size of audio capture device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2307>

3 years agocodecs: h264decoder: let print_ref_pic_list_b print the correct list name.
He Junyan [Fri, 23 Jul 2021 14:02:05 +0000 (22:02 +0800)]
codecs: h264decoder: let print_ref_pic_list_b print the correct list name.

The print_ref_pic_list_b now not only needs to trace the ref_pic_list_b0/1,
but also need to trace the ref_frame_list_0_short_term. We need to pass the
name directly to it rather than an index to refer to ref_pic_list_b0/1.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2425>

3 years agocodecs: h264dec: Fix a typo in construct_ref_field_pic_lists_b.
He Junyan [Fri, 23 Jul 2021 04:31:17 +0000 (12:31 +0800)]
codecs: h264dec: Fix a typo in construct_ref_field_pic_lists_b.

The array sort of ref_frame_list_0_short_term has some typo. The
typo makes this list not in the POC ascend order and generate wrong
decoding result for interlaced streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2425>

3 years agokmssink: Fix fallback path for driver not able to scale scenario
Devarsh Thakkar [Thu, 15 Jul 2021 12:12:37 +0000 (05:12 -0700)]
kmssink: Fix fallback path for driver not able to scale scenario

When driver return error on update plane request, kmssink
disables the scaling and retries plane update.
While doing so kmssink was matching the source rectangle dimensions
to the target rectangle dimensions which were calculated
as per scaling but this is incorrect, instead what we want here is
that target rectangle dimensions should match the source rectangle
dimensions as scaling is disabled now and so we match result
rectangle dimensions with source rectangle dimensions.

While at it, also match the result rectangle coordinates for
horizontal and vertical offsets with source rectange coordinates,
as since there is no scaling being done so no recentering is
required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2415>

3 years agovideoparsers: vp9: Need to process the first frame even not key.
He Junyan [Fri, 23 Jul 2021 08:49:49 +0000 (16:49 +0800)]
videoparsers: vp9: Need to process the first frame even not key.

Some cut VP9 streams begin with a non key frame. The current code
just bail out the parse_process_frame() if not a key frame. Because
of this, we do not set the valid caps before we push the data of the
first frame(even this first frame will be discarded by the downstream
decoder because it is not a key frame).

The pipeline such as:
gst-launch-1.0 filesrc location=some.ivf ! ivfparse ! vp9parse !
  vavp9dec ! fakesink
will get a negotiation error and the pipeline can not continue. The
correct behaviour should be: the decoder discard the first frame and
continue to decode later frames successfully.

So, when the parse does not have valid stream info(should be the first
frame case), we should continue and report caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2427>

3 years agoaudiolatency: Handle audio buffers with invalid duration
Nirbheek Chauhan [Wed, 21 Jul 2021 14:10:17 +0000 (19:40 +0530)]
audiolatency: Handle audio buffers with invalid duration

pipewiresrc outputs audio buffers without a valid duration, so we need
to calculate it manually in that case.

Upstream issue: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1438

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2419>

3 years agova: h265dec: Do not assign the frame->output_buffer until output_picture.
He Junyan [Thu, 22 Jul 2021 14:00:38 +0000 (22:00 +0800)]
va: h265dec: Do not assign the frame->output_buffer until output_picture.

We may need to drop the slices such as RASL pictures with the NoRaslOutputFlag, so
the current picture of h265decoder may be freed. We should not assign the frame->
output_buffer too early until we really output it. Or, the later coming slices will
allocate another picture and trigger the assert of:
  gst_video_decoder_allocate_output_frame_with_params:
  assertion 'frame->output_buffer == NULL' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2421>

3 years agotsdemux: Handle PCR-less streams
Edward Hervey [Thu, 22 Jul 2021 13:14:26 +0000 (15:14 +0200)]
tsdemux: Handle PCR-less streams

Some programs specify a PCR PID but don't actually store any PCR values, or are
way too far apart.

In order to gracefully handle those situations, we will queue up to a certain
amount of pending buffers before deciding to give up on that PCR PID and not use
any (i.e. using DTS/PTS values as-is)

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2422>

3 years agova: H265: Add odd bit depth and chroma depth in get_rtformat.
He Junyan [Thu, 22 Jul 2021 02:44:27 +0000 (10:44 +0800)]
va: H265: Add odd bit depth and chroma depth in get_rtformat.

In H265, the stream may have odd bit depth such as 9 or 11. And
the bit depth of luma and chroma may differ. For example, the
stream with luma depth of 8 and chroma depth of 9 should use the
10 bit rtformat as the decoded picture format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2420>

3 years agocodecs: h264dec: Improve the algorithm for low latency mode.
He Junyan [Tue, 20 Jul 2021 16:04:18 +0000 (00:04 +0800)]
codecs: h264dec: Improve the algorithm for low latency mode.

In low_latency mode, try to bump the picture as soon as possible
without the frames disorder:
1. We can directly output the continuous non-reference frame.
2. Consider max_num_reorder_frames, which is special useful for
   I-P mode.
3. Consider the leading pictures with negative POC.
4  Output small POC pictures when non-reference frame comes.
4. Output the POC increment<=2 pictures. This is not 100% safe,
   but in practice this condition can be used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>

3 years agocodecs: h264dec: Add help function of dpb_set_max_num_reorder_frames.
He Junyan [Tue, 20 Jul 2021 15:49:12 +0000 (23:49 +0800)]
codecs: h264dec: Add help function of dpb_set_max_num_reorder_frames.

The max_num_reorder_frames can be useful for bump check. We store it
in the DPB and no need for the decoder now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>

3 years agocodecs: h264dec: Add a flag to record whether picture is reference.
He Junyan [Tue, 20 Jul 2021 15:36:38 +0000 (23:36 +0800)]
codecs: h264dec: Add a flag to record whether picture is reference.

The picture->ref field will change from time to time according to decoder's
state and reference sliding window. We need another flag to record whether
the picture is a reference picture when it is created, and this can help
the bumping check.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>

3 years agocodecs: h264dec: Change the order of dpb_add and dpb_bump.
He Junyan [Sun, 11 Jul 2021 16:31:54 +0000 (00:31 +0800)]
codecs: h264dec: Change the order of dpb_add and dpb_bump.

The current behavior is different from the SPEC. We should check
and bump the DPB or drain the DPB before we insert the current
picture into it. This may cause the output picture disorder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>

3 years agocodecs: h264dec: Modify the DPB need bump check.
He Junyan [Sun, 11 Jul 2021 16:06:49 +0000 (00:06 +0800)]
codecs: h264dec: Modify the DPB need bump check.

Accord to spec, we should not add the current picture into the DPB
when we check whether it needs to bump, so the checks of the IDR and
the "memory_management_control_operation equal to 5" are no needed.

And the spec also says that the DPB only needs to bump when there is
no empty frame buffer left(We handle the IDR cases in other places).
We need to follow that and the max_num_reorder_frames is useless.

We also minus 1 in has_empty_frame_buffer because the current frame
has not been added yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>

3 years agocodecs: h264dec: Make dpb_has_empty_frame_buffer a codecs API.
He Junyan [Sun, 11 Jul 2021 16:01:58 +0000 (00:01 +0800)]
codecs: h264dec: Make dpb_has_empty_frame_buffer a codecs API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>

3 years agocodecs: h264dec: Set picture to a small poc when mem_mgmt_5.
He Junyan [Mon, 5 Jul 2021 15:53:25 +0000 (23:53 +0800)]
codecs: h264dec: Set picture to a small poc when mem_mgmt_5.

When current frame memory_management_control_operation equal to 5, that
means we need to drain the dpb and the current picture act as an IDR frame.
So it should have smaller poc than the later pictures to ensure the output
order.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>

3 years agomxfdemux: Make gst-indent on the CI happy
Edward Hervey [Thu, 15 Jul 2021 09:12:01 +0000 (11:12 +0200)]
mxfdemux: Make gst-indent on the CI happy

grmbl

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>

3 years agomxfdemux: Handle non-frame wrapping
Edward Hervey [Thu, 15 Jul 2021 08:59:39 +0000 (10:59 +0200)]
mxfdemux: Handle non-frame wrapping

* If we have an index table for non-framed essence, we can handle it

* The demuxer has a state which indicates whether it will next fetch a KLV or
data contained *within* a KLV.

* The position on Essence Tracks always correspond to the next entry to fetch,
demuxer offset will be skipped accordingly whenever we switch between
partitions (in case of resyncs). A copy of the main clip/custom KLV for that
partition is kept to track the position within the essence of that partition.

* For clip/custom-wrapped raw audio, if the edit rate is too small (and would
cause plenty of tiny buffers to be outputted), specify a minimum number of edit
units per buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>

3 years agomxfdemux: Use KLV for position/content tracking
Edward Hervey [Thu, 15 Jul 2021 08:45:46 +0000 (10:45 +0200)]
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>

3 years agomxfdemux: Output the topology of the file in debug logs
Edward Hervey [Thu, 15 Jul 2021 08:28:31 +0000 (10:28 +0200)]
mxfdemux: Output the topology of the file in debug logs

This provides a summary of the number/type of tracks in the Material and File
Packages

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>

3 years agomxfdemux: Refactor pull seek
Edward Hervey [Thu, 15 Jul 2021 08:16:34 +0000 (10:16 +0200)]
mxfdemux: Refactor pull seek

In order to figure out the exact start position (backed by a keyframe) accross
all tracks, we first figure out the backing keyframe position, and *then* seek
to that position.

Avoids ending up in situations where we would properly seek to the backing
keyframe on video ... but not on the audio streams (they would have been set to
the original non-keyframe position). Fixes key-unit seeking.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>

3 years agomxfaes-bwf: Handle new custom-constant-sized variant
Edward Hervey [Wed, 14 Jul 2021 05:58:01 +0000 (07:58 +0200)]
mxfaes-bwf: Handle new custom-constant-sized variant

Defined by Amendment 2:2013 to SMPTE ST 382:2007

Also define a new "UNKNOWN" wrapping type to make the difference with known
wrapping types

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>

3 years agomxfmpeg: Fix essence coding detection
Edward Hervey [Wed, 14 Jul 2021 05:54:38 +0000 (07:54 +0200)]
mxfmpeg: Fix essence coding detection

The picture essence coding matching was wrong. Use the proper "base" MXFUL for
video mpeg compression for matching.

Also handle the case where some old files would put the essence container label
in the essence coding field

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>

3 years agomxfdemux: Refactor index table and offset handling
Edward Hervey [Thu, 1 Jul 2021 06:35:01 +0000 (08:35 +0200)]
mxfdemux: Refactor index table and offset handling

* Streamline offset <=> entry handling. Historically the demuxer didn't support
information from index tables and stored the discovered information in an array
per track. When index table support was added, a parallel system was setup for
that relationship. This commit unifies this into one system with the
`find_edit_entry()` and `find_entry_for_offset()` functions.

* By extension, per-track offset entry tables are only created/used if no index
table is present for those tracks.

* Use index table information as-is. The index table system from MXF is quite
complex and there are various ways to use the information contained
within. Instead of converting that information we store the data from the tables
as-is and extract the needed information when needed.

* Handle index tables without entries (i.e. all content package units are of the
same size).

* Allow collecting index table segments as we go instead of only once if a
random-index-pack is present. This also improves support of some files in
push-mode.

* When searching for keyframe entries, use the keyframe_offset if
present (speeds up searching).

* For interleaved content (i.e. several tracks in the sample essence container),
we use a system to be able to identify the position of each track in the delta
entries of index tables.

* Handle temporal offset only on tracks which *do* need it (as specified in the
delta entries of the index tables). If present, those offsets are stored in a
pre-processed table which allows computing PTS from DTS with a simple offset.

* Add a quirk for files which are known to be have wrongly stored temporal
offsets.

* Overall opens the way to handle more types of MXF files, especially those with
non-frame-wrapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>

3 years agomxfdemux: Drop duplicate seek events
Edward Hervey [Tue, 29 Jun 2021 13:29:36 +0000 (15:29 +0200)]
mxfdemux: Drop duplicate seek events

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>

3 years agomxf: Improve index entry debug log
Edward Hervey [Thu, 24 Jun 2021 07:53:08 +0000 (09:53 +0200)]
mxf: Improve index entry debug log

By printing out the various known flag values

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>

3 years agomxf: Demote error message when resolving valid empty reference
Edward Hervey [Wed, 23 Jun 2021 07:08:33 +0000 (09:08 +0200)]
mxf: Demote error message when resolving valid empty reference

A Source Clip can have zero'd SourcePackageID and SourceTrackID, this indicates
it terminates the source reference chain

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>