Mercurial > hg > forks > bilotrip-mj12
comparison liboggplayer-src/src/open_close.cpp @ 7:26ee741f8c08
Add some primitive debugging in the liboggplayer.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 05 Aug 2013 14:33:35 +0300 |
parents | 105513a2e3c9 |
children | 3b6cea0d1980 |
comparison
equal
deleted
inserted
replaced
6:2741d9fe1c71 | 7:26ee741f8c08 |
---|---|
70 | 70 |
71 // look for further theora headers | 71 // look for further theora headers |
72 while (theora_p && (theora_p < 3) && (ret = ogg_stream_packetout( | 72 while (theora_p && (theora_p < 3) && (ret = ogg_stream_packetout( |
73 &o_tsstate, &o_packet))) { | 73 &o_tsstate, &o_packet))) { |
74 if (ret < 0) { | 74 if (ret < 0) { |
75 fprintf(stderr, "X: 0\n"); | |
75 return false; | 76 return false; |
76 } | 77 } |
77 if (theora_decode_header(&t_info, &t_comment, &o_packet)) { | 78 if (theora_decode_header(&t_info, &t_comment, &o_packet)) { |
79 fprintf(stderr, "X: 1\n"); | |
78 return false; | 80 return false; |
79 } | 81 } |
80 theora_p++; | 82 theora_p++; |
81 } | 83 } |
82 | 84 |
83 // look for more vorbis header packets | 85 // look for more vorbis header packets |
84 while (vorbis_p && (vorbis_p < 3) && (ret = ogg_stream_packetout( | 86 while (vorbis_p && (vorbis_p < 3) && (ret = ogg_stream_packetout( |
85 &o_vsstate, &o_packet))) { | 87 &o_vsstate, &o_packet))) { |
86 if (ret < 0) { | 88 if (ret < 0) { |
89 fprintf(stderr, "X: 2\n"); | |
87 return false; | 90 return false; |
88 } | 91 } |
89 if (vorbis_synthesis_headerin(&v_info, &v_comment, &o_packet)) { | 92 if (vorbis_synthesis_headerin(&v_info, &v_comment, &o_packet)) { |
93 fprintf(stderr, "X: 3\n"); | |
90 return false; | 94 return false; |
91 } | 95 } |
92 vorbis_p++; | 96 vorbis_p++; |
93 if (vorbis_p == 3) | 97 if (vorbis_p == 3) |
94 break; | 98 break; |
99 | 103 |
100 if (ogg_sync_pageout(&o_sync, &o_page) > 0) { | 104 if (ogg_sync_pageout(&o_sync, &o_page) > 0) { |
101 queue_page(&o_page); /* demux into the appropriate stream */ | 105 queue_page(&o_page); /* demux into the appropriate stream */ |
102 } else { | 106 } else { |
103 if (!buffer_data()) /* someone needs more data */{ | 107 if (!buffer_data()) /* someone needs more data */{ |
108 fprintf(stderr, "X: 4\n"); | |
104 return false; | 109 return false; |
105 } | 110 } |
106 } | 111 } |
107 } | 112 } |
108 return true; | 113 return true; |
117 pp_level = pp_level_max; | 122 pp_level = pp_level_max; |
118 theora_control(&t_state, TH_DECCTL_SET_PPLEVEL, &pp_level, | 123 theora_control(&t_state, TH_DECCTL_SET_PPLEVEL, &pp_level, |
119 sizeof(pp_level)); | 124 sizeof(pp_level)); |
120 pp_inc = 0; | 125 pp_inc = 0; |
121 } else { | 126 } else { |
127 fprintf(stderr, "DDD: 0\n"); | |
122 return false; | 128 return false; |
123 } | 129 } |
124 if (vorbis_p) { | 130 if (vorbis_p) { |
125 vorbis_synthesis_init(&v_state, &v_info); | 131 vorbis_synthesis_init(&v_state, &v_info); |
126 vorbis_block_init(&v_state, &v_block); | 132 vorbis_block_init(&v_state, &v_block); |
127 } else { | 133 } else { |
134 fprintf(stderr, "DDD: 1\n"); | |
128 return false; | 135 return false; |
129 } | 136 } |
130 return true; | 137 return true; |
131 } | 138 } |
132 | 139 |
140 last_frame_read=0; | 147 last_frame_read=0; |
141 | 148 |
142 // 1) open the input file | 149 // 1) open the input file |
143 file_in.open(path.c_str(), std::ios::binary); | 150 file_in.open(path.c_str(), std::ios::binary); |
144 if (file_in.fail()) { | 151 if (file_in.fail()) { |
152 fprintf(stderr, "XXX: 0\n"); | |
145 failbit = true; | 153 failbit = true; |
146 return; | 154 return; |
147 } | 155 } |
148 | 156 |
149 // 2) init some structs | 157 // 2) init some structs |
153 theora_info_init(&t_info); | 161 theora_info_init(&t_info); |
154 theora_comment_init(&t_comment); | 162 theora_comment_init(&t_comment); |
155 | 163 |
156 // 3) parse headers | 164 // 3) parse headers |
157 if (!failbit && !parse_headers()) { | 165 if (!failbit && !parse_headers()) { |
166 fprintf(stderr, "XXX: 1\n"); | |
158 failbit = true; | 167 failbit = true; |
159 } | 168 } |
160 | 169 |
161 // 3) init decoders | 170 // 3) init decoders |
162 if (!failbit && !init_decoders()) { | 171 if (!failbit && !init_decoders()) { |
172 fprintf(stderr, "XXX: 2\n"); | |
163 failbit = true; | 173 failbit = true; |
164 } | 174 } |
165 | 175 |
166 // 4) if fail, tear down the partial setup | 176 // 4) if fail, tear down the partial setup |
167 if (failbit) { | 177 if (failbit) { |
169 theora_comment_clear(&t_comment); | 179 theora_comment_clear(&t_comment); |
170 vorbis_info_clear(&v_info); | 180 vorbis_info_clear(&v_info); |
171 vorbis_comment_clear(&v_comment); | 181 vorbis_comment_clear(&v_comment); |
172 ogg_sync_clear(&o_sync); | 182 ogg_sync_clear(&o_sync); |
173 file_in.close(); | 183 file_in.close(); |
184 fprintf(stderr, "XXX: done\n"); | |
174 return; | 185 return; |
175 } | 186 } |
176 | 187 |
177 // 5) init audio conversion | 188 // 5) init audio conversion |
178 int ret = SDL_BuildAudioCVT(&cvt, AUDIO_S16, v_info.channels, | 189 int ret = SDL_BuildAudioCVT(&cvt, AUDIO_S16, v_info.channels, |