Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
merge_av
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
胡斌
2019-01-05 08:56:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f30ffbf0c2eb67058536b9cc392b4804b56ca1a4
f30ffbf0
1 parent
027172a2
support rotate of teacher video in one2one mode
parse width and height in record info file
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
68 行增加
和
8 行删除
pip/AVTranscoder.cpp
pip/media_info.h
pip/merge_pip.cpp
pip/AVTranscoder.cpp
查看文件 @
f30ffbf
...
...
@@ -606,7 +606,37 @@ int CAVTranscoder::open_output_file(const char *filename)
}
if
(
_teacherFrame
)
{
fillDestFrame
(
pDstFrame
,
_teacherFrame
,
0
,
0
);
if
(
_teacherFrame
->
width
==
SRC_W
&&
_teacherFrame
->
height
==
SRC_H
)
{
if
(
_teacherFrame
->
pkt_dts
!=
90
){
fillDestFrame
(
pDstFrame
,
_teacherFrame
,
0
,
0
);
}
else
{
memset
(
pDstFrame
->
data
[
0
],
_blank_y
,
_nOutputWidth
*
_nOutputHeight
/
2
);
memset
(
pDstFrame
->
data
[
1
],
_blank_u
,
_nOutputWidth
*
_nOutputHeight
/
8
);
memset
(
pDstFrame
->
data
[
2
],
_blank_v
,
_nOutputWidth
*
_nOutputHeight
/
8
);
fillDestFrame
(
pDstFrame
,
_teacherFrame
,
(
SRC_W
-
SRC_H
)
/
2
,
0
,
(
SRC_W
-
SRC_H
)
/
2
,
0
,
SRC_H
,
SRC_H
);
}
}
else
if
(
_teacherFrame
->
width
==
SRC_H
&&
_teacherFrame
->
height
==
SRC_W
)
{
if
(
_teacherFrame
->
pkt_dts
==
90
){
fillDestFrame
(
pDstFrame
,
_teacherFrame
,
0
,
0
);
}
else
{
memset
(
pDstFrame
->
data
[
0
],
_blank_y
,
_nOutputWidth
*
_nOutputHeight
/
2
);
memset
(
pDstFrame
->
data
[
1
],
_blank_u
,
_nOutputWidth
*
_nOutputHeight
/
8
);
memset
(
pDstFrame
->
data
[
2
],
_blank_v
,
_nOutputWidth
*
_nOutputHeight
/
8
);
fillDestFrame
(
pDstFrame
,
_teacherFrame
,
(
SRC_W
-
SRC_H
)
/
2
,
0
,
0
,
(
SRC_W
-
SRC_H
)
/
2
,
SRC_H
,
SRC_H
);
}
}
else
if
(
_teacherFrame
->
width
==
SRC_H
&&
_teacherFrame
->
height
==
SRC_H
)
{
memset
(
pDstFrame
->
data
[
0
],
_blank_y
,
_nOutputWidth
*
_nOutputHeight
/
2
);
memset
(
pDstFrame
->
data
[
1
],
_blank_u
,
_nOutputWidth
*
_nOutputHeight
/
8
);
memset
(
pDstFrame
->
data
[
2
],
_blank_v
,
_nOutputWidth
*
_nOutputHeight
/
8
);
fillDestFrame
(
pDstFrame
,
_teacherFrame
,
(
SRC_W
-
SRC_H
)
/
2
,
0
);
}
else
{
printf
(
"
\n
resolution: %dx%d unexpected!"
,
_studentFrame
->
width
,
_studentFrame
->
height
);
}
if
(
_studentFrame
)
{
if
(
_studentFrame
->
width
==
SRC_W
)
{
if
(
_studentFrame
->
pkt_dts
!=
90
){
...
...
@@ -636,7 +666,7 @@ int CAVTranscoder::open_output_file(const char *filename)
fillDestFrame
(
pDstFrame
,
_studentFrame
,
0
,
0
);
}
else
{
fillDestFrame
(
pDstFrame
,
_studentFrame
,
(
SRC_W
-
SRC_H
)
/
2
,
0
,
(
SRC_W
-
SRC_H
)
/
2
,
0
,
SRC_
W
,
SRC_H
);
fillDestFrame
(
pDstFrame
,
_studentFrame
,
(
SRC_W
-
SRC_H
)
/
2
,
0
,
(
SRC_W
-
SRC_H
)
/
2
,
0
,
SRC_
H
,
SRC_H
);
}
}
else
if
(
_studentFrame
->
width
==
SRC_H
&&
_studentFrame
->
height
==
SRC_W
)
{
...
...
@@ -644,7 +674,7 @@ int CAVTranscoder::open_output_file(const char *filename)
fillDestFrame
(
pDstFrame
,
_studentFrame
,
0
,
0
);
}
else
{
fillDestFrame
(
pDstFrame
,
_studentFrame
,
(
SRC_W
-
SRC_H
)
/
2
,
0
,
0
,
(
SRC_W
-
SRC_H
)
/
2
,
SRC_
W
,
SRC_H
);
fillDestFrame
(
pDstFrame
,
_studentFrame
,
(
SRC_W
-
SRC_H
)
/
2
,
0
,
0
,
(
SRC_W
-
SRC_H
)
/
2
,
SRC_
H
,
SRC_H
);
}
}
else
if
(
_studentFrame
->
width
==
SRC_H
&&
_studentFrame
->
height
==
SRC_H
)
{
...
...
pip/media_info.h
查看文件 @
f30ffbf
...
...
@@ -29,6 +29,8 @@ public:
float
end_time
;
int64_t
end_time_ms
;
string
name
;
int
width
;
int
height
;
int
rotate
;
float
duration
;
...
...
pip/merge_pip.cpp
查看文件 @
f30ffbf
...
...
@@ -24,6 +24,8 @@ public:
unsigned
int
uid
;
media_type
m_type
;
media_role
m_role
;
int
width
;
int
height
;
int
rotate
;
//degree,0,90,180 ...
};
...
...
@@ -126,10 +128,12 @@ void addinfo(float t, string name, bool bstart,media_role role,unsigned int uid)
}
}
void
addinfo
(
const
char
*
name
,
const
char
*
rotation
){
void
addinfo
(
const
char
*
name
,
const
char
*
width
,
const
char
*
height
,
const
char
*
rotation
){
int
i
=
0
;
for
(;
i
<
media_files
.
size
();
i
++
)
{
if
(
media_files
[
i
].
name
==
name
)
{
media_files
[
i
].
width
=
atoi
(
width
);
media_files
[
i
].
height
=
atoi
(
height
);
media_files
[
i
].
rotate
=
atoi
(
rotation
);
break
;
}
...
...
@@ -141,7 +145,20 @@ void addinfo(const char * name, const char * rotation){
}
}
void
addinfo
(
const
char
*
name
,
const
char
*
rotation
){
int
i
=
0
;
for
(;
i
<
media_files
.
size
();
i
++
)
{
if
(
media_files
[
i
].
name
==
name
)
{
media_files
[
i
].
rotate
=
atoi
(
rotation
);
break
;
}
}
if
(
i
==
media_files
.
size
())
{
printf
(
"
\n
error ,file : %s info but not found!"
,
name
);
}
}
void
split
(
string
str
,
string
separator
,
vector
<
string
>
&
result
,
bool
includeEmptyItem
=
false
)
{
result
.
clear
();
...
...
@@ -625,6 +642,8 @@ void add_media_infos()
m
.
t_type
=
tt_start
;
m
.
duration
=
f
.
end_time
-
f
.
start_time
;
m
.
type_time
=
m
.
start_time
;
m
.
width
=
f
.
width
;
m
.
height
=
f
.
height
;
m
.
rotate
=
f
.
rotate
;
m
.
m_role
=
f
.
m_role
;
m
.
uid
=
f
.
uid
;
...
...
@@ -664,7 +683,7 @@ void add_media_infos()
printf
(
"
\n
sorted file info:"
);
it
=
sorted_media_with_end
.
begin
();
for
(;
it
!=
sorted_media_with_end
.
end
();
it
++
){
printf
(
"
\n
%2d %8.3f %s %
s"
,
it
->
sorted_index
,
it
->
type_time
,
it
->
name
.
c_str
()
,
it
->
t_type
==
tt_start
?
"start"
:
"end"
);
printf
(
"
\n
%2d %8.3f %s %
4d %4d %3d %s"
,
it
->
sorted_index
,
it
->
type_time
,
it
->
name
.
c_str
(),
it
->
width
,
it
->
height
,
it
->
rotate
,
it
->
t_type
==
tt_start
?
"start"
:
"end"
);
}
printf
(
"
\n
-------------------------
\n
"
);
...
...
@@ -843,9 +862,14 @@ int readfile(const char * filename, media_role role)
}
else
if
(
res
[
2
]
==
"info"
)
{
if
(
res
.
size
()
>
5
)
{
const
char
*
pInfo
=
res
[
5
].
c_str
();
if
(
!
strncmp
(
pInfo
,
"rotation="
,
9
)){
addinfo
(
res
[
1
].
c_str
(),
pInfo
+
9
);
const
char
*
pInfoW
=
res
[
3
].
c_str
();
const
char
*
pInfoH
=
res
[
4
].
c_str
();
const
char
*
pInfoR
=
res
[
5
].
c_str
();
if
(
!
strncmp
(
pInfoW
,
"width="
,
6
)
&&
!
strncmp
(
pInfoH
,
"height="
,
7
)
&&
!
strncmp
(
pInfoR
,
"rotation="
,
9
)){
addinfo
(
res
[
1
].
c_str
(),
pInfoW
+
6
,
pInfoH
+
7
,
pInfoR
+
9
);
}
else
{
printf
(
"error info: %s,"
,
str
);
}
}
}
...
...
@@ -855,6 +879,10 @@ int readfile(const char * filename, media_role role)
if
(
!
strncmp
(
pInfo
,
"rotation="
,
9
)){
addinfo
(
res
[
1
].
c_str
(),
pInfo
+
9
);
}
else
{
printf
(
"error rotation: %s,"
,
str
);
}
}
}
}
...
...
请
注册
或
登录
后发表评论