summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMinh Ngo <nlminhtl@gmail.com>2013-08-05 23:58:41 +0300
committerMichael Meeks <michael.meeks@suse.com>2013-08-21 10:54:51 +0100
commit23c29305a5fa21936a1123eaa938495ffddca8aa (patch)
tree5ac8da64b9751282e1fce3faf6d3f755a87c968f /avmedia
parentcb3ba53e3f995d4034bc5a9113015d81a1db30a4 (diff)
Media wrapper
Change-Id: Ic6bbd4e192206b9be3db1f0e44f904ec51652ea7
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/vlc/wrapper/Media.cxx42
-rw-r--r--avmedia/source/vlc/wrapper/Media.hxx49
2 files changed, 91 insertions, 0 deletions
diff --git a/avmedia/source/vlc/wrapper/Media.cxx b/avmedia/source/vlc/wrapper/Media.cxx
new file mode 100644
index 000000000000..d2cf5c1b6c6c
--- /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 000000000000..cbeef02952c4
--- /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: */