Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
service/mpegts: add raw service type and raw PID handling
  • Loading branch information
perexg committed Mar 11, 2015
1 parent 2b6dd0f commit 2dfc271
Show file tree
Hide file tree
Showing 19 changed files with 568 additions and 388 deletions.
2 changes: 1 addition & 1 deletion src/dvr/dvr_rec.c
Expand Up @@ -85,7 +85,7 @@ dvr_rec_subscribe(dvr_entry_t *de)
return;
}

de->de_s = subscription_create_from_channel(prch, weight,
de->de_s = subscription_create_from_channel(prch, NULL, weight,
buf, prch->prch_flags,
NULL, NULL, NULL);
if (de->de_s == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/htsp_server.c
Expand Up @@ -2023,7 +2023,7 @@ htsp_method_subscribe(htsp_connection_t *htsp, htsmsg_t *in)

tvhdebug("htsp", "%s - subscribe to %s using profile %s\n",
htsp->htsp_logname, channel_get_name(ch), pro->pro_name ?: "");
hs->hs_s = subscription_create_from_channel(&hs->hs_prch, weight,
hs->hs_s = subscription_create_from_channel(&hs->hs_prch, NULL, weight,
htsp->htsp_logname,
SUBSCRIPTION_STREAMING,
htsp->htsp_peername,
Expand Down
30 changes: 22 additions & 8 deletions src/input/mpegts.h
Expand Up @@ -146,12 +146,14 @@ typedef struct mpegts_table_state
typedef struct mpegts_pid_sub
{
RB_ENTRY(mpegts_pid_sub) mps_link;
LIST_ENTRY(mpegts_pid_sub) mps_svc_link;
#define MPS_NONE 0x0
#define MPS_STREAM 0x1
#define MPS_TABLE 0x2
#define MPS_FTABLE 0x4
#define MPS_SERVICE 0x8
LIST_ENTRY(mpegts_pid_sub) mps_svcraw_link;
#define MPS_NONE 0x00
#define MPS_ALL 0x01
#define MPS_RAW 0x02
#define MPS_STREAM 0x04
#define MPS_SERVICE 0x08
#define MPS_TABLE 0x10
#define MPS_FTABLE 0x20
int mps_type;
void *mps_owner;
} mpegts_pid_sub_t;
Expand Down Expand Up @@ -429,11 +431,18 @@ struct mpegts_mux
LIST_HEAD(, mpegts_mux_instance) mm_instances;
mpegts_mux_instance_t *mm_active;

/*
* Raw subscriptions
*/

LIST_HEAD(, th_subscription) mm_raw_subs;

/*
* Data processing
*/

RB_HEAD(, mpegts_pid) mm_pids;
LIST_HEAD(, mpegts_pid_sub) mm_all_subs;
int mm_last_pid;
mpegts_pid_t *mm_last_mp;

Expand Down Expand Up @@ -578,8 +587,6 @@ struct mpegts_mux_instance
mpegts_mux_t *mmi_mux;
mpegts_input_t *mmi_input;

LIST_HEAD(,th_subscription) mmi_subs;

tvh_input_stream_stats_t mmi_stats;

int mmi_tune_failed;
Expand Down Expand Up @@ -745,6 +752,8 @@ int mpegts_input_class_network_set ( void *o, const void *p );
htsmsg_t *mpegts_input_class_network_enum ( void *o );
char *mpegts_input_class_network_rend ( void *o );

int mpegts_mps_cmp( mpegts_pid_sub_t *a, mpegts_pid_sub_t *b );

void mpegts_network_register_builder
( const idclass_t *idc,
mpegts_network_t *(*build)(const idclass_t *idc, htsmsg_t *conf) );
Expand Down Expand Up @@ -877,6 +886,9 @@ mpegts_pid_t * mpegts_input_open_pid
void mpegts_input_close_pid
( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner );

void mpegts_input_close_pids
( mpegts_input_t *mi, mpegts_mux_t *mm, int type, void *owner );

static inline void
tsdebug_write(mpegts_mux_t *mm, uint8_t *buf, size_t len)
{
Expand Down Expand Up @@ -943,6 +955,8 @@ mpegts_service_t *mpegts_service_create0
mpegts_service_create0(calloc(1, sizeof(mpegts_service_t)),\
&mpegts_service_class, u, m, s, p, c)

mpegts_service_t *mpegts_service_create_raw(mpegts_mux_t *mm);

mpegts_service_t *mpegts_service_find
( mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid, int create, int *save );

Expand Down
7 changes: 0 additions & 7 deletions src/input/mpegts/iptv/iptv.c
Expand Up @@ -140,13 +140,6 @@ iptv_input_get_weight ( mpegts_input_t *mi, int flags )
if (!iptv_input_is_free(mi)) {
w = 1000000;

/* Direct subs */
LIST_FOREACH(mmi, &mi->mi_mux_active, mmi_active_link) {
LIST_FOREACH(ths, &mmi->mmi_subs, ths_mmi_link) {
w = MIN(w, ths->ths_weight);
}
}

/* Service subs */
pthread_mutex_lock(&mi->mi_output_lock);
LIST_FOREACH(s, &mi->mi_transports, s_active_link) {
Expand Down

0 comments on commit 2dfc271

Please sign in to comment.