Add flags to set_format

Use flags to control the behaviour of set_format
Move poll into separate file
This commit is contained in:
Wim Taymans 2016-07-18 10:35:02 +02:00
parent b9320c67c2
commit 96df59274c
11 changed files with 146 additions and 97 deletions

View file

@ -365,10 +365,10 @@ spa_alsa_sink_node_port_enum_formats (SpaHandle *handle,
}
static SpaResult
spa_alsa_sink_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
bool test_only,
const SpaFormat *format)
spa_alsa_sink_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
SpaPortFormatFlags flags,
const SpaFormat *format)
{
SpaALSASink *this = (SpaALSASink *) handle;
SpaResult res;
@ -387,8 +387,6 @@ spa_alsa_sink_node_port_set_format (SpaHandle *handle,
if ((res = spa_audio_raw_format_parse (format, &this->current_format)) < 0)
return res;
printf ("format %d\n", this->current_format.info.rate);
this->have_format = true;
return SPA_RESULT_OK;

View file

@ -330,10 +330,10 @@ spa_audiomixer_node_port_enum_formats (SpaHandle *handle,
}
static SpaResult
spa_audiomixer_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
bool test_only,
const SpaFormat *format)
spa_audiomixer_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
SpaPortFormatFlags flags,
const SpaFormat *format)
{
SpaAudioMixer *this = (SpaAudioMixer *) handle;
SpaResult res;

View file

@ -307,10 +307,10 @@ spa_audiotestsrc_node_port_enum_formats (SpaHandle *handle,
}
static SpaResult
spa_audiotestsrc_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
bool test_only,
const SpaFormat *format)
spa_audiotestsrc_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
SpaPortFormatFlags flags,
const SpaFormat *format)
{
SpaAudioTestSrc *this = (SpaAudioTestSrc *) handle;
SpaResult res;

View file

@ -278,10 +278,10 @@ spa_ffmpeg_dec_node_port_enum_formats (SpaHandle *handle,
}
static SpaResult
spa_ffmpeg_dec_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
bool test_only,
const SpaFormat *format)
spa_ffmpeg_dec_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
SpaPortFormatFlags flags,
const SpaFormat *format)
{
SpaFFMpegDec *this = (SpaFFMpegDec *) handle;
SpaFFMpegState *state;
@ -315,7 +315,7 @@ spa_ffmpeg_dec_node_port_set_format (SpaHandle *handle,
} else
return SPA_RESULT_INVALID_MEDIA_TYPE;
if (!test_only) {
if (!(flags & SPA_PORT_FORMAT_FLAG_TEST_ONLY)) {
memcpy (tf, f, fs);
state->current_format = tf;
}

View file

@ -278,10 +278,10 @@ spa_ffmpeg_enc_node_port_enum_formats (SpaHandle *handle,
}
static SpaResult
spa_ffmpeg_enc_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
bool test_only,
const SpaFormat *format)
spa_ffmpeg_enc_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
SpaPortFormatFlags flags,
const SpaFormat *format)
{
SpaFFMpegEnc *this = (SpaFFMpegEnc *) handle;
SpaFFMpegState *state;
@ -315,7 +315,7 @@ spa_ffmpeg_enc_node_port_set_format (SpaHandle *handle,
} else
return SPA_RESULT_INVALID_MEDIA_TYPE;
if (!test_only) {
if (!(flags & SPA_PORT_FORMAT_FLAG_TEST_ONLY)) {
memcpy (tf, f, fs);
state->current_format = tf;
}

View file

@ -331,10 +331,10 @@ spa_v4l2_source_node_port_enum_formats (SpaHandle *handle,
}
static SpaResult
spa_v4l2_source_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
bool test_only,
const SpaFormat *format)
spa_v4l2_source_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
SpaPortFormatFlags flags,
const SpaFormat *format)
{
SpaV4l2Source *this = (SpaV4l2Source *) handle;
SpaV4l2State *state;
@ -368,10 +368,10 @@ spa_v4l2_source_node_port_set_format (SpaHandle *handle,
} else
return SPA_RESULT_INVALID_MEDIA_TYPE;
if (spa_v4l2_set_format (this, f, test_only) < 0)
if (spa_v4l2_set_format (this, f, flags & SPA_PORT_FORMAT_FLAG_TEST_ONLY) < 0)
return SPA_RESULT_INVALID_MEDIA_TYPE;
if (!test_only) {
if (!(flags & SPA_PORT_FORMAT_FLAG_TEST_ONLY)) {
memcpy (tf, f, fs);
state->current_format = tf;
}

View file

@ -288,10 +288,10 @@ spa_volume_node_port_enum_formats (SpaHandle *handle,
}
static SpaResult
spa_volume_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
bool test_only,
const SpaFormat *format)
spa_volume_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
SpaPortFormatFlags flags,
const SpaFormat *format)
{
SpaVolume *this = (SpaVolume *) handle;
SpaResult res;

View file

@ -317,10 +317,10 @@ spa_xv_sink_node_port_enum_formats (SpaHandle *handle,
}
static SpaResult
spa_xv_sink_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
bool test_only,
const SpaFormat *format)
spa_xv_sink_node_port_set_format (SpaHandle *handle,
uint32_t port_id,
SpaPortFormatFlags flags,
const SpaFormat *format)
{
SpaXvSink *this = (SpaXvSink *) handle;
SpaResult res;
@ -351,10 +351,10 @@ spa_xv_sink_node_port_set_format (SpaHandle *handle,
} else
return SPA_RESULT_INVALID_MEDIA_TYPE;
if (spa_xv_set_format (this, f, test_only) < 0)
if (spa_xv_set_format (this, f, flags & SPA_PORT_FORMAT_FLAG_TEST_ONLY) < 0)
return SPA_RESULT_INVALID_MEDIA_TYPE;
if (!test_only) {
if (!(flags & SPA_PORT_FORMAT_FLAG_TEST_ONLY)) {
memcpy (tf, f, fs);
this->current_format = tf;
}