annotate r3d.c @ 4428:fc705c33843f libavformat

remove now useless av_set_program_name() function
author aurel
date Tue, 10 Feb 2009 00:27:42 +0000
parents 3f71ce8f8da1
children 993860d53040
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4257
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
1 /*
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
2 * R3D REDCODE demuxer
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
3 * Copyright (c) 2008 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
4 *
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
5 * This file is part of FFmpeg.
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
6 *
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
11 *
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
15 * Lesser General Public License for more details.
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
16 *
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
20 */
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
21
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
22 //#define DEBUG
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
23
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
24 #include "libavutil/intreadwrite.h"
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
25 #include "avformat.h"
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
26
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
27 typedef struct {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
28 unsigned video_offsets_count;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
29 unsigned *video_offsets;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
30 unsigned rdvo_offset;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
31 } R3DContext;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
32
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
33 typedef struct {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
34 unsigned size;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
35 uint32_t tag;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
36 uint64_t offset;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
37 } Atom;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
38
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
39 static int read_atom(AVFormatContext *s, Atom *atom)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
40 {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
41 atom->offset = url_ftell(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
42 atom->size = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
43 if (atom->size < 8)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
44 return -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
45 atom->tag = get_le32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
46 dprintf(s, "atom %d %.4s offset %#llx\n",
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
47 atom->size, (char*)&atom->tag, atom->offset);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
48 return atom->size;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
49 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
50
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
51 static int r3d_read_red1(AVFormatContext *s)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
52 {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
53 AVStream *st = av_new_stream(s, 0);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
54 int tmp, tmp2;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
55
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
56 if (!st)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
57 return -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
58 st->codec->codec_type = CODEC_TYPE_VIDEO;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
59 st->codec->codec_id = CODEC_ID_JPEG2000;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
60
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
61 tmp = get_byte(s->pb); // major version
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
62 tmp2 = get_byte(s->pb); // minor version
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
63 dprintf(s, "version %d.%d\n", tmp, tmp2);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
64
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
65 tmp = get_be16(s->pb); // unknown
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
66 dprintf(s, "unknown1 %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
67
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
68 tmp = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
69 av_set_pts_info(st, 32, 1, tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
70
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
71 tmp = get_be32(s->pb); // filenum
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
72 dprintf(s, "filenum %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
73
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
74 url_fskip(s->pb, 32); // unknown
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
75
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
76 st->codec->width = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
77 st->codec->height = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
78
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
79 tmp = get_be16(s->pb); // unknown
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
80 dprintf(s, "unknown2 %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
81
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
82 st->codec->time_base.den = get_be16(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
83 st->codec->time_base.num = get_be16(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
84
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
85 tmp = get_byte(s->pb); // audio channels
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
86 dprintf(s, "audio channels %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
87 if (tmp > 0) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
88 AVStream *ast = av_new_stream(s, 1);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
89 ast->codec->codec_type = CODEC_TYPE_AUDIO;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
90 ast->codec->codec_id = CODEC_ID_PCM_S32BE;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
91 ast->codec->channels = tmp;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
92 av_set_pts_info(ast, 32, 1, st->time_base.den);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
93 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
94
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
95 st->filename = av_mallocz(258);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
96 if (!st->filename)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
97 return AVERROR(ENOMEM);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
98 get_buffer(s->pb, st->filename, 257);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
99
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
100 dprintf(s, "filename %s\n", st->filename);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
101 dprintf(s, "resolution %dx%d\n", st->codec->width, st->codec->height);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
102 dprintf(s, "timescale %d\n", st->time_base.den);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
103 dprintf(s, "frame rate %d/%d\n",
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
104 st->codec->time_base.num, st->codec->time_base.den);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
105
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
106 return 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
107 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
108
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
109 static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
110 {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
111 R3DContext *r3d = s->priv_data;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
112 AVStream *st = s->streams[0];
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
113 int i;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
114
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
115 r3d->video_offsets_count = (atom->size - 8) / 4;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
116 r3d->video_offsets = av_malloc(atom->size);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
117 if (!r3d->video_offsets)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
118 return AVERROR(ENOMEM);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
119
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
120 for (i = 0; i < r3d->video_offsets_count; i++) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
121 r3d->video_offsets[i] = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
122 if (!r3d->video_offsets[i]) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
123 r3d->video_offsets_count = i;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
124 break;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
125 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
126 dprintf(s, "video offset %d: %#x\n", i, r3d->video_offsets[i]);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
127 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
128
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
129 if (st->codec->time_base.den)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
130 st->duration = (uint64_t)r3d->video_offsets_count*
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
131 st->time_base.den*st->codec->time_base.num/st->codec->time_base.den;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
132 dprintf(s, "duration %lld\n", st->duration);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
133
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
134 return 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
135 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
136
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
137 static void r3d_read_reos(AVFormatContext *s)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
138 {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
139 R3DContext *r3d = s->priv_data;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
140 int tmp;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
141
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
142 r3d->rdvo_offset = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
143 get_be32(s->pb); // rdvs offset
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
144 get_be32(s->pb); // rdao offset
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
145 get_be32(s->pb); // rdas offset
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
146
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
147 tmp = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
148 dprintf(s, "num video chunks %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
149
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
150 tmp = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
151 dprintf(s, "num audio chunks %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
152
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
153 url_fskip(s->pb, 6*4);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
154 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
155
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
156 static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
157 {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
158 R3DContext *r3d = s->priv_data;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
159 Atom atom;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
160 int ret;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
161
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
162 if (read_atom(s, &atom) < 0) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
163 av_log(s, AV_LOG_ERROR, "error reading atom\n");
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
164 return -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
165 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
166 if (atom.tag == MKTAG('R','E','D','1')) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
167 if ((ret = r3d_read_red1(s)) < 0) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
168 av_log(s, AV_LOG_ERROR, "error parsing 'red1' atom\n");
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
169 return ret;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
170 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
171 } else {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
172 av_log(s, AV_LOG_ERROR, "could not find 'red1' atom\n");
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
173 return -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
174 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
175
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
176 s->data_offset = url_ftell(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
177 dprintf(s, "data offset %#llx\n", s->data_offset);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
178 if (url_is_streamed(s->pb))
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
179 return 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
180 // find REOB/REOF/REOS to load index
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
181 url_fseek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
182 if (read_atom(s, &atom) < 0)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
183 av_log(s, AV_LOG_ERROR, "error reading end atom\n");
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
184
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
185 if (atom.tag != MKTAG('R','E','O','B') &&
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
186 atom.tag != MKTAG('R','E','O','F') &&
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
187 atom.tag != MKTAG('R','E','O','S'))
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
188 goto out;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
189
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
190 r3d_read_reos(s);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
191
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
192 if (r3d->rdvo_offset) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
193 url_fseek(s->pb, r3d->rdvo_offset, SEEK_SET);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
194 if (read_atom(s, &atom) < 0)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
195 av_log(s, AV_LOG_ERROR, "error reading 'rdvo' atom\n");
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
196 if (atom.tag == MKTAG('R','D','V','O')) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
197 if (r3d_read_rdvo(s, &atom) < 0)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
198 av_log(s, AV_LOG_ERROR, "error parsing 'rdvo' atom\n");
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
199 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
200 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
201
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
202 out:
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
203 url_fseek(s->pb, s->data_offset, SEEK_SET);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
204 return 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
205 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
206
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
207 static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
208 {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
209 AVStream *st = s->streams[0];
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
210 int tmp, tmp2;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
211 uint64_t pos = url_ftell(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
212 unsigned dts;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
213
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
214 dts = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
215
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
216 tmp = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
217 dprintf(s, "frame num %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
218
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
219 tmp = get_byte(s->pb); // major version
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
220 tmp2 = get_byte(s->pb); // minor version
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
221 dprintf(s, "version %d.%d\n", tmp, tmp2);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
222
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
223 tmp = get_be16(s->pb); // unknown
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
224 dprintf(s, "unknown %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
225
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
226 if (tmp > 4) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
227 tmp = get_be16(s->pb); // unknown
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
228 dprintf(s, "unknown %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
229
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
230 tmp = get_be16(s->pb); // unknown
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
231 dprintf(s, "unknown %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
232
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
233 tmp = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
234 dprintf(s, "width %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
235 tmp = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
236 dprintf(s, "height %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
237
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
238 tmp = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
239 dprintf(s, "metadata len %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
240 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
241 tmp = atom->size - 8 - (url_ftell(s->pb) - pos);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
242 if (tmp < 0)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
243 return -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
244
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
245 if (av_get_packet(s->pb, pkt, tmp) != tmp) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
246 av_log(s, AV_LOG_ERROR, "error reading video packet\n");
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
247 return -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
248 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
249
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
250 pkt->stream_index = 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
251 pkt->dts = dts;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
252 if (st->codec->time_base.den)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
253 pkt->duration = (uint64_t)st->time_base.den*
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
254 st->codec->time_base.num/st->codec->time_base.den;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
255 dprintf(s, "pkt dts %lld duration %d\n", pkt->dts, pkt->duration);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
256
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
257 return 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
258 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
259
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
260 static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
261 {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
262 AVStream *st = s->streams[1];
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
263 int tmp, tmp2, samples, size;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
264 uint64_t pos = url_ftell(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
265 unsigned dts;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
266
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
267 dts = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
268
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
269 st->codec->sample_rate = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
270
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
271 samples = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
272
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
273 tmp = get_be32(s->pb);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
274 dprintf(s, "packet num %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
275
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
276 tmp = get_be16(s->pb); // unkown
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
277 dprintf(s, "unknown %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
278
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
279 tmp = get_byte(s->pb); // major version
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
280 tmp2 = get_byte(s->pb); // minor version
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
281 dprintf(s, "version %d.%d\n", tmp, tmp2);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
282
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
283 tmp = get_be32(s->pb); // unknown
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
284 dprintf(s, "unknown %d\n", tmp);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
285
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
286 size = atom->size - 8 - (url_ftell(s->pb) - pos);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
287 if (size < 0)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
288 return -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
289 if (av_get_packet(s->pb, pkt, size) != size) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
290 av_log(s, AV_LOG_ERROR, "error reading video packet\n");
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
291 return -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
292 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
293
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
294 pkt->stream_index = 1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
295 pkt->dts = dts;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
296 pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
297 dprintf(s, "pkt dts %lld duration %d samples %d sample rate %d\n",
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
298 pkt->dts, pkt->duration, samples, st->codec->sample_rate);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
299
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
300 return 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
301 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
302
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
303 static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
304 {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
305 Atom atom;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
306 int err = 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
307
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
308 while (!err) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
309 if (read_atom(s, &atom) < 0) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
310 err = -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
311 break;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
312 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
313 switch (atom.tag) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
314 case MKTAG('R','E','D','V'):
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
315 if (s->streams[0]->discard == AVDISCARD_ALL)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
316 goto skip;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
317 if (!(err = r3d_read_redv(s, pkt, &atom)))
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
318 return 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
319 break;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
320 case MKTAG('R','E','D','A'):
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
321 if (s->nb_streams < 2)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
322 return -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
323 if (s->streams[1]->discard == AVDISCARD_ALL)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
324 goto skip;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
325 if (!(err = r3d_read_reda(s, pkt, &atom)))
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
326 return 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
327 break;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
328 default:
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
329 skip:
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
330 url_fskip(s->pb, atom.size-8);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
331 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
332 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
333 return err;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
334 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
335
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
336 static int r3d_probe(AVProbeData *p)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
337 {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
338 if (AV_RL32(p->buf + 4) == MKTAG('R','E','D','1'))
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
339 return AVPROBE_SCORE_MAX;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
340 return 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
341 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
342
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
343 static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
344 {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
345 AVStream *st = s->streams[0]; // video stream
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
346 R3DContext *r3d = s->priv_data;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
347 int frame_num;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
348
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
349 if (!st->codec->time_base.num || !st->time_base.den)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
350 return -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
351
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
352 frame_num = sample_time*st->codec->time_base.den/
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
353 ((int64_t)st->codec->time_base.num*st->time_base.den);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
354 dprintf(s, "seek frame num %d timestamp %lld\n", frame_num, sample_time);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
355
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
356 if (frame_num < r3d->video_offsets_count) {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
357 url_fseek(s->pb, r3d->video_offsets_count, SEEK_SET);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
358 } else {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
359 av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
360 return -1;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
361 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
362
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
363 return 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
364 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
365
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
366 static int r3d_close(AVFormatContext *s)
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
367 {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
368 R3DContext *r3d = s->priv_data;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
369
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
370 av_freep(&r3d->video_offsets);
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
371
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
372 return 0;
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
373 }
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
374
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
375 AVInputFormat r3d_demuxer = {
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
376 "r3d",
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
377 NULL_IF_CONFIG_SMALL("REDCODE R3D format"),
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
378 sizeof(R3DContext),
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
379 r3d_probe,
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
380 r3d_read_header,
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
381 r3d_read_packet,
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
382 r3d_close,
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
383 r3d_seek,
3f71ce8f8da1 R3D REDCODE demuxer
bcoudurier
parents:
diff changeset
384 };