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
5477c311
Commit
5477c311
authored
Jan 18, 2010
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/ffmpeg: optimized the stream_tag() method
Don't use the function ffmpeg_helper(), don't initialize the codec.
parent
acd3f8cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
25 deletions
+27
-25
ffmpeg_decoder_plugin.c
src/decoder/ffmpeg_decoder_plugin.c
+27
-25
No files found.
src/decoder/ffmpeg_decoder_plugin.c
View file @
5477c311
...
...
@@ -51,7 +51,6 @@ struct ffmpeg_context {
AVCodecContext
*
codec_context
;
struct
decoder
*
decoder
;
struct
input_stream
*
input
;
struct
tag
*
tag
;
};
struct
ffmpeg_stream
{
...
...
@@ -405,14 +404,33 @@ ffmpeg_copy_metadata(struct tag *tag, AVMetadata *m,
}
#endif
static
bool
ffmpeg_tag_internal
(
struct
ffmpeg_context
*
ctx
)
//no tag reading in ffmpeg, check if playable
static
struct
tag
*
ffmpeg_stream_tag
(
struct
input_stream
*
is
)
{
struct
tag
*
tag
=
(
struct
tag
*
)
ctx
->
tag
;
AVFormatContext
*
f
=
ctx
->
format_context
;
struct
ffmpeg_stream
stream
=
{
.
url
=
"mpd://X"
,
/* only the mpd:// prefix matters */
.
decoder
=
NULL
,
.
input
=
is
,
};
if
(
is
->
uri
!=
NULL
)
append_uri_suffix
(
&
stream
,
is
->
uri
);
AVFormatContext
*
f
;
if
(
av_open_input_file
(
&
f
,
stream
.
url
,
NULL
,
0
,
NULL
)
!=
0
)
return
NULL
;
if
(
av_find_stream_info
(
f
)
<
0
)
{
av_close_input_file
(
f
);
return
NULL
;
}
struct
tag
*
tag
=
tag_new
();
tag
->
time
=
0
;
if
(
f
->
duration
!=
(
int64_t
)
AV_NOPTS_VALUE
)
tag
->
time
=
f
->
duration
/
AV_TIME_BASE
;
tag
->
time
=
f
->
duration
!=
(
int64_t
)
AV_NOPTS_VALUE
?
f
->
duration
/
AV_TIME_BASE
:
0
;
#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(31<<8)+0)
av_metadata_conv
(
f
,
NULL
,
f
->
iformat
->
metadata_conv
);
...
...
@@ -449,26 +467,10 @@ static bool ffmpeg_tag_internal(struct ffmpeg_context *ctx)
}
#endif
return
true
;
}
//no tag reading in ffmpeg, check if playable
static
struct
tag
*
ffmpeg_stream_tag
(
struct
input_stream
*
is
)
{
struct
ffmpeg_context
ctx
;
bool
ret
;
ctx
.
decoder
=
NULL
;
ctx
.
tag
=
tag_new
();
ret
=
ffmpeg_helper
(
is
,
ffmpeg_tag_internal
,
&
ctx
);
if
(
!
ret
)
{
tag_free
(
ctx
.
tag
);
ctx
.
tag
=
NULL
;
}
av_close_input_file
(
f
);
return
ctx
.
tag
;
return
tag
;
}
/**
...
...
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