Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
89cc4855
Commit
89cc4855
authored
Oct 18, 2017
by
Dave Rice
Committed by
Marton Balint
Oct 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avdevice/decklink_dec: 32 bit audio support
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
c37de519
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
4 deletions
+22
-4
indevs.texi
doc/indevs.texi
+4
-0
decklink_common.h
libavdevice/decklink_common.h
+1
-0
decklink_common_c.h
libavdevice/decklink_common_c.h
+1
-0
decklink_dec.cpp
libavdevice/decklink_dec.cpp
+14
-3
decklink_dec_c.c
libavdevice/decklink_dec_c.c
+1
-0
version.h
libavdevice/version.h
+1
-1
No files found.
doc/indevs.texi
View file @
89cc4855
...
@@ -311,6 +311,10 @@ Sets maximum input buffer size in bytes. If the buffering reaches this value,
...
@@ -311,6 +311,10 @@ Sets maximum input buffer size in bytes. If the buffering reaches this value,
incoming frames will be dropped.
incoming frames will be dropped.
Defaults to @samp{1073741824}.
Defaults to @samp{1073741824}.
@item audio_depth
Sets the audio sample bit depth. Must be @samp{16} or @samp{32}.
Defaults to @samp{16}.
@end table
@end table
@subsection Examples
@subsection Examples
...
...
libavdevice/decklink_common.h
View file @
89cc4855
...
@@ -97,6 +97,7 @@ struct decklink_ctx {
...
@@ -97,6 +97,7 @@ struct decklink_ctx {
int
frames_buffer_available_spots
;
int
frames_buffer_available_spots
;
int
channels
;
int
channels
;
int
audio_depth
;
};
};
typedef
enum
{
DIRECTION_IN
,
DIRECTION_OUT
}
decklink_direction_t
;
typedef
enum
{
DIRECTION_IN
,
DIRECTION_OUT
}
decklink_direction_t
;
...
...
libavdevice/decklink_common_c.h
View file @
89cc4855
...
@@ -42,6 +42,7 @@ struct decklink_cctx {
...
@@ -42,6 +42,7 @@ struct decklink_cctx {
double
preroll
;
double
preroll
;
int
v210
;
int
v210
;
int
audio_channels
;
int
audio_channels
;
int
audio_depth
;
int
duplex_mode
;
int
duplex_mode
;
DecklinkPtsSource
audio_pts_source
;
DecklinkPtsSource
audio_pts_source
;
DecklinkPtsSource
video_pts_source
;
DecklinkPtsSource
video_pts_source
;
...
...
libavdevice/decklink_dec.cpp
View file @
89cc4855
...
@@ -771,7 +771,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
...
@@ -771,7 +771,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
av_init_packet
(
&
pkt
);
av_init_packet
(
&
pkt
);
//hack among hacks
//hack among hacks
pkt
.
size
=
audioFrame
->
GetSampleFrameCount
()
*
ctx
->
audio_st
->
codecpar
->
channels
*
(
16
/
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
);
...
@@ -854,6 +854,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
...
@@ -854,6 +854,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
ctx
->
audio_pts_source
=
cctx
->
audio_pts_source
;
ctx
->
audio_pts_source
=
cctx
->
audio_pts_source
;
ctx
->
video_pts_source
=
cctx
->
video_pts_source
;
ctx
->
video_pts_source
=
cctx
->
video_pts_source
;
ctx
->
draw_bars
=
cctx
->
draw_bars
;
ctx
->
draw_bars
=
cctx
->
draw_bars
;
ctx
->
audio_depth
=
cctx
->
audio_depth
;
cctx
->
ctx
=
ctx
;
cctx
->
ctx
=
ctx
;
/* Check audio channel option for valid values: 2, 8 or 16 */
/* Check audio channel option for valid values: 2, 8 or 16 */
...
@@ -867,6 +868,16 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
...
@@ -867,6 +868,16 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
/* Check audio bit depth option for valid values: 16 or 32 */
switch
(
cctx
->
audio_depth
)
{
case
16
:
case
32
:
break
;
default
:
av_log
(
avctx
,
AV_LOG_ERROR
,
"Value for audio bit depth option must be either 16 or 32
\n
"
);
return
AVERROR
(
EINVAL
);
}
/* List available devices. */
/* List available devices. */
if
(
ctx
->
list_devices
)
{
if
(
ctx
->
list_devices
)
{
ff_decklink_list_devices_legacy
(
avctx
,
1
,
0
);
ff_decklink_list_devices_legacy
(
avctx
,
1
,
0
);
...
@@ -930,7 +941,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
...
@@ -930,7 +941,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
goto
error
;
goto
error
;
}
}
st
->
codecpar
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
st
->
codecpar
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
st
->
codecpar
->
codec_id
=
AV_CODEC_ID_PCM_S16LE
;
st
->
codecpar
->
codec_id
=
cctx
->
audio_depth
==
32
?
AV_CODEC_ID_PCM_S32LE
:
AV_CODEC_ID_PCM_S16LE
;
st
->
codecpar
->
sample_rate
=
bmdAudioSampleRate48kHz
;
st
->
codecpar
->
sample_rate
=
bmdAudioSampleRate48kHz
;
st
->
codecpar
->
channels
=
cctx
->
audio_channels
;
st
->
codecpar
->
channels
=
cctx
->
audio_channels
;
avpriv_set_pts_info
(
st
,
64
,
1
,
1000000
);
/* 64 bits pts in us */
avpriv_set_pts_info
(
st
,
64
,
1
,
1000000
);
/* 64 bits pts in us */
...
@@ -1021,7 +1032,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
...
@@ -1021,7 +1032,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
}
}
av_log
(
avctx
,
AV_LOG_VERBOSE
,
"Using %d input audio channels
\n
"
,
ctx
->
audio_st
->
codecpar
->
channels
);
av_log
(
avctx
,
AV_LOG_VERBOSE
,
"Using %d input audio channels
\n
"
,
ctx
->
audio_st
->
codecpar
->
channels
);
result
=
ctx
->
dli
->
EnableAudioInput
(
bmdAudioSampleRate48kHz
,
bmdAudioSampleType16bitInteger
,
ctx
->
audio_st
->
codecpar
->
channels
);
result
=
ctx
->
dli
->
EnableAudioInput
(
bmdAudioSampleRate48kHz
,
cctx
->
audio_depth
==
32
?
bmdAudioSampleType32bitInteger
:
bmdAudioSampleType16bitInteger
,
ctx
->
audio_st
->
codecpar
->
channels
);
if
(
result
!=
S_OK
)
{
if
(
result
!=
S_OK
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Cannot enable audio input
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Cannot enable audio input
\n
"
);
...
...
libavdevice/decklink_dec_c.c
View file @
89cc4855
...
@@ -72,6 +72,7 @@ static const AVOption options[] = {
...
@@ -72,6 +72,7 @@ static const AVOption options[] = {
{
"wallclock"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PTS_SRC_WALLCLOCK
},
0
,
0
,
DEC
,
"pts_source"
},
{
"wallclock"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PTS_SRC_WALLCLOCK
},
0
,
0
,
DEC
,
"pts_source"
},
{
"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
},
{
NULL
},
{
NULL
},
};
};
...
...
libavdevice/version.h
View file @
89cc4855
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#define LIBAVDEVICE_VERSION_MAJOR 57
#define LIBAVDEVICE_VERSION_MAJOR 57
#define LIBAVDEVICE_VERSION_MINOR 11
#define LIBAVDEVICE_VERSION_MINOR 11
#define LIBAVDEVICE_VERSION_MICRO 10
0
#define LIBAVDEVICE_VERSION_MICRO 10
1
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
LIBAVDEVICE_VERSION_MINOR, \
LIBAVDEVICE_VERSION_MINOR, \
...
...
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