Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
b15c4cde
Commit
b15c4cde
authored
Oct 30, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: use return value of decoder_data()
decoder_data() always returns the current command. If we use this, we can save a lot of decoder_get_command() calls.
parent
f3b4a285
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
18 deletions
+20
-18
ffmpeg_plugin.c
src/decoder/ffmpeg_plugin.c
+20
-18
No files found.
src/decoder/ffmpeg_plugin.c
View file @
b15c4cde
...
@@ -213,7 +213,7 @@ ffmpeg_try_decode(struct input_stream *input)
...
@@ -213,7 +213,7 @@ ffmpeg_try_decode(struct input_stream *input)
return
input
->
seekable
&&
ffmpeg_helper
(
input
,
NULL
,
NULL
);
return
input
->
seekable
&&
ffmpeg_helper
(
input
,
NULL
,
NULL
);
}
}
static
voi
d
static
enum
decoder_comman
d
ffmpeg_send_packet
(
struct
decoder
*
decoder
,
const
AVPacket
*
packet
,
ffmpeg_send_packet
(
struct
decoder
*
decoder
,
const
AVPacket
*
packet
,
AVCodecContext
*
codec_context
,
AVCodecContext
*
codec_context
,
const
AVRational
*
time_base
)
const
AVRational
*
time_base
)
...
@@ -233,15 +233,15 @@ ffmpeg_send_packet(struct decoder *decoder, const AVPacket *packet,
...
@@ -233,15 +233,15 @@ ffmpeg_send_packet(struct decoder *decoder, const AVPacket *packet,
if
(
len
<
0
)
{
if
(
len
<
0
)
{
WARNING
(
"skipping frame!
\n
"
);
WARNING
(
"skipping frame!
\n
"
);
return
;
return
decoder_get_command
(
decoder
)
;
}
}
assert
(
audio_size
>=
0
);
assert
(
audio_size
>=
0
);
decoder_data
(
decoder
,
NULL
,
1
,
return
decoder_data
(
decoder
,
NULL
,
1
,
audio_buf
,
audio_size
,
audio_buf
,
audio_size
,
position
,
position
,
codec_context
->
bit_rate
/
1000
,
NULL
);
codec_context
->
bit_rate
/
1000
,
NULL
);
}
}
static
bool
static
bool
...
@@ -252,6 +252,7 @@ ffmpeg_decode_internal(BasePtrs *base)
...
@@ -252,6 +252,7 @@ ffmpeg_decode_internal(BasePtrs *base)
AVFormatContext
*
pFormatCtx
=
base
->
pFormatCtx
;
AVFormatContext
*
pFormatCtx
=
base
->
pFormatCtx
;
AVPacket
packet
;
AVPacket
packet
;
struct
audio_format
audio_format
;
struct
audio_format
audio_format
;
enum
decoder_command
cmd
;
int
current
,
total_time
;
int
current
,
total_time
;
total_time
=
0
;
total_time
=
0
;
...
@@ -272,8 +273,19 @@ ffmpeg_decode_internal(BasePtrs *base)
...
@@ -272,8 +273,19 @@ ffmpeg_decode_internal(BasePtrs *base)
decoder_initialized
(
decoder
,
&
audio_format
,
total_time
);
decoder_initialized
(
decoder
,
&
audio_format
,
total_time
);
do
{
do
{
if
(
av_read_frame
(
pFormatCtx
,
&
packet
)
<
0
)
/* end of file */
break
;
if
(
packet
.
stream_index
==
base
->
audioStream
)
cmd
=
ffmpeg_send_packet
(
decoder
,
&
packet
,
aCodecCtx
,
&
pFormatCtx
->
streams
[
base
->
audioStream
]
->
time_base
);
else
cmd
=
decoder_get_command
(
decoder
);
av_free_packet
(
&
packet
);
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_SEEK
)
{
if
(
cmd
==
DECODE_COMMAND_SEEK
)
{
current
=
decoder_seek_where
(
decoder
)
*
AV_TIME_BASE
;
current
=
decoder_seek_where
(
decoder
)
*
AV_TIME_BASE
;
if
(
av_seek_frame
(
pFormatCtx
,
-
1
,
current
,
0
)
<
0
)
if
(
av_seek_frame
(
pFormatCtx
,
-
1
,
current
,
0
)
<
0
)
...
@@ -281,17 +293,7 @@ ffmpeg_decode_internal(BasePtrs *base)
...
@@ -281,17 +293,7 @@ ffmpeg_decode_internal(BasePtrs *base)
else
else
decoder_command_finished
(
decoder
);
decoder_command_finished
(
decoder
);
}
}
}
while
(
cmd
!=
DECODE_COMMAND_STOP
);
if
(
av_read_frame
(
pFormatCtx
,
&
packet
)
<
0
)
/* end of file */
break
;
if
(
packet
.
stream_index
==
base
->
audioStream
)
ffmpeg_send_packet
(
decoder
,
&
packet
,
aCodecCtx
,
&
pFormatCtx
->
streams
[
base
->
audioStream
]
->
time_base
);
av_free_packet
(
&
packet
);
}
while
(
decoder_get_command
(
decoder
)
!=
DECODE_COMMAND_STOP
);
return
true
;
return
true
;
}
}
...
...
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