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
c453453e
Commit
c453453e
authored
Oct 17, 2006
by
Derk-Jan Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable ffmpegs TTA decoder, and add a TTA demux to VLC. duration and seeking supported.
parent
b725ca4a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
257 additions
and
1 deletion
+257
-1
configure.ac
configure.ac
+1
-1
modules/codec/ffmpeg/ffmpeg.c
modules/codec/ffmpeg/ffmpeg.c
+6
-0
modules/demux/tta.c
modules/demux/tta.c
+250
-0
No files found.
configure.ac
View file @
c453453e
...
@@ -1148,7 +1148,7 @@ dnl
...
@@ -1148,7 +1148,7 @@ dnl
dnl default modules
dnl default modules
dnl
dnl
VLC_ADD_PLUGINS([dummy logger memcpy])
VLC_ADD_PLUGINS([dummy logger memcpy])
VLC_ADD_PLUGINS([mpgv mpga m4v m4a h264 ps pva avi asf mp4 rawdv nsv real aiff mjpeg demuxdump flac])
VLC_ADD_PLUGINS([mpgv mpga m4v m4a h264 ps pva avi asf mp4 rawdv nsv real aiff mjpeg demuxdump flac
tta
])
VLC_ADD_PLUGINS([cvdsub svcdsub spudec subsdec dvbsub mpeg_audio lpcm a52 dts cinepak flacdec])
VLC_ADD_PLUGINS([cvdsub svcdsub spudec subsdec dvbsub mpeg_audio lpcm a52 dts cinepak flacdec])
VLC_ADD_PLUGINS([deinterlace invert adjust transform wave ripple psychedelic gradient motionblur rv32 rotate noise])
VLC_ADD_PLUGINS([deinterlace invert adjust transform wave ripple psychedelic gradient motionblur rv32 rotate noise])
VLC_ADD_PLUGINS([fixed32tos16 s16tofixed32 u8tofixed32 mono])
VLC_ADD_PLUGINS([fixed32tos16 s16tofixed32 u8tofixed32 mono])
...
...
modules/codec/ffmpeg/ffmpeg.c
View file @
c453453e
...
@@ -1091,6 +1091,12 @@ static struct
...
@@ -1091,6 +1091,12 @@ static struct
AUDIO_ES
,
"Cook Audio"
},
AUDIO_ES
,
"Cook Audio"
},
#endif
#endif
#if LIBAVCODEC_BUILD >= ((51<<16)+(4<<8)+0)
/* TTA: The Lossless True Audio */
{
VLC_FOURCC
(
'T'
,
'T'
,
'A'
,
'1'
),
CODEC_ID_TTA
,
AUDIO_ES
,
"The Lossless True Audio"
},
#endif
#if LIBAVCODEC_BUILD >= ((51<<16)+(8<<8)+0)
#if LIBAVCODEC_BUILD >= ((51<<16)+(8<<8)+0)
/* Shorten */
/* Shorten */
{
VLC_FOURCC
(
's'
,
'h'
,
'n'
,
' '
),
CODEC_ID_SHORTEN
,
{
VLC_FOURCC
(
's'
,
'h'
,
'n'
,
' '
),
CODEC_ID_SHORTEN
,
...
...
modules/demux/tta.c
0 → 100644
View file @
c453453e
/*****************************************************************************
* tta.c : The Lossless True Audio parser
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id$
*
* Authors: Derk-Jan Hartman <hartman at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 General Public License for more details.
*
* You should have received a copy of the GNU 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <vlc_codec.h>
#include <math.h>
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
vlc_module_begin
();
set_shortname
(
"TTA"
);
set_description
(
_
(
"TTA demuxer"
)
);
set_category
(
CAT_INPUT
);
set_subcategory
(
SUBCAT_INPUT_DEMUX
);
set_capability
(
"demux2"
,
145
);
set_callbacks
(
Open
,
Close
);
add_shortcut
(
"tta"
);
vlc_module_end
();
#define TTA_FRAMETIME 1.04489795918367346939
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static
int
Demux
(
demux_t
*
);
static
int
Control
(
demux_t
*
,
int
,
va_list
);
struct
demux_sys_t
{
/* */
es_out_id_t
*
p_es
;
/* */
int
i_totalframes
;
int
i_currentframe
;
uint32_t
*
pi_seektable
;
int
i_datalength
;
int
i_framelength
;
/* */
vlc_meta_t
*
p_meta
;
int64_t
i_start
;
};
/*****************************************************************************
* Open: initializes ES structures
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
)
{
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
demux_sys_t
*
p_sys
;
es_format_t
fmt
;
uint8_t
*
p_peek
;
uint8_t
p_header
[
22
];
uint8_t
*
p_seektable
;
int
i_seektable_size
=
0
,
i
;
//char psz_info[4096];
//module_t *p_id3;
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
4
)
<
4
)
return
VLC_EGENERIC
;
if
(
!
POKE
(
p_peek
,
"TTA1"
,
4
)
)
{
if
(
!
p_demux
->
b_force
)
return
VLC_EGENERIC
;
/* User forced */
msg_Err
(
p_demux
,
"this doesn't look like a flac stream, "
"continuing anyway"
);
}
if
(
stream_Read
(
p_demux
->
s
,
p_header
,
22
)
<
22
)
return
VLC_EGENERIC
;
/* Fill p_demux fields */
p_demux
->
pf_demux
=
Demux
;
p_demux
->
pf_control
=
Control
;
p_demux
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
/* Read the metadata */
es_format_Init
(
&
fmt
,
AUDIO_ES
,
VLC_FOURCC
(
'T'
,
'T'
,
'A'
,
'1'
)
);
fmt
.
audio
.
i_channels
=
GetWLE
(
&
p_header
[
6
]
);
fmt
.
audio
.
i_bitspersample
=
GetWLE
(
&
p_header
[
8
]
);
fmt
.
audio
.
i_rate
=
GetDWLE
(
&
p_header
[
10
]
);
p_sys
->
i_datalength
=
GetDWLE
(
&
p_header
[
14
]
);
p_sys
->
i_framelength
=
TTA_FRAMETIME
*
fmt
.
audio
.
i_rate
;
p_sys
->
i_totalframes
=
p_sys
->
i_datalength
/
p_sys
->
i_framelength
+
((
p_sys
->
i_datalength
%
p_sys
->
i_framelength
)
?
1
:
0
);
p_sys
->
i_currentframe
=
0
;
i_seektable_size
=
sizeof
(
uint32_t
)
*
p_sys
->
i_totalframes
;
p_seektable
=
(
uint8_t
*
)
malloc
(
i_seektable_size
);
stream_Read
(
p_demux
->
s
,
p_seektable
,
i_seektable_size
);
p_sys
->
pi_seektable
=
(
uint32_t
*
)
malloc
(
i_seektable_size
);
for
(
i
=
0
;
i
<
p_sys
->
i_totalframes
;
i
++
)
p_sys
->
pi_seektable
[
i
]
=
GetDWLE
(
&
p_seektable
[
i
*
4
]
);
stream_Read
(
p_demux
->
s
,
NULL
,
4
);
/* CRC */
/* Store the header and Seektable for avcodec */
fmt
.
i_extra
=
22
+
(
p_sys
->
i_totalframes
*
4
)
+
4
;
fmt
.
p_extra
=
malloc
(
fmt
.
i_extra
);
memcpy
(
fmt
.
p_extra
,
p_header
,
22
);
memcpy
(
fmt
.
p_extra
+
22
,
p_seektable
,
fmt
.
i_extra
-
22
);
p_sys
->
p_es
=
es_out_Add
(
p_demux
->
out
,
&
fmt
);
free
(
p_seektable
);
p_sys
->
i_start
=
stream_Tell
(
p_demux
->
s
);
#if 0
/* Parse possible id3 header */
if( ( p_id3 = module_Need( p_demux, "meta reader", NULL, 0 ) ) )
{
p_sys->p_meta = (vlc_meta_t *)p_demux->p_private;
p_demux->p_private = NULL;
module_Unneed( p_demux, p_id3 );
}
if( !p_sys->p_meta )
p_sys->p_meta = vlc_meta_New();
#endif
return
VLC_SUCCESS
;
}
/*****************************************************************************
* Close: frees unused data
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
{
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
free
(
p_sys
);
}
/*****************************************************************************
* Demux:
*****************************************************************************
* Returns -1 in case of error, 0 in case of EOF, 1 otherwise
*****************************************************************************/
static
int
Demux
(
demux_t
*
p_demux
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
block_t
*
p_data
;
if
(
p_sys
->
i_currentframe
>
p_sys
->
i_totalframes
)
return
0
;
p_data
=
stream_Block
(
p_demux
->
s
,
p_sys
->
pi_seektable
[
p_sys
->
i_currentframe
]
);
if
(
p_data
==
NULL
)
return
0
;
p_data
->
i_dts
=
p_data
->
i_pts
=
(
int64_t
)(
1
+
I64C
(
1000000
)
*
p_sys
->
i_currentframe
)
*
TTA_FRAMETIME
;
p_sys
->
i_currentframe
++
;
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
p_data
->
i_dts
);
es_out_Send
(
p_demux
->
out
,
p_sys
->
p_es
,
p_data
);
return
1
;
}
/*****************************************************************************
* Control:
*****************************************************************************/
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
double
f
,
*
pf
;
int64_t
i64
,
*
pi64
;
vlc_meta_t
*
p_meta
;
switch
(
i_query
)
{
case
DEMUX_GET_POSITION
:
pf
=
(
double
*
)
va_arg
(
args
,
double
*
);
i64
=
stream_Size
(
p_demux
->
s
)
-
p_sys
->
i_start
;
if
(
i64
>
0
)
{
*
pf
=
(
double
)(
stream_Tell
(
p_demux
->
s
)
-
p_sys
->
i_start
)
/
(
double
)
i64
;
}
else
{
*
pf
=
0
.
0
;
}
return
VLC_SUCCESS
;
case
DEMUX_SET_POSITION
:
f
=
(
double
)
va_arg
(
args
,
double
);
i64
=
(
int64_t
)(
f
*
(
stream_Size
(
p_demux
->
s
)
-
p_sys
->
i_start
));
es_out_Control
(
p_demux
->
out
,
ES_OUT_RESET_PCR
);
if
(
i64
>
0
)
{
int64_t
tmp
=
0
;
int
i
;
for
(
i
=
0
;
i
<
p_sys
->
i_totalframes
&&
tmp
+
p_sys
->
pi_seektable
[
i
]
<
i64
;
i
++
)
{
tmp
+=
p_sys
->
pi_seektable
[
i
];
}
stream_Seek
(
p_demux
->
s
,
tmp
+
p_sys
->
i_start
);
p_sys
->
i_currentframe
=
i
;
return
VLC_SUCCESS
;
}
return
VLC_EGENERIC
;
case
DEMUX_GET_LENGTH
:
pi64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi64
=
I64C
(
1000000
)
*
p_sys
->
i_totalframes
*
TTA_FRAMETIME
;
return
VLC_SUCCESS
;
case
DEMUX_GET_TIME
:
pi64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi64
=
I64C
(
1000000
)
*
p_sys
->
i_currentframe
*
TTA_FRAMETIME
;
return
VLC_SUCCESS
;
default:
return
VLC_EGENERIC
;
}
}
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