Skip to content

Commit

Permalink
Update FFmpeg for MX Player 1.49.0
Browse files Browse the repository at this point in the history
Edit: from me
this seems to just be a ffmpeg update.
Also never knew about https://github.com/MXVideoPlayer/MX-FFmpeg
Thanks https://github.com/ottokang
  • Loading branch information
MXVideoPlayer authored and USBhost committed Sep 13, 2022
1 parent dea648a commit d6bc11c
Show file tree
Hide file tree
Showing 13 changed files with 475 additions and 3 deletions.
6 changes: 6 additions & 0 deletions ffmpeg/JNI/ffmpeg/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions ffmpeg/JNI/ffmpeg/doc/config.texi
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions ffmpeg/JNI/ffmpeg/ffbuild/config.mak
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ffmpeg/JNI/ffmpeg/libavformat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ OBJS = allformats.o \
sdp.o \
url.o \
utils.o \
ijkutils.o \

OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o

Expand Down
17 changes: 17 additions & 0 deletions ffmpeg/JNI/ffmpeg/libavformat/dashdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand All @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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}
};

Expand Down
24 changes: 22 additions & 2 deletions ffmpeg/JNI/ffmpeg/libavformat/hls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)] == ':')
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) */
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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}
};

Expand Down
67 changes: 67 additions & 0 deletions ffmpeg/JNI/ffmpeg/libavformat/ijkutils.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* utils.c
*
* Copyright (c) 2003 Fabrice Bellard
* Copyright (c) 2013 Zhang Rui <[email protected]>
*
* 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 <stdlib.h>
#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);
6 changes: 6 additions & 0 deletions ffmpeg/JNI/ffmpeg/libavformat/protocol_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
6 changes: 6 additions & 0 deletions ffmpeg/JNI/ffmpeg/libavformat/protocols.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions ffmpeg/JNI/ffmpeg/libavutil/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down
Loading

0 comments on commit d6bc11c

Please sign in to comment.