Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
7c27bbd5
Commit
7c27bbd5
authored
Jan 15, 2018
by
Vishwanath Dixit
Committed by
Marton Balint
Jan 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avdevice/decklink: addition of copyts option
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
e3acba0d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
7 deletions
+18
-7
indevs.texi
doc/indevs.texi
+5
-0
decklink_common_c.h
libavdevice/decklink_common_c.h
+1
-0
decklink_dec.cpp
libavdevice/decklink_dec.cpp
+11
-7
decklink_dec_c.c
libavdevice/decklink_dec_c.c
+1
-0
No files found.
doc/indevs.texi
View file @
7c27bbd5
...
@@ -317,6 +317,11 @@ Defaults to @samp{1073741824}.
...
@@ -317,6 +317,11 @@ Defaults to @samp{1073741824}.
Sets the audio sample bit depth. Must be @samp{16} or @samp{32}.
Sets the audio sample bit depth. Must be @samp{16} or @samp{32}.
Defaults to @samp{16}.
Defaults to @samp{16}.
@item decklink_copyts
If set to @option{true}, timestamps are forwarded as they are without removing
the initial offset.
Defaults to @option{false}.
@end table
@end table
@subsection Examples
@subsection Examples
...
...
libavdevice/decklink_common_c.h
View file @
7c27bbd5
...
@@ -52,6 +52,7 @@ struct decklink_cctx {
...
@@ -52,6 +52,7 @@ struct decklink_cctx {
char
*
format_code
;
char
*
format_code
;
int
raw_format
;
int
raw_format
;
int64_t
queue_size
;
int64_t
queue_size
;
int
copyts
;
};
};
#endif
/* AVDEVICE_DECKLINK_COMMON_C_H */
#endif
/* AVDEVICE_DECKLINK_COMMON_C_H */
libavdevice/decklink_dec.cpp
View file @
7c27bbd5
...
@@ -586,7 +586,8 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame *videoFrame,
...
@@ -586,7 +586,8 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame *videoFrame,
IDeckLinkAudioInputPacket
*
audioFrame
,
IDeckLinkAudioInputPacket
*
audioFrame
,
int64_t
wallclock
,
int64_t
wallclock
,
DecklinkPtsSource
pts_src
,
DecklinkPtsSource
pts_src
,
AVRational
time_base
,
int64_t
*
initial_pts
)
AVRational
time_base
,
int64_t
*
initial_pts
,
int
copyts
)
{
{
int64_t
pts
=
AV_NOPTS_VALUE
;
int64_t
pts
=
AV_NOPTS_VALUE
;
BMDTimeValue
bmd_pts
;
BMDTimeValue
bmd_pts
;
...
@@ -619,10 +620,12 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame *videoFrame,
...
@@ -619,10 +620,12 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame *videoFrame,
if
(
res
==
S_OK
)
if
(
res
==
S_OK
)
pts
=
bmd_pts
/
time_base
.
num
;
pts
=
bmd_pts
/
time_base
.
num
;
if
(
pts
!=
AV_NOPTS_VALUE
&&
*
initial_pts
==
AV_NOPTS_VALUE
)
if
(
!
copyts
)
{
*
initial_pts
=
pts
;
if
(
pts
!=
AV_NOPTS_VALUE
&&
*
initial_pts
==
AV_NOPTS_VALUE
)
if
(
*
initial_pts
!=
AV_NOPTS_VALUE
)
*
initial_pts
=
pts
;
pts
-=
*
initial_pts
;
if
(
*
initial_pts
!=
AV_NOPTS_VALUE
)
pts
-=
*
initial_pts
;
}
return
pts
;
return
pts
;
}
}
...
@@ -635,6 +638,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
...
@@ -635,6 +638,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
BMDTimeValue
frameTime
;
BMDTimeValue
frameTime
;
BMDTimeValue
frameDuration
;
BMDTimeValue
frameDuration
;
int64_t
wallclock
=
0
;
int64_t
wallclock
=
0
;
struct
decklink_cctx
*
cctx
=
(
struct
decklink_cctx
*
)
avctx
->
priv_data
;
if
(
ctx
->
autodetect
)
{
if
(
ctx
->
autodetect
)
{
if
(
videoFrame
&&
!
(
videoFrame
->
GetFlags
()
&
bmdFrameHasNoInputSource
)
&&
if
(
videoFrame
&&
!
(
videoFrame
->
GetFlags
()
&
bmdFrameHasNoInputSource
)
&&
...
@@ -694,7 +698,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
...
@@ -694,7 +698,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
no_video
=
0
;
no_video
=
0
;
}
}
pkt
.
pts
=
get_pkt_pts
(
videoFrame
,
audioFrame
,
wallclock
,
ctx
->
video_pts_source
,
ctx
->
video_st
->
time_base
,
&
initial_video_pts
);
pkt
.
pts
=
get_pkt_pts
(
videoFrame
,
audioFrame
,
wallclock
,
ctx
->
video_pts_source
,
ctx
->
video_st
->
time_base
,
&
initial_video_pts
,
cctx
->
copyts
);
pkt
.
dts
=
pkt
.
pts
;
pkt
.
dts
=
pkt
.
pts
;
pkt
.
duration
=
frameDuration
;
pkt
.
duration
=
frameDuration
;
...
@@ -785,7 +789,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
...
@@ -785,7 +789,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
pkt
.
size
=
audioFrame
->
GetSampleFrameCount
()
*
ctx
->
audio_st
->
codecpar
->
channels
*
(
ctx
->
audio_depth
/
8
);
pkt
.
size
=
audioFrame
->
GetSampleFrameCount
()
*
ctx
->
audio_st
->
codecpar
->
channels
*
(
ctx
->
audio_depth
/
8
);
audioFrame
->
GetBytes
(
&
audioFrameBytes
);
audioFrame
->
GetBytes
(
&
audioFrameBytes
);
audioFrame
->
GetPacketTime
(
&
audio_pts
,
ctx
->
audio_st
->
time_base
.
den
);
audioFrame
->
GetPacketTime
(
&
audio_pts
,
ctx
->
audio_st
->
time_base
.
den
);
pkt
.
pts
=
get_pkt_pts
(
videoFrame
,
audioFrame
,
wallclock
,
ctx
->
audio_pts_source
,
ctx
->
audio_st
->
time_base
,
&
initial_audio_pts
);
pkt
.
pts
=
get_pkt_pts
(
videoFrame
,
audioFrame
,
wallclock
,
ctx
->
audio_pts_source
,
ctx
->
audio_st
->
time_base
,
&
initial_audio_pts
,
cctx
->
copyts
);
pkt
.
dts
=
pkt
.
pts
;
pkt
.
dts
=
pkt
.
pts
;
//fprintf(stderr,"Audio Frame size %d ts %d\n", pkt.size, pkt.pts);
//fprintf(stderr,"Audio Frame size %d ts %d\n", pkt.size, pkt.pts);
...
...
libavdevice/decklink_dec_c.c
View file @
7c27bbd5
...
@@ -73,6 +73,7 @@ static const AVOption options[] = {
...
@@ -73,6 +73,7 @@ static const AVOption options[] = {
{
"draw_bars"
,
"draw bars on signal loss"
,
OFFSET
(
draw_bars
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
1
},
0
,
1
,
DEC
},
{
"draw_bars"
,
"draw bars on signal loss"
,
OFFSET
(
draw_bars
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
1
},
0
,
1
,
DEC
},
{
"queue_size"
,
"input queue buffer size"
,
OFFSET
(
queue_size
),
AV_OPT_TYPE_INT64
,
{
.
i64
=
(
1024
*
1024
*
1024
)},
0
,
INT64_MAX
,
DEC
},
{
"queue_size"
,
"input queue buffer size"
,
OFFSET
(
queue_size
),
AV_OPT_TYPE_INT64
,
{
.
i64
=
(
1024
*
1024
*
1024
)},
0
,
INT64_MAX
,
DEC
},
{
"audio_depth"
,
"audio bitdepth (16 or 32)"
,
OFFSET
(
audio_depth
),
AV_OPT_TYPE_INT
,
{
.
i64
=
16
},
16
,
32
,
DEC
},
{
"audio_depth"
,
"audio bitdepth (16 or 32)"
,
OFFSET
(
audio_depth
),
AV_OPT_TYPE_INT
,
{
.
i64
=
16
},
16
,
32
,
DEC
},
{
"decklink_copyts"
,
"copy timestamps, do not remove the initial offset"
,
OFFSET
(
copyts
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
0
},
0
,
1
,
DEC
},
{
NULL
},
{
NULL
},
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment