www.pudn.com > RTP通用开发库(for Linux).rar > frame.h


/*-------------------------------------------------------------------------
 * frame.h
 *-------------------------------------------------------------------------
 */

#ifndef FRAME_H
#define FRAME_H

#define SYN_FRAME_FRAG	-5

struct frameparam {
  int fp_channels;	/* channels in stream		          */

  /* 
   * Returns true when beginning of RTP data lies on a frame boundry.
   */
  bool (*fp_framealigned)(struct rtp *, int);

  /* Returns bytes of per-packet headers.
   * Per-packet headers are extra headers (possibly RTP extension
   * headers that appear once at start of RTP data regardless of
   * number of frames in packet (e.g., MPEG headers described in
   * RFC 2250).
   */
  int (*fp_dataoffset)(struct rtp *, int); 

  /* 
   * Returns frame duration in the stream's media time units.
   */
  mediatime_t (*fp_frameduration)(char *, int);

  /* 
   * Returns frame length in bytes.
   */
  int (*fp_framelength)(char *, int); 
};

/* 
 * Extra read parameters needed for frame read. Passed as structure
 * as last parameter of synread().
 */
struct framereadparam {
  char *fr_extraheaderbuf;    /* buffer to hold per-packet headers   */
  int   fr_extraheaderbuflen; /* length of buffer; contains bytes
				 copied on return from synread().    */
  bool  fr_mark;              /* True on return if arker bit present */
};

int frameread(struct synsession *, struct synstream *, struct timespec *, mediatime_t *, char *, int, char *, int *, bool *);
int framereadfragmented(struct synsession *, struct synstream *, struct timespec *, mediatime_t *, char *, int, char *, int *, bool *, mediatime_t);
int framereadnonfragmented(struct synsession *, struct synstream *, struct timespec *, mediatime_t *, char *, int, char *, int *, struct rtpln *, char *, mediatime_t, mediatime_t, int);
#endif