inspect: improve output

Keep state variable to enumerate things. This allows us to remove the
expectation that the same index will give the same item.
Use a new rectangle type for video size. When enumerating sizes, this
allows us to specify relations between width and height more easily.
Remove the struct and bytes type, they are like pointer.
Add filter to enum_formats to speed up enumerations.
This commit is contained in:
Wim Taymans 2016-07-15 18:22:29 +02:00
parent 77bc2a1793
commit b9320c67c2
27 changed files with 414 additions and 287 deletions

View file

@ -246,28 +246,33 @@ spa_ffmpeg_dec_node_remove_port (SpaHandle *handle,
static SpaResult
spa_ffmpeg_dec_node_port_enum_formats (SpaHandle *handle,
uint32_t port_id,
unsigned int index,
SpaFormat **format)
SpaFormat **format,
const SpaFormat *filter,
void **state)
{
SpaFFMpegDec *this = (SpaFFMpegDec *) handle;
SpaFFMpegState *state;
SpaFFMpegState *s;
int index;
if (handle == NULL || format == NULL)
if (handle == NULL || format == NULL || state == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
if (!IS_VALID_PORT (port_id))
return SPA_RESULT_INVALID_PORT;
state = &this->state[port_id];
s = &this->state[port_id];
index = (*state == NULL ? 0 : *(int*)state);
switch (index) {
case 0:
spa_video_raw_format_init (&state->raw_format[0]);
spa_video_raw_format_init (&s->raw_format[0]);
break;
default:
return SPA_RESULT_ENUM_END;
}
*format = &state->raw_format[0].format;
*format = &s->raw_format[0].format;
*(int*)state = ++index;
return SPA_RESULT_OK;
}