[Libreoffice-commits] core.git: Branch 'feature/vlc' - avmedia/source

Minh Ngo nlminhtl at gmail.com
Mon Aug 5 13:59:10 PDT 2013


 avmedia/source/vlc/wrapper/Media.cxx |   42 ++++++++++++++++++++++++++++++
 avmedia/source/vlc/wrapper/Media.hxx |   49 +++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+)

New commits:
commit a367b3134dc225e4823703e11fdfacd445dc1a19
Author: Minh Ngo <nlminhtl at gmail.com>
Date:   Mon Aug 5 23:58:41 2013 +0300

    Media wrapper
    
    Change-Id: Ic6bbd4e192206b9be3db1f0e44f904ec51652ea7

diff --git a/avmedia/source/vlc/wrapper/Media.cxx b/avmedia/source/vlc/wrapper/Media.cxx
new file mode 100644
index 0000000..d2cf5c1
--- /dev/null
+++ b/avmedia/source/vlc/wrapper/Media.cxx
@@ -0,0 +1,42 @@
+#include <rtl/ustring.h>
+#include "Media.hxx"
+#include "SymbolLoader.hxx"
+#include "Instance.hxx"
+
+struct libvlc_instance_t;
+namespace VLC
+{
+    namespace
+    {
+        libvlc_media_t* ( *libvlc_media_new_path ) ( libvlc_instance_t *p_instance, const char *path );
+        void ( *libvlc_media_release )( libvlc_media_t *p_md );
+
+        ApiMap VLC_MEDIA_API[] =
+        {
+            SYM_MAP( libvlc_media_new_path ),
+            SYM_MAP( libvlc_media_release )
+        };
+
+        libvlc_media_t* InitMedia( const rtl::OUString& url, VLC::Instance& instance )
+        {
+            rtl::OString dest;
+            url.convertToString(&dest, RTL_TEXTENCODING_UTF8, 0);
+
+            return libvlc_media_new_path(instance, dest.getStr());
+        }
+
+    }
+
+
+Media::Media(const rtl::OUString& url, Instance& instance)
+{
+    InitApiMap(VLC_MEDIA_API);
+    mMedia = InitMedia( url, instance );
+}
+
+Media::~Media()
+{
+    libvlc_media_release( mMedia );
+}
+
+}
diff --git a/avmedia/source/vlc/wrapper/Media.hxx b/avmedia/source/vlc/wrapper/Media.hxx
new file mode 100644
index 0000000..cbeef02
--- /dev/null
+++ b/avmedia/source/vlc/wrapper/Media.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _WRAPPER_MEDIA_HXX
+#define _WRAPPER_MEDIA_HXX
+
+struct libvlc_media_t;
+
+namespace rtl
+{
+    class OUString;
+}
+
+namespace VLC
+{
+    class Instance;
+    class Media
+    {
+    public:
+        Media(const rtl::OUString& url, Instance& instance);
+        virtual ~Media();
+
+        inline operator libvlc_media_t*()
+        {
+            return mMedia;
+        }
+
+    private:
+        libvlc_media_t *mMedia;
+    };
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list