예제 #1
0
static GstCaps *
caps_from_audio_stream_info (GstDiscovererStreamInfo *info)
{
        GstCaps *temp = gst_discoverer_stream_info_get_caps (info);
        GstCaps *caps = gst_caps_copy (temp);
        const GstDiscovererAudioInfo *audio_info =
                GST_DISCOVERER_AUDIO_INFO(info);
        guint data;

        gst_caps_unref (temp);

        data = gst_discoverer_audio_info_get_sample_rate (audio_info);
        if (data)
                gst_caps_set_simple (caps, "rate", G_TYPE_INT, data, NULL);

        data = gst_discoverer_audio_info_get_channels (audio_info);
        if (data)
                gst_caps_set_simple (caps, "channels", G_TYPE_INT, data, NULL);

        data = gst_discoverer_audio_info_get_bitrate (audio_info);
        if (data)
                gst_caps_set_simple (caps, "bitrate", G_TYPE_INT, data, NULL);

        data = gst_discoverer_audio_info_get_max_bitrate (audio_info);
        if (data)
                gst_caps_set_simple
                        (caps, "maximum-bitrate", G_TYPE_INT, data, NULL);

        data = gst_discoverer_audio_info_get_depth (audio_info);
        if (data)
                gst_caps_set_simple (caps, "depth", G_TYPE_INT, data, NULL);

        return caps;
}
예제 #2
0
static gchar *
gst_stream_audio_information_to_string (GstDiscovererStreamInfo * info,
    gint depth)
{
  GstDiscovererAudioInfo *audio_info;
  GString *s;
  gchar *tmp;
  const gchar *ctmp;
  int len = 400;
  const GstTagList *tags;

  g_return_val_if_fail (info != NULL, NULL);

  s = g_string_sized_new (len);

  gst_stream_information_to_string (info, s, depth);

  audio_info = (GstDiscovererAudioInfo *) info;
  ctmp = gst_discoverer_audio_info_get_language (audio_info);
  my_g_string_append_printf (s, depth, "Language: %s\n",
      ctmp ? ctmp : "<unknown>");
  my_g_string_append_printf (s, depth, "Channels: %u\n",
      gst_discoverer_audio_info_get_channels (audio_info));
  my_g_string_append_printf (s, depth, "Sample rate: %u\n",
      gst_discoverer_audio_info_get_sample_rate (audio_info));
  my_g_string_append_printf (s, depth, "Depth: %u\n",
      gst_discoverer_audio_info_get_depth (audio_info));

  my_g_string_append_printf (s, depth, "Bitrate: %u\n",
      gst_discoverer_audio_info_get_bitrate (audio_info));
  my_g_string_append_printf (s, depth, "Max bitrate: %u\n",
      gst_discoverer_audio_info_get_max_bitrate (audio_info));

  my_g_string_append_printf (s, depth, "Tags:\n");
  tags = gst_discoverer_stream_info_get_tags (info);
  if (tags) {
    tmp = gst_tag_list_to_string (tags);
    my_g_string_append_printf (s, depth, "  %s\n", tmp);
    g_free (tmp);
  } else {
    my_g_string_append_printf (s, depth, "  None\n");
  }
  if (verbose)
    my_g_string_append_printf (s, depth, "\n");

  return g_string_free (s, FALSE);
}
static gchar *
gst_stream_audio_information_to_string (GstDiscovererStreamInfo * info,
    guint depth)
{
  GstDiscovererAudioInfo *audio_info;
  GString *s;
  const gchar *ctmp;
  int len = 400;
  const GstTagList *tags;
  gchar *channel_positions;

  g_return_val_if_fail (info != NULL, NULL);

  s = g_string_sized_new (len);

  gst_stream_information_to_string (info, s, depth);

  audio_info = (GstDiscovererAudioInfo *) info;
  ctmp = gst_discoverer_audio_info_get_language (audio_info);
  my_g_string_append_printf (s, depth, "Language: %s\n",
      ctmp ? ctmp : "<unknown>");

  channel_positions = format_channel_mask (audio_info);
  my_g_string_append_printf (s, depth, "Channels: %u (%s)\n",
      gst_discoverer_audio_info_get_channels (audio_info), channel_positions);
  g_free (channel_positions);

  my_g_string_append_printf (s, depth, "Sample rate: %u\n",
      gst_discoverer_audio_info_get_sample_rate (audio_info));
  my_g_string_append_printf (s, depth, "Depth: %u\n",
      gst_discoverer_audio_info_get_depth (audio_info));

  my_g_string_append_printf (s, depth, "Bitrate: %u\n",
      gst_discoverer_audio_info_get_bitrate (audio_info));
  my_g_string_append_printf (s, depth, "Max bitrate: %u\n",
      gst_discoverer_audio_info_get_max_bitrate (audio_info));

  tags = gst_discoverer_stream_info_get_tags (info);
  print_tags_topology (depth, tags);

  return g_string_free (s, FALSE);
}