Adapter.maskedScanUint32

Scan for pattern pattern with applied mask mask in the adapter data, starting from offset offset.

The bytes in pattern and mask are interpreted left-to-right, regardless of endianness. All four bytes of the pattern must be present in the adapter for it to match, even if the first or last bytes are masked out.

It is an error to call this function without making sure that there is enough data (offset+size bytes) in the adapter.

This function calls Adapter.maskedScanUint32Peek passing NULL for value.

class Adapter
ptrdiff_t
maskedScanUint32
(
uint mask
,
uint pattern
,
size_t offset
,
size_t size
)

Parameters

mask uint

mask to apply to data before matching against pattern

pattern uint

pattern to match (after mask is applied)

offset size_t

offset into the adapter data from which to start scanning, returns the last scanned position.

size size_t

number of bytes to scan from offset

Return Value

Type: ptrdiff_t

offset of the first match, or -1 if no match was found.

Examples

|[ // Assume the adapter contains 0x00 0x01 0x02 ... 0xfe 0xff

gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x00010203, 0, 256); // -> returns 0 gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x00010203, 1, 255); // -> returns -1 gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x01020304, 1, 255); // -> returns 1 gst_adapter_masked_scan_uint32 (adapter, 0xffff, 0x0001, 0, 256); // -> returns -1 gst_adapter_masked_scan_uint32 (adapter, 0xffff, 0x0203, 0, 256); // -> returns 0 gst_adapter_masked_scan_uint32 (adapter, 0xffff0000, 0x02030000, 0, 256); // -> returns 2 gst_adapter_masked_scan_uint32 (adapter, 0xffff0000, 0x02030000, 0, 4); // -> returns -1