1 /* GST123 - GStreamer based command line media player 2 * Copyright (C) 2010 Siddhesh Poyarekar 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General 15 * Public License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 17 * Boston, MA 02111-1307, USA. 18 */ 19 20 #ifndef __URI_H__ 21 #define __URI_H__ 22 23 #include <glib.h> 24 #include <string> 25 #include <stdlib.h> 26 #include "iostream.h" 27 28 namespace Gst123 29 { 30 31 enum 32 { 33 URI_ERROR_UNKNOWN = -1, 34 URI_ERROR_INVALID_HOST = -2, 35 URI_ERROR_INVALID_HTTP = -3, 36 URI_ERROR_INVALID_URI = -4, 37 URI_ERROR_INVALID_PATH = -5 38 }; 39 40 class URI 41 { 42 std::string host; 43 int port; 44 std::string path; 45 std::string protocol; 46 int status; 47 48 IOStream *stream; 49 50 bool empty_path_allowed(); 51 52 public: 53 URI (const std::string& input); 54 ~URI(); 55 56 IOStream *get_io_stream(); 57 58 std::string strerror (int error); 59 std::string read_strerror (int error); 60 61 int open(); 62 }; 63 64 } 65 66 #endif 67