Use inline functions for the PID lookup optimizations
This commit is contained in:
parent
60082d68d4
commit
eb6756d002
3 changed files with 34 additions and 25 deletions
|
@ -603,17 +603,17 @@ void mpegts_mux_remove_subscriber(mpegts_mux_t *mm, th_subscription_t *s, int re
|
|||
int mpegts_mux_subscribe(mpegts_mux_t *mm, const char *name, int weight);
|
||||
void mpegts_mux_unsubscribe_by_name(mpegts_mux_t *mm, const char *name);
|
||||
|
||||
#define mpegts_mux_find_pid(mm, pid, create) ({ \
|
||||
mpegts_pid_t *__mp; \
|
||||
if ((mm)->mm_last_pid != (pid)) \
|
||||
__mp = mpegts_mux_find_pid_(mm, pid, create); \
|
||||
else \
|
||||
__mp = (mm)->mm_last_mp; \
|
||||
__mp; \
|
||||
})
|
||||
|
||||
mpegts_pid_t *mpegts_mux_find_pid_(mpegts_mux_t *mm, int pid, int create);
|
||||
|
||||
static inline mpegts_pid_t *
|
||||
mpegts_mux_find_pid(mpegts_mux_t *mm, int pid, int create)
|
||||
{
|
||||
if (mm->mm_last_pid != pid)
|
||||
return mpegts_mux_find_pid_(mm, pid, create);
|
||||
else
|
||||
return mm->mm_last_mp;
|
||||
}
|
||||
|
||||
size_t mpegts_input_recv_packets
|
||||
(mpegts_input_t *mi, mpegts_mux_instance_t *mmi, uint8_t *tsb, size_t len,
|
||||
int64_t *pcr, uint16_t *pcr_pid, const char *name);
|
||||
|
@ -640,10 +640,13 @@ void mpegts_input_close_pid
|
|||
|
||||
void mpegts_table_dispatch
|
||||
(const uint8_t *sec, size_t r, void *mt);
|
||||
#define mpegts_table_release(t) \
|
||||
do { if(--mt->mt_refcount == 0) mpegts_table_release_(mt); } while (0)
|
||||
void mpegts_table_release_
|
||||
(mpegts_table_t *mt);
|
||||
static inline void mpegts_table_release
|
||||
(mpegts_table_t *mt)
|
||||
{
|
||||
if(--mt->mt_refcount == 0) mpegts_table_release_(mt);
|
||||
}
|
||||
mpegts_table_t *mpegts_table_add
|
||||
(mpegts_mux_t *mm, int tableid, int mask,
|
||||
mpegts_table_callback_t callback, void *opaque,
|
||||
|
|
|
@ -450,17 +450,17 @@ service_instance_t *service_find_instance(struct service *s,
|
|||
int *error,
|
||||
int weight);
|
||||
|
||||
#define service_stream_find(t, pid) ({ \
|
||||
elementary_stream_t *__es; \
|
||||
if ((t)->s_last_pid != (pid)) \
|
||||
__es = service_stream_find_(t, pid); \
|
||||
else \
|
||||
__es = (t)->s_last_es; \
|
||||
__es; \
|
||||
})
|
||||
|
||||
elementary_stream_t *service_stream_find_(service_t *t, int pid);
|
||||
|
||||
static inline elementary_stream_t *
|
||||
service_stream_find(service_t *t, int pid)
|
||||
{
|
||||
if (t->s_last_pid != (pid))
|
||||
return service_stream_find_(t, pid);
|
||||
else
|
||||
return t->s_last_es;
|
||||
}
|
||||
|
||||
elementary_stream_t *service_stream_create(service_t *t, int pid,
|
||||
streaming_component_type_t type);
|
||||
|
||||
|
@ -485,9 +485,12 @@ void service_remove_subscriber(service_t *t, struct th_subscription *s,
|
|||
|
||||
void service_set_streaming_status_flags_(service_t *t, int flag);
|
||||
|
||||
#define service_set_streaming_status_flags(t, flag) \
|
||||
do { if (((t)->s_streaming_status & flag) != flag) \
|
||||
service_set_streaming_status_flags_(t, flag); } while (0)
|
||||
static inline void
|
||||
service_set_streaming_status_flags(service_t *t, int flag)
|
||||
{
|
||||
if ((t->s_streaming_status & flag) != flag)
|
||||
service_set_streaming_status_flags_(t, flag);
|
||||
}
|
||||
|
||||
struct streaming_start;
|
||||
struct streaming_start *service_build_stream_start(service_t *t);
|
||||
|
|
|
@ -111,8 +111,11 @@ void streaming_start_unref(streaming_start_t *ss);
|
|||
|
||||
streaming_start_t *streaming_start_copy(const streaming_start_t *src);
|
||||
|
||||
#define streaming_pad_probe_type(sp, smt) \
|
||||
(((sp)->sp_reject_filter & SMT_TO_MASK(smt)) == 0)
|
||||
static inline int
|
||||
streaming_pad_probe_type(streaming_pad_t *sp, streaming_message_type_t smt)
|
||||
{
|
||||
return (sp->sp_reject_filter & SMT_TO_MASK(smt)) == 0;
|
||||
}
|
||||
|
||||
const char *streaming_code2txt(int code);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue