GUPnPDLNAGstImageInformation *
gupnp_dlna_gst_image_information_new_from_discoverer_info
(GstDiscovererInfo *info)
{
    GList* image_list;
    GUPnPDLNAGstImageInformation *image_info = NULL;

    g_return_val_if_fail (GST_IS_DISCOVERER_INFO (info), NULL);

    image_list = gst_discoverer_info_get_video_streams (info);

    if (image_list) {
        if ((image_list->next == NULL) &&
                gst_discoverer_video_info_is_image
                (GST_DISCOVERER_VIDEO_INFO (image_list->data)))
            image_info = GUPNP_DLNA_GST_IMAGE_INFORMATION
                         (g_object_new
                          (GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION,
                           "info", info,
                           NULL));
        gst_discoverer_stream_info_list_free (image_list);
    }

    return image_info;
}
示例#2
0
GUPnPDLNAInformation *
gupnp_dlna_information_new_from_discoverer_info (GstDiscovererInfo *info,
                                                 GList             *profiles)
{
        GUPnPDLNAInformation *dlna;
        GList *video_list, *audio_list;
        gchar *name = NULL, *mime = NULL;

        video_list = gst_discoverer_info_get_video_streams (info);
        audio_list = gst_discoverer_info_get_audio_streams (info);
        if (video_list) {
                if ((g_list_length (video_list) ==1 ) &&
                    gst_discoverer_video_info_is_image
                                        (GST_DISCOVERER_VIDEO_INFO
                                                  (video_list->data))) {
                        GstDiscovererStreamInfo *stream;
                        stream = (GstDiscovererStreamInfo *) video_list->data;
                        guess_image_profile (stream, &name, &mime, profiles);
                } else
                        guess_video_profile (info, &name, &mime, profiles);
        } else if (audio_list)
                guess_audio_profile (info, &name, &mime, profiles);

        gst_discoverer_stream_info_list_free (audio_list);
        gst_discoverer_stream_info_list_free (video_list);

        dlna = gupnp_dlna_information_new (name, mime, info);


        g_free (name);
        g_free (mime);

        return dlna;
}
/**
 * gst_discoverer_stream_info_get_stream_type_nick:
 * @info: a #GstDiscovererStreamInfo
 *
 * Returns: a human readable name for the stream type of the given @info (ex : "audio",
 * "container",...).
 *
 * Since: 0.10.31
 */
const gchar *
gst_discoverer_stream_info_get_stream_type_nick (GstDiscovererStreamInfo * info)
{
  if (GST_IS_DISCOVERER_CONTAINER_INFO (info))
    return "container";
  if (GST_IS_DISCOVERER_AUDIO_INFO (info))
    return "audio";
  if (GST_IS_DISCOVERER_VIDEO_INFO (info)) {
    if (gst_discoverer_video_info_is_image ((GstDiscovererVideoInfo *)
            info))
      return "video(image)";
    else
      return "video";
  }
  return "unknown";
}
static gboolean
check_is_image (GstDiscovererInfo * info)
{
  gboolean ret = FALSE;
  GList *video_streams = gst_discoverer_info_get_video_streams (info);

  if (g_list_length (video_streams) == 1) {
    if (gst_discoverer_video_info_is_image (video_streams->data)) {
      GList *audio_streams = gst_discoverer_info_get_audio_streams (info);

      if (audio_streams == NULL)
        ret = TRUE;
      else
        gst_discoverer_stream_info_list_free (audio_streams);
    }
  }

  gst_discoverer_stream_info_list_free (video_streams);

  return ret;
}
示例#5
0
static void
guess_image_profile (GstDiscovererStreamInfo *info,
                     gchar                   **name,
                     gchar                   **mime,
                     GList                   *profiles)
{
        GstCaps *caps;
        GList *i;
        gboolean found = FALSE;
        GUPnPDLNAProfile *profile;
        GstEncodingProfile *enc_profile;
        const GstDiscovererVideoInfo *video_info =
                GST_DISCOVERER_VIDEO_INFO (info);

        if (!info || !gst_discoverer_video_info_is_image (video_info))
                return;

        caps = caps_from_video_stream_info (info);

        for (i = profiles; !found && i; i = i->next) {
                profile = (GUPnPDLNAProfile *)(i->data);
                enc_profile = gupnp_dlna_profile_get_encoding_profile (profile);

                /* Optimisation TODO: this can be pre-computed */
                if (!is_video_profile (enc_profile))
                        continue;

                if (match_profile (enc_profile,
                                   caps,
                                   GST_TYPE_ENCODING_VIDEO_PROFILE)) {
                        /* Found a match */
                        *name = g_strdup (gupnp_dlna_profile_get_name (profile));
                        *mime = g_strdup (gupnp_dlna_profile_get_mime (profile));
                        break;
                }
        }

        gst_caps_unref (caps);
}