1 /*
2 * Copyright (c) 2014 Nicolas George
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
26
34
35 #define OFFSET(field) offsetof(SubfileContext, field)
36 #define D AV_OPT_FLAG_DECODING_PARAM
37
42 };
43
44 #undef OFFSET
45 #undef D
46
52 };
53
55 {
58
60 if (ret >= 0)
65 }
66 return 0;
67 }
68
71 {
74
78 }
81 if (ret < 0)
87 }
88 return 0;
89 }
90
92 {
95 }
96
98 {
100 int64_t rest = c->
end - c->
pos;
102
103 if (rest <= 0)
104 return 0;
105 size =
FFMIN(size, rest);
107 if (ret >= 0)
110 }
111
113 {
115 int64_t new_pos = -1;
117
120 switch (whence) {
121 case SEEK_SET:
122 new_pos = c->
start + pos;
123 break;
124 case SEEK_CUR:
125 new_pos += pos;
126 break;
127 case SEEK_END:
128 new_pos = c->
end + c->
pos;
129 break;
130 }
131 if (new_pos < c->
start)
137 }
138
146 .priv_data_class = &subfile_class,
147 };