1 /* -*- c-basic-offset: 2 -*- 2 * GStreamer 3 * Copyright (C) <2008> Vincent Penquerc'h <ogg.k.ogg.k at googlemail dot com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 22 #ifndef __GST_KATE_UTIL_H__ 23 #define __GST_KATE_UTIL_H__ 24 25 #include <kate/kate.h> 26 #include <gst/gst.h> 27 28 G_BEGIN_DECLS 29 30 typedef enum { 31 GST_KATE_FORMAT_UNDEFINED, 32 GST_KATE_FORMAT_SPU, 33 GST_KATE_FORMAT_TEXT_UTF8, 34 GST_KATE_FORMAT_TEXT_PANGO_MARKUP 35 } GstKateFormat; 36 37 enum 38 { 39 ARG_DEC_BASE_0, 40 ARG_DEC_BASE_LANGUAGE, 41 ARG_DEC_BASE_CATEGORY, 42 ARG_DEC_BASE_ORIGINAL_CANVAS_WIDTH, 43 ARG_DEC_BASE_ORIGINAL_CANVAS_HEIGHT, 44 DECODER_BASE_ARG_COUNT 45 }; 46 47 typedef struct 48 { 49 GstEvent * event; 50 gboolean (*handler)(GstPad *, GstObject*, GstEvent *); 51 GstObject * parent; 52 GstPad *pad; 53 } GstKateDecoderBaseQueuedEvent; 54 55 typedef struct 56 { 57 GstElement element; 58 59 kate_state k; 60 61 gboolean initialized; 62 63 GstTagList *tags; 64 gboolean tags_changed; 65 66 gchar *language; 67 gchar *category; 68 69 gint original_canvas_width; 70 gint original_canvas_height; 71 72 GstSegment kate_segment; 73 gboolean kate_flushing; 74 75 gboolean delay_events; 76 GQueue *event_queue; 77 } GstKateDecoderBase; 78 79 extern GstCaps *gst_kate_util_set_header_on_caps (GstElement * element, 80 GstCaps * caps, GList * headers); 81 extern void gst_kate_util_decode_base_init (GstKateDecoderBase * decoder, 82 gboolean delay_events); 83 extern void gst_kate_util_install_decoder_base_properties (GObjectClass * 84 gobject_class); 85 extern gboolean gst_kate_util_decoder_base_get_property (GstKateDecoderBase * 86 decoder, GObject * object, guint prop_id, GValue * value, 87 GParamSpec * pspec); 88 extern GstFlowReturn 89 gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder, 90 GstElement * element, GstPad * pad, GstBuffer * buffer, GstPad * srcpad, 91 GstPad * tagpad, GstCaps **src_caps, const kate_event ** ev); 92 extern void 93 gst_kate_util_decoder_base_set_flushing (GstKateDecoderBase * decoder, 94 gboolean flushing); 95 extern void 96 gst_kate_util_decoder_base_segment_event (GstKateDecoderBase * decoder, 97 GstEvent * event); 98 extern gboolean 99 gst_kate_util_decoder_base_update_segment (GstKateDecoderBase * decoder, 100 GstElement * element, GstBuffer * buf); 101 extern GstStateChangeReturn 102 gst_kate_decoder_base_change_state (GstKateDecoderBase * decoder, 103 GstElement * element, GstElementClass * parent_class, 104 GstStateChange transition); 105 extern gboolean gst_kate_decoder_base_convert (GstKateDecoderBase * decoder, 106 GstElement * element, GstPad * pad, GstFormat src_fmt, gint64 src_val, 107 GstFormat * dest_fmt, gint64 * dest_val); 108 extern gboolean gst_kate_decoder_base_sink_query (GstKateDecoderBase * decoder, 109 GstElement * element, GstPad * pad, GstObject * parent, GstQuery * query); 110 extern gboolean 111 gst_kate_util_decoder_base_queue_event (GstKateDecoderBase * decoder, 112 GstEvent * event, gboolean (*handler)(GstPad *, GstObject *, GstEvent *), 113 GstObject * parent, GstPad * pad); 114 extern void 115 gst_kate_util_decoder_base_add_tags (GstKateDecoderBase * decoder, 116 GstTagList * tags, gboolean take_ownership_of_tags); 117 extern GstEvent * 118 gst_kate_util_decoder_base_get_tag_event (GstKateDecoderBase * decoder); 119 extern const char * 120 gst_kate_util_get_error_message (int ret); 121 122 G_END_DECLS 123 #endif /* __GST_KATE_UTIL_H__ */ 124