Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
b5f66834
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b5f66834
编写于
11月 28, 2014
作者:
M
Matthew Oliver
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/master'
上级
6c908c7c
47602780
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
248 addition
and
109 deletion
+248
-109
configure
configure
+2
-0
ffmpeg.c
ffmpeg.c
+14
-0
libavcodec/hevc_ps.c
libavcodec/hevc_ps.c
+2
-4
libavcodec/mjpegdec.c
libavcodec/mjpegdec.c
+3
-2
libavdevice/dshow_capture.h
libavdevice/dshow_capture.h
+1
-0
libavdevice/opengl_enc.c
libavdevice/opengl_enc.c
+1
-0
libavformat/dashenc.c
libavformat/dashenc.c
+5
-9
libavformat/hdsenc.c
libavformat/hdsenc.c
+6
-10
libavformat/internal.h
libavformat/internal.h
+0
-6
libavformat/matroskadec.c
libavformat/matroskadec.c
+7
-6
libavformat/mov.c
libavformat/mov.c
+29
-23
libavformat/os_support.h
libavformat/os_support.h
+20
-20
libavformat/rtpproto.c
libavformat/rtpproto.c
+12
-4
libavformat/smoothstreamingenc.c
libavformat/smoothstreamingenc.c
+3
-5
libavformat/udp.c
libavformat/udp.c
+10
-1
libavutil/atomic_win32.h
libavutil/atomic_win32.h
+1
-0
libavutil/file_open.c
libavutil/file_open.c
+4
-9
libavutil/imgutils.c
libavutil/imgutils.c
+0
-3
libavutil/ppc/util_altivec.h
libavutil/ppc/util_altivec.h
+31
-7
libavutil/thread.h
libavutil/thread.h
+53
-0
libavutil/wchar_filename.h
libavutil/wchar_filename.h
+44
-0
未找到文件。
configure
浏览文件 @
b5f66834
...
...
@@ -1732,6 +1732,7 @@ SYSTEM_FUNCS="
lzo1x_999_compress
mach_absolute_time
MapViewOfFile
MoveFileExA
memalign
mkstemp
mmap
...
...
@@ -4736,6 +4737,7 @@ check_func_headers windows.h GetProcessAffinityMask
check_func_headers windows.h GetProcessTimes
check_func_headers windows.h GetSystemTimeAsFileTime
check_func_headers windows.h MapViewOfFile
check_func_headers windows.h MoveFileExA
check_func_headers windows.h PeekNamedPipe
check_func_headers windows.h SetConsoleTextAttribute
check_func_headers windows.h Sleep
...
...
ffmpeg.c
浏览文件 @
b5f66834
...
...
@@ -1948,6 +1948,20 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
if
(
*
got_output
||
ret
<
0
||
pkt
->
size
)
decode_error_stat
[
ret
<
0
]
++
;
if
(
*
got_output
&&
ret
>=
0
)
{
if
(
ist
->
dec_ctx
->
width
!=
decoded_frame
->
width
||
ist
->
dec_ctx
->
height
!=
decoded_frame
->
height
||
ist
->
dec_ctx
->
pix_fmt
!=
decoded_frame
->
format
)
{
av_log
(
NULL
,
AV_LOG_DEBUG
,
"Frame parameters mismatch context %d,%d,%d != %d,%d,%d
\n
"
,
decoded_frame
->
width
,
decoded_frame
->
height
,
decoded_frame
->
format
,
ist
->
dec_ctx
->
width
,
ist
->
dec_ctx
->
height
,
ist
->
dec_ctx
->
pix_fmt
);
}
}
if
(
!*
got_output
||
ret
<
0
)
{
if
(
!
pkt
->
size
)
{
for
(
i
=
0
;
i
<
ist
->
nb_filters
;
i
++
)
...
...
libavcodec/hevc_ps.c
浏览文件 @
b5f66834
...
...
@@ -1025,10 +1025,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
}
av_log
(
s
->
avctx
,
AV_LOG_WARNING
,
"Displaying the whole video surface.
\n
"
);
sps
->
pic_conf_win
.
left_offset
=
sps
->
pic_conf_win
.
right_offset
=
sps
->
pic_conf_win
.
top_offset
=
sps
->
pic_conf_win
.
bottom_offset
=
0
;
memset
(
&
sps
->
pic_conf_win
,
0
,
sizeof
(
sps
->
pic_conf_win
));
memset
(
&
sps
->
output_window
,
0
,
sizeof
(
sps
->
output_window
));
sps
->
output_width
=
sps
->
width
;
sps
->
output_height
=
sps
->
height
;
}
...
...
libavcodec/mjpegdec.c
浏览文件 @
b5f66834
...
...
@@ -244,7 +244,8 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
int
ff_mjpeg_decode_sof
(
MJpegDecodeContext
*
s
)
{
int
len
,
nb_components
,
i
,
width
,
height
,
bits
,
pix_fmt_id
,
ret
;
int
len
,
nb_components
,
i
,
width
,
height
,
bits
,
ret
;
unsigned
pix_fmt_id
;
int
h_count
[
MAX_COMPONENTS
];
int
v_count
[
MAX_COMPONENTS
];
...
...
@@ -383,7 +384,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
else
if
(
!
s
->
lossless
)
s
->
rgb
=
0
;
/* XXX: not complete test ! */
pix_fmt_id
=
(
s
->
h_count
[
0
]
<<
28
)
|
(
s
->
v_count
[
0
]
<<
24
)
|
pix_fmt_id
=
(
(
unsigned
)
s
->
h_count
[
0
]
<<
28
)
|
(
s
->
v_count
[
0
]
<<
24
)
|
(
s
->
h_count
[
1
]
<<
20
)
|
(
s
->
v_count
[
1
]
<<
16
)
|
(
s
->
h_count
[
2
]
<<
12
)
|
(
s
->
v_count
[
2
]
<<
8
)
|
(
s
->
h_count
[
3
]
<<
4
)
|
s
->
v_count
[
3
];
...
...
libavdevice/dshow_capture.h
浏览文件 @
b5f66834
...
...
@@ -27,6 +27,7 @@
#include "avdevice.h"
#define COBJMACROS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define NO_DSHOW_STRSAFE
#include <dshow.h>
...
...
libavdevice/opengl_enc.c
浏览文件 @
b5f66834
...
...
@@ -31,6 +31,7 @@
#include "config.h"
#if HAVE_WINDOWS_H
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#if HAVE_OPENGL_GL3_H
...
...
libavformat/dashenc.c
浏览文件 @
b5f66834
...
...
@@ -296,15 +296,13 @@ static int write_manifest(AVFormatContext *s, int final)
DASHContext
*
c
=
s
->
priv_data
;
AVIOContext
*
out
;
char
temp_filename
[
1024
];
const
char
*
write_filename
;
int
ret
,
i
;
AVDictionaryEntry
*
title
=
av_dict_get
(
s
->
metadata
,
"title"
,
NULL
,
0
);
snprintf
(
temp_filename
,
sizeof
(
temp_filename
),
"%s.tmp"
,
s
->
filename
);
write_filename
=
USE_RENAME_REPLACE
?
temp_filename
:
s
->
filename
;
ret
=
avio_open2
(
&
out
,
write_filename
,
AVIO_FLAG_WRITE
,
&
s
->
interrupt_callback
,
NULL
);
ret
=
avio_open2
(
&
out
,
temp_filename
,
AVIO_FLAG_WRITE
,
&
s
->
interrupt_callback
,
NULL
);
if
(
ret
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to open %s for writing
\n
"
,
write
_filename
);
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to open %s for writing
\n
"
,
temp
_filename
);
return
ret
;
}
avio_printf
(
out
,
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
?>
\n
"
);
...
...
@@ -394,7 +392,7 @@ static int write_manifest(AVFormatContext *s, int final)
avio_printf
(
out
,
"</MPD>
\n
"
);
avio_flush
(
out
);
avio_close
(
out
);
return
USE_RENAME_REPLACE
?
ff_rename
(
temp_filename
,
s
->
filename
,
s
)
:
0
;
return
ff_rename
(
temp_filename
,
s
->
filename
,
s
)
;
}
static
int
dash_write_header
(
AVFormatContext
*
s
)
...
...
@@ -610,7 +608,6 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
OutputStream
*
os
=
&
c
->
streams
[
i
];
char
filename
[
1024
]
=
""
,
full_path
[
1024
],
temp_path
[
1024
];
const
char
*
write_path
;
int64_t
start_pos
=
avio_tell
(
os
->
ctx
->
pb
);
int
range_length
,
index_length
=
0
;
...
...
@@ -633,8 +630,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
snprintf
(
filename
,
sizeof
(
filename
),
"chunk-stream%d-%05d.m4s"
,
i
,
os
->
segment_index
);
snprintf
(
full_path
,
sizeof
(
full_path
),
"%s%s"
,
c
->
dirname
,
filename
);
snprintf
(
temp_path
,
sizeof
(
temp_path
),
"%s.tmp"
,
full_path
);
write_path
=
USE_RENAME_REPLACE
?
temp_path
:
full_path
;
ret
=
ffurl_open
(
&
os
->
out
,
write_path
,
AVIO_FLAG_WRITE
,
&
s
->
interrupt_callback
,
NULL
);
ret
=
ffurl_open
(
&
os
->
out
,
temp_path
,
AVIO_FLAG_WRITE
,
&
s
->
interrupt_callback
,
NULL
);
if
(
ret
<
0
)
break
;
write_styp
(
os
->
ctx
->
pb
);
...
...
@@ -649,7 +645,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
}
else
{
ffurl_close
(
os
->
out
);
os
->
out
=
NULL
;
ret
=
USE_RENAME_REPLACE
?
ff_rename
(
temp_path
,
full_path
,
s
)
:
0
;
ret
=
ff_rename
(
temp_path
,
full_path
,
s
)
;
if
(
ret
<
0
)
break
;
}
...
...
libavformat/hdsenc.c
浏览文件 @
b5f66834
...
...
@@ -163,7 +163,6 @@ static int write_manifest(AVFormatContext *s, int final)
HDSContext
*
c
=
s
->
priv_data
;
AVIOContext
*
out
;
char
filename
[
1024
],
temp_filename
[
1024
];
const
char
*
write_filename
;
int
ret
,
i
;
float
duration
=
0
;
...
...
@@ -172,11 +171,10 @@ static int write_manifest(AVFormatContext *s, int final)
snprintf
(
filename
,
sizeof
(
filename
),
"%s/index.f4m"
,
s
->
filename
);
snprintf
(
temp_filename
,
sizeof
(
temp_filename
),
"%s/index.f4m.tmp"
,
s
->
filename
);
write_filename
=
USE_RENAME_REPLACE
?
temp_filename
:
filename
;
ret
=
avio_open2
(
&
out
,
write_filename
,
AVIO_FLAG_WRITE
,
ret
=
avio_open2
(
&
out
,
temp_filename
,
AVIO_FLAG_WRITE
,
&
s
->
interrupt_callback
,
NULL
);
if
(
ret
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to open %s for writing
\n
"
,
write
_filename
);
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to open %s for writing
\n
"
,
temp
_filename
);
return
ret
;
}
avio_printf
(
out
,
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
?>
\n
"
);
...
...
@@ -206,7 +204,7 @@ static int write_manifest(AVFormatContext *s, int final)
avio_printf
(
out
,
"</manifest>
\n
"
);
avio_flush
(
out
);
avio_close
(
out
);
return
USE_RENAME_REPLACE
?
ff_rename
(
temp_filename
,
filename
,
s
)
:
0
;
return
ff_rename
(
temp_filename
,
filename
,
s
)
;
}
static
void
update_size
(
AVIOContext
*
out
,
int64_t
pos
)
...
...
@@ -225,7 +223,6 @@ static int write_abst(AVFormatContext *s, OutputStream *os, int final)
HDSContext
*
c
=
s
->
priv_data
;
AVIOContext
*
out
;
char
filename
[
1024
],
temp_filename
[
1024
];
const
char
*
write_filename
;
int
i
,
ret
;
int64_t
asrt_pos
,
afrt_pos
;
int
start
=
0
,
fragments
;
...
...
@@ -243,11 +240,10 @@ static int write_abst(AVFormatContext *s, OutputStream *os, int final)
"%s/stream%d.abst"
,
s
->
filename
,
index
);
snprintf
(
temp_filename
,
sizeof
(
temp_filename
),
"%s/stream%d.abst.tmp"
,
s
->
filename
,
index
);
write_filename
=
USE_RENAME_REPLACE
?
temp_filename
:
filename
;
ret
=
avio_open2
(
&
out
,
write_filename
,
AVIO_FLAG_WRITE
,
ret
=
avio_open2
(
&
out
,
temp_filename
,
AVIO_FLAG_WRITE
,
&
s
->
interrupt_callback
,
NULL
);
if
(
ret
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to open %s for writing
\n
"
,
write
_filename
);
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to open %s for writing
\n
"
,
temp
_filename
);
return
ret
;
}
avio_wb32
(
out
,
0
);
// abst size
...
...
@@ -289,7 +285,7 @@ static int write_abst(AVFormatContext *s, OutputStream *os, int final)
update_size
(
out
,
afrt_pos
);
update_size
(
out
,
0
);
avio_close
(
out
);
return
USE_RENAME_REPLACE
?
ff_rename
(
temp_filename
,
filename
,
s
)
:
0
;
return
ff_rename
(
temp_filename
,
filename
,
s
)
;
}
static
int
init_file
(
AVFormatContext
*
s
,
OutputStream
*
os
,
int64_t
start_ts
)
...
...
libavformat/internal.h
浏览文件 @
b5f66834
...
...
@@ -436,10 +436,4 @@ enum AVWriteUncodedFrameFlags {
*/
int
ff_copy_whitelists
(
AVFormatContext
*
dst
,
AVFormatContext
*
src
);
#ifndef _WIN32
#define USE_RENAME_REPLACE 1
#else
#define USE_RENAME_REPLACE 0
#endif
#endif
/* AVFORMAT_INTERNAL_H */
libavformat/matroskadec.c
浏览文件 @
b5f66834
...
...
@@ -32,12 +32,6 @@
#include <inttypes.h>
#include <stdio.h>
#if CONFIG_BZLIB
#include <bzlib.h>
#endif
#if CONFIG_ZLIB
#include <zlib.h>
#endif
#include "libavutil/avstring.h"
#include "libavutil/base64.h"
...
...
@@ -62,6 +56,13 @@
#include "riff.h"
#include "rmsipr.h"
#if CONFIG_BZLIB
#include <bzlib.h>
#endif
#if CONFIG_ZLIB
#include <zlib.h>
#endif
typedef
enum
{
EBML_NONE
,
EBML_UINT
,
...
...
libavformat/mov.c
浏览文件 @
b5f66834
...
...
@@ -1272,14 +1272,12 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if
(
!
entries
)
return
0
;
if
(
entries
>=
UINT_MAX
/
sizeof
(
int64_t
))
return
AVERROR_INVALIDDATA
;
if
(
sc
->
chunk_offsets
)
av_log
(
c
->
fc
,
AV_LOG_WARNING
,
"Duplicate STCO atom
\n
"
);
av_log
(
c
->
fc
,
AV_LOG_WARNING
,
"Duplicate
d
STCO atom
\n
"
);
av_free
(
sc
->
chunk_offsets
);
sc
->
chunk_count
=
0
;
sc
->
chunk_offsets
=
av_malloc
(
entries
*
sizeof
(
int64_t
));
sc
->
chunk_offsets
=
av_malloc
_array
(
entries
,
sizeof
(
*
sc
->
chunk_offsets
));
if
(
!
sc
->
chunk_offsets
)
return
AVERROR
(
ENOMEM
);
sc
->
chunk_count
=
entries
;
...
...
@@ -1873,13 +1871,11 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if
(
!
entries
)
return
0
;
if
(
entries
>=
UINT_MAX
/
sizeof
(
*
sc
->
stsc_data
))
return
AVERROR_INVALIDDATA
;
if
(
sc
->
stsc_data
)
av_log
(
c
->
fc
,
AV_LOG_WARNING
,
"Duplicate STSC atom
\n
"
);
av_log
(
c
->
fc
,
AV_LOG_WARNING
,
"Duplicate
d
STSC atom
\n
"
);
av_free
(
sc
->
stsc_data
);
sc
->
stsc_count
=
0
;
sc
->
stsc_data
=
av_malloc
(
entries
*
sizeof
(
*
sc
->
stsc_data
));
sc
->
stsc_data
=
av_malloc
_array
(
entries
,
sizeof
(
*
sc
->
stsc_data
));
if
(
!
sc
->
stsc_data
)
return
AVERROR
(
ENOMEM
);
...
...
@@ -1911,9 +1907,11 @@ static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_rb32
(
pb
);
// version + flags
entries
=
avio_rb32
(
pb
);
if
(
entries
>=
UINT_MAX
/
sizeof
(
*
sc
->
stps_data
))
return
AVERROR_INVALIDDATA
;
sc
->
stps_data
=
av_malloc
(
entries
*
sizeof
(
*
sc
->
stps_data
));
if
(
sc
->
stps_data
)
av_log
(
c
->
fc
,
AV_LOG_WARNING
,
"Duplicated STPS atom
\n
"
);
av_free
(
sc
->
stps_data
);
sc
->
stps_count
=
0
;
sc
->
stps_data
=
av_malloc_array
(
entries
,
sizeof
(
*
sc
->
stps_data
));
if
(
!
sc
->
stps_data
)
return
AVERROR
(
ENOMEM
);
...
...
@@ -1955,9 +1953,11 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
st
->
need_parsing
=
AVSTREAM_PARSE_HEADERS
;
return
0
;
}
if
(
entries
>=
UINT_MAX
/
sizeof
(
int
))
return
AVERROR_INVALIDDATA
;
sc
->
keyframes
=
av_malloc
(
entries
*
sizeof
(
int
));
if
(
sc
->
keyframes
)
av_log
(
c
->
fc
,
AV_LOG_WARNING
,
"Duplicated STSS atom
\n
"
);
av_free
(
sc
->
keyframes
);
sc
->
keyframe_count
=
0
;
sc
->
keyframes
=
av_malloc_array
(
entries
,
sizeof
(
*
sc
->
keyframes
));
if
(
!
sc
->
keyframes
)
return
AVERROR
(
ENOMEM
);
...
...
@@ -2016,9 +2016,13 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if
(
!
entries
)
return
0
;
if
(
entries
>=
UINT_MAX
/
sizeof
(
int
)
||
entries
>=
(
UINT_MAX
-
4
)
/
field_size
)
if
(
entries
>=
(
UINT_MAX
-
4
)
/
field_size
)
return
AVERROR_INVALIDDATA
;
sc
->
sample_sizes
=
av_malloc
(
entries
*
sizeof
(
int
));
if
(
sc
->
sample_sizes
)
av_log
(
c
->
fc
,
AV_LOG_WARNING
,
"Duplicated STSZ atom
\n
"
);
av_free
(
sc
->
sample_sizes
);
sc
->
sample_count
=
0
;
sc
->
sample_sizes
=
av_malloc_array
(
entries
,
sizeof
(
*
sc
->
sample_sizes
));
if
(
!
sc
->
sample_sizes
)
return
AVERROR
(
ENOMEM
);
...
...
@@ -2072,11 +2076,11 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_dlog
(
c
->
fc
,
"track[%i].stts.entries = %i
\n
"
,
c
->
fc
->
nb_streams
-
1
,
entries
);
if
(
entries
>=
UINT_MAX
/
sizeof
(
*
sc
->
stts_data
))
return
-
1
;
if
(
sc
->
stts_data
)
av_log
(
c
->
fc
,
AV_LOG_WARNING
,
"Duplicated STTS atom
\n
"
);
av_free
(
sc
->
stts_data
);
sc
->
stts_data
=
av_malloc
(
entries
*
sizeof
(
*
sc
->
stts_data
));
sc
->
stts_count
=
0
;
sc
->
stts_data
=
av_malloc_array
(
entries
,
sizeof
(
*
sc
->
stts_data
));
if
(
!
sc
->
stts_data
)
return
AVERROR
(
ENOMEM
);
...
...
@@ -2215,9 +2219,11 @@ static int mov_read_sbgp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
entries
=
avio_rb32
(
pb
);
if
(
!
entries
)
return
0
;
if
(
entries
>=
UINT_MAX
/
sizeof
(
*
sc
->
rap_group
))
return
AVERROR_INVALIDDATA
;
sc
->
rap_group
=
av_malloc
(
entries
*
sizeof
(
*
sc
->
rap_group
));
if
(
sc
->
rap_group
)
av_log
(
c
->
fc
,
AV_LOG_WARNING
,
"Duplicated SBGP atom
\n
"
);
av_free
(
sc
->
rap_group
);
sc
->
rap_group_count
=
0
;
sc
->
rap_group
=
av_malloc_array
(
entries
,
sizeof
(
*
sc
->
rap_group
));
if
(
!
sc
->
rap_group
)
return
AVERROR
(
ENOMEM
);
...
...
libavformat/os_support.h
浏览文件 @
b5f66834
...
...
@@ -144,24 +144,7 @@ int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout);
#elif defined(_WIN32)
#include <stdio.h>
#include <windows.h>
#include "libavutil/mem.h"
static
inline
int
utf8towchar
(
const
char
*
filename_utf8
,
wchar_t
**
filename_w
)
{
int
num_chars
;
num_chars
=
MultiByteToWideChar
(
CP_UTF8
,
MB_ERR_INVALID_CHARS
,
filename_utf8
,
-
1
,
NULL
,
0
);
if
(
num_chars
<=
0
)
{
*
filename_w
=
NULL
;
return
0
;
}
*
filename_w
=
(
wchar_t
*
)
av_mallocz
(
sizeof
(
wchar_t
)
*
num_chars
);
if
(
!*
filename_w
)
{
errno
=
ENOMEM
;
return
-
1
;
}
MultiByteToWideChar
(
CP_UTF8
,
0
,
filename_utf8
,
-
1
,
*
filename_w
,
num_chars
);
return
0
;
}
#include "libavutil/wchar_filename.h"
#define DEF_FS_FUNCTION(name, wfunc, afunc) \
static inline int win32_##name(const char *filename_utf8) \
...
...
@@ -204,14 +187,31 @@ static inline int win32_rename(const char *src_utf8, const char *dest_utf8)
goto
fallback
;
}
ret
=
_wrename
(
src_w
,
dest_w
);
ret
=
MoveFileExW
(
src_w
,
dest_w
,
MOVEFILE_REPLACE_EXISTING
);
av_free
(
src_w
);
av_free
(
dest_w
);
// Lacking proper mapping from GetLastError() error codes to errno codes
if
(
ret
)
errno
=
EPERM
;
return
ret
;
fallback:
/* filename may be be in CP_ACP */
return
rename
(
src_utf8
,
dest_utf8
);
#if HAVE_MOVEFILEEXA
ret
=
MoveFileExA
(
src_utf8
,
dest_utf8
,
MOVEFILE_REPLACE_EXISTING
);
if
(
ret
)
errno
=
EPERM
;
#else
/* Windows Phone doesn't have MoveFileExA. However, it's unlikely
* that anybody would input filenames in CP_ACP there, so this
* fallback is kept mostly for completeness. Alternatively we could
* do MultiByteToWideChar(CP_ACP) and use MoveFileExW, but doing
* explicit conversions with CP_ACP is allegedly forbidden in windows
* store apps (or windows phone), and the notion of a native code page
* doesn't make much sense there. */
ret
=
rename
(
src_utf8
,
dest_utf8
);
#endif
return
ret
;
}
#define mkdir(a, b) win32_mkdir(a)
...
...
libavformat/rtpproto.c
浏览文件 @
b5f66834
...
...
@@ -192,6 +192,7 @@ static void build_udp_url(char *buf, int buf_size,
const
char
*
hostname
,
int
port
,
int
local_port
,
int
ttl
,
int
max_packet_size
,
int
connect
,
int
dscp
,
const
char
*
include_sources
,
const
char
*
exclude_sources
)
{
...
...
@@ -204,6 +205,8 @@ static void build_udp_url(char *buf, int buf_size,
url_add_option
(
buf
,
buf_size
,
"pkt_size=%d"
,
max_packet_size
);
if
(
connect
)
url_add_option
(
buf
,
buf_size
,
"connect=1"
);
if
(
dscp
>=
0
)
url_add_option
(
buf
,
buf_size
,
"dscp=%d"
,
dscp
);
url_add_option
(
buf
,
buf_size
,
"fifo_size=0"
);
if
(
include_sources
&&
include_sources
[
0
])
url_add_option
(
buf
,
buf_size
,
"sources=%s"
,
include_sources
);
...
...
@@ -264,6 +267,7 @@ static void rtp_parse_addr_list(URLContext *h, char *buf,
* 'sources=ip[,ip]' : list allowed source IP addresses
* 'block=ip[,ip]' : list disallowed source IP addresses
* 'write_to_source=0/1' : send packets to the source address of the latest received packet
* 'dscp=n' : set DSCP value to n (QoS)
* deprecated option:
* 'localport=n' : set the local port to n
*
...
...
@@ -278,7 +282,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
RTPContext
*
s
=
h
->
priv_data
;
int
rtp_port
,
rtcp_port
,
ttl
,
connect
,
local_rtp_port
,
local_rtcp_port
,
max_packet_size
;
local_rtp_port
,
local_rtcp_port
,
max_packet_size
,
dscp
;
char
hostname
[
256
],
include_sources
[
1024
]
=
""
,
exclude_sources
[
1024
]
=
""
;
char
buf
[
1024
];
char
path
[
1024
];
...
...
@@ -294,6 +298,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
local_rtcp_port
=
-
1
;
max_packet_size
=
-
1
;
connect
=
0
;
dscp
=
-
1
;
p
=
strchr
(
uri
,
'?'
);
if
(
p
)
{
...
...
@@ -321,6 +326,9 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
if
(
av_find_info_tag
(
buf
,
sizeof
(
buf
),
"write_to_source"
,
p
))
{
s
->
write_to_source
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
av_find_info_tag
(
buf
,
sizeof
(
buf
),
"dscp"
,
p
))
{
dscp
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
av_find_info_tag
(
buf
,
sizeof
(
buf
),
"sources"
,
p
))
{
av_strlcpy
(
include_sources
,
buf
,
sizeof
(
include_sources
));
rtp_parse_addr_list
(
h
,
buf
,
&
s
->
ssm_include_addrs
,
&
s
->
nb_ssm_include_addrs
);
...
...
@@ -334,7 +342,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
for
(
i
=
0
;
i
<
max_retry_count
;
i
++
)
{
build_udp_url
(
buf
,
sizeof
(
buf
),
hostname
,
rtp_port
,
local_rtp_port
,
ttl
,
max_packet_size
,
connect
,
include_sources
,
exclude_sources
);
connect
,
dscp
,
include_sources
,
exclude_sources
);
if
(
ffurl_open
(
&
s
->
rtp_hd
,
buf
,
flags
,
&
h
->
interrupt_callback
,
NULL
)
<
0
)
goto
fail
;
local_rtp_port
=
ff_udp_get_local_port
(
s
->
rtp_hd
);
...
...
@@ -346,7 +354,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
local_rtcp_port
=
local_rtp_port
+
1
;
build_udp_url
(
buf
,
sizeof
(
buf
),
hostname
,
rtcp_port
,
local_rtcp_port
,
ttl
,
max_packet_size
,
connect
,
include_sources
,
exclude_sources
);
connect
,
dscp
,
include_sources
,
exclude_sources
);
if
(
ffurl_open
(
&
s
->
rtcp_hd
,
buf
,
flags
,
&
h
->
interrupt_callback
,
NULL
)
<
0
)
{
local_rtp_port
=
local_rtcp_port
=
-
1
;
continue
;
...
...
@@ -355,7 +363,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
}
build_udp_url
(
buf
,
sizeof
(
buf
),
hostname
,
rtcp_port
,
local_rtcp_port
,
ttl
,
max_packet_size
,
connect
,
include_sources
,
exclude_sources
);
connect
,
dscp
,
include_sources
,
exclude_sources
);
if
(
ffurl_open
(
&
s
->
rtcp_hd
,
buf
,
flags
,
&
h
->
interrupt_callback
,
NULL
)
<
0
)
goto
fail
;
break
;
...
...
libavformat/smoothstreamingenc.c
浏览文件 @
b5f66834
...
...
@@ -215,16 +215,14 @@ static int write_manifest(AVFormatContext *s, int final)
SmoothStreamingContext
*
c
=
s
->
priv_data
;
AVIOContext
*
out
;
char
filename
[
1024
],
temp_filename
[
1024
];
const
char
*
write_filename
;
int
ret
,
i
,
video_chunks
=
0
,
audio_chunks
=
0
,
video_streams
=
0
,
audio_streams
=
0
;
int64_t
duration
=
0
;
snprintf
(
filename
,
sizeof
(
filename
),
"%s/Manifest"
,
s
->
filename
);
snprintf
(
temp_filename
,
sizeof
(
temp_filename
),
"%s/Manifest.tmp"
,
s
->
filename
);
write_filename
=
USE_RENAME_REPLACE
?
temp_filename
:
filename
;
ret
=
avio_open2
(
&
out
,
write_filename
,
AVIO_FLAG_WRITE
,
&
s
->
interrupt_callback
,
NULL
);
ret
=
avio_open2
(
&
out
,
temp_filename
,
AVIO_FLAG_WRITE
,
&
s
->
interrupt_callback
,
NULL
);
if
(
ret
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to open %s for writing
\n
"
,
write
_filename
);
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to open %s for writing
\n
"
,
temp
_filename
);
return
ret
;
}
avio_printf
(
out
,
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
?>
\n
"
);
...
...
@@ -285,7 +283,7 @@ static int write_manifest(AVFormatContext *s, int final)
avio_printf
(
out
,
"</SmoothStreamingMedia>
\n
"
);
avio_flush
(
out
);
avio_close
(
out
);
return
USE_RENAME_REPLACE
?
ff_rename
(
temp_filename
,
filename
,
s
)
:
0
;
return
ff_rename
(
temp_filename
,
filename
,
s
)
;
}
static
int
ism_write_header
(
AVFormatContext
*
s
)
...
...
libavformat/udp.c
浏览文件 @
b5f66834
...
...
@@ -556,7 +556,7 @@ static int parse_source_list(char *buf, char **sources, int *num_sources,
static
int
udp_open
(
URLContext
*
h
,
const
char
*
uri
,
int
flags
)
{
char
hostname
[
1024
],
localaddr
[
1024
]
=
""
;
int
port
,
udp_fd
=
-
1
,
tmp
,
bind_ret
=
-
1
;
int
port
,
udp_fd
=
-
1
,
tmp
,
bind_ret
=
-
1
,
dscp
=
-
1
;
UDPContext
*
s
=
h
->
priv_data
;
int
is_output
;
const
char
*
p
;
...
...
@@ -612,6 +612,9 @@ static int udp_open(URLContext *h, const char *uri, int flags)
if
(
av_find_info_tag
(
buf
,
sizeof
(
buf
),
"connect"
,
p
))
{
s
->
is_connected
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
av_find_info_tag
(
buf
,
sizeof
(
buf
),
"dscp"
,
p
))
{
dscp
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
av_find_info_tag
(
buf
,
sizeof
(
buf
),
"fifo_size"
,
p
))
{
s
->
circular_buffer_size
=
strtol
(
buf
,
NULL
,
10
);
if
(
!
HAVE_PTHREAD_CANCEL
)
...
...
@@ -695,6 +698,12 @@ static int udp_open(URLContext *h, const char *uri, int flags)
av_log
(
h
,
AV_LOG_WARNING
,
"socket option UDPLITE_RECV_CSCOV not available"
);
}
if
(
dscp
>=
0
)
{
dscp
<<=
2
;
if
(
setsockopt
(
udp_fd
,
IPPROTO_IP
,
IP_TOS
,
&
dscp
,
sizeof
(
dscp
))
!=
0
)
goto
fail
;
}
/* If multicast, try binding the multicast address first, to avoid
* receiving UDP packets from other sources aimed at the same UDP
* port. This fails on windows. This makes sending to the same address
...
...
libavutil/atomic_win32.h
浏览文件 @
b5f66834
...
...
@@ -21,6 +21,7 @@
#ifndef AVUTIL_ATOMIC_WIN32_H
#define AVUTIL_ATOMIC_WIN32_H
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define avpriv_atomic_int_get atomic_int_get_win32
...
...
libavutil/file_open.c
浏览文件 @
b5f66834
...
...
@@ -37,23 +37,18 @@
#include <windows.h>
#include <share.h>
#include <errno.h>
#include "wchar_filename.h"
static
int
win32_open
(
const
char
*
filename_utf8
,
int
oflag
,
int
pmode
)
{
int
fd
;
int
num_chars
;
wchar_t
*
filename_w
;
/* convert UTF-8 to wide chars */
num_chars
=
MultiByteToWideChar
(
CP_UTF8
,
MB_ERR_INVALID_CHARS
,
filename_utf8
,
-
1
,
NULL
,
0
);
if
(
num_chars
<=
0
)
goto
fallback
;
filename_w
=
av_mallocz_array
(
num_chars
,
sizeof
(
wchar_t
));
if
(
!
filename_w
)
{
errno
=
ENOMEM
;
if
(
utf8towchar
(
filename_utf8
,
&
filename_w
))
return
-
1
;
}
MultiByteToWideChar
(
CP_UTF8
,
0
,
filename_utf8
,
-
1
,
filename_w
,
num_chars
)
;
if
(
!
filename_w
)
goto
fallback
;
fd
=
_wsopen
(
filename_w
,
oflag
,
SH_DENYNO
,
pmode
);
av_freep
(
&
filename_w
);
...
...
libavutil/imgutils.c
浏览文件 @
b5f66834
...
...
@@ -331,9 +331,6 @@ int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4],
for
(
i
=
0
;
i
<
4
;
i
++
)
dst_linesize
[
i
]
=
FFALIGN
(
dst_linesize
[
i
],
align
);
if
((
ret
=
av_image_fill_pointers
(
dst_data
,
pix_fmt
,
width
,
NULL
,
dst_linesize
))
<
0
)
return
ret
;
return
av_image_fill_pointers
(
dst_data
,
pix_fmt
,
height
,
(
uint8_t
*
)
src
,
dst_linesize
);
}
...
...
libavutil/ppc/util_altivec.h
浏览文件 @
b5f66834
...
...
@@ -46,9 +46,21 @@
#define WORD_s1 0x14,0x15,0x16,0x17
#define WORD_s2 0x18,0x19,0x1a,0x1b
#define WORD_s3 0x1c,0x1d,0x1e,0x1f
#define vcprm(a,b,c,d) (const vector unsigned char){WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d}
#define SWP_W2S0 0x02,0x03,0x00,0x01
#define SWP_W2S1 0x06,0x07,0x04,0x05
#define SWP_W2S2 0x0a,0x0b,0x08,0x09
#define SWP_W2S3 0x0e,0x0f,0x0c,0x0d
#define SWP_W2Ss0 0x12,0x13,0x10,0x11
#define SWP_W2Ss1 0x16,0x17,0x14,0x15
#define SWP_W2Ss2 0x1a,0x1b,0x18,0x19
#define SWP_W2Ss3 0x1e,0x1f,0x1c,0x1d
#define vcswapi2s(a,b,c,d) (const vector unsigned char){SWP_W2S ## a, SWP_W2S ## b, SWP_W2S ## c, SWP_W2S ## d}
#define vcswapc() \
(const vector unsigned char){0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00}
// Transpose 8x8 matrix of 16-bit elements (in-place)
#define TRANSPOSE8(a,b,c,d,e,f,g,h) \
...
...
@@ -103,8 +115,15 @@ static inline vector unsigned char unaligned_load(int offset, const uint8_t *src
register
vector
unsigned
char
mask
=
vec_lvsl
(
offset
,
src
);
return
vec_perm
(
first
,
second
,
mask
);
}
static
inline
vec_u8
load_with_perm_vec
(
int
offset
,
const
uint8_t
*
src
,
vec_u8
perm_vec
)
{
vec_u8
a
=
vec_ld
(
offset
,
src
);
vec_u8
b
=
vec_ld
(
offset
+
15
,
src
);
return
vec_perm
(
a
,
b
,
perm_vec
);
}
#else
#define unaligned_load(a,b) VEC_LD(a,b)
#define load_with_perm_vec(a,b,c) VEC_LD(a,b)
#endif
...
...
@@ -112,12 +131,6 @@ static inline vector unsigned char unaligned_load(int offset, const uint8_t *src
* loads vector known misalignment
* @param perm_vec the align permute vector to combine the two loads from lvsl
*/
static
inline
vec_u8
load_with_perm_vec
(
int
offset
,
const
uint8_t
*
src
,
vec_u8
perm_vec
)
{
vec_u8
a
=
vec_ld
(
offset
,
src
);
vec_u8
b
=
vec_ld
(
offset
+
15
,
src
);
return
vec_perm
(
a
,
b
,
perm_vec
);
}
#define vec_unaligned_load(b) VEC_LD(0, b)
...
...
@@ -135,6 +148,17 @@ static inline vec_u8 load_with_perm_vec(int offset, const uint8_t *src, vec_u8 p
#define VEC_ST(a,b,c) vec_vsx_st(a,b,c)
#endif
#if HAVE_BIGENDIAN
#define VEC_SPLAT16(a,b) vec_splat((vec_s16)a, b)
#else
#define VEC_SPLAT16(a,b) vec_splat((vec_s16)(vec_perm(a, a, vcswapi2s(0,1,2,3))), b)
#endif
#if HAVE_BIGENDIAN
#define VEC_SLD16(a,b,c) vec_sld(a, b, c)
#else
#define VEC_SLD16(a,b,c) vec_sld(b, a, c)
#endif
#endif
/* HAVE_ALTIVEC */
...
...
libavutil/thread.h
0 → 100644
浏览文件 @
b5f66834
/*
* 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
*/
// This header should only be used to simplify code where
// threading is optional, not as a generic threading abstraction.
#ifndef AVUTIL_THREAD_H
#define AVUTIL_THREAD_H
#include "config.h"
#if HAVE_PTHREADS || HAVE_W32THREADS
#if HAVE_PTHREADS
#include <pthread.h>
#else
#include <compat/w32pthreads.h>
#endif
#define AVMutex pthread_mutex_t
#define ff_mutex_init pthread_mutex_init
#define ff_mutex_lock pthread_mutex_lock
#define ff_mutex_unlock pthread_mutex_unlock
#define ff_mutex_destroy pthread_mutex_destroy
#else
#define AVMutex char
#define ff_mutex_init(mutex, attr) (0)
#define ff_mutex_lock(mutex) (0)
#define ff_mutex_unlock(mutex) (0)
#define ff_mutex_destroy(mutex) (0)
#endif
#endif
/* AVUTIL_THREAD_H */
libavutil/wchar_filename.h
0 → 100644
浏览文件 @
b5f66834
/*
* 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_WCHAR_FILENAME_H
#define AVUTIL_WCHAR_FILENAME_H
#if defined(_WIN32) && !defined(__MINGW32CE__)
#include <windows.h>
#include "mem.h"
static
inline
int
utf8towchar
(
const
char
*
filename_utf8
,
wchar_t
**
filename_w
)
{
int
num_chars
;
num_chars
=
MultiByteToWideChar
(
CP_UTF8
,
MB_ERR_INVALID_CHARS
,
filename_utf8
,
-
1
,
NULL
,
0
);
if
(
num_chars
<=
0
)
{
*
filename_w
=
NULL
;
return
0
;
}
*
filename_w
=
(
wchar_t
*
)
av_mallocz_array
(
num_chars
,
sizeof
(
wchar_t
));
if
(
!*
filename_w
)
{
errno
=
ENOMEM
;
return
-
1
;
}
MultiByteToWideChar
(
CP_UTF8
,
0
,
filename_utf8
,
-
1
,
*
filename_w
,
num_chars
);
return
0
;
}
#endif
#endif
/* AVUTIL_WCHAR_FILENAME_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录