avformat/ffmdec: Add cleaner API for ffserver to interface without depending on internal ABI

Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2015-11-20 03:08:34 +01:00
parent bf2590aed3
commit 3444c00aab
3 changed files with 17 additions and 1 deletions

View File

@ -42,6 +42,7 @@ enum {
}; };
typedef struct FFMContext { typedef struct FFMContext {
const AVClass *class;
/* only reading mode */ /* only reading mode */
int64_t write_index, file_size; int64_t write_index, file_size;
int read_state; int read_state;
@ -55,6 +56,7 @@ typedef struct FFMContext {
uint8_t *packet_ptr, *packet_end; uint8_t *packet_ptr, *packet_end;
uint8_t packet[FFM_PACKET_SIZE]; uint8_t packet[FFM_PACKET_SIZE];
int64_t start_time; int64_t start_time;
int server_attached;
} FFMContext; } FFMContext;
#endif /* AVFORMAT_FFM_H */ #endif /* AVFORMAT_FFM_H */

View File

@ -731,6 +731,19 @@ static int ffm_probe(AVProbeData *p)
return 0; return 0;
} }
static const AVOption options[] = {
{"server_attached", NULL, offsetof(FFMContext, server_attached), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_EXPORT },
{"ffm_write_index", NULL, offsetof(FFMContext, write_index), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, 1, AV_OPT_FLAG_EXPORT },
{"ffm_file_size", NULL, offsetof(FFMContext, file_size), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, 1, AV_OPT_FLAG_EXPORT },
{ NULL },
};
static const AVClass ffm_class = {
.class_name = "ffm demuxer",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
AVInputFormat ff_ffm_demuxer = { AVInputFormat ff_ffm_demuxer = {
.name = "ffm", .name = "ffm",
.long_name = NULL_IF_CONFIG_SMALL("FFM (FFserver live feed)"), .long_name = NULL_IF_CONFIG_SMALL("FFM (FFserver live feed)"),
@ -740,4 +753,5 @@ AVInputFormat ff_ffm_demuxer = {
.read_packet = ffm_read_packet, .read_packet = ffm_read_packet,
.read_close = ffm_close, .read_close = ffm_close,
.read_seek = ffm_seek, .read_seek = ffm_seek,
.priv_class = &ffm_class,
}; };

View File

@ -30,7 +30,7 @@
#include "libavutil/version.h" #include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 57 #define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 16 #define LIBAVFORMAT_VERSION_MINOR 17
#define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \