* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define _GNU_SOURCE
-#include <stdlib.h>
#include <pthread.h>
-
#include <assert.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
#include <errno.h>
-
#include <stdio.h>
#include <unistd.h>
#include <string.h>
-#include <libhts/htscfg.h>
-
#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
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;
{
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:
* 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;
LIST_INSERT_HEAD(&tm->tm_streams, tms, tms_muxer_link0);
}
-
- s->ths_muxer = tm;
return tm;
}
}
-/*
+/**
*
*/
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);
#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);