Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
4e033b07
Commit
4e033b07
authored
Feb 08, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support output bits per sample changes in ffmpeg (close #2493).
parent
3801da9d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
33 deletions
+45
-33
modules/codec/avcodec/audio.c
modules/codec/avcodec/audio.c
+45
-33
No files found.
modules/codec/avcodec/audio.c
View file @
4e033b07
...
@@ -89,6 +89,8 @@ struct decoder_sys_t
...
@@ -89,6 +89,8 @@ struct decoder_sys_t
int
i_reject_count
;
int
i_reject_count
;
};
};
static
void
SetupOutputCodec
(
decoder_t
*
p_dec
);
/*****************************************************************************
/*****************************************************************************
* InitAudioDec: initialize audio decoder
* InitAudioDec: initialize audio decoder
*****************************************************************************
*****************************************************************************
...
@@ -100,8 +102,7 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
...
@@ -100,8 +102,7 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
decoder_sys_t
*
p_sys
;
decoder_sys_t
*
p_sys
;
/* Allocate the memory needed to store the decoder's structure */
/* Allocate the memory needed to store the decoder's structure */
if
(
(
p_dec
->
p_sys
=
p_sys
=
if
(
(
p_dec
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
*
p_sys
))
)
==
NULL
)
(
decoder_sys_t
*
)
malloc
(
sizeof
(
decoder_sys_t
))
)
==
NULL
)
{
{
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
...
@@ -189,7 +190,7 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
...
@@ -189,7 +190,7 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
/* ***** Open the codec ***** */
/* ***** Open the codec ***** */
vlc_mutex_lock
(
&
avcodec_lock
);
vlc_mutex_lock
(
&
avcodec_lock
);
if
(
avcodec_open
(
p_sys
->
p_context
,
p_sys
->
p_codec
)
<
0
)
if
(
avcodec_open
(
p_sys
->
p_context
,
p_sys
->
p_codec
)
<
0
)
{
{
vlc_mutex_unlock
(
&
avcodec_lock
);
vlc_mutex_unlock
(
&
avcodec_lock
);
msg_Err
(
p_dec
,
"cannot open codec (%s)"
,
p_sys
->
psz_namecodec
);
msg_Err
(
p_dec
,
"cannot open codec (%s)"
,
p_sys
->
psz_namecodec
);
...
@@ -213,36 +214,7 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
...
@@ -213,36 +214,7 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
/* Set output properties */
/* Set output properties */
p_dec
->
fmt_out
.
i_cat
=
AUDIO_ES
;
p_dec
->
fmt_out
.
i_cat
=
AUDIO_ES
;
#if defined(AV_VERSION_INT) && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 65, 0 )
SetupOutputCodec
(
p_dec
);
switch
(
p_sys
->
p_context
->
sample_fmt
)
{
case
SAMPLE_FMT_U8
:
p_dec
->
fmt_out
.
i_codec
=
VLC_FOURCC
(
'u'
,
'8'
,
' '
,
' '
);
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
8
;
break
;
case
SAMPLE_FMT_S32
:
p_dec
->
fmt_out
.
i_codec
=
AOUT_FMT_S32_NE
;
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
32
;
break
;
case
SAMPLE_FMT_FLT
:
p_dec
->
fmt_out
.
i_codec
=
VLC_FOURCC
(
'f'
,
'l'
,
'3'
,
'2'
);
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
32
;
break
;
case
SAMPLE_FMT_DBL
:
p_dec
->
fmt_out
.
i_codec
=
VLC_FOURCC
(
'f'
,
'l'
,
'6'
,
'4'
);
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
64
;
break
;
case
SAMPLE_FMT_S16
:
default:
p_dec
->
fmt_out
.
i_codec
=
AOUT_FMT_S16_NE
;
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
16
;
break
;
}
#else
p_dec
->
fmt_out
.
i_codec
=
AOUT_FMT_S16_NE
;
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
16
;
#endif
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -375,6 +347,7 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
...
@@ -375,6 +347,7 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
}
}
/* **** Set audio output parameters **** */
/* **** Set audio output parameters **** */
SetupOutputCodec
(
p_dec
);
p_dec
->
fmt_out
.
audio
.
i_rate
=
p_sys
->
p_context
->
sample_rate
;
p_dec
->
fmt_out
.
audio
.
i_rate
=
p_sys
->
p_context
->
sample_rate
;
p_dec
->
fmt_out
.
audio
.
i_channels
=
p_sys
->
p_context
->
channels
;
p_dec
->
fmt_out
.
audio
.
i_channels
=
p_sys
->
p_context
->
channels
;
p_dec
->
fmt_out
.
audio
.
i_original_channels
=
p_dec
->
fmt_out
.
audio
.
i_original_channels
=
...
@@ -413,3 +386,42 @@ void EndAudioDec( decoder_t *p_dec )
...
@@ -413,3 +386,42 @@ void EndAudioDec( decoder_t *p_dec )
free
(
p_sys
->
p_output
);
free
(
p_sys
->
p_output
);
}
}
/*****************************************************************************
*
*****************************************************************************/
static
void
SetupOutputCodec
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
#if defined(AV_VERSION_INT) && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 65, 0 )
switch
(
p_sys
->
p_context
->
sample_fmt
)
{
case
SAMPLE_FMT_U8
:
p_dec
->
fmt_out
.
i_codec
=
VLC_FOURCC
(
'u'
,
'8'
,
' '
,
' '
);
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
8
;
break
;
case
SAMPLE_FMT_S32
:
p_dec
->
fmt_out
.
i_codec
=
AOUT_FMT_S32_NE
;
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
32
;
break
;
case
SAMPLE_FMT_FLT
:
p_dec
->
fmt_out
.
i_codec
=
VLC_FOURCC
(
'f'
,
'l'
,
'3'
,
'2'
);
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
32
;
break
;
case
SAMPLE_FMT_DBL
:
p_dec
->
fmt_out
.
i_codec
=
VLC_FOURCC
(
'f'
,
'l'
,
'6'
,
'4'
);
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
64
;
break
;
case
SAMPLE_FMT_S16
:
default:
p_dec
->
fmt_out
.
i_codec
=
AOUT_FMT_S16_NE
;
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
16
;
break
;
}
#else
p_dec
->
fmt_out
.
i_codec
=
AOUT_FMT_S16_NE
;
p_dec
->
fmt_out
.
audio
.
i_bitspersample
=
16
;
#endif
}
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