1 /* GStreamer PNM utility functions 2 * Copyright (C) 2009 Lutz Mueller <lutz@users.sourceforge.net> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef __GST_PNM_UTILS_H__ 21 #define __GST_PNM_UTILS_H__ 22 23 #include <glib.h> 24 #include <glib-object.h> 25 26 #define MIME_BM "image/x-portable-bitmap" 27 #define MIME_GM "image/x-portable-graymap" 28 #define MIME_PM "image/x-portable-pixmap" 29 #define MIME_AM "image/x-portable-anymap" 30 #define MIME_ALL MIME_BM "; " MIME_GM "; " MIME_PM "; " MIME_AM 31 32 typedef enum 33 { 34 GST_PNM_INFO_FIELDS_TYPE = 1 << 0, 35 GST_PNM_INFO_FIELDS_WIDTH = 1 << 1, 36 GST_PNM_INFO_FIELDS_HEIGHT = 1 << 2, 37 GST_PNM_INFO_FIELDS_MAX = 1 << 3, 38 GST_PNM_INFO_FIELDS_ENCODING = 1 << 4 39 } GstPnmInfoFields; 40 41 #define GST_PNM_INFO_FIELDS_ALL (GST_PNM_INFO_FIELDS_TYPE | GST_PNM_INFO_FIELDS_WIDTH | GST_PNM_INFO_FIELDS_HEIGHT | GST_PNM_INFO_FIELDS_MAX | GST_PNM_INFO_FIELDS_ENCODING) 42 43 typedef enum 44 { 45 GST_PNM_TYPE_BITMAP = 1, 46 GST_PNM_TYPE_GRAYMAP = 2, 47 GST_PNM_TYPE_PIXMAP = 3 48 } GstPnmType; 49 50 typedef enum 51 { 52 GST_PNM_ENCODING_RAW = 0, 53 GST_PNM_ENCODING_ASCII = 1 54 } GstPnmEncoding; 55 56 typedef struct 57 { 58 GstPnmInfoFields fields; 59 GstPnmType type; 60 GstPnmEncoding encoding; 61 guint width, height, max; 62 } GstPnmInfo; 63 64 typedef enum 65 { 66 GST_PNM_INFO_MNGR_STATE_NONE = 0, 67 GST_PNM_INFO_MNGR_STATE_DATA_TYPE, 68 GST_PNM_INFO_MNGR_STATE_DATA_WIDTH, 69 GST_PNM_INFO_MNGR_STATE_DATA_HEIGHT, 70 GST_PNM_INFO_MNGR_STATE_DATA_MAX, 71 GST_PNM_INFO_MNGR_STATE_COMMENT, 72 GST_PNM_INFO_MNGR_STATE_WHITE_SPACE 73 } GstPnmInfoMngrState; 74 75 typedef struct 76 { 77 GstPnmInfoMngrState state; 78 GstPnmInfo info; 79 guint8 data_offset; 80 } GstPnmInfoMngr; 81 82 typedef enum 83 { 84 GST_PNM_INFO_MNGR_RESULT_FAILED, 85 GST_PNM_INFO_MNGR_RESULT_READING, 86 GST_PNM_INFO_MNGR_RESULT_FINISHED 87 } GstPnmInfoMngrResult; 88 89 GstPnmInfoMngrResult gst_pnm_info_mngr_scan (GstPnmInfoMngr *, const guint8 *, guint); 90 91 #endif /* __GST_PNM_UTILS_H__ */ 92