From: Andreas Ă–man Date: Fri, 5 Sep 2008 21:06:26 +0000 (+0000) Subject: Clean up mux.c a bit more. X-Git-Tag: 2.12~907 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=10c457edc299795061014a283bf8a68a7263baa9;p=thirdparty%2Ftvheadend.git Clean up mux.c a bit more. --- diff --git a/mux.c b/mux.c index 52f16260f..bda4e318c 100644 --- a/mux.c +++ b/mux.c @@ -15,37 +15,22 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#define _GNU_SOURCE -#include #include - #include -#include -#include -#include -#include -#include #include - #include #include #include -#include - #include "tvhead.h" -#include "dispatch.h" -#include "teletext.h" #include "transports.h" #include "subscriptions.h" #include "psi.h" #include "buffer.h" #include "mux.h" - - -/* +/** * pause playback */ void @@ -62,18 +47,10 @@ muxer_pause(th_muxer_t *tm) void muxer_play(th_muxer_t *tm, int64_t toffset) { - th_subscription_t *s = tm->tm_subscription; - th_transport_t *t = s->ths_transport; + th_transport_t *t = tm->tm_transport; transport_link_muxer(t, tm); - if(!tm->tm_linked) { - pthread_mutex_lock(&t->tht_delivery_mutex); - LIST_INSERT_HEAD(&s->ths_transport->tht_muxers, tm, tm_transport_link); - pthread_mutex_unlock(&t->tht_delivery_mutex); - tm->tm_linked = 1; - } - if(toffset == AV_NOPTS_VALUE) { /* continue from last playback */ tm->tm_offset = 0; @@ -106,7 +83,7 @@ mux_new_packet(th_muxer_t *tm, th_stream_t *st, th_pkt_t *pkt) { th_muxstream_t *tms; - pkt_store(pkt); /* need to keep packet around */ + pkt_store(st, pkt); /* need to keep packet around */ switch(tm->tm_status) { case TM_IDLE: @@ -137,15 +114,14 @@ mux_new_packet(th_muxer_t *tm, th_stream_t *st, th_pkt_t *pkt) * TS Muxer */ th_muxer_t * -muxer_init(th_subscription_t *s, th_mux_output_t *cb, void *opaque) +muxer_create(th_transport_t *t, th_mux_output_t *cb, void *opaque) { - th_transport_t *t = s->ths_transport; th_stream_t *st; th_muxer_t *tm; th_muxstream_t *tms; tm = calloc(1, sizeof(th_muxer_t)); - tm->tm_subscription = s; + tm->tm_transport = t; tm->tm_output = cb; tm->tm_opaque = opaque; @@ -172,8 +148,6 @@ muxer_init(th_subscription_t *s, th_mux_output_t *cb, void *opaque) LIST_INSERT_HEAD(&tm->tm_streams, tms, tms_muxer_link0); } - - s->ths_muxer = tm; return tm; } @@ -191,22 +165,15 @@ tms_destroy(th_muxstream_t *tms) } -/* +/** * */ void -muxer_deinit(th_muxer_t *tm, th_subscription_t *s) +muxer_destroy(th_muxer_t *tm) { th_muxstream_t *tms; - th_transport_t *t; - - s->ths_raw_input = NULL; - s->ths_muxer = NULL; - - if(tm->tm_linked) { - pthread_mutex_lock(&t->tht_delivery_mutex); - LIST_REMOVE(tm, tm_transport_link); + transport_unlink_muxer(tm); while((tms = LIST_FIRST(&tm->tm_streams)) != NULL) tms_destroy(tms); diff --git a/mux.h b/mux.h index 4a9edc069..77018c5b0 100644 --- a/mux.h +++ b/mux.h @@ -19,10 +19,9 @@ #ifndef MUX_H #define MUX_H -th_muxer_t *muxer_init(th_subscription_t *s, th_mux_output_t *cb, - void *opaque); +th_muxer_t *muxer_create(th_transport_t *t, th_mux_output_t *cb, void *opaque); -void muxer_deinit(th_muxer_t *tm, th_subscription_t *s); +void muxer_destroy(th_muxer_t *tm); void muxer_play(th_muxer_t *tm, int64_t toffset);