Skip to content

Commit 7861716

Browse files
committed
Stick to the FFmpeg's git revision ffmpeg-version
1 parent 689fa10 commit 7861716

File tree

3 files changed

+139
-64
lines changed

3 files changed

+139
-64
lines changed

FFmpeg-Android.sh

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,4 @@
11
#!/bin/bash
2-
#
3-
# FFmpeg-Android, a bash script to build FFmpeg for Android.
4-
#
5-
# Copyright (c) 2012 Cedric Fung <[email protected]>
6-
#
7-
# FFmpeg-Android will build FFmpeg for Android automatically,
8-
# with patches from VPlayer's Android version <https://vplayer.net/>.
9-
#
10-
# FFmpeg-Android is free software; you can redistribute it and/or
11-
# modify it under the terms of the GNU Lesser General Public
12-
# License as published by the Free Software Foundation; either
13-
# version 3 of the License, or (at your option) any later version.
14-
15-
# FFmpeg-Android is distributed in the hope that it will be useful,
16-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18-
# Lesser General Public License for more details.
19-
20-
# You should have received a copy of the GNU Lesser General Public
21-
# License along with FFmpeg-Android; if not, write to the Free Software
22-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23-
#
24-
#
25-
# Instruction:
26-
#
27-
# 0. Install git and Android ndk
28-
# 1. $ export ANDROID_NDK=/path/to/your/android-ndk
29-
# 2. $ ./FFmpeg-Android.sh
30-
# 3. libffmpeg.so will be built to build/ffmpeg/{neon,armv7,vfp,armv6}/
31-
#
32-
#
332

343
DEST=`pwd`/build/ffmpeg && rm -rf $DEST
354
SOURCE=`pwd`/ffmpeg
@@ -38,10 +7,16 @@ if [ -d ffmpeg ]; then
387
cd ffmpeg
398
else
409
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
41-
cd ffmpeg && patch -p1 <../FFmpeg-VPlayer.patch
10+
cd ffmpeg
4211
fi
4312

44-
git log | head -n 1 | awk '{print $2}' > ../ffmpeg-version
13+
git reset --hard
14+
git clean -f -d
15+
git checkout `cat ../ffmpeg-version`
16+
patch -p1 <../FFmpeg-VPlayer.patch
17+
[ $PIPESTATUS == 0 ] || exit 1
18+
19+
git log --pretty=format:%H -1 > ../ffmpeg-version
4520

4621
TOOLCHAIN=/tmp/vplayer
4722
SYSROOT=$TOOLCHAIN/sysroot/
@@ -73,20 +48,22 @@ FFMPEG_FLAGS="--target-os=linux \
7348
--disable-ffserver \
7449
--disable-avdevice \
7550
--disable-avfilter \
76-
--disable-encoders \
7751
--disable-encoders \
7852
--disable-muxers \
79-
--disable-bsfs \
8053
--disable-filters \
8154
--disable-devices \
8255
--disable-everything \
8356
--enable-protocols \
8457
--enable-parsers \
8558
--enable-demuxers \
86-
--disable-demuxer=sbg \
8759
--enable-decoders \
60+
--enable-bsfs \
8861
--enable-network \
8962
--enable-swscale \
63+
--disable-demuxer=sbg \
64+
--disable-demuxer=dts \
65+
--disable-parser=dca \
66+
--disable-decoder=dca \
9067
--enable-asm \
9168
--enable-version3"
9269

FFmpeg-VPlayer.patch

Lines changed: 125 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ index 62619b3..dab19e8 100644
6363

6464
*got_picture_ptr = finish_frame(avctx, pict);
6565
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
66-
index ddd63db..8b5b087 100644
66+
index 63aa862..acba3cc 100644
6767
--- a/libavcodec/utils.c
6868
+++ b/libavcodec/utils.c
69-
@@ -1986,6 +1986,8 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
69+
@@ -2040,6 +2040,8 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
7070
static void video_free_buffers(AVCodecContext *s)
7171
{
7272
AVCodecInternal *avci = s->internal;
@@ -76,18 +76,18 @@ index ddd63db..8b5b087 100644
7676

7777
if (!avci->buffer)
7878
diff --git a/libavformat/Makefile b/libavformat/Makefile
79-
index 54b26c1..b542d43 100644
79+
index 45ae6ea..4387ff1 100644
8080
--- a/libavformat/Makefile
8181
+++ b/libavformat/Makefile
82-
@@ -371,6 +371,7 @@ OBJS-$(CONFIG_CACHE_PROTOCOL) += cache.o
83-
OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o
82+
@@ -375,6 +375,7 @@ OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o
8483
OBJS-$(CONFIG_CRYPTO_PROTOCOL) += crypto.o
84+
OBJS-$(CONFIG_FFRTMPHTTP_PROTOCOL) += rtmphttp.o
8585
OBJS-$(CONFIG_FILE_PROTOCOL) += file.o
8686
+OBJS-$(CONFIG_FD_PROTOCOL) += fd.o
8787
OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o
8888
OBJS-$(CONFIG_HLS_PROTOCOL) += hlsproto.o
8989
OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o
90-
@@ -378,6 +379,7 @@ OBJS-$(CONFIG_HTTPPROXY_PROTOCOL) += http.o httpauth.o
90+
@@ -382,6 +383,7 @@ OBJS-$(CONFIG_HTTPPROXY_PROTOCOL) += http.o httpauth.o
9191
OBJS-$(CONFIG_HTTPS_PROTOCOL) += http.o httpauth.o
9292
OBJS-$(CONFIG_MMSH_PROTOCOL) += mmsh.o mms.o asf.o
9393
OBJS-$(CONFIG_MMST_PROTOCOL) += mmst.o mms.o asf.o
@@ -96,25 +96,38 @@ index 54b26c1..b542d43 100644
9696
OBJS-$(CONFIG_PIPE_PROTOCOL) += file.o
9797
OBJS-$(CONFIG_RTMP_PROTOCOL) += rtmpproto.o rtmppkt.o
9898
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
99-
index 7ea4ebb..b0ccebf 100644
99+
index 94dc347..68e5525 100644
100100
--- a/libavformat/allformats.c
101101
+++ b/libavformat/allformats.c
102-
@@ -273,6 +273,7 @@ void av_register_all(void)
103-
REGISTER_PROTOCOL (CONCAT, concat);
102+
@@ -274,6 +274,7 @@ void av_register_all(void)
104103
REGISTER_PROTOCOL (CRYPTO, crypto);
104+
REGISTER_PROTOCOL (FFRTMPHTTP, ffrtmphttp);
105105
REGISTER_PROTOCOL (FILE, file);
106106
+ REGISTER_PROTOCOL (FD, fd);
107107
REGISTER_PROTOCOL (GOPHER, gopher);
108108
REGISTER_PROTOCOL (HLS, hls);
109109
REGISTER_PROTOCOL (HTTP, http);
110-
@@ -280,6 +281,7 @@ void av_register_all(void)
110+
@@ -281,6 +282,7 @@ void av_register_all(void)
111111
REGISTER_PROTOCOL (HTTPS, https);
112112
REGISTER_PROTOCOL (MMSH, mmsh);
113113
REGISTER_PROTOCOL (MMST, mmst);
114114
+ REGISTER_PROTOCOL (MMSU, mmsu);
115115
REGISTER_PROTOCOL (MD5, md5);
116116
REGISTER_PROTOCOL (PIPE, pipe);
117117
REGISTER_PROTOCOL (RTMP, rtmp);
118+
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
119+
index 3bbc683..327edbc 100644
120+
--- a/libavformat/avformat.h
121+
+++ b/libavformat/avformat.h
122+
@@ -912,7 +912,7 @@ typedef struct AVFormatContext {
123+
unsigned int nb_streams;
124+
AVStream **streams;
125+
126+
- char filename[1024]; /**< input or output filename */
127+
+ char filename[10240]; /**< input or output filename */
128+
129+
/**
130+
* Decoding: position of the first frame of the component, in
118131
diff --git a/libavformat/fd.c b/libavformat/fd.c
119132
new file mode 100644
120133
index 0000000..d8d2e41
@@ -299,7 +312,7 @@ index a51a616..bf4c7f5 100644
299312
}
300313
return AVERROR_EOF;
301314
diff --git a/libavformat/http.c b/libavformat/http.c
302-
index 5355bdc..366b814 100644
315+
index 5355bdc..0472cf3 100644
303316
--- a/libavformat/http.c
304317
+++ b/libavformat/http.c
305318
@@ -1,6 +1,7 @@
@@ -310,25 +323,90 @@ index 5355bdc..366b814 100644
310323
*
311324
* This file is part of FFmpeg.
312325
*
313-
@@ -36,6 +37,8 @@
314-
#define BUFFER_SIZE 1024
326+
@@ -33,9 +34,11 @@
327+
only a subset of it. */
328+
329+
/* used for protocol handling */
330+
-#define BUFFER_SIZE 1024
331+
+#define BUFFER_SIZE 10240
315332
#define MAX_REDIRECTS 8
316333

317334
+#define DEFAULT_UA "Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; zh-cn) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5"
318335
+
319336
typedef struct {
320337
const AVClass *class;
321338
URLContext *hd;
322-
@@ -404,14 +407,15 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
323-
local_path, method);
339+
@@ -99,11 +102,11 @@ void ff_http_init_auth_state(URLContext *dest, const URLContext *src)
340+
static int http_open_cnx(URLContext *h)
341+
{
342+
const char *path, *proxy_path, *lower_proto = "tcp", *local_path;
343+
- char hostname[1024], hoststr[1024], proto[10];
344+
- char auth[1024], proxyauth[1024] = "";
345+
- char path1[1024];
346+
- char buf[1024], urlbuf[1024];
347+
- int port, use_proxy, err, location_changed = 0, redirects = 0, attempts = 0;
348+
+ char hostname[10240], hoststr[10240], proto[10];
349+
+ char auth[10240], proxyauth[10240] = "";
350+
+ char path1[10240];
351+
+ char buf[10240], urlbuf[10240];
352+
+ int port, use_proxy, err, location_changed = 0, redirects = 0, attempts = 0, change_ua = 0;
353+
HTTPAuthType cur_auth_type, cur_proxy_auth_type;
354+
HTTPContext *s = h->priv_data;
324355

325-
/* set default headers if needed */
326-
+ av_log(h, AV_LOG_VERBOSE, "HTTP host %s %s\n", hoststr, strstr(hoststr, "youku.com"));
327-
if (!has_header(s->headers, "\r\nUser-Agent: "))
328-
len += av_strlcatf(headers + len, sizeof(headers) - len,
329-
"User-Agent: %s\r\n",
330-
- s->user_agent ? s->user_agent : LIBAVFORMAT_IDENT);
331-
+ s->user_agent ? s->user_agent : DEFAULT_UA);
356+
@@ -165,6 +168,15 @@ static int http_open_cnx(URLContext *h)
357+
} else
358+
goto fail;
359+
}
360+
+ if (s->http_code == 403 && !change_ua) {
361+
+ av_opt_set(s, "user-agent", DEFAULT_UA, 0);
362+
+ ffurl_closep(&s->hd);
363+
+ memset(&s->auth_state, 0, sizeof(s->auth_state));
364+
+ attempts = 0;
365+
+ location_changed = 0;
366+
+ change_ua = 1;
367+
+ goto redo;
368+
+ }
369+
if (s->http_code == 407) {
370+
if ((cur_proxy_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) &&
371+
s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) {
372+
@@ -285,9 +297,9 @@ static int process_line(URLContext *h, char *line, int line_count,
373+
374+
/* error codes are 4xx and 5xx, but regard 401 as a success, so we
375+
* don't abort until all headers have been parsed. */
376+
- if (s->http_code >= 400 && s->http_code < 600 && (s->http_code != 401
377+
- || s->auth_state.auth_type != HTTP_AUTH_NONE) &&
378+
- (s->http_code != 407 || s->proxy_auth_state.auth_type != HTTP_AUTH_NONE)) {
379+
+ if (s->http_code >= 400 && s->http_code < 600 && s->http_code != 403
380+
+ && (s->http_code != 401 || s->auth_state.auth_type != HTTP_AUTH_NONE)
381+
+ && (s->http_code != 407 || s->proxy_auth_state.auth_type != HTTP_AUTH_NONE)) {
382+
end += strspn(end, SPACE_CHARS);
383+
av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n",
384+
s->http_code, end);
385+
@@ -352,7 +364,7 @@ static inline int has_header(const char *str, const char *header)
386+
static int http_read_header(URLContext *h, int *new_location)
387+
{
388+
HTTPContext *s = h->priv_data;
389+
- char line[1024];
390+
+ char line[10240];
391+
int err = 0;
392+
393+
s->chunksize = -1;
394+
@@ -380,13 +392,12 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
395+
{
396+
HTTPContext *s = h->priv_data;
397+
int post, err;
398+
- char headers[1024] = "";
399+
+ char headers[10240] = "";
400+
char *authstr = NULL, *proxyauthstr = NULL;
401+
int64_t off = s->off;
402+
int len = 0;
403+
const char *method;
404+
405+
-
406+
/* send http header */
407+
post = h->flags & AVIO_FLAG_WRITE;
408+
409+
@@ -411,7 +422,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
332410
if (!has_header(s->headers, "\r\nAccept: "))
333411
len += av_strlcpy(headers + len, "Accept: */*\r\n",
334412
sizeof(headers) - len);
@@ -337,17 +415,37 @@ index 5355bdc..366b814 100644
337415
len += av_strlcatf(headers + len, sizeof(headers) - len,
338416
"Range: bytes=%"PRId64"-\r\n", s->off);
339417

340-
@@ -450,6 +454,8 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
418+
@@ -450,6 +461,8 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
341419
authstr ? authstr : "",
342420
proxyauthstr ? "Proxy-" : "", proxyauthstr ? proxyauthstr : "");
343421

344422
+
345-
+ av_log(h, AV_LOG_VERBOSE, "HTTP HEADERS: \n%s\n", s->buffer);
423+
+ av_dlog(h, "HTTP HEADERS: \n%s\n", s->buffer);
346424
av_freep(&authstr);
347425
av_freep(&proxyauthstr);
348426
if ((err = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0)
427+
@@ -479,7 +492,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
428+
/* wait for header */
429+
err = http_read_header(h, new_location);
430+
if (err < 0)
431+
- return err;
432+
+ return err;
433+
434+
return (off == s->off) ? 0 : -1;
435+
}
436+
@@ -691,8 +704,8 @@ static int http_proxy_close(URLContext *h)
437+
static int http_proxy_open(URLContext *h, const char *uri, int flags)
438+
{
439+
HTTPContext *s = h->priv_data;
440+
- char hostname[1024], hoststr[1024];
441+
- char auth[1024], pathbuf[1024], *path;
442+
+ char hostname[10240], hoststr[10240];
443+
+ char auth[10240], pathbuf[10240], *path;
444+
char lower_url[100];
445+
int port, ret = 0, attempts = 0;
446+
HTTPAuthType cur_auth_type;
349447
diff --git a/libavformat/isom.h b/libavformat/isom.h
350-
index 5f7f189..202b66a 100644
448+
index f1cbe8c..9f6645a 100644
351449
--- a/libavformat/isom.h
352450
+++ b/libavformat/isom.h
353451
@@ -3,6 +3,7 @@
@@ -358,7 +456,7 @@ index 5f7f189..202b66a 100644
358456
*
359457
* This file is part of FFmpeg.
360458
*
361-
@@ -154,6 +155,8 @@ typedef struct MOVContext {
459+
@@ -155,6 +156,8 @@ typedef struct MOVContext {
362460
int chapter_track;
363461
int use_absolute_path;
364462
int64_t next_root_atom; ///< offset of the next root atom
@@ -522,7 +620,7 @@ index 0000000..33e96e6
522620
+ .url_close = mmsu_close,
523621
+};
524622
diff --git a/libavformat/mov.c b/libavformat/mov.c
525-
index becfeec..4d90933 100644
623+
index b4295f8..f53bddb 100644
526624
--- a/libavformat/mov.c
527625
+++ b/libavformat/mov.c
528626
@@ -2,6 +2,7 @@

ffmpeg-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5e99df019a850e9ffa96d73e72b8a47a93a61de8
1+
5e99df019a850e9ffa96d73e72b8a47a93a61de8

0 commit comments

Comments
 (0)