| @@ -1395,21 +1395,38 @@ Screenshot Commands · 1394 unmodified lines |
| 1395 | 1395 | Like all input command parameters, the filename is subject to property |
| 1396 | 1396 | expansion as described in `Property Expansion`_. |
| 1397 | 1397 | |
| 1398 | | −``screenshot-raw [<flags>]`` |
| 1398 | +``screenshot-raw [<flags> [<format>]]`` |
| 1399 | 1399 | Return a screenshot in memory. This can be used only through the client |
| 1400 | 1400 | API. The MPV_FORMAT_NODE_MAP returned by this command has the ``w``, ``h``, |
| 1401 | | − ``stride`` fields set to obvious contents. The ``format`` field is set to |
| 1402 | | − ``bgr0`` by default. This format is organized as ``B8G8R8X8`` (where ``B`` |
| 1403 | | − is the LSB). The contents of the padding ``X`` are undefined. The ``data`` |
| 1404 | | − field is of type MPV_FORMAT_BYTE_ARRAY with the actual image data. The image |
| 1405 | | − is freed as soon as the result mpv_node is freed. As usual with client API |
| 1406 | | − semantics, you are not allowed to write to the image data. |
| 1401 | + ``stride`` fields set to obvious contents. |
| 1402 | + |
| 1403 | + The ``format`` field is set to the format of the screenshot image data. |
| 1404 | + This can be controlled by the ``format`` argument. The format can be one of |
| 1405 | + the following: |
| 1406 | + |
| 1407 | + bgr0 (default) |
| 1408 | + This format is organized as ``B8G8R8X8`` (where ``B`` is the LSB). |
| 1409 | + The contents of the padding ``X`` are undefined. |
| 1410 | + bgra |
| 1411 | + This format is organized as ``B8G8R8A8`` (where ``B`` is the LSB). |
| 1412 | + rgba |
| 1413 | + This format is organized as ``R8G8B8A8`` (where ``R`` is the LSB). |
| 1414 | + rgba64 |
| 1415 | + This format is organized as ``R16G16B16A16`` (where ``R`` is the LSB). |
| 1416 | + Each component occupies 2 bytes per pixel. |
| 1417 | + When this format is used, the image data will be high bit depth, and |
| 1418 | + ``--screenshot-high-bit-depth`` is ignored. |
| 1419 | + |
| 1420 | + The ``data`` field is of type MPV_FORMAT_BYTE_ARRAY with the actual image |
| 1421 | + data. The image is freed as soon as the result mpv_node is freed. As usual |
| 1422 | + with client API semantics, you are not allowed to write to the image data. |
| 1407 | 1423 | |
| 1408 | 1424 | The ``stride`` is the number of bytes from a pixel at ``(x0, y0)`` to the |
| 1409 | | − pixel at ``(x0, y0 + 1)``. This can be larger than ``w * 4`` if the image |
| 1425 | + pixel at ``(x0, y0 + 1)``. This can be larger than ``w * bpp`` if the image |
| 1410 | 1426 | was cropped, or if there is padding. This number can be negative as well. |
| 1411 | | − You access a pixel with ``byte_index = y * stride + x * 4`` (assuming the |
| 1412 | | − ``bgr0`` format). |
| 1427 | + You access a pixel with ``byte_index = y * stride + x * bpp``. |
| 1428 | + Here, ``bpp`` is the number of bytes per pixel, which is 8 for ``rgba64`` |
| 1429 | + format and 4 for other formats. |
| 1413 | 1430 | |
| 1414 | 1431 | The ``flags`` argument is like the first argument to ``screenshot`` and |
| 1415 | 1432 | supports ``subtitles``, ``video``, ``window``. |