Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
37e2a978
Commit
37e2a978
authored
12 years ago
by
Paul B Mahol
Browse files
Options
Downloads
Patches
Plain Diff
lxfdec: remove deplanarization hack
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
467dfd5d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/lxfdec.c
+5
-30
5 additions, 30 deletions
libavformat/lxfdec.c
with
5 additions
and
30 deletions
libavformat/lxfdec.c
+
5
−
30
View file @
37e2a978
...
@@ -48,7 +48,6 @@ static const AVCodecTag lxf_tags[] = {
...
@@ -48,7 +48,6 @@ static const AVCodecTag lxf_tags[] = {
typedef
struct
{
typedef
struct
{
int
channels
;
///< number of audio channels. zero means no audio
int
channels
;
///< number of audio channels. zero means no audio
uint8_t
temp
[
LXF_MAX_AUDIO_PACKET
];
///< temp buffer for de-planarizing the audio data
int
frame_number
;
///< current video frame
int
frame_number
;
///< current video frame
uint32_t
video_format
,
packet_type
,
extended_size
;
uint32_t
video_format
,
packet_type
,
extended_size
;
}
LXFDemuxContext
;
}
LXFDemuxContext
;
...
@@ -185,10 +184,10 @@ static int get_packet_header(AVFormatContext *s)
...
@@ -185,10 +184,10 @@ static int get_packet_header(AVFormatContext *s)
}
}
switch
(
st
->
codec
->
bits_per_coded_sample
)
{
switch
(
st
->
codec
->
bits_per_coded_sample
)
{
case
16
:
st
->
codec
->
codec_id
=
AV_CODEC_ID_PCM_S16LE
;
break
;
case
16
:
st
->
codec
->
codec_id
=
AV_CODEC_ID_PCM_S16LE
_PLANAR
;
break
;
case
20
:
st
->
codec
->
codec_id
=
AV_CODEC_ID_PCM_LXF
;
break
;
case
20
:
st
->
codec
->
codec_id
=
AV_CODEC_ID_PCM_LXF
;
break
;
case
24
:
st
->
codec
->
codec_id
=
AV_CODEC_ID_PCM_S24LE
;
break
;
case
24
:
st
->
codec
->
codec_id
=
AV_CODEC_ID_PCM_S24LE
_PLANAR
;
break
;
case
32
:
st
->
codec
->
codec_id
=
AV_CODEC_ID_PCM_S32LE
;
break
;
case
32
:
st
->
codec
->
codec_id
=
AV_CODEC_ID_PCM_S32LE
_PLANAR
;
break
;
default:
default:
av_log
(
s
,
AV_LOG_WARNING
,
av_log
(
s
,
AV_LOG_WARNING
,
"only 16-, 20-, 24- and 32-bit PCM currently supported
\n
"
);
"only 16-, 20-, 24- and 32-bit PCM currently supported
\n
"
);
...
@@ -288,28 +287,10 @@ static int lxf_read_header(AVFormatContext *s)
...
@@ -288,28 +287,10 @@ static int lxf_read_header(AVFormatContext *s)
return
0
;
return
0
;
}
}
/**
* De-planerize the PCM data in lxf->temp
* FIXME: remove this once support for planar audio is added to libavcodec
*
* @param[out] out where to write the de-planerized data to
* @param[in] bytes the total size of the PCM data
*/
static
void
deplanarize
(
LXFDemuxContext
*
lxf
,
AVStream
*
ast
,
uint8_t
*
out
,
int
bytes
)
{
int
x
,
y
,
z
,
i
,
bytes_per_sample
=
ast
->
codec
->
bits_per_coded_sample
>>
3
;
for
(
z
=
i
=
0
;
z
<
lxf
->
channels
;
z
++
)
for
(
y
=
0
;
y
<
bytes
/
bytes_per_sample
/
lxf
->
channels
;
y
++
)
for
(
x
=
0
;
x
<
bytes_per_sample
;
x
++
,
i
++
)
out
[
x
+
bytes_per_sample
*
(
z
+
y
*
lxf
->
channels
)]
=
lxf
->
temp
[
i
];
}
static
int
lxf_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
static
int
lxf_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
{
LXFDemuxContext
*
lxf
=
s
->
priv_data
;
LXFDemuxContext
*
lxf
=
s
->
priv_data
;
AVIOContext
*
pb
=
s
->
pb
;
AVIOContext
*
pb
=
s
->
pb
;
uint8_t
*
buf
;
AVStream
*
ast
=
NULL
;
AVStream
*
ast
=
NULL
;
uint32_t
stream
;
uint32_t
stream
;
int
ret
,
ret2
;
int
ret
,
ret2
;
...
@@ -339,20 +320,14 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -339,20 +320,14 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
if
((
ret2
=
av_new_packet
(
pkt
,
ret
))
<
0
)
if
((
ret2
=
av_new_packet
(
pkt
,
ret
))
<
0
)
return
ret2
;
return
ret2
;
//read non-20-bit audio data into lxf->temp so we can deplanarize it
if
((
ret2
=
avio_read
(
pb
,
pkt
->
data
,
ret
))
!=
ret
)
{
buf
=
ast
&&
ast
->
codec
->
codec_id
!=
AV_CODEC_ID_PCM_LXF
?
lxf
->
temp
:
pkt
->
data
;
if
((
ret2
=
avio_read
(
pb
,
buf
,
ret
))
!=
ret
)
{
av_free_packet
(
pkt
);
av_free_packet
(
pkt
);
return
ret2
<
0
?
ret2
:
AVERROR_EOF
;
return
ret2
<
0
?
ret2
:
AVERROR_EOF
;
}
}
pkt
->
stream_index
=
stream
;
pkt
->
stream_index
=
stream
;
if
(
ast
)
{
if
(
!
ast
)
{
if
(
ast
->
codec
->
codec_id
!=
AV_CODEC_ID_PCM_LXF
)
deplanarize
(
lxf
,
ast
,
pkt
->
data
,
ret
);
}
else
{
//picture type (0 = closed I, 1 = open I, 2 = P, 3 = B)
//picture type (0 = closed I, 1 = open I, 2 = P, 3 = B)
if
(((
lxf
->
video_format
>>
22
)
&
0x3
)
<
2
)
if
(((
lxf
->
video_format
>>
22
)
&
0x3
)
<
2
)
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment