Esempio n. 1
0
static gboolean
gst_interleave_check_channel_positions (GValueArray * positions)
{
  gint i;

  guint channels;

  GstAudioChannelPosition *pos;

  gboolean ret;

  channels = positions->n_values;
  pos = g_new (GstAudioChannelPosition, positions->n_values);

  for (i = 0; i < channels; i++) {
    GValue *v = g_value_array_get_nth (positions, i);

    pos[i] = g_value_get_enum (v);
  }

  ret = gst_audio_check_channel_positions (pos, channels);
  g_free (pos);

  return ret;
}
Esempio n. 2
0
GstRingBufferSpec *
gst_pulse_channel_map_to_gst (const pa_channel_map * map,
    GstRingBufferSpec * spec)
{
  int i;
  GstAudioChannelPosition *pos;
  gboolean invalid = FALSE;

  g_return_val_if_fail (map->channels == spec->channels, NULL);

  pos = g_new0 (GstAudioChannelPosition, spec->channels + 1);

  for (i = 0; i < spec->channels; i++) {
    if (map->map[i] == PA_CHANNEL_POSITION_INVALID) {
      invalid = TRUE;
      break;
    } else if ((int) map->map[i] < (int) GST_AUDIO_CHANNEL_POSITION_NUM) {
      pos[i] = pa_to_gst_pos[map->map[i] + 1];
    } else {
      invalid = TRUE;
      break;
    }
  }

  if (!invalid && !gst_audio_check_channel_positions (pos, spec->channels))
    invalid = TRUE;

  if (invalid) {
    for (i = 0; i < spec->channels; i++)
      pos[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
  }

  gst_audio_set_channel_positions (gst_caps_get_structure (spec->caps, 0), pos);

  g_free (pos);

  return spec;
}