mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
Rework formats
Use a POD for the format body. This allows us to more easily build and copy the formats. Remove obsolete code to make video and audio formats. Use SpaVideo/AudioInfo to keep track of formats. Make functions to parse the format into the structures. Update plugins
This commit is contained in:
parent
7fc73953cd
commit
16b62de53a
34 changed files with 1096 additions and 1579 deletions
|
|
@ -56,7 +56,7 @@ struct _FFMpegBuffer {
|
|||
};
|
||||
|
||||
typedef struct {
|
||||
SpaFormatVideo format[2];
|
||||
SpaVideoInfo format[2];
|
||||
SpaFormat *current_format;
|
||||
bool have_buffers;
|
||||
FFMpegBuffer buffers[MAX_BUFFERS];
|
||||
|
|
@ -273,14 +273,11 @@ spa_ffmpeg_enc_node_port_enum_formats (SpaNode *node,
|
|||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_format_video_init (SPA_MEDIA_TYPE_VIDEO,
|
||||
SPA_MEDIA_SUBTYPE_RAW,
|
||||
&port->format[0]);
|
||||
break;
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*format = &port->format[0].format;
|
||||
*format = NULL;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -310,16 +307,17 @@ spa_ffmpeg_enc_node_port_set_format (SpaNode *node,
|
|||
port->current_format = NULL;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
if ((res = spa_format_video_parse (format, &port->format[0]) < 0))
|
||||
return res;
|
||||
|
||||
if (format->media_type != SPA_MEDIA_TYPE_VIDEO ||
|
||||
format->media_subtype != SPA_MEDIA_SUBTYPE_RAW)
|
||||
return SPA_RESULT_INVALID_MEDIA_TYPE;
|
||||
|
||||
if ((res = spa_format_video_parse (format, &port->format[0]) < 0))
|
||||
return res;
|
||||
|
||||
if (!(flags & SPA_PORT_FORMAT_FLAG_TEST_ONLY)) {
|
||||
memcpy (&port->format[1], &port->format[0], sizeof (SpaFormatVideo));
|
||||
port->current_format = &port->format[1].format;
|
||||
memcpy (&port->format[1], &port->format[0], sizeof (SpaVideoInfo));
|
||||
port->current_format = NULL;
|
||||
}
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue