tizen 2.0 init
[framework/multimedia/gst-plugins-base0.10.git] / gst-libs / gst / pbutils / gstdiscoverer-types.c
index 2edf8e9..0cb9a1b 100644 (file)
@@ -39,6 +39,9 @@ static GstDiscovererAudioInfo
 static GstDiscovererVideoInfo
     * gst_discoverer_video_info_copy_int (GstDiscovererVideoInfo * ptr);
 
+static GstDiscovererSubtitleInfo
+    * gst_discoverer_subtitle_info_copy_int (GstDiscovererSubtitleInfo * ptr);
+
 /* Per-stream information */
 
 G_DEFINE_TYPE (GstDiscovererStreamInfo, gst_discoverer_stream_info,
@@ -110,6 +113,11 @@ gst_discoverer_info_copy_int (GstDiscovererStreamInfo * info,
     ret = (GstDiscovererStreamInfo *)
         gst_discoverer_video_info_copy_int ((GstDiscovererVideoInfo *) info);
 
+  } else if (ltyp == GST_TYPE_DISCOVERER_SUBTITLE_INFO) {
+    ret = (GstDiscovererStreamInfo *)
+        gst_discoverer_subtitle_info_copy_int ((GstDiscovererSubtitleInfo *)
+        info);
+
   } else
     ret = gst_discoverer_stream_info_new ();
 
@@ -199,15 +207,23 @@ G_DEFINE_TYPE (GstDiscovererAudioInfo, gst_discoverer_audio_info,
     GST_TYPE_DISCOVERER_STREAM_INFO);
 
 static void
+gst_discoverer_audio_info_finalize (GstDiscovererAudioInfo * info)
+{
+  g_free (info->language);
+  gst_discoverer_stream_info_finalize ((GstDiscovererStreamInfo *) info);
+}
+
+static void
 gst_discoverer_audio_info_class_init (GstDiscovererAudioInfoClass * klass)
 {
-  /* Nothing to initialize */
+  klass->finalize =
+      (GstMiniObjectFinalizeFunction) gst_discoverer_audio_info_finalize;
 }
 
 static void
 gst_discoverer_audio_info_init (GstDiscovererAudioInfo * info)
 {
-  /* Nothing to initialize */
+  info->language = NULL;
 }
 
 static GstDiscovererAudioInfo *
@@ -229,6 +245,50 @@ gst_discoverer_audio_info_copy_int (GstDiscovererAudioInfo * ptr)
   ret->depth = ptr->depth;
   ret->bitrate = ptr->bitrate;
   ret->max_bitrate = ptr->max_bitrate;
+  ret->language = g_strdup (ptr->language);
+
+  return ret;
+}
+
+/* Subtitle information */
+G_DEFINE_TYPE (GstDiscovererSubtitleInfo, gst_discoverer_subtitle_info,
+    GST_TYPE_DISCOVERER_STREAM_INFO);
+
+static void
+gst_discoverer_subtitle_info_init (GstDiscovererSubtitleInfo * info)
+{
+  info->language = NULL;
+}
+
+static void
+gst_discoverer_subtitle_info_finalize (GstDiscovererSubtitleInfo * info)
+{
+  g_free (info->language);
+  gst_discoverer_stream_info_finalize ((GstDiscovererStreamInfo *) info);
+}
+
+static void
+gst_discoverer_subtitle_info_class_init (GstMiniObjectClass * klass)
+{
+  klass->finalize =
+      (GstMiniObjectFinalizeFunction) gst_discoverer_subtitle_info_finalize;
+}
+
+static GstDiscovererSubtitleInfo *
+gst_discoverer_subtitle_info_new (void)
+{
+  return (GstDiscovererSubtitleInfo *)
+      gst_mini_object_new (GST_TYPE_DISCOVERER_SUBTITLE_INFO);
+}
+
+static GstDiscovererSubtitleInfo *
+gst_discoverer_subtitle_info_copy_int (GstDiscovererSubtitleInfo * ptr)
+{
+  GstDiscovererSubtitleInfo *ret;
+
+  ret = gst_discoverer_subtitle_info_new ();
+
+  ret->language = g_strdup (ptr->language);
 
   return ret;
 }
@@ -314,11 +374,13 @@ GstDiscovererInfo *
 gst_discoverer_info_copy (GstDiscovererInfo * ptr)
 {
   GstDiscovererInfo *ret;
-  GHashTable *stream_map = g_hash_table_new (g_direct_hash, NULL);
+  GHashTable *stream_map;
   GList *tmp;
 
   g_return_val_if_fail (ptr != NULL, NULL);
 
+  stream_map = g_hash_table_new (g_direct_hash, NULL);
+
   ret = gst_discoverer_info_new ();
 
   ret->uri = g_strdup (ptr->uri);
@@ -440,6 +502,25 @@ gst_discoverer_info_get_video_streams (GstDiscovererInfo * info)
 }
 
 /**
+ * gst_discoverer_info_get_subtitle_streams:
+ * @info: a #GstDiscovererInfo
+ *
+ * Finds all the #GstDiscovererSubtitleInfo contained in @info
+ *
+ * Returns: (transfer full) (element-type Gst.DiscovererStreamInfo): A #GList of
+ * matching #GstDiscovererStreamInfo. The caller should free it with
+ * gst_discoverer_stream_info_list_free().
+ *
+ * Since: 0.10.36
+ */
+GList *
+gst_discoverer_info_get_subtitle_streams (GstDiscovererInfo * info)
+{
+  return gst_discoverer_info_get_streams (info,
+      GST_TYPE_DISCOVERER_SUBTITLE_INFO);
+}
+
+/**
  * gst_discoverer_info_get_container_streams:
  * @info: a #GstDiscovererInfo
  *
@@ -481,6 +562,8 @@ gst_discoverer_stream_info_get_stream_type_nick (GstDiscovererStreamInfo * info)
     else
       return "video";
   }
+  if (GST_IS_DISCOVERER_SUBTITLE_INFO (info))
+    return "subtitles";
   return "unknown";
 }
 
@@ -679,6 +762,17 @@ AUDIO_INFO_ACCESSOR_CODE (bitrate, guint, 0);
 
 AUDIO_INFO_ACCESSOR_CODE (max_bitrate, guint, 0);
 
+/**
+ * gst_discoverer_audio_info_get_language:
+ * @info: a #GstDiscovererAudioInfo
+ *
+ * Returns: the language of the stream, or NULL if unknown.
+ *
+ * Since: 0.10.36
+ */
+
+AUDIO_INFO_ACCESSOR_CODE (language, const gchar *, NULL);
+
 /* GstDiscovererVideoInfo */
 
 #define VIDEO_INFO_ACCESSOR_CODE(fieldname, type, failval)             \
@@ -818,6 +912,24 @@ gst_discoverer_video_info_is_image (const GstDiscovererVideoInfo * info)
   return info->is_image;
 }
 
+/* GstDiscovererSubtitleInfo */
+
+#define SUBTITLE_INFO_ACCESSOR_CODE(fieldname, type, failval)                     \
+  GENERIC_ACCESSOR_CODE(gst_discoverer_subtitle_info, GstDiscovererSubtitleInfo*, \
+                       GST_TYPE_DISCOVERER_SUBTITLE_INFO,                        \
+                       fieldname, type, failval)
+
+/**
+ * gst_discoverer_subtitle_info_get_language:
+ * @info: a #GstDiscovererSubtitleInfo
+ *
+ * Returns: the language of the stream, or NULL if unknown.
+ *
+ * Since: 0.10.36
+ */
+
+SUBTITLE_INFO_ACCESSOR_CODE (language, const gchar *, NULL);
+
 /* GstDiscovererInfo */
 
 #define DISCOVERER_INFO_ACCESSOR_CODE(fieldname, type, failval)                \
@@ -910,7 +1022,7 @@ DISCOVERER_INFO_ACCESSOR_CODE (duration, GstClockTime, GST_CLOCK_TIME_NONE);
  * gst_discoverer_info_get_seekable:
  * @info: a #GstDiscovererInfo
  *
- * Returns: the wheter the URI is seekable.
+ * Returns: the whether the URI is seekable.
  *
  * Since: 0.10.32
  */
@@ -934,7 +1046,7 @@ DISCOVERER_INFO_ACCESSOR_CODE (misc, const GstStructure *, NULL);
  * gst_discoverer_info_get_tags:
  * @info: a #GstDiscovererInfo
  *
- * Returns: (transfer none): all tags contained in the %URI. If you wish to use
+ * Returns: (transfer none): all tags contained in the URI. If you wish to use
  * the tags after the life-time of @info, you will need to copy them.
  *
  * Since: 0.10.31