Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
78162b4e
Commit
78162b4e
authored
Nov 21, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avconv: reindent.
parent
2a651b71
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
63 deletions
+63
-63
avconv.c
avconv.c
+63
-63
No files found.
avconv.c
View file @
78162b4e
...
...
@@ -1672,76 +1672,76 @@ static int output_packet(InputStream *ist, int ist_index,
decoded_data_buf
=
NULL
;
/* fail safe */
decoded_data_size
=
0
;
subtitle_to_free
=
NULL
;
switch
(
ist
->
st
->
codec
->
codec_type
)
{
case
AVMEDIA_TYPE_AUDIO
:{
if
(
pkt
&&
samples_size
<
FFMAX
(
pkt
->
size
*
bps
,
AVCODEC_MAX_AUDIO_FRAME_SIZE
))
{
samples_size
=
FFMAX
(
pkt
->
size
*
bps
,
AVCODEC_MAX_AUDIO_FRAME_SIZE
);
av_free
(
samples
);
samples
=
av_malloc
(
samples_size
);
}
decoded_data_size
=
samples_size
;
/* XXX: could avoid copy if PCM 16 bits with same
endianness as CPU */
ret
=
avcodec_decode_audio3
(
ist
->
st
->
codec
,
samples
,
&
decoded_data_size
,
&
avpkt
);
if
(
ret
<
0
)
return
ret
;
avpkt
.
data
+=
ret
;
avpkt
.
size
-=
ret
;
got_output
=
decoded_data_size
>
0
;
/* Some bug in mpeg audio decoder gives */
/* decoded_data_size < 0, it seems they are overflows */
if
(
!
got_output
)
{
/* no audio frame */
continue
;
}
decoded_data_buf
=
(
uint8_t
*
)
samples
;
ist
->
next_pts
+=
((
int64_t
)
AV_TIME_BASE
/
bps
*
decoded_data_size
)
/
(
ist
->
st
->
codec
->
sample_rate
*
ist
->
st
->
codec
->
channels
);
break
;}
case
AVMEDIA_TYPE_VIDEO
:
if
(
!
(
decoded_frame
=
avcodec_alloc_frame
()))
return
AVERROR
(
ENOMEM
);
avpkt
.
pts
=
pkt_pts
;
avpkt
.
dts
=
ist
->
pts
;
pkt_pts
=
AV_NOPTS_VALUE
;
ret
=
avcodec_decode_video2
(
ist
->
st
->
codec
,
decoded_frame
,
&
got_output
,
&
avpkt
);
quality
=
same_quant
?
decoded_frame
->
quality
:
0
;
if
(
ret
<
0
)
goto
fail
;
if
(
!
got_output
)
{
/* no picture yet */
av_freep
(
&
decoded_frame
);
goto
discard_packet
;
}
ist
->
next_pts
=
ist
->
pts
=
guess_correct_pts
(
&
ist
->
pts_ctx
,
decoded_frame
->
pkt_pts
,
decoded_frame
->
pkt_dts
);
if
(
ist
->
st
->
codec
->
time_base
.
num
!=
0
)
{
int
ticks
=
ist
->
st
->
parser
?
ist
->
st
->
parser
->
repeat_pict
+
1
:
ist
->
st
->
codec
->
ticks_per_frame
;
ist
->
next_pts
+=
((
int64_t
)
AV_TIME_BASE
*
ist
->
st
->
codec
->
time_base
.
num
*
ticks
)
/
ist
->
st
->
codec
->
time_base
.
den
;
}
avpkt
.
size
=
0
;
buffer_to_free
=
NULL
;
pre_process_video_frame
(
ist
,
(
AVPicture
*
)
decoded_frame
,
&
buffer_to_free
);
break
;
case
AVMEDIA_TYPE_SUBTITLE
:
ret
=
avcodec_decode_subtitle2
(
ist
->
st
->
codec
,
&
subtitle
,
&
got_output
,
&
avpkt
);
switch
(
ist
->
st
->
codec
->
codec_type
)
{
case
AVMEDIA_TYPE_AUDIO
:{
if
(
pkt
&&
samples_size
<
FFMAX
(
pkt
->
size
*
bps
,
AVCODEC_MAX_AUDIO_FRAME_SIZE
))
{
samples_size
=
FFMAX
(
pkt
->
size
*
bps
,
AVCODEC_MAX_AUDIO_FRAME_SIZE
);
av_free
(
samples
);
samples
=
av_malloc
(
samples_size
);
}
decoded_data_size
=
samples_size
;
/* XXX: could avoid copy if PCM 16 bits with same
endianness as CPU */
ret
=
avcodec_decode_audio3
(
ist
->
st
->
codec
,
samples
,
&
decoded_data_size
,
&
avpkt
);
if
(
ret
<
0
)
return
ret
;
avpkt
.
data
+=
ret
;
avpkt
.
size
-=
ret
;
got_output
=
decoded_data_size
>
0
;
/* Some bug in mpeg audio decoder gives */
/* decoded_data_size < 0, it seems they are overflows */
if
(
!
got_output
)
{
/* no audio frame */
continue
;
}
decoded_data_buf
=
(
uint8_t
*
)
samples
;
ist
->
next_pts
+=
((
int64_t
)
AV_TIME_BASE
/
bps
*
decoded_data_size
)
/
(
ist
->
st
->
codec
->
sample_rate
*
ist
->
st
->
codec
->
channels
);
break
;}
case
AVMEDIA_TYPE_VIDEO
:
if
(
!
(
decoded_frame
=
avcodec_alloc_frame
()))
return
AVERROR
(
ENOMEM
);
avpkt
.
pts
=
pkt_pts
;
avpkt
.
dts
=
ist
->
pts
;
pkt_pts
=
AV_NOPTS_VALUE
;
ret
=
avcodec_decode_video2
(
ist
->
st
->
codec
,
decoded_frame
,
&
got_output
,
&
avpkt
);
quality
=
same_quant
?
decoded_frame
->
quality
:
0
;
if
(
ret
<
0
)
return
ret
;
goto
fail
;
if
(
!
got_output
)
{
/* no picture yet */
av_freep
(
&
decoded_frame
);
goto
discard_packet
;
}
subtitle_to_free
=
&
subtitle
;
ist
->
next_pts
=
ist
->
pts
=
guess_correct_pts
(
&
ist
->
pts_ctx
,
decoded_frame
->
pkt_pts
,
decoded_frame
->
pkt_dts
);
if
(
ist
->
st
->
codec
->
time_base
.
num
!=
0
)
{
int
ticks
=
ist
->
st
->
parser
?
ist
->
st
->
parser
->
repeat_pict
+
1
:
ist
->
st
->
codec
->
ticks_per_frame
;
ist
->
next_pts
+=
((
int64_t
)
AV_TIME_BASE
*
ist
->
st
->
codec
->
time_base
.
num
*
ticks
)
/
ist
->
st
->
codec
->
time_base
.
den
;
}
avpkt
.
size
=
0
;
buffer_to_free
=
NULL
;
pre_process_video_frame
(
ist
,
(
AVPicture
*
)
decoded_frame
,
&
buffer_to_free
);
break
;
default
:
return
-
1
;
case
AVMEDIA_TYPE_SUBTITLE
:
ret
=
avcodec_decode_subtitle2
(
ist
->
st
->
codec
,
&
subtitle
,
&
got_output
,
&
avpkt
);
if
(
ret
<
0
)
return
ret
;
if
(
!
got_output
)
{
goto
discard_packet
;
}
subtitle_to_free
=
&
subtitle
;
avpkt
.
size
=
0
;
break
;
default
:
return
-
1
;
}
// preprocess audio (volume)
if
(
ist
->
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
{
...
...
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