|
VLC 4.0.0-dev
|
Functions | |
| struct vlc_process * | vlc_process_Spawn (const char *path, int argc, const char *const *argv) |
| Spawn a new process with input and output redirection. | |
| int | vlc_process_Terminate (struct vlc_process *process, bool kill_process) |
| Stop a vlc_process and wait for its termination. | |
| ssize_t | vlc_process_fd_Read (struct vlc_process *process, uint8_t *buf, size_t size, vlc_tick_t timeout_ms) |
| Read data from the process's standard output with a timeout. | |
| ssize_t | vlc_process_fd_Write (struct vlc_process *process, const uint8_t *buf, size_t size, vlc_tick_t timeout_ms) |
| Write data to the process's standard input with a timeout. | |
| ssize_t vlc_process_fd_Read | ( | struct vlc_process * | process, |
| uint8_t * | buf, | ||
| size_t | size, | ||
| vlc_tick_t | timeout_ms | ||
| ) |
Read data from the process's standard output with a timeout.
Attempts to read up to size bytes from the process's standard output into the provided buffer, waiting up to timeout_ms milliseconds for data to become available.
On POSIX systems, this uses poll to wait for readability. On Windows, a platform-specific implementation is used due to limitations with poll on non-socket handles.
| [in] | process | Pointer to the vlc_process instance. |
| [out] | buf | Buffer where the read data will be stored. |
| [in] | size | Maximum number of bytes to read. |
| [in] | timeout_ms | Timeout in milliseconds to wait for data. |
References pollfd::fd, vlc_process::fd, vlc_process::fd_in, vlc_process::hEvent, POLLIN, pollfd::revents, vlc_assert_unreachable, vlc_poll_i11e(), vlc_process_WindowsPoll(), VLC_SUCCESS, and VLC_UNUSED.
Referenced by read_cbs().
| ssize_t vlc_process_fd_Write | ( | struct vlc_process * | process, |
| const uint8_t * | buf, | ||
| size_t | size, | ||
| vlc_tick_t | timeout_ms | ||
| ) |
Write data to the process's standard input with a timeout.
Attempts to write up to size bytes from the provided buffer to the process's standard input, waiting up to timeout_ms milliseconds for the pipe to become writable.
On POSIX systems, this uses poll to wait for writability. On Windows, a platform-specific implementation is used due to limitations with poll on non-socket handles.
| [in] | process | Pointer to the vlc_process instance. |
| [in] | buf | Buffer containing the data to write. |
| [in] | size | Number of bytes to write. |
| [in] | timeout_ms | Timeout in milliseconds to wait for the pipe to be writable. |
References pollfd::fd, vlc_process::fd, vlc_process::fd_out, vlc_process::hEvent, POLLOUT, pollfd::revents, vlc_assert_unreachable, vlc_poll_i11e(), vlc_process_WindowsPoll(), vlc_send_i11e(), VLC_SUCCESS, and VLC_UNUSED.
Referenced by write_cbs().
| struct vlc_process * vlc_process_Spawn | ( | const char * | path, |
| int | argc, | ||
| const char *const * | argv | ||
| ) |
Spawn a new process with input and output redirection.
Creates and starts a new vlc_process for the specified executable path with the given arguments. Sets up pipes to allow reading from the process's standard output and writing to its standard input.
| [in] | path | Path to the executable to run. Must not be NULL. |
| [in] | argc | Number of arguments passed to the process (must be greater than 0). |
| [in] | argv | Array of argument strings (argv[0] must not be NULL). |
References vlc_process::fd, vlc_process::fd_in, vlc_process::fd_out, vlc_process::hEvent, net_Close, vlc_process::pid, vlc_close(), vlc_dup(), VLC_EGENERIC, VLC_ENOMEM, vlc_pipe(), vlc_socketpair(), vlc_spawnp(), and VLC_UNUSED.
Referenced by preparser_pool_SpawnProcess().
| int vlc_process_Terminate | ( | struct vlc_process * | process, |
| bool | kill_process | ||
| ) |
Stop a vlc_process and wait for its termination.
Closes its file descriptors, and waits for it to exit. Optionally sends a termination signal to the process,
| [in] | process | Pointer to the vlc_process instance. Must not be NULL. |
| [in] | kill_process | Whether to forcibly terminate the process before waiting. |
References vlc_process::fd, vlc_process::fd_in, vlc_process::fd_out, vlc_process::hEvent, net_Close, vlc_process::pid, vlc_assert_unreachable, vlc_close(), VLC_UNUSED, and vlc_waitpid().
Referenced by preparser_pool_Delete(), preparser_pool_Run(), and preparser_pool_SpawnThread().