mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
examples: use PW_KEY_TARGET_OBJECT
In examples, tell people how to use target.object.
This commit is contained in:
parent
de65fd442f
commit
ca87d40448
16 changed files with 94 additions and 65 deletions
|
|
@ -419,6 +419,7 @@ int main(int argc, char *argv[])
|
|||
const struct spa_pod *params[2];
|
||||
uint8_t buffer[1024];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
struct pw_properties *props;
|
||||
int res, n_params;
|
||||
|
||||
pw_init(&argc, &argv);
|
||||
|
|
@ -440,19 +441,22 @@ int main(int argc, char *argv[])
|
|||
* you need to listen to is the process event where you need to consume
|
||||
* the data provided to you.
|
||||
*/
|
||||
props = pw_properties_new(PW_KEY_MEDIA_TYPE, "Video",
|
||||
PW_KEY_MEDIA_CATEGORY, "Capture",
|
||||
PW_KEY_MEDIA_ROLE, "Camera",
|
||||
NULL),
|
||||
data.path = argc > 1 ? argv[1] : NULL;
|
||||
if (data.path)
|
||||
/* Set stream target if given on command line */
|
||||
pw_properties_set(props, PW_KEY_TARGET_OBJECT, data.path);
|
||||
|
||||
data.stream = pw_stream_new_simple(
|
||||
pw_main_loop_get_loop(data.loop),
|
||||
"video-play-reneg",
|
||||
pw_properties_new(
|
||||
PW_KEY_MEDIA_TYPE, "Video",
|
||||
PW_KEY_MEDIA_CATEGORY, "Capture",
|
||||
PW_KEY_MEDIA_ROLE, "Camera",
|
||||
NULL),
|
||||
"video-play-fixate",
|
||||
props,
|
||||
&stream_events,
|
||||
&data);
|
||||
|
||||
data.path = argc > 1 ? argv[1] : NULL;
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
fprintf(stderr, "can't initialize SDL: %s\n", SDL_GetError());
|
||||
return -1;
|
||||
|
|
@ -477,7 +481,7 @@ int main(int argc, char *argv[])
|
|||
*/
|
||||
if ((res = pw_stream_connect(data.stream,
|
||||
PW_DIRECTION_INPUT,
|
||||
data.path ? (uint32_t)atoi(data.path) : PW_ID_ANY,
|
||||
PW_ID_ANY,
|
||||
PW_STREAM_FLAG_AUTOCONNECT | /* try to automatically connect this stream */
|
||||
PW_STREAM_FLAG_MAP_BUFFERS, /* mmap the buffer data for us */
|
||||
params, n_params)) /* extra parameters, see above */ < 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue