diff --git a/ffmpeg/JNI/ffmpeg/config.h b/ffmpeg/JNI/ffmpeg/config.h index 3be7cb01..4a37cf0f 100644 --- a/ffmpeg/JNI/ffmpeg/config.h +++ b/ffmpeg/JNI/ffmpeg/config.h @@ -2585,6 +2585,12 @@ #define CONFIG_LIBSRT_PROTOCOL 0 #define CONFIG_LIBSSH_PROTOCOL 0 #define CONFIG_LIBSMBCLIENT_PROTOCOL 0 +#define CONFIG_IJKHTTPHOOK_PROTOCOL 1 +#define CONFIG_IJKLONGURL_PROTOCOL 1 +#define CONFIG_IJKMEDIADATASOURCE_PROTOCOL 1 +#define CONFIG_IJKSEGMENT_PROTOCOL 1 +#define CONFIG_IJKTCPHOOK_PROTOCOL 1 +#define CONFIG_IJKIO_PROTOCOL 1 #define CONFIG_LIBSMB2_PROTOCOL 1 #define CONFIG_USB_PROTOCOL 1 #define CONFIG_LIBZMQ_PROTOCOL 0 diff --git a/ffmpeg/JNI/ffmpeg/doc/config.texi b/ffmpeg/JNI/ffmpeg/doc/config.texi index 928e7b3b..35f7df89 100644 --- a/ffmpeg/JNI/ffmpeg/doc/config.texi +++ b/ffmpeg/JNI/ffmpeg/doc/config.texi @@ -2570,6 +2570,12 @@ @c @set config-libsrt-protocol no @c @set config-libssh-protocol no @c @set config-libsmbclient-protocol no +@set config-ijkhttphook-protocol yes +@set config-ijklongurl-protocol yes +@set config-ijkmediadatasource-protocol yes +@set config-ijksegment-protocol yes +@set config-ijktcphook-protocol yes +@set config-ijkio-protocol yes @set config-libsmb2-protocol yes @set config-usb-protocol yes @c @set config-libzmq-protocol no diff --git a/ffmpeg/JNI/ffmpeg/ffbuild/config.mak b/ffmpeg/JNI/ffmpeg/ffbuild/config.mak index 363bbb52..efb03455 100644 --- a/ffmpeg/JNI/ffmpeg/ffbuild/config.mak +++ b/ffmpeg/JNI/ffmpeg/ffbuild/config.mak @@ -2729,6 +2729,12 @@ CONFIG_UDP_PROTOCOL=yes !CONFIG_LIBSRT_PROTOCOL=yes !CONFIG_LIBSSH_PROTOCOL=yes !CONFIG_LIBSMBCLIENT_PROTOCOL=yes +CONFIG_IJKHTTPHOOK_PROTOCOL=yes +CONFIG_IJKLONGURL_PROTOCOL=yes +CONFIG_IJKMEDIADATASOURCE_PROTOCOL=yes +CONFIG_IJKSEGMENT_PROTOCOL=yes +CONFIG_IJKTCPHOOK_PROTOCOL=yes +CONFIG_IJKIO_PROTOCOL=yes CONFIG_LIBSMB2_PROTOCOL=yes CONFIG_USB_PROTOCOL=yes !CONFIG_LIBZMQ_PROTOCOL=yes diff --git a/ffmpeg/JNI/ffmpeg/libavformat/Makefile b/ffmpeg/JNI/ffmpeg/libavformat/Makefile index 08227ed4..32e5d25e 100644 --- a/ffmpeg/JNI/ffmpeg/libavformat/Makefile +++ b/ffmpeg/JNI/ffmpeg/libavformat/Makefile @@ -23,6 +23,7 @@ OBJS = allformats.o \ sdp.o \ url.o \ utils.o \ + ijkutils.o \ OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o diff --git a/ffmpeg/JNI/ffmpeg/libavformat/dashdec.c b/ffmpeg/JNI/ffmpeg/libavformat/dashdec.c index 5bbe5d39..4cbbfaf7 100644 --- a/ffmpeg/JNI/ffmpeg/libavformat/dashdec.c +++ b/ffmpeg/JNI/ffmpeg/libavformat/dashdec.c @@ -167,6 +167,9 @@ typedef struct DASHContext { int is_init_section_common_video; int is_init_section_common_audio; + char *io_manager_ctx; + char *app_ctx; + } DASHContext; static int ishttp(char *url) @@ -439,6 +442,8 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, } } else if (av_strstart(proto_name, "http", NULL)) { ; + } else if (av_strstart(proto_name, "ijkio", NULL)) { + ; } else return AVERROR_INVALIDDATA; @@ -449,6 +454,10 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5)) return AVERROR_INVALIDDATA; + av_dict_set( &tmp, "ijkiomanager", c->io_manager_ctx, 0); + av_dict_set( &tmp, "ijkapplication", c->app_ctx, 0); + av_dict_set_int( &tmp, "medialive", (int64_t)c->is_live, 0); + av_freep(pb); ret = avio_open2(pb, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp); if (ret >= 0) { @@ -1235,6 +1244,10 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in) close_in = 1; av_dict_copy(&opts, c->avio_opts, 0); + + av_dict_set( &opts, "ijkiomanager", c->io_manager_ctx, 0); + av_dict_set( &opts, "ijkapplication", c->app_ctx, 0); + ret = avio_open2(&in, url, AVIO_FLAG_READ, c->interrupt_callback, &opts); av_dict_free(&opts); if (ret < 0) @@ -2379,6 +2392,10 @@ static const AVOption dash_options[] = { OFFSET(allowed_extensions), AV_OPT_TYPE_STRING, {.str = "aac,m4a,m4s,m4v,mov,mp4,webm,ts"}, INT_MIN, INT_MAX, FLAGS}, + { "dashiomanager", "DASHIOManagerContext", + OFFSET(io_manager_ctx), AV_OPT_TYPE_STRING, { .str = 0 }, 0, 0, FLAGS }, + { "dashapplication", "AVApplicationContext", + OFFSET(app_ctx), AV_OPT_TYPE_STRING, { .str = 0 }, 0, 0, FLAGS }, {NULL} }; diff --git a/ffmpeg/JNI/ffmpeg/libavformat/hls.c b/ffmpeg/JNI/ffmpeg/libavformat/hls.c index b2de1d54..5832c01f 100644 --- a/ffmpeg/JNI/ffmpeg/libavformat/hls.c +++ b/ffmpeg/JNI/ffmpeg/libavformat/hls.c @@ -216,6 +216,8 @@ typedef struct HLSContext { #ifdef MXTECHS int8_t local_file_only; #endif + char *io_manager_ctx; + char *app_ctx; } HLSContext; static void free_segment_dynarray(struct segment **segments, int n_segments) @@ -658,7 +660,9 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, is_http = 1; } else if (av_strstart(proto_name, "data", NULL)) { ; - } else + } else if (av_strstart(proto_name, "ijkio", NULL)) { + + } else return AVERROR_INVALIDDATA; if (!strncmp(proto_name, url, strlen(proto_name)) && url[strlen(proto_name)] == ':') @@ -798,6 +802,9 @@ static int parse_playlist(HLSContext *c, const char *url, if (c->http_persistent) av_dict_set(&opts, "multiple_requests", "1", 0); + av_dict_set( &opts, "ijkiomanager", c->io_manager_ctx, 0); + av_dict_set( &opts, "ijkapplication", c->app_ctx, 0); + ret = c->ctx->io_open(c->ctx, &in, url, AVIO_FLAG_READ, &opts); av_dict_free(&opts); if (ret < 0) @@ -1291,6 +1298,10 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg, if (c->http_persistent) av_dict_set(&opts, "multiple_requests", "1", 0); + av_dict_set( &opts, "ijkiomanager", c->io_manager_ctx, 0); + av_dict_set( &opts, "ijkapplication", c->app_ctx, 0); + av_dict_set_int( &opts, "medialive", (int64_t)!pls->finished, 0); + if (seg->size >= 0) { /* try to restrict the HTTP request to the part we want * (if this is in fact a HTTP request) */ @@ -2065,7 +2076,12 @@ static int hls_read_header(AVFormatContext *s) if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0) goto fail; - ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, NULL); + AVDictionary *opts = NULL; + av_dict_set( &opts, "ijkiomanager", c->io_manager_ctx, 0); + av_dict_set( &opts, "ijkapplication", c->app_ctx, 0); + av_dict_set_int( &opts, "medialive", (int64_t)!pls->finished, 0); + + ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, &opts); if (ret < 0) goto fail; @@ -2457,6 +2473,10 @@ static const AVOption hls_options[] = { #ifdef MXTECHS {"local-file-only", "Reject.", OFFSET(local_file_only), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM}, #endif + { "hlsiomanager", "HlsIOManagerContext", + OFFSET(io_manager_ctx), AV_OPT_TYPE_STRING, { .str = 0 }, 0, 0, FLAGS }, + { "hlsapplication", "AVApplicationContext", + OFFSET(app_ctx), AV_OPT_TYPE_STRING, { .str = 0 }, 0, 0, FLAGS }, {NULL} }; diff --git a/ffmpeg/JNI/ffmpeg/libavformat/ijkutils.c b/ffmpeg/JNI/ffmpeg/libavformat/ijkutils.c new file mode 100644 index 00000000..3b883fd6 --- /dev/null +++ b/ffmpeg/JNI/ffmpeg/libavformat/ijkutils.c @@ -0,0 +1,67 @@ +/* + * utils.c + * + * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2013 Zhang Rui + * + * This file is part of ijkPlayer. + * + * ijkPlayer is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * ijkPlayer 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with ijkPlayer; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include "url.h" + + +#define IJK_FF_PROTOCOL(x) \ +extern URLProtocol ff_##x##_protocol; \ +int ijkav_register_##x##_protocol(URLProtocol *protocol, int protocol_size); \ +int ijkav_register_##x##_protocol(URLProtocol *protocol, int protocol_size) \ +{ \ + if (protocol_size != sizeof(URLProtocol)) { \ + av_log(NULL, AV_LOG_ERROR, "ijkav_register_##x##_protocol: ABI mismatch.\n"); \ + return -1; \ + } \ + memcpy(&ff_##x##_protocol, protocol, protocol_size); \ + return 0; \ +} + +#define IJK_DUMMY_PROTOCOL(x) \ +IJK_FF_PROTOCOL(x); \ +static const AVClass ijk_##x##_context_class = { \ + .class_name = #x, \ + .item_name = av_default_item_name, \ + .version = LIBAVUTIL_VERSION_INT, \ + }; \ + \ +URLProtocol ff_##x##_protocol = { \ + .name = #x, \ + .url_open2 = ijkdummy_open, \ + .priv_data_size = 1, \ + .priv_data_class = &ijk_##x##_context_class, \ +}; + +static int ijkdummy_open(URLContext *h, const char *arg, int flags, AVDictionary **options) +{ + return -1; +} + +IJK_FF_PROTOCOL(async); +IJK_DUMMY_PROTOCOL(ijkmediadatasource); +IJK_DUMMY_PROTOCOL(ijkhttphook); +IJK_DUMMY_PROTOCOL(ijklongurl); +IJK_DUMMY_PROTOCOL(ijksegment); +IJK_DUMMY_PROTOCOL(ijktcphook); +IJK_DUMMY_PROTOCOL(ijkio); diff --git a/ffmpeg/JNI/ffmpeg/libavformat/protocol_list.c b/ffmpeg/JNI/ffmpeg/libavformat/protocol_list.c index 1dcdf336..e6f99202 100644 --- a/ffmpeg/JNI/ffmpeg/libavformat/protocol_list.c +++ b/ffmpeg/JNI/ffmpeg/libavformat/protocol_list.c @@ -28,6 +28,12 @@ static const URLProtocol * const url_protocols[] = { &ff_tcp_protocol, &ff_tls_protocol, &ff_udp_protocol, + &ff_ijkhttphook_protocol, + &ff_ijklongurl_protocol, + &ff_ijkmediadatasource_protocol, + &ff_ijksegment_protocol, + &ff_ijktcphook_protocol, + &ff_ijkio_protocol, &ff_libsmb2_protocol, &ff_usb_protocol, NULL }; diff --git a/ffmpeg/JNI/ffmpeg/libavformat/protocols.c b/ffmpeg/JNI/ffmpeg/libavformat/protocols.c index 257d18bd..267ef916 100644 --- a/ffmpeg/JNI/ffmpeg/libavformat/protocols.c +++ b/ffmpeg/JNI/ffmpeg/libavformat/protocols.c @@ -69,6 +69,12 @@ extern const URLProtocol ff_librtmpte_protocol; extern const URLProtocol ff_libsrt_protocol; extern const URLProtocol ff_libssh_protocol; extern const URLProtocol ff_libsmbclient_protocol; +extern const URLProtocol ff_ijkhttphook_protocol; +extern const URLProtocol ff_ijklongurl_protocol; +extern const URLProtocol ff_ijkmediadatasource_protocol; +extern const URLProtocol ff_ijksegment_protocol; +extern const URLProtocol ff_ijktcphook_protocol; +extern const URLProtocol ff_ijkio_protocol; #ifdef MXTECHS extern const URLProtocol ff_libsmb2_protocol; extern const URLProtocol ff_usb_protocol; diff --git a/ffmpeg/JNI/ffmpeg/libavutil/Makefile b/ffmpeg/JNI/ffmpeg/libavutil/Makefile index 8feb029a..e5390744 100644 --- a/ffmpeg/JNI/ffmpeg/libavutil/Makefile +++ b/ffmpeg/JNI/ffmpeg/libavutil/Makefile @@ -4,6 +4,7 @@ DESC = FFmpeg utility library HEADERS = adler32.h \ aes.h \ aes_ctr.h \ + application.h \ attributes.h \ audio_fifo.h \ avassert.h \ @@ -96,6 +97,7 @@ BUILT_HEADERS = avconfig.h \ OBJS = adler32.o \ aes.o \ aes_ctr.o \ + application.o \ audio_fifo.o \ avstring.o \ avsscanf.o \ diff --git a/ffmpeg/JNI/ffmpeg/libavutil/application.c b/ffmpeg/JNI/ffmpeg/libavutil/application.c new file mode 100644 index 00000000..99751876 --- /dev/null +++ b/ffmpeg/JNI/ffmpeg/libavutil/application.c @@ -0,0 +1,214 @@ +/* + * copyright (c) 2016 Zhang Rui + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "application.h" +#include "libavformat/network.h" +#include "libavutil/avstring.h" + +void av_application_on_io_traffic(AVApplicationContext *h, AVAppIOTraffic *event); + +int av_application_alloc(AVApplicationContext **ph, void *opaque) +{ + AVApplicationContext *h = NULL; + + h = av_mallocz(sizeof(AVApplicationContext)); + if (!h) + return AVERROR(ENOMEM); + + h->opaque = opaque; + + *ph = h; + return 0; +} + +int av_application_open(AVApplicationContext **ph, void *opaque) +{ + int ret = av_application_alloc(ph, opaque); + if (ret) + return ret; + + return 0; +} + +void av_application_close(AVApplicationContext *h) +{ + av_free(h); +} + +void av_application_closep(AVApplicationContext **ph) +{ + if (!ph || !*ph) + return; + + av_application_close(*ph); + *ph = NULL; +} + +void av_application_on_http_event(AVApplicationContext *h, int event_type, AVAppHttpEvent *event) +{ + if (h && h->func_on_app_event) + h->func_on_app_event(h, event_type, (void *)event, sizeof(AVAppHttpEvent)); +} + +void av_application_will_http_open(AVApplicationContext *h, void *obj, const char *url) +{ + AVAppHttpEvent event = {0}; + + if (!h || !obj || !url) + return; + + event.obj = obj; + av_strlcpy(event.url, url, sizeof(event.url)); + + av_application_on_http_event(h, AVAPP_EVENT_WILL_HTTP_OPEN, &event); +} + +void av_application_did_http_open(AVApplicationContext *h, void *obj, const char *url, int error, int http_code, int64_t filesize) +{ + AVAppHttpEvent event = {0}; + + if (!h || !obj || !url) + return; + + event.obj = obj; + av_strlcpy(event.url, url, sizeof(event.url)); + event.error = error; + event.http_code = http_code; + event.filesize = filesize; + + av_application_on_http_event(h, AVAPP_EVENT_DID_HTTP_OPEN, &event); +} + +void av_application_will_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset) +{ + AVAppHttpEvent event = {0}; + + if (!h || !obj || !url) + return; + + event.obj = obj; + event.offset = offset; + av_strlcpy(event.url, url, sizeof(event.url)); + + av_application_on_http_event(h, AVAPP_EVENT_WILL_HTTP_SEEK, &event); +} + +void av_application_did_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset, int error, int http_code) +{ + AVAppHttpEvent event = {0}; + + if (!h || !obj || !url) + return; + + event.obj = obj; + event.offset = offset; + av_strlcpy(event.url, url, sizeof(event.url)); + event.error = error; + event.http_code = http_code; + + av_application_on_http_event(h, AVAPP_EVENT_DID_HTTP_SEEK, &event); +} + +void av_application_on_io_traffic(AVApplicationContext *h, AVAppIOTraffic *event) +{ + if (h && h->func_on_app_event) + h->func_on_app_event(h, AVAPP_EVENT_IO_TRAFFIC, (void *)event, sizeof(AVAppIOTraffic)); +} + +int av_application_on_io_control(AVApplicationContext *h, int event_type, AVAppIOControl *control) +{ + if (h && h->func_on_app_event) + return h->func_on_app_event(h, event_type, (void *)control, sizeof(AVAppIOControl)); + return 0; +} + +int av_application_on_tcp_will_open(AVApplicationContext *h) +{ + if (h && h->func_on_app_event) { + AVAppTcpIOControl control = {0}; + return h->func_on_app_event(h, AVAPP_CTRL_WILL_TCP_OPEN, (void *)&control, sizeof(AVAppTcpIOControl)); + } + return 0; +} + +// only callback returns error +int av_application_on_tcp_did_open(AVApplicationContext *h, int error, int fd, AVAppTcpIOControl *control) +{ + struct sockaddr_storage so_stg; + int ret = 0; + socklen_t so_len = sizeof(so_stg); + int so_family; + char *so_ip_name = control->ip; + + if (!h || !h->func_on_app_event || fd <= 0) + return 0; + + ret = getpeername(fd, (struct sockaddr *)&so_stg, &so_len); + if (ret) + return 0; + control->error = error; + control->fd = fd; + + so_family = ((struct sockaddr*)&so_stg)->sa_family; + switch (so_family) { + case AF_INET: { + struct sockaddr_in* in4 = (struct sockaddr_in*)&so_stg; + if (inet_ntop(AF_INET, &(in4->sin_addr), so_ip_name, sizeof(control->ip))) { + control->family = AF_INET; + control->port = in4->sin_port; + } + break; + } + case AF_INET6: { + struct sockaddr_in6* in6 = (struct sockaddr_in6*)&so_stg; + if (inet_ntop(AF_INET6, &(in6->sin6_addr), so_ip_name, sizeof(control->ip))) { + control->family = AF_INET6; + control->port = in6->sin6_port; + } + break; + } + } + + return h->func_on_app_event(h, AVAPP_CTRL_DID_TCP_OPEN, (void *)control, sizeof(AVAppTcpIOControl)); +} + +void av_application_on_async_statistic(AVApplicationContext *h, AVAppAsyncStatistic *statistic) +{ + if (h && h->func_on_app_event) + h->func_on_app_event(h, AVAPP_EVENT_ASYNC_STATISTIC, (void *)statistic, sizeof(AVAppAsyncStatistic)); +} + +void av_application_on_async_read_speed(AVApplicationContext *h, AVAppAsyncReadSpeed *speed) +{ + if (h && h->func_on_app_event) + h->func_on_app_event(h, AVAPP_EVENT_ASYNC_READ_SPEED, (void *)speed, sizeof(AVAppAsyncReadSpeed)); +} + +void av_application_did_io_tcp_read(AVApplicationContext *h, void *obj, int bytes) +{ + AVAppIOTraffic event = {0}; + if (!h || !obj || bytes <= 0) + return; + + event.obj = obj; + event.bytes = bytes; + + av_application_on_io_traffic(h, &event); +} diff --git a/ffmpeg/JNI/ffmpeg/libavutil/application.h b/ffmpeg/JNI/ffmpeg/libavutil/application.h new file mode 100644 index 00000000..72fe9027 --- /dev/null +++ b/ffmpeg/JNI/ffmpeg/libavutil/application.h @@ -0,0 +1,121 @@ +/* + * copyright (c) 2016 Zhang Rui + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_APPLICATION_H +#define AVUTIL_APPLICATION_H + +#include "libavutil/log.h" + +#define AVAPP_EVENT_WILL_HTTP_OPEN 1 //AVAppHttpEvent +#define AVAPP_EVENT_DID_HTTP_OPEN 2 //AVAppHttpEvent +#define AVAPP_EVENT_WILL_HTTP_SEEK 3 //AVAppHttpEvent +#define AVAPP_EVENT_DID_HTTP_SEEK 4 //AVAppHttpEvent + +#define AVAPP_EVENT_ASYNC_STATISTIC 0x11000 //AVAppAsyncStatistic +#define AVAPP_EVENT_ASYNC_READ_SPEED 0x11001 //AVAppAsyncReadSpeed +#define AVAPP_EVENT_IO_TRAFFIC 0x12204 //AVAppIOTraffic + +#define AVAPP_CTRL_WILL_TCP_OPEN 0x20001 //AVAppTcpIOControl +#define AVAPP_CTRL_DID_TCP_OPEN 0x20002 //AVAppTcpIOControl + +#define AVAPP_CTRL_WILL_HTTP_OPEN 0x20003 //AVAppIOControl +#define AVAPP_CTRL_WILL_LIVE_OPEN 0x20005 //AVAppIOControl + +#define AVAPP_CTRL_WILL_CONCAT_SEGMENT_OPEN 0x20007 //AVAppIOControl + +typedef struct AVAppIOControl { + size_t size; + char url[4096]; /* in, out */ + int segment_index; /* in, default = 0 */ + int retry_counter; /* in */ + + int is_handled; /* out, default = false */ + int is_url_changed; /* out, default = false */ +} AVAppIOControl; + +typedef struct AVAppTcpIOControl { + int error; + int family; + char ip[96]; + int port; + int fd; +} AVAppTcpIOControl; + +typedef struct AVAppAsyncStatistic { + size_t size; + int64_t buf_backwards; + int64_t buf_forwards; + int64_t buf_capacity; +} AVAppAsyncStatistic; + +typedef struct AVAppAsyncReadSpeed { + size_t size; + int is_full_speed; + int64_t io_bytes; + int64_t elapsed_milli; +} AVAppAsyncReadSpeed; + +typedef struct AVAppHttpEvent +{ + void *obj; + char url[4096]; + int64_t offset; + int error; + int http_code; + int64_t filesize; +} AVAppHttpEvent; + +typedef struct AVAppIOTraffic +{ + void *obj; + int bytes; +} AVAppIOTraffic; + +typedef struct AVApplicationContext AVApplicationContext; +struct AVApplicationContext { + const AVClass *av_class; /**< information for av_log(). Set by av_application_open(). */ + void *opaque; /**< user data. */ + + int (*func_on_app_event)(AVApplicationContext *h, int event_type ,void *obj, size_t size); +}; + +int av_application_alloc(AVApplicationContext **ph, void *opaque); +int av_application_open(AVApplicationContext **ph, void *opaque); +void av_application_close(AVApplicationContext *h); +void av_application_closep(AVApplicationContext **ph); + +void av_application_on_http_event(AVApplicationContext *h, int event_type, AVAppHttpEvent *event); +void av_application_will_http_open(AVApplicationContext *h, void *obj, const char *url); +void av_application_did_http_open(AVApplicationContext *h, void *obj, const char *url, int error, int http_code, int64_t filesize); +void av_application_will_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset); +void av_application_did_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset, int error, int http_code); + +void av_application_did_io_tcp_read(AVApplicationContext *h, void *obj, int bytes); + +int av_application_on_io_control(AVApplicationContext *h, int event_type, AVAppIOControl *control); + +int av_application_on_tcp_will_open(AVApplicationContext *h); +int av_application_on_tcp_did_open(AVApplicationContext *h, int error, int fd, AVAppTcpIOControl *control); + +void av_application_on_async_statistic(AVApplicationContext *h, AVAppAsyncStatistic *statistic); +void av_application_on_async_read_speed(AVApplicationContext *h, AVAppAsyncReadSpeed *speed); + + +#endif /* AVUTIL_APPLICATION_H */ diff --git a/ffmpeg/JNI/ffmpeg/libavutil/ffversion.h b/ffmpeg/JNI/ffmpeg/libavutil/ffversion.h index 03dcf1ed..6e795a40 100644 --- a/ffmpeg/JNI/ffmpeg/libavutil/ffversion.h +++ b/ffmpeg/JNI/ffmpeg/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "git-2022-01-30-5dc9aac7" +#define FFMPEG_VERSION "git-2022-08-16-c4202568" #endif /* AVUTIL_FFVERSION_H */