[gnomemm] Problems with Gst::Object



Hi!

I'm currently trying to wrap Gstreamer. My main problem is Gst::Object.
I'm quite unsure if the ctor is correct. IMO I need a wrapper which
transforms a Glib::Object to a Gst::Object.

Second problem:
It seems like the compiler doesn't like my defined macro or the macro
used in GstObject (see
http://gstreamer.net/docs/0.4.0/gstreamer/gstobject.html for more
information)

Any help, suggestions, rants, improvements are highly appreciated.
I'm so damn stuck.

Thanks in advance.

Greetings,
Christian

/*
 *  Gstmm wrapper for GstObject
 *  Copyright (C) 2002 Christian Meyer <chrisime gnome org>
 *  Based upon Tim Jansen's Qt/KDE wrapper
 *  Copyright (C) 2002 Tim Jansen <tim tjansen de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#include "object.h"

extern "C" {
#include <gst/gst.h>
}

using namespace Gst;

#define gs () GST_OBJECT(m_real)

/*
Object::Object (void *real) : Glib::Object (real) {
}
*/

Object::~Object() {
}

/* this needs to be fixed!!

Object * Object::wrap (void *real) {
        return (Object *) Wrapper::wrap (real);
}
*/

/* Macros in GstObject */
Flags Object::get_flags () const {
        return GST_FLAGS (gs ());
}

bool Object::flag_is_set (Flags flag) {
        return GST_FLAG_IS_SET (gs (), flag);
}

void Object::set_flag (Flags flag) {
        GST_FLAG_SET (gs (), flag);
}

void Object::unset_flag (Flags flag) {
        GST_FLAG_UNSET (gs (), flag);
}

void Object::lock () {
        GST_LOCK (gs ());
}

bool Object::try_lock () {
        return GST_TRYLOCK (gs ());
}

void Object::unlock () {
        GST_UNLOCK (gs ());
}

bool Object::is_floating () const {
        return GST_OBJECT_FLOATING (gs ());
}

bool Object::is_destroyed () const {
        return GST_OBJECT_DESTROYED (gs ());
}

/* Functions in GstObject */
bool check_uniqueness (GList *list,
                       const Glib::ustring &name) {
        /* FIXME */
        return true;
}

void Object::set_parent (Object *parent) {
        gst_object_set_parent (gs (), GST_OBJECT (parent));
}

/*
Object * Object::get_parent () const {
        return wrap (gst_object_get_parent (gs ()));
}
*/

void Object::set_name (const Glib::ustring &name) {
        gst_object_set_name (gs (), locale_from_utf8 (name).c_str ());
}

Glib::ustring Object::get_name () const {
        return Glib::ustring (gst_object_get_name (gs ()));
}

void Object::unparent() {
        gst_object_unparent (gs ());
}

void Object::ref () {
        gst_object_ref (gs ());
}

void Object::unref () {
        gst_object_unref (gs ());
}

void Object::sink () {
        gst_object_sink (gs ());
}

void Object::destroy () {
        gst_object_destroy (gs ());
}

// xmlNodePtr save_thyself (Object *object, xmlNodePtr parent) { }

void restore_thyself (Object *object, xmlNodePtr parent) {
        /* FIXME */
        return;
}

Glib::ustring Object::get_path_string () const {
        return Glib::ustring (gst_object_get_path_string (gs ()));
}

void class_signal_emit_by_name (Object *object,
                                const Glib::ustring &name,
                                xmlNodePtr self) {
        /* FIXME */
        return;
}

guint class_signal_connect (ObjectClass *klass,
                            const Glib::ustring &name,
                            gpointer func, gpointer func_data) {
        /* FIXME */
        return (0);
}

/*
 *  Gstmm wrapper for GstObject
 *  Copyright (C) 2002 Christian Meyer <chrisime gnome org>
 *  Based upon Tim Jansen's work
 *  Copyright (C) 2002 Tim Jansen <tim tjansen de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef GST_OBJECT_H
#define GST_OBJECT_H

#include <glibmm.h>

_DEFS(gstmm,gst)

namespace Gst {

        class Object : public Glib::Object {

        friend class GStreamer;

        public:
                enum Flags {
                        FLAG_DESTROYED = 0,
                        FLAG_FLOATING,
                        FLAG_LAST      = 4
                };

        _CTOR_DEFAULT
        // Object (void *real);
        virtual ~Object ();
        /* uhoh! Fixme, Tim's code isn't usable here! */
        // static Object * wrap (void *real);

        /* Macros in GstObject */
        Flags get_flags () const;

        bool flag_is_set (Flags flag);

        void set_flag (Flags flag);

        void unset_flag (Flags flag);

        void lock ();

        bool try_lock ();

        void unlock ();

//        Glib::Mutex::Mutex get_lock () const; // FIXME

        bool is_floating () const;

        bool is_destroyed () const;

        /* Functions in GstObject */
        _WRAP_METHOD(bool check_uniqueness (GList *list,
                                            const Glib::ustring&name),
                                            gst_object_check_uniqueness)

        _WRAP_METHOD(void set_parent (Object *parent), gst_object_set_partent)

        _WRAP_METHOD(Object * get_parent () const, gst_object_get_parent)

        _WRAP_METHOD(void set_name (const Glib::ustring &name),
                                    gst_object_set_name)

        _WRAP_METHOD(Glib::ustring get_name () const, gst_object_get_name)

        _WRAP_METHOD(void unparent (), gst_object_unparent)

        _WRAP_METHOD(void ref (), gst_object_ref)

        _WRAP_METHOD(void unref (), gst_object_unref)

        _WRAP_METHOD(void sink (), gst_object_sink)

        _WRAP_METHOD(void destroy (), gst_object_destroy)

//        xmlNodePtr save_thyself (Object *object, xmlNodePtr parent);

        _WRAP_METHOD(void restore_thyself (Object *object, xmlNodePtr parent),
                                           gst_object_restore_thyself)

        _WRAP_METHOD(Glib::ustring get_path_string () const,
                     gst_object_get_path_string)

        _WRAP_METHOD(void class_signal_emit_by_name (Object *object,
                                                     const Glib::ustring &name,
                                                     xmlNodePtr self),
                     gst_object_class_signal_emit_by_name)

        _WRAP_METHOD(guint class_signal_connect (ObjectClass *klass,
                                                 const Glib::ustring &name,
                                                 gpointer func,
                                                 gpointer func_data),
                     gst_object_class_signal_connect)

        };
}

#endif /* GST_OBJECT_H */


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