mirror of https://github.com/mpv-player/mpv
demux: minor simplification
Oops, should have been part of commit 37085788
.
This commit is contained in:
parent
e6643abc98
commit
de28876222
|
@ -659,7 +659,7 @@ void demuxer_select_track(struct demuxer *demuxer, struct sh_stream *stream,
|
|||
}
|
||||
}
|
||||
|
||||
bool demuxer_stream_is_selected(struct demuxer *d, struct sh_stream *stream)
|
||||
bool demux_stream_is_selected(struct sh_stream *stream)
|
||||
{
|
||||
return stream && stream->ds->selected;
|
||||
}
|
||||
|
|
|
@ -229,6 +229,7 @@ void free_demuxer(struct demuxer *demuxer);
|
|||
int demux_add_packet(struct sh_stream *stream, demux_packet_t *dp);
|
||||
|
||||
struct demux_packet *demux_read_packet(struct sh_stream *sh);
|
||||
bool demux_stream_is_selected(struct sh_stream *stream);
|
||||
double demux_get_next_pts(struct sh_stream *sh);
|
||||
bool demux_has_packet(struct sh_stream *sh);
|
||||
bool demux_stream_eof(struct sh_stream *sh);
|
||||
|
@ -265,8 +266,6 @@ double demuxer_get_time_length(struct demuxer *demuxer);
|
|||
struct sh_stream *demuxer_stream_by_demuxer_id(struct demuxer *d,
|
||||
enum stream_type t, int id);
|
||||
|
||||
bool demuxer_stream_is_selected(struct demuxer *d, struct sh_stream *stream);
|
||||
|
||||
bool demux_matroska_uid_cmp(struct matroska_segment_uid *a,
|
||||
struct matroska_segment_uid *b);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ static void reselect_streams(demuxer_t *demuxer)
|
|||
for (int n = 0; n < MPMIN(p->slave->num_streams, p->num_streams); n++) {
|
||||
if (p->streams[n]) {
|
||||
demuxer_select_track(p->slave, p->slave->streams[n],
|
||||
demuxer_stream_is_selected(demuxer, p->streams[n]));
|
||||
demux_stream_is_selected(p->streams[n]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -391,7 +391,7 @@ static void select_tracks(struct demuxer *demuxer, int start)
|
|||
for (int n = start; n < priv->num_streams; n++) {
|
||||
struct sh_stream *stream = priv->streams[n];
|
||||
AVStream *st = priv->avfc->streams[n];
|
||||
bool selected = stream && demuxer_stream_is_selected(demuxer, stream) &&
|
||||
bool selected = stream && demux_stream_is_selected(stream) &&
|
||||
!stream->attached_picture;
|
||||
st->discard = selected ? AVDISCARD_DEFAULT : AVDISCARD_ALL;
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ static int demux_lavf_fill_buffer(demuxer_t *demux)
|
|||
struct sh_stream *stream = priv->streams[pkt->stream_index];
|
||||
AVStream *st = priv->avfc->streams[pkt->stream_index];
|
||||
|
||||
if (!demuxer_stream_is_selected(demux, stream)) {
|
||||
if (!demux_stream_is_selected(stream)) {
|
||||
talloc_free(pkt);
|
||||
return 1; // don't signal EOF if skipping a packet
|
||||
}
|
||||
|
|
|
@ -2362,7 +2362,7 @@ static int handle_block(demuxer_t *demuxer, struct block_info *block_info)
|
|||
uint32_t lace_size[MAX_NUM_LACES];
|
||||
bool use_this_block = tc >= mkv_d->skip_to_timecode;
|
||||
|
||||
if (!demuxer_stream_is_selected(demuxer, stream))
|
||||
if (!demux_stream_is_selected(stream))
|
||||
return 0;
|
||||
|
||||
if (demux_mkv_read_block_lacing(&data, &laces, lace_size)) {
|
||||
|
@ -2716,7 +2716,7 @@ static void demux_mkv_seek(demuxer_t *demuxer, float rel_seek_secs, int flags)
|
|||
mkv_seek_reset(demuxer);
|
||||
for (int i = 0; i < mkv_d->num_tracks; i++) {
|
||||
mkv_track_t *track = mkv_d->tracks[i];
|
||||
if (demuxer_stream_is_selected(demuxer, track->stream)) {
|
||||
if (demux_stream_is_selected(track->stream)) {
|
||||
st_active[track->stream->type] = true;
|
||||
if (track->type == MATROSKA_TRACK_VIDEO)
|
||||
v_tnum = track->tnum;
|
||||
|
|
|
@ -191,9 +191,7 @@ static int demux_tv_fill_buffer(demuxer_t *demux)
|
|||
|
||||
for (int n = 0; n < demux->num_streams; n++) {
|
||||
struct sh_stream *sh = demux->streams[n];
|
||||
if (!demux_has_packet(sh) &&
|
||||
demuxer_stream_is_selected(demux, sh))
|
||||
{
|
||||
if (!demux_has_packet(sh) && demux_stream_is_selected(sh)) {
|
||||
if (sh->type == STREAM_AUDIO)
|
||||
want_audio = sh;
|
||||
if (sh->type == STREAM_VIDEO)
|
||||
|
|
|
@ -265,7 +265,7 @@ static void external_track_seek(struct MPContext *mpctx, struct track *track)
|
|||
for (int t = 0; t < mpctx->num_tracks; t++) {
|
||||
struct track *other = mpctx->tracks[t];
|
||||
if (other->demuxer == track->demuxer &&
|
||||
demuxer_stream_is_selected(other->demuxer, other->stream))
|
||||
demux_stream_is_selected(other->stream))
|
||||
return;
|
||||
}
|
||||
double pts = get_main_demux_pts(mpctx);
|
||||
|
|
Loading…
Reference in New Issue