| 156 | } |
| 157 | |
| 158 | static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 159 | { |
| 160 | R3DContext *r3d = s->priv_data; |
| 161 | Atom atom; |
| 162 | int ret; |
| 163 | |
| 164 | if (read_atom(s, &atom) < 0) { |
| 165 | av_log(s, AV_LOG_ERROR, "error reading atom\n"); |
| 166 | return -1; |
| 167 | } |
| 168 | if (atom.tag == MKTAG('R','E','D','1')) { |
| 169 | if ((ret = r3d_read_red1(s)) < 0) { |
| 170 | av_log(s, AV_LOG_ERROR, "error parsing 'red1' atom\n"); |
| 171 | return ret; |
| 172 | } |
| 173 | } else { |
| 174 | av_log(s, AV_LOG_ERROR, "could not find 'red1' atom\n"); |
| 175 | return -1; |
| 176 | } |
| 177 | |
| 178 | s->data_offset = url_ftell(s->pb); |
| 179 | dprintf(s, "data offset %#llx\n", s->data_offset); |
| 180 | if (url_is_streamed(s->pb)) |
| 181 | return 0; |
| 182 | // find REOB/REOF/REOS to load index |
| 183 | url_fseek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET); |
| 184 | if (read_atom(s, &atom) < 0) |
| 185 | av_log(s, AV_LOG_ERROR, "error reading end atom\n"); |
| 186 | |
| 187 | if (atom.tag != MKTAG('R','E','O','B') && |
| 188 | atom.tag != MKTAG('R','E','O','F') && |
| 189 | atom.tag != MKTAG('R','E','O','S')) |
| 190 | goto out; |
| 191 | |
| 192 | r3d_read_reos(s); |
| 193 | |
| 194 | if (r3d->rdvo_offset) { |
| 195 | url_fseek(s->pb, r3d->rdvo_offset, SEEK_SET); |
| 196 | if (read_atom(s, &atom) < 0) |
| 197 | av_log(s, AV_LOG_ERROR, "error reading 'rdvo' atom\n"); |
| 198 | if (atom.tag == MKTAG('R','D','V','O')) { |
| 199 | if (r3d_read_rdvo(s, &atom) < 0) |
| 200 | av_log(s, AV_LOG_ERROR, "error parsing 'rdvo' atom\n"); |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | out: |
| 205 | url_fseek(s->pb, s->data_offset, SEEK_SET); |
| 206 | return 0; |
| 207 | } |
| 208 | |
| 209 | static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) |
| 210 | { |
nothing calls this directly
no test coverage detected