Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
59987d76
Commit
59987d76
authored
Nov 15, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
endian: endian conversion code from format
parent
add4be43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
0 deletions
+148
-0
modules/audio_filter/Modules.am
modules/audio_filter/Modules.am
+2
-0
modules/audio_filter/converter/endian.c
modules/audio_filter/converter/endian.c
+146
-0
No files found.
modules/audio_filter/Modules.am
View file @
59987d76
...
...
@@ -51,10 +51,12 @@ SOURCES_a52tofloat32 = converter/a52tofloat32.c
SOURCES_dtstospdif = converter/dtstospdif.c
SOURCES_dtstofloat32 = converter/dtstofloat32.c
SOURCES_mpgatofixed32 = converter/mpgatofixed32.c
SOURCES_audio_endian = converter/endian.c
SOURCES_audio_format = converter/format.c
libvlc_LTLIBRARIES += \
liba52tospdif_plugin.la \
libaudio_endian_plugin.la \
libaudio_format_plugin.la \
libdtstospdif_plugin.la
...
...
modules/audio_filter/converter/endian.c
0 → 100644
View file @
59987d76
/*****************************************************************************
* endian.c : PCM endian converter
*****************************************************************************
* Copyright (C) 2002-2005 VLC authors and VideoLAN
* Copyright (C) 2010 Laurent Aimar
* Copyright (C) 2012 Rémi Denis-Courmont
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Gildas Bazin <gbazin@videolan.org>
* Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_block.h>
#include <vlc_filter.h>
static
int
Open
(
vlc_object_t
*
);
vlc_module_begin
()
set_description
(
N_
(
"Audio filter for endian conversion"
))
set_category
(
CAT_AUDIO
)
set_subcategory
(
SUBCAT_AUDIO_MISC
)
set_capability
(
"audio converter"
,
2
)
set_callbacks
(
Open
,
NULL
)
vlc_module_end
()
static
block_t
*
Filter16
(
filter_t
*
filter
,
block_t
*
block
)
{
uint16_t
*
data
=
(
uint16_t
*
)
block
->
p_buffer
;
for
(
size_t
i
=
0
;
i
<
block
->
i_buffer
/
2
;
i
++
)
data
[
i
]
=
bswap16
(
data
[
i
]);
(
void
)
filter
;
return
block
;
}
static
block_t
*
Filter24
(
filter_t
*
filter
,
block_t
*
block
)
{
uint8_t
*
data
=
(
uint8_t
*
)
block
->
p_buffer
;
for
(
size_t
i
=
0
;
i
<
block
->
i_buffer
;
i
+=
3
)
{
uint8_t
buf
=
data
[
i
];
data
[
i
]
=
data
[
i
+
2
];
data
[
i
+
2
]
=
buf
;
}
(
void
)
filter
;
return
block
;
}
static
block_t
*
Filter32
(
filter_t
*
filter
,
block_t
*
block
)
{
uint32_t
*
data
=
(
uint32_t
*
)
block
->
p_buffer
;
for
(
size_t
i
=
0
;
i
<
block
->
i_buffer
/
4
;
i
++
)
data
[
i
]
=
bswap32
(
data
[
i
]);
(
void
)
filter
;
return
block
;
}
static
block_t
*
Filter64
(
filter_t
*
filter
,
block_t
*
block
)
{
uint64_t
*
data
=
(
uint64_t
*
)
block
->
p_buffer
;
for
(
size_t
i
=
0
;
i
<
block
->
i_buffer
/
8
;
i
++
)
data
[
i
]
=
bswap64
(
data
[
i
]);
(
void
)
filter
;
return
block
;
}
static
const
vlc_fourcc_t
list
[][
2
]
=
{
{
VLC_CODEC_F64B
,
VLC_CODEC_F64L
},
{
VLC_CODEC_F32B
,
VLC_CODEC_F32L
},
{
VLC_CODEC_S16B
,
VLC_CODEC_S16L
},
{
VLC_CODEC_S24B
,
VLC_CODEC_S24L
},
{
VLC_CODEC_S32B
,
VLC_CODEC_S32L
},
{
VLC_CODEC_S16B
,
VLC_CODEC_S16L
},
{
VLC_CODEC_S24B
,
VLC_CODEC_S24L
},
{
VLC_CODEC_S32B
,
VLC_CODEC_S32L
},
};
static
int
Open
(
vlc_object_t
*
object
)
{
filter_t
*
filter
=
(
filter_t
*
)
object
;
const
audio_sample_format_t
*
src
=
&
filter
->
fmt_in
.
audio
;
const
audio_sample_format_t
*
dst
=
&
filter
->
fmt_out
.
audio
;
if
(
!
AOUT_FMTS_SIMILAR
(
src
,
dst
))
return
VLC_EGENERIC
;
for
(
size_t
i
=
0
;
i
<
sizeof
(
list
)
/
sizeof
(
list
[
0
]);
i
++
)
{
if
(
src
->
i_format
==
list
[
i
][
0
])
{
if
(
dst
->
i_format
!=
list
[
i
][
1
])
goto
ok
;
break
;
}
if
(
src
->
i_format
==
list
[
i
][
1
])
{
if
(
dst
->
i_format
==
list
[
i
][
0
])
goto
ok
;
break
;
}
}
return
VLC_EGENERIC
;
ok:
switch
(
src
->
i_bitspersample
)
{
case
16
:
filter
->
pf_audio_filter
=
Filter16
;
break
;
case
24
:
filter
->
pf_audio_filter
=
Filter24
;
break
;
case
32
:
filter
->
pf_audio_filter
=
Filter32
;
break
;
case
64
:
filter
->
pf_audio_filter
=
Filter64
;
break
;
}
return
VLC_SUCCESS
;
}
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