Opened 14 years ago

Last modified 13 years ago

#1284 closed enhancement

Media event framework — at Version 7

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-2.0-alpha
Component: pjmedia Version: 2.0-dev-branch
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description (last modified by bennylp)

Framework to publish and consume media events in a media flow. The event framework can be used by any media types (audio and video) and any objects.

Overview of the framework (pjmedia/event.h):

typedef enum pjmedia_event_type
{
    PJMEDIA_EVENT_NONE,
    PJMEDIA_EVENT_FMT_CHANGED,
    PJMEDIA_EVENT_WND_CLOSING,
    PJMEDIA_EVENT_WND_CLOSED,
    PJMEDIA_EVENT_WND_RESIZED,
    PJMEDIA_EVENT_MOUSE_BTN_DOWN,
    PJMEDIA_EVENT_KEY_FRAME_FOUND,
    PJMEDIA_EVENT_KEY_FRAME_MISSING,
    PJMEDIA_EVENT_USER = 100
} pjmedia_event_type;

typedef struct pjmedia_event
{
    pjmedia_event_type			 type;
    pj_timestamp		 	 timestamp;
    unsigned				 proc_cnt;
    const pjmedia_event_publisher	*epub;

    union {
	pjmedia_event_fmt_changed_data		fmt_changed;
	pjmedia_event_wnd_resized_data		wnd_resized;
	pjmedia_event_wnd_closing_data		wnd_closing;
	pjmedia_event_wnd_closed_data		wnd_closed;
	pjmedia_event_mouse_btn_down_data	mouse_btn_down;
	pjmedia_event_key_frame_found_data	key_frm_found;
	pjmedia_event_key_frame_missing_data	key_frm_missing;
	pjmedia_event_user_data			user;
	void					*ptr;
    } data;
} pjmedia_event;

typedef pj_status_t pjmedia_event_cb(pjmedia_event_subscription *esub,
				     pjmedia_event *event);

struct pjmedia_event_subscription
{
    PJ_DECL_LIST_MEMBER(pjmedia_event_subscription);
    pjmedia_event_cb	*cb;
    void		*user_data;
};

struct pjmedia_event_publisher
{
    pjmedia_event_subscription	subscription_list;
};

PJ_DECL(void) pjmedia_event_init(pjmedia_event *event,
                                 pjmedia_event_type type,
                                 const pj_timestamp *ts,
                                 const pjmedia_event_publisher *epub);
PJ_DECL(void) pjmedia_event_publisher_init(pjmedia_event_publisher *epub);
PJ_DECL(void) pjmedia_event_subscription_init(pjmedia_event_subscription *esub,
                                              pjmedia_event_cb *cb,
                                              void *user_data);
PJ_DECL(pj_status_t) pjmedia_event_subscribe(pjmedia_event_publisher *epub,
                                             pjmedia_event_subscription *esub);
PJ_DECL(pj_status_t) pjmedia_event_unsubscribe(pjmedia_event_publisher *epub,
                                               pjmedia_event_subscription *esub);
PJ_DECL(pj_status_t) pjmedia_event_publish(pjmedia_event_publisher *epub,
                                           pjmedia_event *event);
PJ_DECL(pj_status_t) pjmedia_event_republish(pjmedia_event_publisher *esrc,
                                             pjmedia_event_publisher *epub,
                                             pjmedia_event_subscription *esub);

Change History (7)

comment:1 Changed 14 years ago by nanang

  • Description modified (diff)

comment:2 Changed 13 years ago by bennylp

  • Owner changed from nanang to bennylp
  • Status changed from new to assigned

comment:3 Changed 13 years ago by bennylp

  • Description modified (diff)
  • Summary changed from Event mechanism (e.g. format change) to Media event framework

comment:4 Changed 13 years ago by bennylp

  • Description modified (diff)

comment:5 Changed 13 years ago by bennylp

(In [3617]) Initial implementation of re #1284 (Event Framework). Current event has been converted to the new framework. Next to convert is codec event

comment:6 Changed 13 years ago by bennylp

  • Description modified (diff)

comment:7 Changed 13 years ago by bennylp

  • Description modified (diff)
Note: See TracTickets for help on using tickets.