[rygel-gst-0-10-fullscreen-renderer] Port to 2.2 API version



commit 6b8706b924165a301b49467b8398608b8e4fe91d
Author: Jens Georg <mail jensge org>
Date:   Sun Mar 23 14:50:32 2014 +0100

    Port to 2.2 API version
    
    Signed-off-by: Jens Georg <mail jensge org>

 configure.ac               |    8 ++--
 src/Makefile.am            |   10 ++--
 src/rygel-playbin-player.c |   98 +++++++++++++++++++++++++++++++++++--------
 3 files changed, 88 insertions(+), 28 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7110b15..0764b3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,7 +30,7 @@ dnl Required versions of library packages
 LIBRYGEL_RENDERER_GST_REQUIRED=0.17.4
 GSTREAMER_REQUIRED=0.10.36
 GTK_REQUIRED=3.0.0
-REQUIRED_MODULES='gio-2.0 rygel-renderer-2.0 >= $LIBRYGEL_RENDERER_GST_REQUIRED
+REQUIRED_MODULES='gio-2.0 rygel-renderer-2.2 >= $LIBRYGEL_RENDERER_GST_REQUIRED
                   gstreamer-0.10 >= $GSTREAMER_REQUIRED
                   gstreamer-plugins-base-0.10 >= $GSTREAMER_REQUIRED
                   gstreamer-video-0.10 >= $GSTREAMER_REQUIRED
@@ -64,13 +64,13 @@ AC_ARG_ENABLE([plugin],
 AM_CONDITIONAL([BUILD_PLUGIN], [test "x$[]enable_plugin" = "xyes"])
 AS_IF([test "x$[]enable_plugin" = "xyes"],
       [
-        RYGEL_PLUGIN_LINKER_FLAGS="`$PKG_CONFIG --variable=plugin_ldflags rygel-core-2.0`"
+        RYGEL_PLUGIN_LINKER_FLAGS="`$PKG_CONFIG --variable=plugin_ldflags  rygel-core-2.2`"
         AC_SUBST(RYGEL_PLUGIN_LINKER_FLAGS)
 
-        RYGEL_PLUGIN_DIR="`$PKG_CONFIG --variable=plugindir rygel-core-2.0`"
+        RYGEL_PLUGIN_DIR="`$PKG_CONFIG --variable=plugindir rygel-core-2.2`"
         AC_SUBST(RYGEL_PLUGIN_DIR)
 
-        RYGEL_VERSION="`$PKG_CONFIG --modversion rygel-core-2.0`"
+        RYGEL_VERSION="`$PKG_CONFIG --modversion rygel-core-2.2`"
         AC_SUBST(RYGEL_VERSION)
       ])
 
diff --git a/src/Makefile.am b/src/Makefile.am
index f8832e5..76c9138 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,21 +19,21 @@ endif
 
 if BUILD_PLUGIN
 plugindir = $(RYGEL_PLUGIN_DIR)
-plugin_LTLIBRARIES = libgstreamer-legacy-renderer.la
+plugin_LTLIBRARIES = librygel-gstreamer-legacy-renderer.la
 plugin_DATA = legacy-playbin.plugin
-libgstreamer_legacy_renderer_la_SOURCES = \
+librygel_gstreamer_legacy_renderer_la_SOURCES = \
        rygel-playbin-player.c \
        rygel-playbin-player.h \
        gstreamer-legacy-renderer-plugin.c \
        gstreamer-legacy-renderer-plugin.h
 
-libgstreamer_legacy_renderer_la_CFLAGS = \
+librygel_gstreamer_legacy_renderer_la_CFLAGS = \
        $(DEPS_CFLAGS)
 
-libgstreamer_legacy_renderer_la_LDFLAGS = \
+librygel_gstreamer_legacy_renderer_la_LDFLAGS = \
        $(RYGEL_PLUGIN_LINKER_FLAGS)
 
-libgstreamer_legacy_renderer_la_LIBADD = \
+librygel_gstreamer_legacy_renderer_la_LIBADD = \
        $(DEPS_LIBS)
 endif
 
diff --git a/src/rygel-playbin-player.c b/src/rygel-playbin-player.c
index e7b186e..22877d5 100644
--- a/src/rygel-playbin-player.c
+++ b/src/rygel-playbin-player.c
@@ -80,10 +80,13 @@ enum  {
   RYGEL_PLAYBIN_PLAYER_MIME_TYPE,
   RYGEL_PLAYBIN_PLAYER_METADATA,
   RYGEL_PLAYBIN_PLAYER_CAN_SEEK,
+  RYGEL_PLAYBIN_PLAYER_CAN_SEEK_BYTES,
   RYGEL_PLAYBIN_PLAYER_CONTENT_FEATURES,
   RYGEL_PLAYBIN_PLAYER_VOLUME,
   RYGEL_PLAYBIN_PLAYER_DURATION,
+  RYGEL_PLAYBIN_PLAYER_SIZE,
   RYGEL_PLAYBIN_PLAYER_POSITION,
+  RYGEL_PLAYBIN_PLAYER_BYTE_POSITION,
   RYGEL_PLAYBIN_PLAYER_SUPPORTED_PROFILES
 };
 
@@ -743,6 +746,10 @@ rygel_playbin_player_real_get_can_seek (RygelMediaPlayer *base) {
     g_str_has_prefix (self->priv->_mime_type, "image/");
 }
 
+static gboolean
+rygel_playbin_player_real_get_can_seek_bytes (RygelMediaPlayer *base) {
+  return rygel_playbin_player_real_get_can_seek (base);
+}
 
 static gchar*
 rygel_playbin_player_real_get_content_features (RygelMediaPlayer *base) {
@@ -844,6 +851,21 @@ rygel_playbin_player_real_get_duration (RygelMediaPlayer *base) {
   }
 }
 
+static gint64
+rygel_playbin_player_real_get_size (RygelMediaPlayer *base) {
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+  GstFormat format = GST_FORMAT_BYTES;
+  gint64 pos = 0LL;
+
+  g_return_val_if_fail (self, 0LL);
+  g_return_val_if_fail (self->priv->_playbin, 0LL);
+
+  if (gst_element_query_duration (self->priv->_playbin, &format, &pos)) {
+    return pos / GST_USECOND;
+  } else {
+    return 0LL;
+  }
+}
 
 static gint64
 rygel_playbin_player_real_get_position (RygelMediaPlayer *base) {
@@ -861,46 +883,62 @@ rygel_playbin_player_real_get_position (RygelMediaPlayer *base) {
   }
 }
 
+static gint64
+rygel_playbin_player_real_get_byte_position (RygelMediaPlayer *base) {
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+  GstFormat format = GST_FORMAT_BYTES;
+  gint64 pos = 0LL;
+
+  g_return_val_if_fail (self, 0LL);
+  g_return_val_if_fail (self->priv->_playbin, 0LL);
+
+  if (gst_element_query_position (self->priv->_playbin, &format, &pos)) {
+    return pos / GST_USECOND;
+  } else {
+    return 0LL;
+  }
+}
+
 GList *
 rygel_playbin_player_get_supported_profiles (RygelPlaybinPlayer *self) {
   if (self->priv->_supported_profiles == NULL) {
-    RygelRendererDLNAProfile *profile = NULL;
+    RygelDLNAProfile *profile = NULL;
 
-    profile = rygel_renderer_dlna_profile_new ("JPEG_SM", "image/jpeg");
+    profile = rygel_dlna_profile_new ("JPEG_SM", "image/jpeg");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("JPEG_MED", "image/jpeg");
+    profile = rygel_dlna_profile_new ("JPEG_MED", "image/jpeg");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("JPEG_LRG", "image/jpeg");
+    profile = rygel_dlna_profile_new ("JPEG_LRG", "image/jpeg");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("PNG_LRG", "image/png");
+    profile = rygel_dlna_profile_new ("PNG_LRG", "image/png");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("MP3", "audio/mpeg");
+    profile = rygel_dlna_profile_new ("MP3", "audio/mpeg");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("MP3X", "audio/mpeg");
+    profile = rygel_dlna_profile_new ("MP3X", "audio/mpeg");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("AAC_ADTS_320", "audio/vnd.dlna.adts");
+    profile = rygel_dlna_profile_new ("AAC_ADTS_320", "audio/vnd.dlna.adts");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("AAC_ISO_320", "audio/mp4");
+    profile = rygel_dlna_profile_new ("AAC_ISO_320", "audio/mp4");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("AAC_ISO_320", "audio/3gpp");
+    profile = rygel_dlna_profile_new ("AAC_ISO_320", "audio/3gpp");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("LPCM", "audio/l16;rate=44100;channels=2");
+    profile = rygel_dlna_profile_new ("LPCM", "audio/l16;rate=44100;channels=2");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("LPCM", "audio/l16;rate=44100;channels=1");
+    profile = rygel_dlna_profile_new ("LPCM", "audio/l16;rate=44100;channels=1");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("WMABASE", "audio/x-ms-wma");
+    profile = rygel_dlna_profile_new ("WMABASE", "audio/x-ms-wma");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("WMAFULL", "audio/x-ms-wma");
+    profile = rygel_dlna_profile_new ("WMAFULL", "audio/x-ms-wma");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("WMAPRO", "audio/x-ms-wma");
+    profile = rygel_dlna_profile_new ("WMAPRO", "audio/x-ms-wma");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("MPEG_TS_SD_EU_ISO", "video/mpeg");
+    profile = rygel_dlna_profile_new ("MPEG_TS_SD_EU_ISO", "video/mpeg");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("MPEG_TS_SD_NA_ISO", "video/mpeg");
+    profile = rygel_dlna_profile_new ("MPEG_TS_SD_NA_ISO", "video/mpeg");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("MPEG_TS_HD_NA_ISO", "video/mpeg");
+    profile = rygel_dlna_profile_new ("MPEG_TS_HD_NA_ISO", "video/mpeg");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
-    profile = rygel_renderer_dlna_profile_new ("AVC_MP4_BL_CIF15_AAC_520", "video/mp4");
+    profile = rygel_dlna_profile_new ("AVC_MP4_BL_CIF15_AAC_520", "video/mp4");
     self->priv->_supported_profiles = g_list_prepend (self->priv->_supported_profiles, profile);
   }
 
@@ -944,6 +982,10 @@ static void rygel_playbin_player_class_init (RygelPlaybinPlayerClass *klass) {
                                     "can-seek");
 
   g_object_class_override_property (gobject_class,
+                                    RYGEL_PLAYBIN_PLAYER_CAN_SEEK_BYTES,
+                                    "can-seek-bytes");
+
+  g_object_class_override_property (gobject_class,
                                     RYGEL_PLAYBIN_PLAYER_CONTENT_FEATURES,
                                     "content-features");
 
@@ -956,10 +998,18 @@ static void rygel_playbin_player_class_init (RygelPlaybinPlayerClass *klass) {
                                     "duration");
 
   g_object_class_override_property (gobject_class,
+                                    RYGEL_PLAYBIN_PLAYER_SIZE,
+                                    "size");
+
+  g_object_class_override_property (gobject_class,
                                     RYGEL_PLAYBIN_PLAYER_POSITION,
                                     "position");
 
   g_object_class_override_property (gobject_class,
+                                    RYGEL_PLAYBIN_PLAYER_BYTE_POSITION,
+                                    "byte-position");
+
+  g_object_class_override_property (gobject_class,
                                     RYGEL_PLAYBIN_PLAYER_PLAYBACK_SPEED,
                                     "playback-speed");
 
@@ -987,6 +1037,7 @@ static void rygel_playbin_player_rygel_media_player_interface_init (RygelMediaPl
   iface->get_metadata = rygel_playbin_player_real_get_metadata;
   iface->set_metadata = rygel_playbin_player_real_set_metadata;
   iface->get_can_seek = rygel_playbin_player_real_get_can_seek;
+  iface->get_can_seek_bytes = rygel_playbin_player_real_get_can_seek_bytes;
   iface->get_content_features = rygel_playbin_player_real_get_content_features;
   iface->set_content_features = rygel_playbin_player_real_set_content_features;
   iface->get_volume = rygel_playbin_player_real_get_volume;
@@ -1090,6 +1141,9 @@ static void _vala_rygel_playbin_player_get_property (GObject *object, guint prop
     case RYGEL_PLAYBIN_PLAYER_CAN_SEEK:
       g_value_set_boolean (value, rygel_media_player_get_can_seek (RYGEL_MEDIA_PLAYER (self)));
       break;
+    case RYGEL_PLAYBIN_PLAYER_CAN_SEEK_BYTES:
+      g_value_set_boolean (value, rygel_media_player_get_can_seek_bytes (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_CONTENT_FEATURES:
       g_value_take_string (value, rygel_media_player_get_content_features (RYGEL_MEDIA_PLAYER (self)));
       break;
@@ -1099,9 +1153,15 @@ static void _vala_rygel_playbin_player_get_property (GObject *object, guint prop
     case RYGEL_PLAYBIN_PLAYER_DURATION:
       g_value_set_int64 (value, rygel_media_player_get_duration (RYGEL_MEDIA_PLAYER (self)));
       break;
+    case RYGEL_PLAYBIN_PLAYER_SIZE:
+      g_value_set_int64 (value, rygel_media_player_get_size (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_POSITION:
       g_value_set_int64 (value, rygel_media_player_get_position (RYGEL_MEDIA_PLAYER (self)));
       break;
+    case RYGEL_PLAYBIN_PLAYER_BYTE_POSITION:
+      g_value_set_int64 (value, rygel_media_player_get_byte_position (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_SUPPORTED_PROFILES:
       g_value_set_pointer (value, rygel_playbin_player_get_supported_profiles (self));
       break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]