annotate libmpdemux/pnm.c @ 9019:555d64fc02b8

fixed query_format (RGB24 supports OSD and is preferred) based on patch by Alvaro Lopes <alvieboy@alvie.com>
author arpi
date Sun, 19 Jan 2003 15:25:03 +0000
parents e44d2ac094e8
children 35e306346e59
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8570
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
1 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
2 * Copyright (C) 2000-2002 the xine project
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
3 *
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
4 * This file is part of xine, a free video player.
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
5 *
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
6 * xine is free software; you can redistribute it and/or modify
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
9 * (at your option) any later version.
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
10 *
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
11 * xine is distributed in the hope that it will be useful,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
14 * GNU General Public License for more details.
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
15 *
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
19 *
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
20 * $Id$
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
21 *
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
22 * pnm protocol implementation
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
23 * based upon code from joschka
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
24 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
25
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
26 #include <unistd.h>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
27 #include <stdio.h>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
28 #include <assert.h>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
29 //#include <sys/socket.h>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
30 //#include <netinet/in.h>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
31 //#include <netdb.h>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
32 #include <string.h>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
33 #include <sys/stat.h>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
34 #include <fcntl.h>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
35 #include <errno.h>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
36 #include <stdlib.h>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
37 #include <sys/time.h>
8584
2d4328af7ea9 prefer inttypes.h (probably fix cygwin compile)
arpi
parents: 8570
diff changeset
38 #include <inttypes.h>
8570
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
39
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
40 #include "pnm.h"
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
41 //#include "libreal/rmff.h"
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
42
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
43 #define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
44 (((long)(unsigned char)(ch3) ) | \
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
45 ( (long)(unsigned char)(ch2) << 8 ) | \
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
46 ( (long)(unsigned char)(ch1) << 16 ) | \
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
47 ( (long)(unsigned char)(ch0) << 24 ) )
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
48
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
49
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
50 #define RMF_TAG FOURCC_TAG('.', 'R', 'M', 'F')
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
51 #define PROP_TAG FOURCC_TAG('P', 'R', 'O', 'P')
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
52 #define MDPR_TAG FOURCC_TAG('M', 'D', 'P', 'R')
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
53 #define CONT_TAG FOURCC_TAG('C', 'O', 'N', 'T')
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
54 #define DATA_TAG FOURCC_TAG('D', 'A', 'T', 'A')
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
55 #define INDX_TAG FOURCC_TAG('I', 'N', 'D', 'X')
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
56 #define PNA_TAG FOURCC_TAG('P', 'N', 'A', 0 )
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
57
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
58 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
59 #define LOG
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
60 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
61
8880
e44d2ac094e8 buffer overflow fix :)
arpi
parents: 8852
diff changeset
62 #define BUF_SIZE 4096
e44d2ac094e8 buffer overflow fix :)
arpi
parents: 8852
diff changeset
63 #define HEADER_SIZE 4096
8570
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
64
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
65 struct pnm_s {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
66
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
67 int s;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
68
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
69 // char *host;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
70 // int port;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
71 char *path;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
72 // char *url;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
73
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
74 char buffer[BUF_SIZE]; /* scratch buffer */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
75
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
76 /* receive buffer */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
77 uint8_t recv[BUF_SIZE];
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
78 int recv_size;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
79 int recv_read;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
80
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
81 uint8_t header[HEADER_SIZE];
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
82 int header_len;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
83 int header_read;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
84 unsigned int seq_num[4]; /* two streams with two indices */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
85 unsigned int seq_current[2]; /* seqs of last stream chunk read */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
86 uint32_t ts_current; /* timestamp of current chunk */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
87 uint32_t ts_last[2]; /* timestamps of last chunks */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
88 unsigned int packet; /* number of last recieved packet */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
89 };
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
90
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
91 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
92 * utility macros
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
93 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
94
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
95 #define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
96 #define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
97 (((uint8_t*)(x))[1] << 16) | \
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
98 (((uint8_t*)(x))[2] << 8) | \
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
99 ((uint8_t*)(x))[3])
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
100
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
101 /* D means direct (no pointer) */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
102 #define BE_16D(x) ((x & 0xff00) >> 8)|((x & 0x00ff) << 8)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
103
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
104 /* sizes */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
105 #define PREAMBLE_SIZE 8
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
106 #define CHECKSUM_SIZE 3
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
107
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
108
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
109 /* header of rm files */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
110 #define RM_HEADER_SIZE 0x12
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
111 const unsigned char rm_header[]={
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
112 0x2e, 0x52, 0x4d, 0x46, /* object_id ".RMF" */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
113 0x00, 0x00, 0x00, 0x12, /* header_size 0x12 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
114 0x00, 0x00, /* object_version 0x00 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
115 0x00, 0x00, 0x00, 0x00, /* file_version 0x00 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
116 0x00, 0x00, 0x00, 0x06 /* num_headers 0x06 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
117 };
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
118
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
119 /* data chunk header */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
120 #define PNM_DATA_HEADER_SIZE 18
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
121 const unsigned char pnm_data_header[]={
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
122 'D','A','T','A',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
123 0,0,0,0, /* data chunk size */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
124 0,0, /* object version */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
125 0,0,0,0, /* num packets */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
126 0,0,0,0}; /* next data header */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
127
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
128 /* pnm request chunk ids */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
129
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
130 #define PNA_CLIENT_CAPS 0x03
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
131 #define PNA_CLIENT_CHALLANGE 0x04
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
132 #define PNA_BANDWIDTH 0x05
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
133 #define PNA_GUID 0x13
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
134 #define PNA_TIMESTAMP 0x17
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
135 #define PNA_TWENTYFOUR 0x18
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
136
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
137 #define PNA_CLIENT_STRING 0x63
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
138 #define PNA_PATH_REQUEST 0x52
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
139
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
140 const unsigned char pnm_challenge[] = "0990f6b4508b51e801bd6da011ad7b56";
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
141 const unsigned char pnm_timestamp[] = "[15/06/1999:22:22:49 00:00]";
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
142 const unsigned char pnm_guid[] = "3eac2411-83d5-11d2-f3ea-d7c3a51aa8b0";
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
143 const unsigned char pnm_response[] = "97715a899cbe41cee00dd434851535bf";
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
144 const unsigned char client_string[] = "WinNT_4.0_6.0.6.45_plus32_MP60_en-US_686l";
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
145
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
146 #define PNM_HEADER_SIZE 11
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
147 const unsigned char pnm_header[] = {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
148 'P','N','A',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
149 0x00, 0x0a,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
150 0x00, 0x14,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
151 0x00, 0x02,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
152 0x00, 0x01 };
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
153
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
154 #define PNM_CLIENT_CAPS_SIZE 126
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
155 const unsigned char pnm_client_caps[] = {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
156 0x07, 0x8a, 'p','n','r','v',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
157 0, 0x90, 'p','n','r','v',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
158 0, 0x64, 'd','n','e','t',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
159 0, 0x46, 'p','n','r','v',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
160 0, 0x32, 'd','n','e','t',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
161 0, 0x2b, 'p','n','r','v',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
162 0, 0x28, 'd','n','e','t',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
163 0, 0x24, 'p','n','r','v',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
164 0, 0x19, 'd','n','e','t',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
165 0, 0x18, 'p','n','r','v',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
166 0, 0x14, 's','i','p','r',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
167 0, 0x14, 'd','n','e','t',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
168 0, 0x24, '2','8','_','8',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
169 0, 0x12, 'p','n','r','v',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
170 0, 0x0f, 'd','n','e','t',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
171 0, 0x0a, 's','i','p','r',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
172 0, 0x0a, 'd','n','e','t',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
173 0, 0x08, 's','i','p','r',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
174 0, 0x06, 's','i','p','r',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
175 0, 0x12, 'l','p','c','J',
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
176 0, 0x07, '0','5','_','6' };
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
177
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
178 const uint32_t pnm_default_bandwidth=10485800;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
179 const uint32_t pnm_available_bandwidths[]={14400,19200,28800,33600,34430,57600,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
180 115200,262200,393216,524300,1544000,10485800};
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
181
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
182 #define PNM_TWENTYFOUR_SIZE 16
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
183 unsigned char pnm_twentyfour[]={
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
184 0xd5, 0x42, 0xa3, 0x1b, 0xef, 0x1f, 0x70, 0x24,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
185 0x85, 0x29, 0xb3, 0x8d, 0xba, 0x11, 0xf3, 0xd6 };
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
186
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
187 /* now other data follows. marked with 0x0000 at the beginning */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
188 int after_chunks_length=6;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
189 unsigned char after_chunks[]={
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
190 0x00, 0x00, /* mark */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
191
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
192 0x50, 0x84, /* seems to be fixated */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
193 0x1f, 0x3a /* varies on each request (checksum ?)*/
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
194 };
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
195
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
196 static void hexdump (char *buf, int length);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
197
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
198 static int rm_write(int s, const char *buf, int len) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
199 int total, timeout;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
200
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
201 total = 0; timeout = 30;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
202 while (total < len){
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
203 int n;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
204
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
205 n = write (s, &buf[total], len - total);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
206
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
207 if (n > 0)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
208 total += n;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
209 else if (n < 0) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
210 if ((timeout>0) && ((errno == EAGAIN) || (errno == EINPROGRESS))) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
211 sleep (1); timeout--;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
212 } else
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
213 return -1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
214 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
215 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
216
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
217 return total;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
218 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
219
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
220 static ssize_t rm_read(int fd, void *buf, size_t count) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
221
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
222 ssize_t ret, total;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
223
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
224 total = 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
225
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
226 while (total < count) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
227
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
228 fd_set rset;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
229 struct timeval timeout;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
230
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
231 FD_ZERO (&rset);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
232 FD_SET (fd, &rset);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
233
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
234 timeout.tv_sec = 3;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
235 timeout.tv_usec = 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
236
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
237 if (select (fd+1, &rset, NULL, NULL, &timeout) <= 0) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
238 return -1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
239 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
240
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
241 ret=read (fd, ((uint8_t*)buf)+total, count-total);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
242
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
243 if (ret<=0) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
244 printf ("input_pnm: read error.\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
245 return ret;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
246 } else
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
247 total += ret;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
248 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
249
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
250 return total;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
251 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
252
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
253 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
254 * debugging utilities
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
255 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
256
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
257 static void hexdump (char *buf, int length) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
258
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
259 int i;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
260
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
261 printf ("input_pnm: ascii>");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
262 for (i = 0; i < length; i++) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
263 unsigned char c = buf[i];
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
264
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
265 if ((c >= 32) && (c <= 128))
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
266 printf ("%c", c);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
267 else
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
268 printf (".");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
269 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
270 printf ("\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
271
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
272 printf ("input_pnm: hexdump> ");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
273 for (i = 0; i < length; i++) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
274 unsigned char c = buf[i];
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
275
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
276 printf ("%02x", c);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
277
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
278 if ((i % 16) == 15)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
279 printf ("\npnm: ");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
280
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
281 if ((i % 2) == 1)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
282 printf (" ");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
283
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
284 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
285 printf ("\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
286 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
287
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
288 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
289 * pnm_get_chunk gets a chunk from stream
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
290 * and returns number of bytes read
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
291 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
292
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
293 static unsigned int pnm_get_chunk(pnm_t *p,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
294 unsigned int max,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
295 unsigned int *chunk_type,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
296 char *data, int *need_response) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
297
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
298 unsigned int chunk_size;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
299 int n;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
300 char *ptr;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
301
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
302 /* get first PREAMBLE_SIZE bytes and ignore checksum */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
303 rm_read (p->s, data, CHECKSUM_SIZE);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
304 if (data[0] == 0x72)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
305 rm_read (p->s, data, PREAMBLE_SIZE);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
306 else
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
307 rm_read (p->s, data+CHECKSUM_SIZE, PREAMBLE_SIZE-CHECKSUM_SIZE);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
308
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
309 *chunk_type = BE_32(data);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
310 chunk_size = BE_32(data+4);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
311
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
312 switch (*chunk_type) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
313 case PNA_TAG:
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
314 *need_response=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
315 ptr=data+PREAMBLE_SIZE;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
316 rm_read (p->s, ptr++, 1);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
317
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
318 while(1) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
319 /* expecting following chunk format: 0x4f <chunk size> <data...> */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
320
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
321 rm_read (p->s, ptr, 2);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
322 if (*ptr == 'X') /* checking for server message */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
323 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
324 printf("input_pnm: got a message from server:\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
325 rm_read (p->s, ptr+2, 1);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
326 n=BE_16(ptr+1);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
327 rm_read (p->s, ptr+3, n);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
328 ptr[3+n]=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
329 printf("%s\n",ptr+3);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
330 return -1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
331 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
332
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
333 if (*ptr == 'F') /* checking for server error */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
334 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
335 printf("input_pnm: server error.\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
336 return -1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
337 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
338 if (*ptr == 'i')
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
339 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
340 ptr+=2;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
341 *need_response=1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
342 continue;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
343 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
344 if (*ptr != 0x4f) break;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
345 n=ptr[1];
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
346 rm_read (p->s, ptr+2, n);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
347 ptr+=(n+2);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
348 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
349 /* the checksum of the next chunk is ignored here */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
350 rm_read (p->s, ptr+2, 1);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
351 ptr+=3;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
352 chunk_size=ptr-data;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
353 break;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
354 case RMF_TAG:
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
355 case DATA_TAG:
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
356 case PROP_TAG:
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
357 case MDPR_TAG:
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
358 case CONT_TAG:
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
359 if (chunk_size > max) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
360 printf("error: max chunk size exeeded (max was 0x%04x)\n", max);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
361 n=rm_read (p->s, &data[PREAMBLE_SIZE], 0x100 - PREAMBLE_SIZE);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
362 hexdump(data,n+PREAMBLE_SIZE);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
363 return -1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
364 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
365 rm_read (p->s, &data[PREAMBLE_SIZE], chunk_size-PREAMBLE_SIZE);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
366 break;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
367 default:
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
368 *chunk_type = 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
369 chunk_size = PREAMBLE_SIZE;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
370 break;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
371 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
372
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
373 return chunk_size;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
374 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
375
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
376 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
377 * writes a chunk to a buffer, returns number of bytes written
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
378 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
379
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
380 static int pnm_write_chunk(uint16_t chunk_id, uint16_t length,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
381 const char *chunk, char *data) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
382
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
383 data[0]=(chunk_id>>8)%0xff;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
384 data[1]=chunk_id%0xff;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
385 data[2]=(length>>8)%0xff;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
386 data[3]=length%0xff;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
387 memcpy(&data[4],chunk,length);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
388
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
389 return length+4;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
390 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
391
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
392 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
393 * constructs a request and sends it
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
394 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
395
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
396 static void pnm_send_request(pnm_t *p, uint32_t bandwidth) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
397
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
398 uint16_t i16;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
399 int c=PNM_HEADER_SIZE;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
400 char fixme[]={0,1};
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
401
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
402 memcpy(p->buffer,pnm_header,PNM_HEADER_SIZE);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
403 c+=pnm_write_chunk(PNA_CLIENT_CHALLANGE,strlen(pnm_challenge),
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
404 pnm_challenge,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
405 c+=pnm_write_chunk(PNA_CLIENT_CAPS,PNM_CLIENT_CAPS_SIZE,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
406 pnm_client_caps,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
407 c+=pnm_write_chunk(0x0a,0,NULL,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
408 c+=pnm_write_chunk(0x0c,0,NULL,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
409 c+=pnm_write_chunk(0x0d,0,NULL,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
410 c+=pnm_write_chunk(0x16,2,fixme,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
411 c+=pnm_write_chunk(PNA_TIMESTAMP,strlen(pnm_timestamp),
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
412 pnm_timestamp,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
413 c+=pnm_write_chunk(PNA_BANDWIDTH,4,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
414 (const char *)&pnm_default_bandwidth,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
415 c+=pnm_write_chunk(0x08,0,NULL,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
416 c+=pnm_write_chunk(0x0e,0,NULL,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
417 c+=pnm_write_chunk(0x0f,0,NULL,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
418 c+=pnm_write_chunk(0x11,0,NULL,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
419 c+=pnm_write_chunk(0x10,0,NULL,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
420 c+=pnm_write_chunk(0x15,0,NULL,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
421 c+=pnm_write_chunk(0x12,0,NULL,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
422 c+=pnm_write_chunk(PNA_GUID,strlen(pnm_guid),
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
423 pnm_guid,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
424 c+=pnm_write_chunk(PNA_TWENTYFOUR,PNM_TWENTYFOUR_SIZE,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
425 pnm_twentyfour,&p->buffer[c]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
426
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
427 /* data after chunks */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
428 memcpy(&p->buffer[c],after_chunks,after_chunks_length);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
429 c+=after_chunks_length;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
430
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
431 /* client id string */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
432 p->buffer[c]=PNA_CLIENT_STRING;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
433 i16=BE_16D((strlen(client_string)-1)); /* dont know why do we have -1 here */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
434 memcpy(&p->buffer[c+1],&i16,2);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
435 memcpy(&p->buffer[c+3],client_string,strlen(client_string)+1);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
436 c=c+3+strlen(client_string)+1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
437
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
438 /* file path */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
439 p->buffer[c]=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
440 p->buffer[c+1]=PNA_PATH_REQUEST;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
441 i16=BE_16D(strlen(p->path));
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
442 memcpy(&p->buffer[c+2],&i16,2);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
443 memcpy(&p->buffer[c+4],p->path,strlen(p->path));
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
444 c=c+4+strlen(p->path);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
445
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
446 /* some trailing bytes */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
447 p->buffer[c]='y';
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
448 p->buffer[c+1]='B';
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
449
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
450 rm_write(p->s,p->buffer,c+2);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
451 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
452
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
453 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
454 * pnm_send_response sends a response of a challenge
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
455 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
456
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
457 static void pnm_send_response(pnm_t *p, const char *response) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
458
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
459 int size=strlen(response);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
460
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
461 p->buffer[0]=0x23;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
462 p->buffer[1]=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
463 p->buffer[2]=(unsigned char) size;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
464
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
465 memcpy(&p->buffer[3], response, size);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
466
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
467 rm_write (p->s, p->buffer, size+3);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
468
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
469 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
470
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
471 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
472 * get headers and challenge and fix headers
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
473 * write headers to p->header
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
474 * write challenge to p->buffer
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
475 *
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
476 * return 0 on error. != 0 on success
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
477 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
478
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
479 static int pnm_get_headers(pnm_t *p, int *need_response) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
480
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
481 uint32_t chunk_type;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
482 uint8_t *ptr=p->header;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
483 uint8_t *prop_hdr=NULL;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
484 int chunk_size,size=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
485 int nr;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
486 /* rmff_header_t *h; */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
487
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
488 *need_response=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
489
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
490 while(1) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
491 if (HEADER_SIZE-size<=0)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
492 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
493 printf("input_pnm: header buffer overflow. exiting\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
494 return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
495 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
496 chunk_size=pnm_get_chunk(p,HEADER_SIZE-size,&chunk_type,ptr,&nr);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
497 if (chunk_size < 0) return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
498 if (chunk_type == 0) break;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
499 if (chunk_type == PNA_TAG)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
500 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
501 memcpy(ptr, rm_header, RM_HEADER_SIZE);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
502 chunk_size=RM_HEADER_SIZE;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
503 *need_response=nr;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
504 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
505 if (chunk_type == DATA_TAG)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
506 chunk_size=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
507 if (chunk_type == RMF_TAG)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
508 chunk_size=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
509 if (chunk_type == PROP_TAG)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
510 prop_hdr=ptr;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
511 size+=chunk_size;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
512 ptr+=chunk_size;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
513 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
514
8852
668cc9e77d2d check if prop_hdr==NULL insteda of sig11
arpi
parents: 8584
diff changeset
515 if (!prop_hdr) {
668cc9e77d2d check if prop_hdr==NULL insteda of sig11
arpi
parents: 8584
diff changeset
516 printf("input_pnm: error while parsing headers.\n");
668cc9e77d2d check if prop_hdr==NULL insteda of sig11
arpi
parents: 8584
diff changeset
517 return 0;
668cc9e77d2d check if prop_hdr==NULL insteda of sig11
arpi
parents: 8584
diff changeset
518 }
668cc9e77d2d check if prop_hdr==NULL insteda of sig11
arpi
parents: 8584
diff changeset
519
8570
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
520 /* set data offset */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
521 size--;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
522 prop_hdr[42]=(size>>24)%0xff;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
523 prop_hdr[43]=(size>>16)%0xff;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
524 prop_hdr[44]=(size>>8)%0xff;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
525 prop_hdr[45]=(size)%0xff;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
526 size++;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
527
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
528 /* read challenge */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
529 memcpy (p->buffer, ptr, PREAMBLE_SIZE);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
530 rm_read (p->s, &p->buffer[PREAMBLE_SIZE], 64);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
531
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
532 /* now write a data header */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
533 memcpy(ptr, pnm_data_header, PNM_DATA_HEADER_SIZE);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
534 size+=PNM_DATA_HEADER_SIZE;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
535 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
536 h=rmff_scan_header(p->header);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
537 rmff_fix_header(h);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
538 p->header_len=rmff_get_header_size(h);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
539 rmff_dump_header(h, p->header, HEADER_SIZE);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
540 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
541 p->header_len=size;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
542
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
543 return 1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
544 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
545
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
546 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
547 * determine correct stream number by looking at indices
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
548 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
549
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
550 static int pnm_calc_stream(pnm_t *p) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
551
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
552 char str0=0,str1=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
553
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
554 /* looking at the first index to
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
555 * find possible stream types
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
556 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
557 if (p->seq_current[0]==p->seq_num[0]) str0=1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
558 if (p->seq_current[0]==p->seq_num[2]) str1=1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
559
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
560 switch (str0+str1) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
561 case 1: /* one is possible, good. */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
562 if (str0)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
563 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
564 p->seq_num[0]++;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
565 p->seq_num[1]=p->seq_current[1]+1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
566 return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
567 } else
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
568 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
569 p->seq_num[2]++;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
570 p->seq_num[3]=p->seq_current[1]+1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
571 return 1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
572 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
573 break;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
574 case 0:
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
575 case 2: /* both types or none possible, not so good */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
576 /* try to figure out by second index */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
577 if ( (p->seq_current[1] == p->seq_num[1])
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
578 &&(p->seq_current[1] != p->seq_num[3]))
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
579 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
580 /* ok, only stream0 matches */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
581 p->seq_num[0]=p->seq_current[0]+1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
582 p->seq_num[1]++;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
583 return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
584 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
585 if ( (p->seq_current[1] == p->seq_num[3])
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
586 &&(p->seq_current[1] != p->seq_num[1]))
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
587 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
588 /* ok, only stream1 matches */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
589 p->seq_num[2]=p->seq_current[0]+1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
590 p->seq_num[3]++;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
591 return 1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
592 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
593 /* wow, both streams match, or not. */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
594 /* now we try to decide by timestamps */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
595 if (p->ts_current < p->ts_last[1])
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
596 return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
597 if (p->ts_current < p->ts_last[0])
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
598 return 1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
599 /* does not help, we guess type 0 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
600 #ifdef LOG
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
601 printf("guessing stream# 0\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
602 #endif
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
603 p->seq_num[0]=p->seq_current[0]+1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
604 p->seq_num[1]=p->seq_current[1]+1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
605 return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
606 break;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
607 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
608 printf("input_pnm: wow, something very nasty happened in pnm_calc_stream\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
609 return 2;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
610 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
611
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
612 /*
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
613 * gets a stream chunk and writes it to a recieve buffer
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
614 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
615
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
616 static int pnm_get_stream_chunk(pnm_t *p) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
617
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
618 int n;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
619 char keepalive='!';
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
620 unsigned int fof1, fof2, stream;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
621
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
622 /* send a keepalive */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
623 /* realplayer seems to do that every 43th package */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
624 if ((p->packet%43) == 42)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
625 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
626 rm_write(p->s,&keepalive,1);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
627 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
628
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
629 /* data chunks begin with: 'Z' <o> <o> <i1> 'Z' <i2>
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
630 * where <o> is the offset to next stream chunk,
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
631 * <i1> is a 16 bit index
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
632 * <i2> is a 8 bit index which counts from 0x10 to somewhere
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
633 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
634
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
635 n = rm_read (p->s, p->buffer, 8);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
636 if (n<8) return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
637
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
638 /* skip 8 bytes if 0x62 is read */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
639 if (p->buffer[0] == 0x62)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
640 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
641 n = rm_read (p->s, p->buffer, 8);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
642 if (n<8) return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
643 #ifdef LOG
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
644 printf("input_pnm: had to seek 8 bytes on 0x62\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
645 #endif
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
646 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
647
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
648 /* a server message */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
649 if (p->buffer[0] == 'X')
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
650 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
651 int size=BE_16(&p->buffer[1]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
652
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
653 rm_read (p->s, &p->buffer[8], size-5);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
654 p->buffer[size+3]=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
655 printf("input_pnm: got message from server while reading stream:\n%s\n", &p->buffer[3]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
656 return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
657 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
658 if (p->buffer[0] == 'F')
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
659 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
660 printf("input_pnm: server error.\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
661 return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
662 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
663
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
664 /* skip bytewise to next chunk.
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
665 * seems, that we dont need that, if we send enough
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
666 * keepalives
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
667 */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
668 n=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
669 while (p->buffer[0] != 0x5a) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
670 int i;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
671 for (i=1; i<8; i++) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
672 p->buffer[i-1]=p->buffer[i];
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
673 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
674 rm_read (p->s, &p->buffer[7], 1);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
675 n++;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
676 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
677
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
678 #ifdef LOG
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
679 if (n) printf("input_pnm: had to seek %i bytes to next chunk\n", n);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
680 #endif
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
681
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
682 /* check for 'Z's */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
683 if ((p->buffer[0] != 0x5a)||(p->buffer[7] != 0x5a))
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
684 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
685 printf("input_pnm: bad boundaries\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
686 hexdump(p->buffer, 8);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
687 return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
688 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
689
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
690 /* check offsets */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
691 fof1=BE_16(&p->buffer[1]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
692 fof2=BE_16(&p->buffer[3]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
693 if (fof1 != fof2)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
694 {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
695 printf("input_pnm: frame offsets are different: 0x%04x 0x%04x\n",fof1,fof2);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
696 return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
697 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
698
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
699 /* get first index */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
700 p->seq_current[0]=BE_16(&p->buffer[5]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
701
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
702 /* now read the rest of stream chunk */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
703 n = rm_read (p->s, &p->recv[5], fof1-5);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
704 if (n<(fof1-5)) return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
705
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
706 /* get second index */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
707 p->seq_current[1]=p->recv[5];
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
708
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
709 /* get timestamp */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
710 p->ts_current=BE_32(&p->recv[6]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
711
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
712 /* get stream number */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
713 stream=pnm_calc_stream(p);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
714
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
715 /* saving timestamp */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
716 p->ts_last[stream]=p->ts_current;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
717
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
718 /* constructing a data packet header */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
719
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
720 p->recv[0]=0; /* object version */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
721 p->recv[1]=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
722
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
723 fof2=BE_16(&fof2);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
724 memcpy(&p->recv[2], &fof2, 2);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
725 /*p->recv[2]=(fof2>>8)%0xff;*/ /* length */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
726 /*p->recv[3]=(fof2)%0xff;*/
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
727
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
728 p->recv[4]=0; /* stream number */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
729 p->recv[5]=stream;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
730
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
731 p->recv[10]=p->recv[10] & 0xfe; /* streambox seems to do that... */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
732
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
733 p->packet++;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
734
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
735 p->recv_size=fof1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
736
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
737 return fof1;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
738 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
739
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
740 // pnm_t *pnm_connect(const char *mrl) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
741 pnm_t *pnm_connect(int fd, char *path) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
742
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
743 pnm_t *p=malloc(sizeof(pnm_t));
8852
668cc9e77d2d check if prop_hdr==NULL insteda of sig11
arpi
parents: 8584
diff changeset
744 int need_response=0;
8570
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
745
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
746 p->path=strdup(path);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
747 p->s=fd;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
748
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
749 pnm_send_request(p,pnm_available_bandwidths[10]);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
750 if (!pnm_get_headers(p, &need_response)) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
751 printf ("input_pnm: failed to set up stream\n");
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
752 free(p->path);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
753 free(p);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
754 return NULL;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
755 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
756 if (need_response)
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
757 pnm_send_response(p, pnm_response);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
758 p->ts_last[0]=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
759 p->ts_last[1]=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
760
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
761 /* copy header to recv */
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
762
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
763 memcpy(p->recv, p->header, p->header_len);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
764 p->recv_size = p->header_len;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
765 p->recv_read = 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
766
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
767 return p;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
768 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
769
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
770 int pnm_read (pnm_t *this, char *data, int len) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
771
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
772 int to_copy=len;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
773 char *dest=data;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
774 char *source=this->recv + this->recv_read;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
775 int fill=this->recv_size - this->recv_read;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
776
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
777 if (len < 0) return 0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
778 while (to_copy > fill) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
779
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
780 memcpy(dest, source, fill);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
781 to_copy -= fill;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
782 dest += fill;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
783 this->recv_read=0;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
784
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
785 if (!pnm_get_stream_chunk (this)) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
786 #ifdef LOG
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
787 printf ("input_pnm: %d of %d bytes provided\n", len-to_copy, len);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
788 #endif
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
789 return len-to_copy;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
790 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
791 source = this->recv;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
792 fill = this->recv_size - this->recv_read;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
793 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
794
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
795 memcpy(dest, source, to_copy);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
796 this->recv_read += to_copy;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
797
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
798 #ifdef LOG
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
799 printf ("input_pnm: %d bytes provided\n", len);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
800 #endif
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
801
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
802 return len;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
803 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
804
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
805 int pnm_peek_header (pnm_t *this, char *data) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
806
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
807 memcpy (data, this->header, this->header_len);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
808 return this->header_len;
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
809 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
810
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
811 void pnm_close(pnm_t *p) {
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
812
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
813 if (p->s >= 0) close(p->s);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
814 free(p->path);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
815 free(p);
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
816 }
16af93c01dbf pnm:// support (ported from xine)
arpi
parents:
diff changeset
817