Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
03e512ac
Commit
03e512ac
authored
Oct 20, 2013
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shine: use external library
https://github.com/savonet/shine
parent
6ba6d9fc
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
2723 deletions
+59
-2723
configure.ac
configure.ac
+3
-7
modules/codec/Makefile.am
modules/codec/Makefile.am
+3
-3
modules/codec/shine.c
modules/codec/shine.c
+53
-23
modules/codec/shine/enc_base.h
modules/codec/shine/enc_base.h
+0
-301
modules/codec/shine/shine.c
modules/codec/shine/shine.c
+0
-2389
No files found.
configure.ac
View file @
03e512ac
...
...
@@ -2107,14 +2107,10 @@ then
fi
dnl
dnl shine
fixed point mp3 encoder
dnl shine
encoder plugin
dnl
AC_ARG_ENABLE(shine,
[ --enable-shine shine mp3 encoding module (default disabled)])
if test "${enable_shine}" = "yes"
then
VLC_ADD_PLUGIN([shine])
fi
PKG_ENABLE_MODULES_VLC([SHINE], [], [shine >= 3.0.0], [MPEG Audio Layer 3 encoder], [auto], [], [], [])
dnl
dnl openmax il codec plugin
...
...
modules/codec/Makefile.am
View file @
03e512ac
...
...
@@ -392,9 +392,9 @@ libfdkaac_plugin_la_LIBADD = $(FDKAAC_LIBS)
EXTRA_LTLIBRARIES
+=
libfdkaac_plugin.la
codec_LTLIBRARIES
+=
$(LTLIBfdkaac)
libshine_plugin_la_SOURCES
=
codec/shine
/shine_mod.c codec/shine/enc_base.h
EXTRA_libshine_plugin_la_SOURCES
=
codec/shine/shine.c
libshine_plugin_la_LDFLAGS
=
$(AM_LDFLAGS)
-rpath
'
$(codecdir)
'
libshine_plugin_la_SOURCES
=
codec/shine
.c
libshine_plugin_la_CFLAGS
=
$(AM_CFLAGS)
$(SHINE_CFLAGS)
libshine_plugin_la_LDFLAGS
=
$(AM_LDFLAGS)
-rpath
'
$(codecdir)
'
$(SHINE_LIBS)
EXTRA_LTLIBRARIES
+=
libshine_plugin.la
codec_LTLIBRARIES
+=
$(LTLIBshine)
...
...
modules/codec/shine
/shine_mod
.c
→
modules/codec/shine.c
View file @
03e512ac
...
...
@@ -33,18 +33,17 @@
#include <vlc_block.h>
#include <vlc_block_helper.h>
#include <vlc_bits.h>
#include <vlc_aout.h>
#include <assert.h>
#include <inttypes.h>
/* shine.c uses a lot of static variables, so we include the C file to keep
* the scope.
* Note that it makes this decoder non reentrant, this is why we have the
* struct entrant below */
#include "shine.c"
#include <shine/layer3.h>
struct
encoder_sys_t
{
shine_t
s
;
unsigned
int
samples_per_frame
;
block_fifo_t
*
p_fifo
;
unsigned
int
i_buffer
;
...
...
@@ -121,12 +120,30 @@ static int OpenEncoder( vlc_object_t *p_this )
goto
enomem
;
}
init_mp3_encoder_engine
(
p_enc
->
fmt_out
.
audio
.
i_rate
,
p_enc
->
fmt_out
.
audio
.
i_channels
,
p_enc
->
fmt_out
.
i_bitrate
/
1000
);
shine_config_t
cfg
=
{
.
wave
=
{
.
channels
=
p_enc
->
fmt_out
.
audio
.
i_channels
,
.
samplerate
=
p_enc
->
fmt_out
.
audio
.
i_rate
,
},
};
shine_set_config_mpeg_defaults
(
&
cfg
.
mpeg
);
cfg
.
mpeg
.
bitr
=
p_enc
->
fmt_out
.
i_bitrate
/
1000
;
if
(
shine_check_config
(
cfg
.
wave
.
samplerate
,
cfg
.
mpeg
.
bitr
)
==
-
1
)
{
msg_Err
(
p_enc
,
"Invalid bitrate %d
\n
"
,
cfg
.
mpeg
.
bitr
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
p_sys
->
s
=
shine_initialise
(
&
cfg
);
p_sys
->
samples_per_frame
=
shine_samples_per_pass
(
p_sys
->
s
);
p_enc
->
pf_encode_audio
=
EncodeFrame
;
p_enc
->
fmt_out
.
i_cat
=
AUDIO_ES
;
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_S16N
;
return
VLC_SUCCESS
;
enomem:
...
...
@@ -136,7 +153,7 @@ enomem:
return
VLC_ENOMEM
;
}
/* We split/pack PCM blocks to a fixed size: p
cm_chunk_size
bytes */
/* We split/pack PCM blocks to a fixed size: p
_sys->samples_per_frame * 4
bytes */
static
block_t
*
GetPCM
(
encoder_t
*
p_enc
,
block_t
*
p_block
)
{
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
...
...
@@ -145,10 +162,10 @@ static block_t *GetPCM( encoder_t *p_enc, block_t *p_block )
if
(
!
p_block
)
goto
buffered
;
/* just return a block if we can */
/* Put the PCM samples sent by VLC in the Fifo */
while
(
p_sys
->
i_buffer
+
p_block
->
i_buffer
>=
p
cm_chunk_size
)
while
(
p_sys
->
i_buffer
+
p_block
->
i_buffer
>=
p
_sys
->
samples_per_frame
*
4
)
{
unsigned
int
i_buffer
=
0
;
p_pcm_block
=
block_Alloc
(
p
cm_chunk_size
);
p_pcm_block
=
block_Alloc
(
p
_sys
->
samples_per_frame
*
4
);
if
(
!
p_pcm_block
)
break
;
...
...
@@ -162,10 +179,10 @@ static block_t *GetPCM( encoder_t *p_enc, block_t *p_block )
}
memcpy
(
p_pcm_block
->
p_buffer
+
i_buffer
,
p_block
->
p_buffer
,
p
cm_chunk_size
-
i_buffer
);
p_block
->
p_buffer
+=
p
cm_chunk_size
-
i_buffer
;
p_block
->
p_buffer
,
p
_sys
->
samples_per_frame
*
4
-
i_buffer
);
p_block
->
p_buffer
+=
p
_sys
->
samples_per_frame
*
4
-
i_buffer
;
p_block
->
i_buffer
-=
p
cm_chunk_size
-
i_buffer
;
p_block
->
i_buffer
-=
p
_sys
->
samples_per_frame
*
4
-
i_buffer
;
block_FifoPut
(
p_sys
->
p_fifo
,
p_pcm_block
);
}
...
...
@@ -202,6 +219,10 @@ buffered:
static
block_t
*
EncodeFrame
(
encoder_t
*
p_enc
,
block_t
*
p_block
)
{
if
(
!
p_block
)
/* TODO: flush */
return
NULL
;
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
block_t
*
p_pcm_block
;
block_t
*
p_chain
=
NULL
;
unsigned
int
i_samples
=
p_block
->
i_buffer
>>
2
/* s16l stereo */
;
...
...
@@ -216,28 +237,35 @@ static block_t *EncodeFrame( encoder_t *p_enc, block_t *p_block )
break
;
p_block
=
NULL
;
/* we don't need it anymore */
uint32_t
enc_buffer
[
16384
];
/* storage for 65536 Bytes XXX: too much */
struct
enc_chunk_hdr
*
chunk
=
(
void
*
)
enc_buffer
;
chunk
->
enc_data
=
ENC_CHUNK_SKIP_HDR
(
chunk
->
enc_data
,
chunk
);
encode_frame
(
(
char
*
)
p_pcm_block
->
p_buffer
,
chunk
);
int16_t
pcm_planar_buf
[
SHINE_MAX_SAMPLES
*
2
];
int16_t
*
pcm_planar_buf_chans
[
2
]
=
{
&
pcm_planar_buf
[
0
],
&
pcm_planar_buf
[
p_sys
->
samples_per_frame
],
};
aout_Deinterleave
(
pcm_planar_buf
,
p_pcm_block
->
p_buffer
,
p_sys
->
samples_per_frame
,
p_enc
->
fmt_in
.
audio
.
i_channels
,
p_enc
->
fmt_in
.
i_codec
);
long
written
;
unsigned
char
*
buf
=
shine_encode_buffer
(
p_sys
->
s
,
pcm_planar_buf_chans
,
&
written
);
block_Release
(
p_pcm_block
);
block_t
*
p_mp3_block
=
block_Alloc
(
chunk
->
enc_size
);
if
(
written
<=
0
)
break
;
block_t
*
p_mp3_block
=
block_Alloc
(
written
);
if
(
!
p_mp3_block
)
break
;
memcpy
(
p_mp3_block
->
p_buffer
,
chunk
->
enc_data
,
chunk
->
enc_size
);
memcpy
(
p_mp3_block
->
p_buffer
,
buf
,
written
);
/* date management */
p_mp3_block
->
i_length
=
SAMP_PER_FRAME1
*
1000000
/
p_mp3_block
->
i_length
=
p_sys
->
samples_per_frame
*
1000000
/
p_enc
->
fmt_out
.
audio
.
i_rate
;
start_date
+=
p_mp3_block
->
i_length
;
p_mp3_block
->
i_dts
=
p_mp3_block
->
i_pts
=
start_date
;
p_mp3_block
->
i_nb_samples
=
SAMP_PER_FRAME1
;
p_mp3_block
->
i_nb_samples
=
p_sys
->
samples_per_frame
;
block_ChainAppend
(
&
p_chain
,
p_mp3_block
);
...
...
@@ -259,6 +287,8 @@ static void CloseEncoder( vlc_object_t *p_this )
if
(
p_sys
->
i_buffer
)
free
(
p_sys
->
p_buffer
);
shine_close
(
p_sys
->
s
);
block_FifoRelease
(
p_sys
->
p_fifo
);
free
(
p_sys
);
}
modules/codec/shine/enc_base.h
deleted
100644 → 0
View file @
6ba6d9fc
This diff is collapsed.
Click to expand it.
modules/codec/shine/shine.c
deleted
100644 → 0
View file @
6ba6d9fc
This diff is collapsed.
Click to expand it.
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