projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
353507a
)
Another small clean-up.
author
Carl Hetherington
<cth@carlh.net>
Fri, 21 Feb 2014 10:25:00 +0000
(10:25 +0000)
committer
Carl Hetherington
<cth@carlh.net>
Fri, 21 Feb 2014 10:25:00 +0000
(10:25 +0000)
src/lib/ffmpeg_content.cc
patch
|
blob
|
history
src/lib/ffmpeg_content.h
patch
|
blob
|
history
src/lib/ffmpeg_decoder.cc
patch
|
blob
|
history
src/lib/ffmpeg_examiner.cc
patch
|
blob
|
history
src/lib/ffmpeg_examiner.h
patch
|
blob
|
history
diff --git
a/src/lib/ffmpeg_content.cc
b/src/lib/ffmpeg_content.cc
index 221a262ef6e9308cf4b2e2f4490e98aee730afbf..2c888baaf087fa49a5c1239900db35617d2f5593 100644
(file)
--- a/
src/lib/ffmpeg_content.cc
+++ b/
src/lib/ffmpeg_content.cc
@@
-393,22
+393,22
@@
FFmpegAudioStream::as_xml (xmlpp::Node* root) const
mapping.as_xml (root->add_child("Mapping"));
}
mapping.as_xml (root->add_child("Mapping"));
}
-int
-FFmpegStream::
index (AVFormatContext const * fc
) const
+bool
+FFmpegStream::
uses_index (AVFormatContext const * fc, int index
) const
{
if (_legacy_id) {
{
if (_legacy_id) {
- return id;
+ return id
== index
;
}
size_t i = 0;
while (i < fc->nb_streams) {
if (fc->streams[i]->id == id) {
}
size_t i = 0;
while (i < fc->nb_streams) {
if (fc->streams[i]->id == id) {
- return i;
+ return i
nt (i) == index
;
}
++i;
}
}
++i;
}
-
assert (false)
;
+
return false
;
}
AVStream *
}
AVStream *
diff --git
a/src/lib/ffmpeg_content.h
b/src/lib/ffmpeg_content.h
index b1f2abceaa37d46a382a2e2607dcf45e930b6291..d1aa3a0b56ec88f04e1078b5998f99f2f639d912 100644
(file)
--- a/
src/lib/ffmpeg_content.h
+++ b/
src/lib/ffmpeg_content.h
@@
-46,9
+46,10
@@
public:
void as_xml (xmlpp::Node *) const;
/** @param c An AVFormatContext.
void as_xml (xmlpp::Node *) const;
/** @param c An AVFormatContext.
- * @return Stream index within the AVFormatContext.
+ * @param index A stream index within the AVFormatContext.
+ * @return true if this FFmpegStream uses the given stream index.
*/
*/
-
int index (AVFormatContext const * c
) const;
+
bool uses_index (AVFormatContext const * c, int index
) const;
AVStream* stream (AVFormatContext const * c) const;
std::string name;
AVStream* stream (AVFormatContext const * c) const;
std::string name;
diff --git
a/src/lib/ffmpeg_decoder.cc
b/src/lib/ffmpeg_decoder.cc
index 587c794955c614a79a9bb896f52d9b22c0600d36..16da64c6014e5998e4fc581d838c9e3419a3c15f 100644
(file)
--- a/
src/lib/ffmpeg_decoder.cc
+++ b/
src/lib/ffmpeg_decoder.cc
@@
-172,9
+172,9
@@
FFmpegDecoder::pass ()
if (si == _video_stream && _decode_video) {
decode_video_packet ();
if (si == _video_stream && _decode_video) {
decode_video_packet ();
- } else if (_ffmpeg_content->audio_stream() &&
si == _ffmpeg_content->audio_stream()->index (_format_context
) && _decode_audio) {
+ } else if (_ffmpeg_content->audio_stream() &&
_ffmpeg_content->audio_stream()->uses_index (_format_context, si
) && _decode_audio) {
decode_audio_packet ();
decode_audio_packet ();
- } else if (_ffmpeg_content->subtitle_stream() &&
si == _ffmpeg_content->subtitle_stream()->index (_format_context
) && film->with_subtitles ()) {
+ } else if (_ffmpeg_content->subtitle_stream() &&
_ffmpeg_content->subtitle_stream()->uses_index (_format_context, si
) && film->with_subtitles ()) {
decode_subtitle_packet ();
}
decode_subtitle_packet ();
}
diff --git
a/src/lib/ffmpeg_examiner.cc
b/src/lib/ffmpeg_examiner.cc
index a63090d12e72a5bbfc90185a7df2b758012af839..ec090ed6123745bc147ad06ba1f0b7cccc18a38e 100644
(file)
--- a/
src/lib/ffmpeg_examiner.cc
+++ b/
src/lib/ffmpeg_examiner.cc
@@
-75,13
+75,13
@@
FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c)
if (_packet.stream_index == _video_stream && !_first_video) {
if (avcodec_decode_video2 (context, _frame, &frame_finished, &_packet) >= 0 && frame_finished) {
if (_packet.stream_index == _video_stream && !_first_video) {
if (avcodec_decode_video2 (context, _frame, &frame_finished, &_packet) >= 0 && frame_finished) {
- _first_video = frame_time (_
video_stream
);
+ _first_video = frame_time (_
format_context->streams[_video_stream]
);
}
} else {
for (size_t i = 0; i < _audio_streams.size(); ++i) {
}
} else {
for (size_t i = 0; i < _audio_streams.size(); ++i) {
- if (_
packet.stream_index == _audio_streams[i]->index (_format_context
) && !_audio_streams[i]->first_audio) {
+ if (_
audio_streams[i]->uses_index (_format_context, _packet.stream_index
) && !_audio_streams[i]->first_audio) {
if (avcodec_decode_audio4 (context, _frame, &frame_finished, &_packet) >= 0 && frame_finished) {
if (avcodec_decode_audio4 (context, _frame, &frame_finished, &_packet) >= 0 && frame_finished) {
- _audio_streams[i]->first_audio = frame_time (_audio_streams[i]->
index
(_format_context));
+ _audio_streams[i]->first_audio = frame_time (_audio_streams[i]->
stream
(_format_context));
}
}
}
}
}
}
@@
-103,13
+103,13
@@
FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c)
}
optional<double>
}
optional<double>
-FFmpegExaminer::frame_time (
int stream
) const
+FFmpegExaminer::frame_time (
AVStream* s
) const
{
optional<double> t;
int64_t const bet = av_frame_get_best_effort_timestamp (_frame);
if (bet != AV_NOPTS_VALUE) {
{
optional<double> t;
int64_t const bet = av_frame_get_best_effort_timestamp (_frame);
if (bet != AV_NOPTS_VALUE) {
- t = bet * av_q2d (
_format_context->streams[stream]
->time_base);
+ t = bet * av_q2d (
s
->time_base);
}
return t;
}
return t;
diff --git
a/src/lib/ffmpeg_examiner.h
b/src/lib/ffmpeg_examiner.h
index 4de475d2a3f78d753985f6b165e56bf3b74c7290..369dac29c992748b3b394b1a42ae1da3a4315235 100644
(file)
--- a/
src/lib/ffmpeg_examiner.h
+++ b/
src/lib/ffmpeg_examiner.h
@@
-49,7
+49,7
@@
private:
std::string stream_name (AVStream* s) const;
std::string audio_stream_name (AVStream* s) const;
std::string subtitle_stream_name (AVStream* s) const;
std::string stream_name (AVStream* s) const;
std::string audio_stream_name (AVStream* s) const;
std::string subtitle_stream_name (AVStream* s) const;
- boost::optional<double> frame_time (
int
) const;
+ boost::optional<double> frame_time (
AVStream* s
) const;
std::vector<boost::shared_ptr<FFmpegSubtitleStream> > _subtitle_streams;
std::vector<boost::shared_ptr<FFmpegAudioStream> > _audio_streams;
std::vector<boost::shared_ptr<FFmpegSubtitleStream> > _subtitle_streams;
std::vector<boost::shared_ptr<FFmpegAudioStream> > _audio_streams;