rfc3984.h 1.96 KB
Newer Older
aymeric's avatar
aymeric committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2006  Simon MORLAT (simon.morlat@linphone.org)

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 2
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#ifndef rfc3984_h
#define rfc3984_h

Simon Morlat's avatar
Simon Morlat committed
23 24
#include <mediastreamer2/mscommon.h>
#include <mediastreamer2/msqueue.h>
aymeric's avatar
aymeric committed
25

Simon Morlat's avatar
Simon Morlat committed
26 27 28 29 30
/*
This file declares an API useful to pack/unpack H264 nals as described in RFC3984
It is part of the public API to allow external H264 plugins use this api.
*/

aymeric's avatar
aymeric committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44
#ifdef __cplusplus
extern "C"{
#endif

typedef struct Rfc3984Context{
	MSQueue q;
	mblk_t *m;
	int maxsz;
	uint32_t last_ts;
	uint8_t mode;
	bool_t stap_a_allowed;
	uint8_t reserved;
} Rfc3984Context;

Simon Morlat's avatar
Simon Morlat committed
45 46
MS2_PUBLIC Rfc3984Context *rfc3984_new(void);
MS2_PUBLIC void rfc3984_destroy(Rfc3984Context *ctx);
47

aymeric's avatar
aymeric committed
48 49
void rfc3984_init(Rfc3984Context *ctx);

Simon Morlat's avatar
Simon Morlat committed
50
MS2_PUBLIC void rfc3984_set_mode(Rfc3984Context *ctx, int mode);
aymeric's avatar
aymeric committed
51 52

/* some stupid phones don't decode STAP-A packets ...*/
Simon Morlat's avatar
Simon Morlat committed
53
MS2_PUBLIC void rfc3984_enable_stap_a(Rfc3984Context *ctx, bool_t yesno);
aymeric's avatar
aymeric committed
54 55

/*process NALUs and pack them into rtp payloads */
Simon Morlat's avatar
Simon Morlat committed
56
MS2_PUBLIC void rfc3984_pack(Rfc3984Context *ctx, MSQueue *naluq, MSQueue *rtpq, uint32_t ts);
aymeric's avatar
aymeric committed
57 58

/*process incoming rtp data and output NALUs, whenever possible*/
Simon Morlat's avatar
Simon Morlat committed
59
MS2_PUBLIC void rfc3984_unpack(Rfc3984Context *ctx, mblk_t *im, MSQueue *naluq);
aymeric's avatar
aymeric committed
60 61 62 63 64 65 66 67 68

void rfc3984_uninit(Rfc3984Context *ctx);

#ifdef __cplusplus
}
#endif

#endif