From 18180ae89b7d162e04d84d36fa04ac14a58db1f7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 7 Sep 2018 23:10:14 +0200 Subject: [PATCH] demux: get rid of ->control callback The only thing left is the notification for track switching. Just get rid of that. There's probably no real reason to get rid of control(), but why not. I think I was actually trying to do some real work but fuck that. --- demux/demux.c | 4 ++-- demux/demux.h | 6 +----- demux/demux_lavf.c | 12 +++--------- demux/demux_timeline.c | 11 +++-------- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/demux/demux.c b/demux/demux.c index cf94805384..cac4874e8b 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -1732,8 +1732,8 @@ static void execute_trackswitch(struct demux_internal *in) pthread_mutex_unlock(&in->lock); - if (in->d_thread->desc->control) - in->d_thread->desc->control(in->d_thread, DEMUXER_CTRL_SWITCHED_TRACKS, 0); + if (in->d_thread->desc->switched_tracks) + in->d_thread->desc->switched_tracks(in->d_thread); pthread_mutex_lock(&in->lock); } diff --git a/demux/demux.h b/demux/demux.h index ed013a043c..3674f7ea34 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -30,10 +30,6 @@ #include "packet.h" #include "stheader.h" -enum demux_ctrl { - DEMUXER_CTRL_SWITCHED_TRACKS = 1, -}; - #define MAX_SEEK_RANGES 10 struct demux_seek_range { @@ -107,7 +103,7 @@ typedef struct demuxer_desc { bool (*read_packet)(struct demuxer *demuxer, struct demux_packet **pkt); void (*close)(struct demuxer *demuxer); void (*seek)(struct demuxer *demuxer, double rel_seek_secs, int flags); - int (*control)(struct demuxer *demuxer, int cmd, void *arg); + void (*switched_tracks)(struct demuxer *demuxer); // See timeline.c void (*load_timeline)(struct timeline *tl); } demuxer_desc_t; diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index eae78f9b4c..d6e14b8617 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -1185,15 +1185,9 @@ static void demux_seek_lavf(demuxer_t *demuxer, double seek_pts, int flags) update_read_stats(demuxer); } -static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg) +static void demux_lavf_switched_tracks(struct demuxer *demuxer) { - switch (cmd) { - case DEMUXER_CTRL_SWITCHED_TRACKS: - select_tracks(demuxer, 0); - return CONTROL_OK; - default: - return CONTROL_UNKNOWN; - } + select_tracks(demuxer, 0); } static void demux_close_lavf(demuxer_t *demuxer) @@ -1235,5 +1229,5 @@ const demuxer_desc_t demuxer_desc_lavf = { .open = demux_open_lavf, .close = demux_close_lavf, .seek = demux_seek_lavf, - .control = demux_lavf_control, + .switched_tracks = demux_lavf_switched_tracks, }; diff --git a/demux/demux_timeline.c b/demux/demux_timeline.c index d0c1740e9e..49046222d9 100644 --- a/demux/demux_timeline.c +++ b/demux/demux_timeline.c @@ -435,14 +435,9 @@ static void d_close(struct demuxer *demuxer) demux_free(master); } -static int d_control(struct demuxer *demuxer, int cmd, void *arg) +static void d_switched_tracks(struct demuxer *demuxer) { - if (cmd == DEMUXER_CTRL_SWITCHED_TRACKS) { - reselect_streams(demuxer); - return CONTROL_OK; - } - - return CONTROL_UNKNOWN; + reselect_streams(demuxer); } const demuxer_desc_t demuxer_desc_timeline = { @@ -452,5 +447,5 @@ const demuxer_desc_t demuxer_desc_timeline = { .open = d_open, .close = d_close, .seek = d_seek, - .control = d_control, + .switched_tracks = d_switched_tracks, };