1 /* 2 * This library is licensed under 2 different licenses and you 3 * can choose to use it under the terms of either one of them. The 4 * two licenses are the MPL 1.1 and the LGPL. 5 * 6 * MPL: 7 * 8 * The contents of this file are subject to the Mozilla Public License 9 * Version 1.1 (the "License"); you may not use this file except in 10 * compliance with the License. You may obtain a copy of the License at 11 * http://www.mozilla.org/MPL/. 12 * 13 * Software distributed under the License is distributed on an "AS IS" 14 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 15 * License for the specific language governing rights and limitations 16 * under the License. 17 * 18 * LGPL: 19 * 20 * This library is free software; you can redistribute it and/or 21 * modify it under the terms of the GNU Library General Public 22 * License as published by the Free Software Foundation; either 23 * version 2 of the License, or (at your option) any later version. 24 * 25 * This library is distributed in the hope that it will be useful, 26 * but WITHOUT ANY WARRANTY; without even the implied warranty of 27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 * Library General Public License for more details. 29 * 30 * You should have received a copy of the GNU Library General Public 31 * License along with this library; if not, write to the 32 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 33 * Boston, MA 02110-1301, USA. 34 * 35 * The Original Code is Fluendo MPEG Demuxer plugin. 36 * 37 * The Initial Developer of the Original Code is Fluendo, S.L. 38 * Portions created by Fluendo, S.L. are Copyright (C) 2005 39 * Fluendo, S.L. All Rights Reserved. 40 * 41 * Contributor(s): Wim Taymans <wim@fluendo.com> 42 */ 43 44 #ifndef __GST_PES_FILTER_H__ 45 #define __GST_PES_FILTER_H__ 46 47 #include <gst/gst.h> 48 #include <gst/base/gstadapter.h> 49 50 G_BEGIN_DECLS 51 52 typedef struct _GstPESFilter GstPESFilter; 53 54 typedef GstFlowReturn (*GstPESFilterData) (GstPESFilter * filter, gboolean first, GstBuffer * buffer, 55 gpointer user_data); 56 typedef void (*GstPESFilterResync) (GstPESFilter * filter, gpointer user_data); 57 typedef void (*GstPESFilterIndex) (GstPESFilter * filter, gpointer user_data); 58 59 typedef enum { 60 STATE_HEADER_PARSE, 61 STATE_DATA_PUSH, 62 STATE_DATA_SKIP 63 } GstPESFilterState; 64 65 struct _GstPESFilter { 66 GstAdapter * adapter; 67 guint64 * adapter_offset; 68 69 GstPESFilterState state; 70 /* Whether to collect entire PES packets before 71 * outputting */ 72 gboolean gather_pes; 73 /* Whether unbounded packets are allowed in this 74 * stream */ 75 gboolean allow_unbounded; 76 77 gboolean first; 78 GstPESFilterData data_cb; 79 GstPESFilterResync resync_cb; 80 gpointer user_data; 81 82 guint32 start_code; 83 guint8 id; 84 gboolean unbounded_packet; 85 guint16 length; 86 87 gint64 pts; 88 gint64 dts; 89 }; 90 91 void gst_pes_filter_init (GstPESFilter * filter, GstAdapter * adapter, guint64 * adapter_offset); 92 93 void gst_pes_filter_uninit (GstPESFilter * filter); 94 95 void gst_pes_filter_set_callbacks (GstPESFilter * filter, 96 GstPESFilterData data_cb, 97 GstPESFilterResync resync_cb, 98 gpointer user_data); 99 100 GstFlowReturn gst_pes_filter_push (GstPESFilter * filter, GstBuffer * buffer); 101 GstFlowReturn gst_pes_filter_process (GstPESFilter * filter); 102 103 void gst_pes_filter_flush (GstPESFilter * filter); 104 GstFlowReturn gst_pes_filter_drain (GstPESFilter * filter); 105 106 G_END_DECLS 107 108 #endif /* __GST_PES_FILTER_H__ */ 109