Remove "mux"ing code which has been replaced with the "streaming" components
This commit is contained in:
parent
3086de63e0
commit
bdc0941d92
5 changed files with 2 additions and 280 deletions
183
mux.c
183
mux.c
|
@ -1,183 +0,0 @@
|
|||
/*
|
||||
* tvheadend, Muxing
|
||||
* Copyright (C) 2007 Andreas Öman
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tvhead.h"
|
||||
#include "transports.h"
|
||||
#include "subscriptions.h"
|
||||
#include "psi.h"
|
||||
#include "buffer.h"
|
||||
#include "mux.h"
|
||||
|
||||
/**
|
||||
* pause playback
|
||||
*/
|
||||
void
|
||||
muxer_pause(th_muxer_t *tm)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* playback start
|
||||
*/
|
||||
void
|
||||
muxer_play(th_muxer_t *tm, int64_t toffset)
|
||||
{
|
||||
th_transport_t *t = tm->tm_transport;
|
||||
|
||||
transport_link_muxer(t, tm);
|
||||
|
||||
if(toffset == AV_NOPTS_VALUE) {
|
||||
/* continue from last playback */
|
||||
tm->tm_offset = 0;
|
||||
} else {
|
||||
tm->tm_offset = toffset;
|
||||
}
|
||||
tm->tm_status = TM_PLAY;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void
|
||||
mux_new_packet_for_stream(th_muxer_t *tm, th_muxstream_t *tms, th_pkt_t *pkt)
|
||||
{
|
||||
if(tm->tm_offset == 0) {
|
||||
/* Direct playback, pass it on at once */
|
||||
tm->tm_output(tm->tm_opaque, tms, pkt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void
|
||||
mux_new_packet(th_muxer_t *tm, th_stream_t *st, th_pkt_t *pkt)
|
||||
{
|
||||
th_muxstream_t *tms;
|
||||
|
||||
pkt_store(st, pkt); /* need to keep packet around */
|
||||
|
||||
switch(tm->tm_status) {
|
||||
case TM_IDLE:
|
||||
break;
|
||||
|
||||
case TM_WAITING_FOR_LOCK:
|
||||
break;
|
||||
|
||||
case TM_PLAY:
|
||||
LIST_FOREACH(tms, &tm->tm_streams, tms_muxer_link0) {
|
||||
if(tms->tms_stream == st) {
|
||||
mux_new_packet_for_stream(tm, tms, pkt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TM_PAUSE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* TS Muxer
|
||||
*/
|
||||
th_muxer_t *
|
||||
muxer_create(th_transport_t *t, th_mux_output_t *cb, void *opaque)
|
||||
{
|
||||
th_stream_t *st;
|
||||
th_muxer_t *tm;
|
||||
th_muxstream_t *tms;
|
||||
|
||||
tm = calloc(1, sizeof(th_muxer_t));
|
||||
tm->tm_transport = t;
|
||||
|
||||
tm->tm_output = cb;
|
||||
tm->tm_opaque = opaque;
|
||||
tm->tm_new_pkt = mux_new_packet;
|
||||
|
||||
|
||||
LIST_FOREACH(st, &t->tht_streams, st_link) {
|
||||
|
||||
switch(st->st_type) {
|
||||
case HTSTV_MPEG2VIDEO:
|
||||
case HTSTV_MPEG2AUDIO:
|
||||
case HTSTV_AC3:
|
||||
case HTSTV_H264:
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
tms = calloc(1, sizeof(th_muxstream_t));
|
||||
tms->tms_muxer = tm;
|
||||
tms->tms_stream = st;
|
||||
|
||||
|
||||
LIST_INSERT_HEAD(&tm->tm_streams, tms, tms_muxer_link0);
|
||||
}
|
||||
return tm;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static void
|
||||
tms_destroy(th_muxstream_t *tms)
|
||||
{
|
||||
LIST_REMOVE(tms, tms_muxer_link0);
|
||||
|
||||
// dtimer_disarm(&tms->tms_timer);
|
||||
free(tms);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void
|
||||
muxer_destroy(th_muxer_t *tm)
|
||||
{
|
||||
th_muxstream_t *tms;
|
||||
|
||||
transport_unlink_muxer(tm);
|
||||
|
||||
while((tms = LIST_FIRST(&tm->tm_streams)) != NULL)
|
||||
tms_destroy(tms);
|
||||
|
||||
free(tm);
|
||||
}
|
||||
|
30
mux.h
30
mux.h
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* tvheadend, Stream muxer
|
||||
* Copyright (C) 2007 Andreas Öman
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MUX_H
|
||||
#define MUX_H
|
||||
|
||||
th_muxer_t *muxer_create(th_transport_t *t, th_mux_output_t *cb, void *opaque);
|
||||
|
||||
void muxer_destroy(th_muxer_t *tm);
|
||||
|
||||
void muxer_play(th_muxer_t *tm, int64_t toffset);
|
||||
|
||||
void muxer_pause(th_muxer_t *tm);
|
||||
|
||||
#endif /* MUX_H */
|
|
@ -106,7 +106,7 @@ parse_raw_mpeg(th_transport_t *t, th_stream_t *st, uint8_t *data,
|
|||
{
|
||||
th_subscription_t *s;
|
||||
|
||||
if(LIST_FIRST(&t->tht_muxers) == NULL) {
|
||||
if(LIST_FIRST(&t->tht_streaming_pad.sp_targets) == NULL) {
|
||||
/* No muxers. However, subscriptions may force demultiplex
|
||||
for other reasons (serviceprobe does this) */
|
||||
LIST_FOREACH(s, &t->tht_subscriptions, ths_transport_link)
|
||||
|
|
|
@ -81,7 +81,7 @@ transport_stop(th_transport_t *t)
|
|||
|
||||
t->tht_tt_commercial_advice = COMMERCIAL_UNKNOWN;
|
||||
|
||||
assert(LIST_FIRST(&t->tht_muxers) == NULL);
|
||||
assert(LIST_FIRST(&t->tht_streaming_pad.sp_targets) == NULL);
|
||||
assert(LIST_FIRST(&t->tht_subscriptions) == NULL);
|
||||
|
||||
/**
|
||||
|
|
65
tvhead.h
65
tvhead.h
|
@ -678,14 +678,6 @@ typedef struct th_transport {
|
|||
int tht_scrambled;
|
||||
int tht_caid;
|
||||
|
||||
/**
|
||||
* List of muxers
|
||||
*
|
||||
* The parsing code will invoke each of these whene complete
|
||||
* packets have been assembled.
|
||||
*/
|
||||
struct th_muxer_list tht_muxers;
|
||||
|
||||
/**
|
||||
* Used by parsing code to normalize timestamp to zero
|
||||
*/
|
||||
|
@ -813,63 +805,6 @@ typedef struct th_muxstream {
|
|||
} th_muxstream_t;
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
typedef void (th_mux_newpkt_t)(struct th_muxer *tm, th_stream_t *st,
|
||||
th_pkt_t *pkt);
|
||||
|
||||
typedef struct th_muxer {
|
||||
|
||||
th_mux_newpkt_t *tm_new_pkt;
|
||||
|
||||
LIST_ENTRY(th_muxer) tm_transport_link;
|
||||
th_transport_t *tm_transport;
|
||||
|
||||
int64_t tm_offset;
|
||||
|
||||
struct th_muxstream_list tm_streams;
|
||||
|
||||
th_mux_output_t *tm_output;
|
||||
void *tm_opaque;
|
||||
|
||||
|
||||
enum {
|
||||
TM_IDLE,
|
||||
TM_WAITING_FOR_LOCK,
|
||||
TM_PLAY,
|
||||
TM_PAUSE,
|
||||
} tm_status;
|
||||
|
||||
} th_muxer_t;
|
||||
|
||||
|
||||
/**
|
||||
* Output muxer for usage via ffmpeg (avformat)
|
||||
*/
|
||||
typedef struct th_ffmuxer {
|
||||
th_muxer_t tffm_muxer;
|
||||
|
||||
enum {
|
||||
TFFM_STOP,
|
||||
TFFM_WAIT_SUBSCRIPTION,
|
||||
TFFM_WAIT_FOR_START,
|
||||
TFFM_WAIT_AUDIO_LOCK,
|
||||
TFFM_WAIT_VIDEO_LOCK,
|
||||
TFFM_RUNNING,
|
||||
TFFM_COMMERCIAL,
|
||||
|
||||
} tffm_state;
|
||||
|
||||
int tffm_header_written;
|
||||
|
||||
char *tffm_printname;
|
||||
|
||||
struct AVFormatContext *tffm_avfctx;
|
||||
} th_ffmuxer_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue