gst_cbs.h 6.57 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
/*
 * Copyright 2015 Andrew Eikum for CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#ifndef GST_CBS_H
#define GST_CBS_H

#include "wine/list.h"
#include "windef.h"
#include <pthread.h>

typedef enum {
  GST_AUTOPLUG_SELECT_TRY,
  GST_AUTOPLUG_SELECT_EXPOSE,
  GST_AUTOPLUG_SELECT_SKIP
} GstAutoplugSelectResult;

enum CB_TYPE {
    WATCH_BUS,
    EXISTING_NEW_PAD,
    QUERY_FUNCTION,
36
    ACTIVATE_MODE,
37 38 39 40 41 42 43 44 45 46 47 48
    NO_MORE_PADS,
    REQUEST_BUFFER_SRC,
    EVENT_SRC,
    EVENT_SINK,
    ACCEPT_CAPS_SINK,
    SETCAPS_SINK,
    GOT_DATA_SINK,
    GOT_DATA,
    REMOVED_DECODED_PAD,
    AUTOPLUG_BLACKLIST,
    UNKNOWN_TYPE,
    RELEASE_SAMPLE,
49 50
    TRANSFORM_PAD_ADDED,
    QUERY_SINK
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
};

struct cb_data {
    enum CB_TYPE type;
    union {
        struct watch_bus_data {
            GstBus *bus;
            GstMessage *msg;
            gpointer user;
            GstBusSyncReply ret;
        } watch_bus_data;
        struct existing_new_pad_data {
            GstElement *bin;
            GstPad *pad;
            gpointer user;
        } existing_new_pad_data;
        struct query_function_data {
            GstPad *pad;
69
            GstObject *parent;
70 71 72
            GstQuery *query;
            gboolean ret;
        } query_function_data;
73
        struct activate_mode_data {
74
            GstPad *pad;
75 76
            GstObject *parent;
            GstPadMode mode;
77 78
            gboolean activate;
            gboolean ret;
79
        } activate_mode_data;
80 81 82 83 84 85
        struct no_more_pads_data {
            GstElement *decodebin;
            gpointer user;
        } no_more_pads_data;
        struct request_buffer_src_data {
            GstPad *pad;
86
            GstObject *parent;
87 88 89 90 91 92 93
            guint64 ofs;
            guint len;
            GstBuffer **buf;
            GstFlowReturn ret;
        } request_buffer_src_data;
        struct event_src_data {
            GstPad *pad;
94
            GstObject *parent;
95 96 97 98 99
            GstEvent *event;
            gboolean ret;
        } event_src_data;
        struct event_sink_data {
            GstPad *pad;
100
            GstObject *parent;
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
            GstEvent *event;
            gboolean ret;
        } event_sink_data;
        struct accept_caps_sink_data {
            GstPad *pad;
            GstCaps *caps;
            gboolean ret;
        } accept_caps_sink_data;
        struct setcaps_sink_data {
            GstPad *pad;
            GstCaps *caps;
            gboolean ret;
        } setcaps_sink_data;
        struct got_data_sink_data {
            GstPad *pad;
116
            GstObject *parent;
117 118 119 120 121
            GstBuffer *buf;
            GstFlowReturn ret;
        } got_data_sink_data;
        struct got_data_data {
            GstPad *pad;
122
            GstObject *parent;
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
            GstBuffer *buf;
            GstFlowReturn ret;
        } got_data_data;
        struct removed_decoded_pad_data {
            GstElement *bin;
            GstPad *pad;
            gpointer user;
        } removed_decoded_pad_data;
        struct autoplug_blacklist_data {
            GstElement *bin;
            GstPad *pad;
            GstCaps *caps;
            GstElementFactory *fact;
            gpointer user;
            GstAutoplugSelectResult ret;
        } autoplug_blacklist_data;
        struct unknown_type_data {
            GstElement *bin;
            GstPad *pad;
            GstCaps *caps;
            gpointer user;
        } unknown_type_data;
        struct release_sample_data {
            gpointer data;
        } release_sample_data;
        struct transform_pad_added_data {
            GstElement *filter;
            GstPad *pad;
            gpointer user;
        } transform_pad_added_data;
153 154 155 156 157 158
        struct query_sink_data {
            GstPad *pad;
            GstObject *parent;
            GstQuery *query;
            gboolean ret;
        } query_sink_data;
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
    } u;

    int finished;
    pthread_mutex_t lock;
    pthread_cond_t cond;
    struct list entry;
};

extern pthread_mutex_t cb_list_lock DECLSPEC_HIDDEN;
extern pthread_cond_t cb_list_cond DECLSPEC_HIDDEN;
extern struct list cb_list DECLSPEC_HIDDEN;
void CALLBACK perform_cb(TP_CALLBACK_INSTANCE *instance, void *user) DECLSPEC_HIDDEN;
BOOL is_wine_thread(void) DECLSPEC_HIDDEN;
void mark_wine_thread(void) DECLSPEC_HIDDEN;

GstBusSyncReply watch_bus_wrapper(GstBus *bus, GstMessage *msg, gpointer user) DECLSPEC_HIDDEN;
175 176 177
void existing_new_pad_wrapper(GstElement *bin, GstPad *pad, gpointer user) DECLSPEC_HIDDEN;
gboolean query_function_wrapper(GstPad *pad, GstObject *parent, GstQuery *query) DECLSPEC_HIDDEN;
gboolean activate_mode_wrapper(GstPad *pad, GstObject *parent, GstPadMode mode, gboolean activate) DECLSPEC_HIDDEN;
178
void no_more_pads_wrapper(GstElement *decodebin, gpointer user) DECLSPEC_HIDDEN;
179 180 181
GstFlowReturn request_buffer_src_wrapper(GstPad *pad, GstObject *parent, guint64 ofs, guint len, GstBuffer **buf) DECLSPEC_HIDDEN;
gboolean event_src_wrapper(GstPad *pad, GstObject *parent, GstEvent *event) DECLSPEC_HIDDEN;
gboolean event_sink_wrapper(GstPad *pad, GstObject *parent, GstEvent *event) DECLSPEC_HIDDEN;
182 183
gboolean accept_caps_sink_wrapper(GstPad *pad, GstCaps *caps) DECLSPEC_HIDDEN;
gboolean setcaps_sink_wrapper(GstPad *pad, GstCaps *caps) DECLSPEC_HIDDEN;
184 185
GstFlowReturn got_data_sink_wrapper(GstPad *pad, GstObject *parent, GstBuffer *buf) DECLSPEC_HIDDEN;
GstFlowReturn got_data_wrapper(GstPad *pad, GstObject *parent, GstBuffer *buf) DECLSPEC_HIDDEN;
186 187 188 189 190
void removed_decoded_pad_wrapper(GstElement *bin, GstPad *pad, gpointer user) DECLSPEC_HIDDEN;
GstAutoplugSelectResult autoplug_blacklist_wrapper(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *fact, gpointer user) DECLSPEC_HIDDEN;
void unknown_type_wrapper(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer user) DECLSPEC_HIDDEN;
void release_sample_wrapper(gpointer data) DECLSPEC_HIDDEN;
void Gstreamer_transform_pad_added_wrapper(GstElement *filter, GstPad *pad, gpointer user) DECLSPEC_HIDDEN;
191
gboolean query_sink_wrapper(GstPad *pad, GstObject *parent, GstQuery *query) DECLSPEC_HIDDEN;
192 193

#endif