コード例 #1
0
ファイル: rbgst-query.c プロジェクト: Mazwak/ruby-gnome2
void
Init_gst_query (VALUE mGst)
{
    RGConvertTable table;

    memset(&table, 0, sizeof(table));
    table.type = GST_TYPE_QUERY;
    table.klass = Qnil;
    table.get_superclass = get_superclass;
    table.instance2robj = instance2robj;
    RG_DEF_CONVERSION(&table);

    rb_cGstQuery = G_DEF_CLASS (GST_TYPE_QUERY, "Query", mGst);

#define DEFINE_QUERY(type, lctype, arguments) \
    rb_cGstQuery ## type =                                          \
        rb_define_class_under(mGst, "Query" #type, rb_cGstQuery); \
    rbg_define_method(rb_cGstQuery ## type, "initialize",            \
      lctype ## _initialize, arguments);                            \
    rbg_define_method(rb_cGstQuery ## type, "parse",                 \
      lctype ## _parse, 0)                                          \

    DEFINE_QUERY(Position, position, 1);
    DEFINE_QUERY(Duration, duration, 1);
    DEFINE_QUERY(Latency, latency, 0);
    DEFINE_QUERY(Seeking, seeking, 1);
    DEFINE_QUERY(Segment, segment, 1);
    DEFINE_QUERY(Convert, convert, 2);
    DEFINE_QUERY(Formats, formats, 0);
#undef DEFINE_QUERY
}
コード例 #2
0
ファイル: rbgst-object.c プロジェクト: benolee/ruby-gnome2
void
Init_gst_object(void)
{
    VALUE cGstObject;

    table.type = GST_TYPE_OBJECT;
    table.instance2robj = rbgst_object_instance2robj;
    table.initialize = rbgst_object_initialize;

    RG_DEF_CONVERSION(&table);

    cGstObject = G_DEF_CLASS(GST_TYPE_OBJECT, "Object", mGst);

    rb_define_method(cGstObject, "set_name", object_set_name, 1);

    G_DEF_SETTERS(cGstObject);

    G_DEF_CLASS(GST_TYPE_OBJECT_FLAGS, "Flags", cGstObject);
    G_DEF_CONSTANTS(cGstObject, GST_TYPE_OBJECT_FLAGS, "GST_");
}
コード例 #3
0
ファイル: rbgst-event.c プロジェクト: Mazwak/ruby-gnome2
void
Init_gst_event (VALUE mGst)
{
    RGConvertTable table;

    memset(&table, 0, sizeof(RGConvertTable));
    table.type = GST_TYPE_EVENT;
    table.get_superclass = get_superclass;
    table.instance2robj = instance2robj;
    RG_DEF_CONVERSION(&table);

    rb_cGstEvent = G_DEF_CLASS(GST_TYPE_EVENT, "Event", mGst);
    rbg_define_method(rb_cGstEvent, "get_type", rbgst_event_get_type, 0);
    G_DEF_CLASS(GST_TYPE_EVENT_TYPE, "EventType", mGst);
    G_DEF_CONSTANTS(rb_cGstEvent, GST_TYPE_EVENT_TYPE, "GST_EVENT_");

#define DEFINE_EVENT(type, lctype, arguments) \
    rb_cGstEvent ## type =                                          \
        rb_define_class_under(mGst, "Event" #type, rb_cGstEvent);   \
    rbg_define_method(rb_cGstEvent ## type, "initialize",            \
                     lctype ## _initialize, arguments)

#define DEFINE_EVENT_PARSE(type, lctype, arguments)                 \
    DEFINE_EVENT(type, lctype, arguments);                          \
    rbg_define_method(rb_cGstEvent ## type, "parse",                 \
                     lctype ## _parse, 0)

    DEFINE_EVENT(FlushStart, flush_start, 0);
    DEFINE_EVENT(FlushStop,  flush_stop, 0);
    DEFINE_EVENT(EOS, eos, 0);
    DEFINE_EVENT_PARSE(NewSegment, newsegment, 7);
    DEFINE_EVENT_PARSE(Tag, tag, 1);
    DEFINE_EVENT_PARSE(BufferSize, buffersize, 4);
    DEFINE_EVENT_PARSE(QOS, qos, 3);
    DEFINE_EVENT_PARSE(Seek, seek, 7);
    DEFINE_EVENT(Navigation, navigation, 1);
    DEFINE_EVENT_PARSE(Latency, latency, 1);

#undef DEFINE_EVENT_PARSE
#undef DEFINE_EVENT
}
コード例 #4
0
ファイル: rbgst-message.c プロジェクト: msakai/ruby-gnome2
void
Init_gst_message(void)
{
    VALUE rb_cGstMessageType;

    table.type = GST_TYPE_MESSAGE;
    table.get_superclass = get_superclass;
    table.instance2robj = instance2robj;
    RG_DEF_CONVERSION(&table);

    rb_cGstMessage = G_DEF_CLASS(GST_TYPE_MESSAGE, "Message", mGst);

#define DEFINE_MESSAGE(type)                                            \
    rb_cGstMessage ## type =                                            \
        rb_define_class_under(mGst, "Message" #type, rb_cGstMessage)

    DEFINE_MESSAGE(Unknown);
    DEFINE_MESSAGE(Eos);
    DEFINE_MESSAGE(Error);
    DEFINE_MESSAGE(Warning);
    DEFINE_MESSAGE(Info);
    DEFINE_MESSAGE(Tag);
    DEFINE_MESSAGE(Buffering);
    DEFINE_MESSAGE(StateChanged);
    DEFINE_MESSAGE(StateDirty);
    DEFINE_MESSAGE(StepDone);
    DEFINE_MESSAGE(ClockProvide);
    DEFINE_MESSAGE(ClockLost);
    DEFINE_MESSAGE(NewClock);
    DEFINE_MESSAGE(StructureChange);
    DEFINE_MESSAGE(StreamStatus);
    DEFINE_MESSAGE(Application);
    DEFINE_MESSAGE(Element);
    DEFINE_MESSAGE(SegmentStart);
    DEFINE_MESSAGE(SegmentDone);
    DEFINE_MESSAGE(Duration);
    DEFINE_MESSAGE(Latency);
    DEFINE_MESSAGE(AsyncStart);
    DEFINE_MESSAGE(AsyncDone);
    DEFINE_MESSAGE(Any);

#undef DEFINE_MESSAGE

    rb_cGstMessageType = G_DEF_CLASS(GST_TYPE_MESSAGE_TYPE,
                                     "Type", rb_cGstMessage);
    G_DEF_CONSTANTS(rb_cGstMessage, GST_TYPE_MESSAGE_TYPE, "GST_MESSAGE_");

    rb_define_method(rb_cGstMessage, "initialize", initialize, 3);

    rb_define_method(rb_cGstMessage, "type", get_type, 0);
    rb_define_method(rb_cGstMessage, "set_type", set_type, 1);

    rb_define_method(rb_cGstMessage, "have_mutex?", have_mutex_p, 0);
    rb_define_method(rb_cGstMessage, "lock", lock, 0);
    rb_define_method(rb_cGstMessage, "unlock", unlock, 0);
    rb_define_method(rb_cGstMessage, "have_cond?", have_cond_p, 0);
    rb_define_method(rb_cGstMessage, "wait", cond_wait, 0);
    rb_define_method(rb_cGstMessage, "signal", cond_signal, 0);

    rb_define_method(rb_cGstMessage, "timestamp", get_timestamp, 0);
    rb_define_method(rb_cGstMessage, "set_timestamp", set_timestamp, 1);
    rb_define_method(rb_cGstMessage, "valid_timestamp?", valid_timestamp_p, 0);

    rb_define_method(rb_cGstMessage, "source", get_source, 0);
    rb_define_method(rb_cGstMessage, "set_source", set_source, 1);
    rb_define_alias(rb_cGstMessage, "src", "source");
    rb_define_alias(rb_cGstMessage, "set_src", "set_source");

    rb_define_method(rb_cGstMessage, "structure", get_structure, 0);


    rb_define_method(rb_cGstMessageEos, "initialize", eos_initialize, 1);

#if 0
    rb_define_method(rb_cGstMessageError, "initialize", error_initialize, 3);
#endif
    rb_define_method(rb_cGstMessageError, "parse", error_parse, 0);

#if 0
    rb_define_method(rb_cGstMessageWarning, "initialize", warning_initialize, 3);
#endif
    rb_define_method(rb_cGstMessageWarning, "parse", warning_parse, 0);

#if 0
    rb_define_method(rb_cGstMessageInfo, "initialize", info_initialize, 3);
#endif
    rb_define_method(rb_cGstMessageInfo, "parse", info_parse, 0);

#if 0
    rb_define_method(rb_cGstMessageTag, "initialize", tag_initialize, 2);
#endif
    rb_define_method(rb_cGstMessageTag, "parse", tag_parse, 0);

    rb_define_method(rb_cGstMessageBuffering, "initialize",
                     buffering_initialize, 2);
    rb_define_method(rb_cGstMessageBuffering, "parse", buffering_parse, 0);

    rb_define_method(rb_cGstMessageStateChanged, "initialize",
                     state_changed_initialize, 4);
    rb_define_method(rb_cGstMessageStateChanged, "parse",
                     state_changed_parse, 0);

    rb_define_method(rb_cGstMessageStateDirty, "initialize",
                     state_dirty_initialize, 1);

    rb_define_method(rb_cGstMessageClockProvide, "initialize",
                     clock_provide_initialize, 3);
    rb_define_method(rb_cGstMessageClockProvide, "parse",
                     clock_provide_parse, 0);

    rb_define_method(rb_cGstMessageClockLost, "initialize",
                     clock_lost_initialize, 2);
    rb_define_method(rb_cGstMessageClockLost, "parse", clock_lost_parse, 0);

    rb_define_method(rb_cGstMessageNewClock, "initialize",
                     new_clock_initialize, 2);
    rb_define_method(rb_cGstMessageNewClock, "parse", new_clock_parse, 0);

    rb_define_method(rb_cGstMessageApplication, "initialize",
                     application_initialize, 2);

    rb_define_method(rb_cGstMessageElement, "initialize",
                     element_initialize, 2);
#ifdef HAVE_GST_PBUTILS
    rb_cGstMissingMessage =
        rb_define_class_under(mGst, "MissingMessage", rb_cGstMessageElement);
    rb_define_method(rb_cGstMissingMessage, "installer_detail",
                     missing_message_get_installer_detail, 0);
    rb_define_method(rb_cGstMissingMessage, "description",
                     missing_message_get_description, 0);

    rb_cGstMissingURISourceMessage =
        rb_define_class_under(mGst, "MissingURISourceMessage",
                              rb_cGstMissingMessage);
    rb_define_method(rb_cGstMissingURISourceMessage, "initialize",
                     missing_uri_source_message_initialize, 2);
#endif

    rb_define_method(rb_cGstMessageSegmentStart, "initialize",
                     segment_start_initialize, 3);
    rb_define_method(rb_cGstMessageSegmentStart, "parse",
                     segment_start_parse, 0);

    rb_define_method(rb_cGstMessageSegmentDone, "initialize",
                     segment_done_initialize, 3);
    rb_define_method(rb_cGstMessageSegmentDone, "parse", segment_done_parse, 0);

    rb_define_method(rb_cGstMessageDuration, "initialize",
                     duration_initialize, 3);
    rb_define_method(rb_cGstMessageDuration, "parse", duration_parse, 0);

    rb_define_method(rb_cGstMessageAsyncStart, "initialize",
                     async_start_initialize, 2);
    rb_define_method(rb_cGstMessageAsyncStart, "parse", async_start_parse, 0);

    rb_define_method(rb_cGstMessageAsyncDone, "initialize",
                     async_done_initialize, 1);

    rb_define_method(rb_cGstMessageLatency, "initialize", latency_initialize, 1);


    rb_define_method(rb_cGstMessageType, "name", type_name, 0);


    G_DEF_SETTERS(rb_cGstMessage);
}
コード例 #5
0
ファイル: rbgst-value.c プロジェクト: benolee/ruby-gnome2
void
Init_gst_value(void)
{
    value_list_table.type = GST_TYPE_LIST;
    value_list_table.rvalue2gvalue = value_list_rvalue2gvalue;
    value_list_table.gvalue2rvalue = value_list_gvalue2rvalue;

    RG_DEF_CONVERSION(&value_list_table);


    value_array_table.type = GST_TYPE_ARRAY;
    value_array_table.rvalue2gvalue = value_array_rvalue2gvalue;
    value_array_table.gvalue2rvalue = value_array_gvalue2rvalue;

    RG_DEF_CONVERSION(&value_array_table);


    int_range_table.type = GST_TYPE_INT_RANGE;
    int_range_table.get_superclass = int_range_get_superclass;
    int_range_table.type_init_hook = NULL;
    int_range_table.rvalue2gvalue = int_range_rvalue2gvalue;
    int_range_table.gvalue2rvalue = g_value_to_ruby_value;
    int_range_table.initialize = NULL;
    int_range_table.robj2instance = int_range_robj2instance;
    int_range_table.instance2robj = g_value_type_instance_to_ruby_object;
    int_range_table.unref = g_value_type_unref;

    RG_DEF_CONVERSION(&int_range_table);

    cIntRange = G_DEF_CLASS(GST_TYPE_INT_RANGE, "IntRange", mGst);

    rb_define_alloc_func(cIntRange, int_range_allocate);

    rb_define_method(cIntRange, "initialize", int_range_initialize, 2);

    rb_define_method(cIntRange, "min", int_range_get_min, 0);
    rb_define_method(cIntRange, "set_min", int_range_set_min, 1);
    rb_define_method(cIntRange, "max", int_range_get_max, 0);
    rb_define_method(cIntRange, "set_max", int_range_set_max, 1);

    rb_define_method(cIntRange, "set", int_range_set, 2);

    rb_define_method(cIntRange, "to_a", int_range_to_a, 0);
    rb_define_method(cIntRange, "to_s", g_value_to_s, 0);

    G_DEF_SETTERS(cIntRange);


    fourcc_table.type = GST_TYPE_FOURCC;
    fourcc_table.get_superclass = fourcc_get_superclass;
    fourcc_table.type_init_hook = NULL;
    fourcc_table.rvalue2gvalue = fourcc_rvalue2gvalue;
    fourcc_table.gvalue2rvalue = g_value_to_ruby_value;
    fourcc_table.initialize = NULL;
    fourcc_table.robj2instance = fourcc_robj2instance;
    fourcc_table.instance2robj = g_value_type_instance_to_ruby_object;
    fourcc_table.unref = g_value_type_unref;

    RG_DEF_CONVERSION(&fourcc_table);

    cFourcc = G_DEF_CLASS(GST_TYPE_FOURCC, "Fourcc", mGst);

    rb_define_alloc_func(cFourcc, fourcc_allocate);

    rb_define_method(cFourcc, "initialize", fourcc_initialize, 1);

    rb_define_method(cFourcc, "replace!", fourcc_replace_bang, 1);

    rb_define_method(cFourcc, "to_i", fourcc_to_i, 0);
    rb_define_method(cFourcc, "to_s", g_value_to_s, 0);

    G_DEF_SETTERS(cFourcc);


    fraction_table.type = GST_TYPE_FRACTION;
    fraction_table.klass = rb_const_get(rb_cObject, rb_intern("Rational"));
    fraction_table.rvalue2gvalue = fraction_rvalue2gvalue;
    fraction_table.gvalue2rvalue = fraction_gvalue2rvalue;

    RG_DEF_CONVERSION(&fraction_table);


    fraction_range_table.type = GST_TYPE_FRACTION_RANGE;
    fraction_range_table.get_superclass = fraction_range_get_superclass;
    fraction_range_table.type_init_hook = NULL;
    fraction_range_table.rvalue2gvalue = fraction_range_rvalue2gvalue;
    fraction_range_table.gvalue2rvalue = g_value_to_ruby_value;
    fraction_range_table.initialize = NULL;
    fraction_range_table.robj2instance = fraction_range_robj2instance;
    fraction_range_table.instance2robj = g_value_type_instance_to_ruby_object;
    fraction_range_table.unref = g_value_type_unref;

    RG_DEF_CONVERSION(&fraction_range_table);

    cFractionRange = G_DEF_CLASS(GST_TYPE_FRACTION_RANGE, "FractionRange", mGst);

    rb_define_alloc_func(cFractionRange, fraction_range_allocate);

    rb_define_method(cFractionRange, "initialize", fraction_range_initialize, 2);

    rb_define_method(cFractionRange, "min", fraction_range_get_min, 0);
    rb_define_method(cFractionRange, "set_min", fraction_range_set_min, 1);
    rb_define_method(cFractionRange, "max", fraction_range_get_max, 0);
    rb_define_method(cFractionRange, "set_max", fraction_range_set_max, 1);

    rb_define_method(cFractionRange, "set", fraction_range_set, 2);

    rb_define_method(cFractionRange, "to_a", fraction_range_to_a, 0);
    rb_define_method(cFractionRange, "to_s", g_value_to_s, 0);

    G_DEF_SETTERS(cFractionRange);
}