75 lines
3.6 KiB
C
75 lines
3.6 KiB
C
#ifndef AVIO_LPBUF_HEADER
|
|
#define AVIO_LPBUF_HEADER
|
|
#include <libavformat/avio.h>
|
|
#include <libavformat/url.h>
|
|
|
|
#include <pthread.h>
|
|
#include "stdio.h"
|
|
|
|
#define lock_t pthread_mutex_t
|
|
#define lp_lock_init(x, v) pthread_mutex_init(x, v)
|
|
#define lp_lock(x) pthread_mutex_lock(x)
|
|
#define lp_unlock(x) pthread_mutex_unlock(x)
|
|
#define lp_trylock(x) pthread_mutex_trylock(x)
|
|
|
|
/*URL flags*/
|
|
#define LESS_READ_SEEK (0x10000)
|
|
#define MORE_READ_SEEK (0x20000)
|
|
#define LESS_BUFF_DATA (0x40000) //do not buffering more data,just buffered need..
|
|
#define NO_READ_RETRY (0x80000) //do not retry read,if have get data and then get eagain.
|
|
#define PLAYER_ON_SEEKING (0x100000) //on seek now,
|
|
#define URL_SEEK_FAIL_NO_BACK (0x200000)
|
|
|
|
#define AVSEEK_TO_TIME 0x30000
|
|
#define AVSEEK_BUFFERED_TIME 0x40000
|
|
#define AVSEEK_FULLTIME 0x50000
|
|
|
|
#define AVSEEK_SLICE_BYINDEX (0x80000 + 1)
|
|
#define AVSEEK_SLICE_BYTIME (0x80000 + 2)
|
|
#define AVSEEK_ITEM_TIME (0x80000 + 3)
|
|
#define AVSEEK_CMF_TS_TIME (0x80000 + 4)
|
|
#define AVSEEK_CURL_HTTP_KEEPALIVE (0x80000 + 5)
|
|
#define AVSEEK_LOOPBUFFER_OFFSET (0x80000 + 6)
|
|
|
|
#define AVERROR_BSF_NOT_FOUND (-MKTAG(0xF8, 'B', 'S', 'F')) ///< Bitstream filter not found
|
|
#define AVERROR_DECODER_NOT_FOUND (-MKTAG(0xF8, 'D', 'E', 'C')) ///< Decoder not found
|
|
#define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8, 'D', 'E', 'M')) ///< Demuxer not found
|
|
#define AVERROR_ENCODER_NOT_FOUND (-MKTAG(0xF8, 'E', 'N', 'C')) ///< Encoder not found
|
|
#define AVERROR_EOF (-MKTAG('E', 'O', 'F', ' ')) ///< End of file
|
|
#define AVERROR_EXIT (-MKTAG('E', 'X', 'I', 'T')) ///< Immediate exit was requested; the called function should not be restarted
|
|
#define AVERROR_FILTER_NOT_FOUND (-MKTAG(0xF8, 'F', 'I', 'L')) ///< Filter not found
|
|
#define AVERROR_INVALIDDATA (-MKTAG('I', 'N', 'D', 'A')) ///< Invalid data found when processing input
|
|
#define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8, 'M', 'U', 'X')) ///< Muxer not found
|
|
#define AVERROR_OPTION_NOT_FOUND (-MKTAG(0xF8, 'O', 'P', 'T')) ///< Option not found
|
|
#define AVERROR_PATCHWELCOME (-MKTAG('P', 'A', 'W', 'E')) ///< Not yet implemented in FFmpeg, patches welcome
|
|
#define AVERROR_PROTOCOL_NOT_FOUND (-MKTAG(0xF8, 'P', 'R', 'O')) ///< Protocol not found
|
|
#define AVERROR_STREAM_NOT_FOUND (-MKTAG(0xF8, 'S', 'T', 'R')) ///< Stream not found
|
|
#define AVERROR_STREAM_SIZE_NOTVALID (-MKTAG(0xF8, 'E', 'S', 'Z')) ///< Stream not found
|
|
#define AVERROR_MODULE_UNSUPPORT (-MKTAG(0xF8, 'U', 'S', 'T')) ///< module not support the function
|
|
|
|
#define IO_LP_BUFFER_SIZE (1024 * 1024 * 64)
|
|
#define IO_LP_BUFFER_MINI_SIZE (1024 * 32)
|
|
|
|
int url_lpopen(URLContext *s, int size);
|
|
int url_lpfillbuffer(URLContext *s, int size);
|
|
int64_t url_lpexseek(URLContext *s, int64_t offset, int whence);
|
|
int64_t url_lpexseekoffset(URLContext *s, int64_t offset);
|
|
int url_lpread(void *void_p, unsigned char *buf, int size);
|
|
int64_t url_lpseek(void *void_p, int64_t offset, int whence);
|
|
int url_lpreset(URLContext *s);
|
|
int url_lpfree(URLContext *s);
|
|
int url_lp_intelligent_buffering(URLContext *s, int size);
|
|
int url_lp_getbuffering_size(URLContext *s, int *forward_data, int *back_data);
|
|
int url_lp_set_seekflags(URLContext *s, int seekflagmask);
|
|
int url_lp_clear_seekflags(URLContext *s, int seekflagmask);
|
|
int64_t url_lp_get_buffed_pos(URLContext *s);
|
|
int64_t url_buffed_size(AVIOContext *s);
|
|
|
|
int url_lpopen_ex(URLContext *s,
|
|
int size,
|
|
int flags,
|
|
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
|
|
int64_t (*seek)(void *opaque, int64_t offset, int whence));
|
|
|
|
#endif
|