OLD | NEW |
1 /* | 1 /* |
2 * mtv demuxer | 2 * mtv demuxer |
3 * Copyright (c) 2006 Reynaldo H. Verdejo Pinochet | 3 * Copyright (c) 2006 Reynaldo H. Verdejo Pinochet |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 int ret; | 161 int ret; |
162 #if !HAVE_BIGENDIAN | 162 #if !HAVE_BIGENDIAN |
163 int i; | 163 int i; |
164 #endif | 164 #endif |
165 | 165 |
166 if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segm
ent_size) | 166 if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segm
ent_size) |
167 { | 167 { |
168 url_fskip(pb, MTV_AUDIO_PADDING_SIZE); | 168 url_fskip(pb, MTV_AUDIO_PADDING_SIZE); |
169 | 169 |
170 ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE); | 170 ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE); |
171 if(ret != MTV_ASUBCHUNK_DATA_SIZE) | 171 if(ret < 0) |
172 return AVERROR(EIO); | 172 return ret; |
173 | 173 |
174 pkt->pos -= MTV_AUDIO_PADDING_SIZE; | 174 pkt->pos -= MTV_AUDIO_PADDING_SIZE; |
175 pkt->stream_index = AUDIO_SID; | 175 pkt->stream_index = AUDIO_SID; |
176 | 176 |
177 }else | 177 }else |
178 { | 178 { |
179 ret = av_get_packet(pb, pkt, mtv->img_segment_size); | 179 ret = av_get_packet(pb, pkt, mtv->img_segment_size); |
180 if(ret != mtv->img_segment_size) | 180 if(ret < 0) |
181 return AVERROR(EIO); | 181 return ret; |
182 | 182 |
183 #if !HAVE_BIGENDIAN | 183 #if !HAVE_BIGENDIAN |
184 | 184 |
185 /* pkt->data is GGGRRRR BBBBBGGG | 185 /* pkt->data is GGGRRRR BBBBBGGG |
186 * and we need RRRRRGGG GGGBBBBB | 186 * and we need RRRRRGGG GGGBBBBB |
187 * for PIX_FMT_RGB565 so here we | 187 * for PIX_FMT_RGB565 so here we |
188 * just swap bytes as they come | 188 * just swap bytes as they come |
189 */ | 189 */ |
190 | 190 |
191 for(i=0;i<mtv->img_segment_size/2;i++) | 191 for(i=0;i<mtv->img_segment_size/2;i++) |
192 *((uint16_t *)pkt->data+i) = bswap_16(*((uint16_t *)pkt->data+i)); | 192 *((uint16_t *)pkt->data+i) = bswap_16(*((uint16_t *)pkt->data+i)); |
193 #endif | 193 #endif |
194 pkt->stream_index = VIDEO_SID; | 194 pkt->stream_index = VIDEO_SID; |
195 } | 195 } |
196 | 196 |
197 return ret; | 197 return ret; |
198 } | 198 } |
199 | 199 |
200 AVInputFormat mtv_demuxer = { | 200 AVInputFormat mtv_demuxer = { |
201 "MTV", | 201 "MTV", |
202 NULL_IF_CONFIG_SMALL("MTV format"), | 202 NULL_IF_CONFIG_SMALL("MTV format"), |
203 sizeof(MTVDemuxContext), | 203 sizeof(MTVDemuxContext), |
204 mtv_probe, | 204 mtv_probe, |
205 mtv_read_header, | 205 mtv_read_header, |
206 mtv_read_packet, | 206 mtv_read_packet, |
207 }; | 207 }; |
OLD | NEW |