Mercurial > mplayer.hg
comparison command.c @ 37163:caea6b4337d8
Check existence of a demuxer when updating global_sub_size.
The GUI may call mpctx_get_global_sub_info() which forces
updating global_sub_size even if there isn't yet a demuxer.
This closes Trac #2201.
author | ib |
---|---|
date | Thu, 28 Aug 2014 19:34:05 +0000 |
parents | 598ef7d90b78 |
children |
comparison
equal
deleted
inserted
replaced
37162:b25434b964e0 | 37163:caea6b4337d8 |
---|---|
153 int i; | 153 int i; |
154 int cnt = 0; | 154 int cnt = 0; |
155 | 155 |
156 // update number of demuxer sub streams | 156 // update number of demuxer sub streams |
157 for (i = 0; i < MAX_S_STREAMS; i++) | 157 for (i = 0; i < MAX_S_STREAMS; i++) |
158 if (mpctx->demuxer->s_streams[i]) | 158 if (mpctx->demuxer && mpctx->demuxer->s_streams[i]) |
159 cnt++; | 159 cnt++; |
160 if (cnt > mpctx->sub_counts[SUB_SOURCE_DEMUX]) | 160 if (cnt > mpctx->sub_counts[SUB_SOURCE_DEMUX]) |
161 mpctx->sub_counts[SUB_SOURCE_DEMUX] = cnt; | 161 mpctx->sub_counts[SUB_SOURCE_DEMUX] = cnt; |
162 | 162 |
163 // update global size | 163 // update global size |
166 mpctx->global_sub_size += mpctx->sub_counts[i]; | 166 mpctx->global_sub_size += mpctx->sub_counts[i]; |
167 | 167 |
168 // update global_sub_pos if we auto-detected a demuxer sub | 168 // update global_sub_pos if we auto-detected a demuxer sub |
169 if (mpctx->global_sub_pos == -1) { | 169 if (mpctx->global_sub_pos == -1) { |
170 int sub_id = -1; | 170 int sub_id = -1; |
171 if (mpctx->demuxer->sub) | 171 if (mpctx->demuxer && mpctx->demuxer->sub) |
172 sub_id = mpctx->demuxer->sub->id; | 172 sub_id = mpctx->demuxer->sub->id; |
173 if (sub_id < 0) | 173 if (sub_id < 0) |
174 sub_id = dvdsub_id; | 174 sub_id = dvdsub_id; |
175 if (sub_id >= 0 && sub_id < mpctx->sub_counts[SUB_SOURCE_DEMUX]) | 175 if (sub_id >= 0 && sub_id < mpctx->sub_counts[SUB_SOURCE_DEMUX]) |
176 mpctx->global_sub_pos = sub_pos_by_source(mpctx, SUB_SOURCE_DEMUX) + | 176 mpctx->global_sub_pos = sub_pos_by_source(mpctx, SUB_SOURCE_DEMUX) + |