Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
8c9971c3
Commit
8c9971c3
authored
May 21, 2012
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: fix stream cycling if audio decoding fails
Fixes ticket 1161. Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
c2e8691c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
17 deletions
+24
-17
ffplay.c
ffplay.c
+24
-17
No files found.
ffplay.c
View file @
8c9971c3
...
...
@@ -232,6 +232,7 @@ typedef struct VideoState {
#endif
int
refresh
;
int
last_video_stream
,
last_audio_stream
,
last_subtitle_stream
;
}
VideoState
;
typedef
struct
AllocEventProps
{
...
...
@@ -2263,9 +2264,9 @@ static int stream_component_open(VideoState *is, int stream_index)
opts
=
filter_codec_opts
(
codec_opts
,
codec
,
ic
,
ic
->
streams
[
stream_index
]);
switch
(
avctx
->
codec_type
){
case
AVMEDIA_TYPE_AUDIO
:
if
(
audio_codec_name
)
codec
=
avcodec_find_decoder_by_name
(
audio_codec_name
);
break
;
case
AVMEDIA_TYPE_SUBTITLE
:
if
(
subtitle_codec_name
)
codec
=
avcodec_find_decoder_by_name
(
subtitle_codec_name
);
break
;
case
AVMEDIA_TYPE_VIDEO
:
if
(
video_codec_name
)
codec
=
avcodec_find_decoder_by_name
(
video_codec_name
);
break
;
case
AVMEDIA_TYPE_AUDIO
:
i
s
->
last_audio_stream
=
stream_index
;
i
f
(
audio_codec_name
)
codec
=
avcodec_find_decoder_by_name
(
audio_codec_name
);
break
;
case
AVMEDIA_TYPE_SUBTITLE
:
i
s
->
last_subtitle_stream
=
stream_index
;
i
f
(
subtitle_codec_name
)
codec
=
avcodec_find_decoder_by_name
(
subtitle_codec_name
);
break
;
case
AVMEDIA_TYPE_VIDEO
:
i
s
->
last_video_stream
=
stream_index
;
i
f
(
video_codec_name
)
codec
=
avcodec_find_decoder_by_name
(
video_codec_name
);
break
;
}
if
(
!
codec
)
return
-
1
;
...
...
@@ -2492,9 +2493,9 @@ static int read_thread(void *arg)
int
orig_nb_streams
;
memset
(
st_index
,
-
1
,
sizeof
(
st_index
));
is
->
video_stream
=
-
1
;
is
->
audio_stream
=
-
1
;
is
->
subtitle_stream
=
-
1
;
is
->
last_video_stream
=
is
->
video_stream
=
-
1
;
is
->
last_audio_stream
=
is
->
audio_stream
=
-
1
;
is
->
last_subtitle_stream
=
is
->
subtitle_stream
=
-
1
;
ic
=
avformat_alloc_context
();
ic
->
interrupt_callback
.
callback
=
decode_interrupt_cb
;
...
...
@@ -2772,16 +2773,19 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
{
AVFormatContext
*
ic
=
is
->
ic
;
int
start_index
,
stream_index
;
int
old_index
;
AVStream
*
st
;
if
(
codec_type
==
AVMEDIA_TYPE_VIDEO
)
start_index
=
is
->
video_stream
;
else
if
(
codec_type
==
AVMEDIA_TYPE_AUDIO
)
start_index
=
is
->
audio_stream
;
else
start_index
=
is
->
subtitle_stream
;
if
(
start_index
<
(
codec_type
==
AVMEDIA_TYPE_SUBTITLE
?
-
1
:
0
))
return
;
if
(
codec_type
==
AVMEDIA_TYPE_VIDEO
)
{
start_index
=
is
->
last_video_stream
;
old_index
=
is
->
video_stream
;
}
else
if
(
codec_type
==
AVMEDIA_TYPE_AUDIO
)
{
start_index
=
is
->
last_audio_stream
;
old_index
=
is
->
audio_stream
;
}
else
{
start_index
=
is
->
last_subtitle_stream
;
old_index
=
is
->
subtitle_stream
;
}
stream_index
=
start_index
;
for
(;;)
{
if
(
++
stream_index
>=
is
->
ic
->
nb_streams
)
...
...
@@ -2789,9 +2793,12 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
if
(
codec_type
==
AVMEDIA_TYPE_SUBTITLE
)
{
stream_index
=
-
1
;
is
->
last_subtitle_stream
=
-
1
;
goto
the_end
;
}
else
stream_index
=
0
;
}
if
(
start_index
==
-
1
)
return
;
stream_index
=
0
;
}
if
(
stream_index
==
start_index
)
return
;
...
...
@@ -2813,7 +2820,7 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
}
}
the_end:
stream_component_close
(
is
,
start
_index
);
stream_component_close
(
is
,
old
_index
);
stream_component_open
(
is
,
stream_index
);
}
...
...
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