summaryrefslogtreecommitdiff
path: root/src/lib/examine_ffmpeg_subtitles_job.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-03-01 21:06:01 +0100
committerCarl Hetherington <cth@carlh.net>2021-03-02 15:40:18 +0100
commit2091311fde159ec39126608327eb93b28898bd6c (patch)
tree1396d4e920de7603b402353c00ba5cce765c33e5 /src/lib/examine_ffmpeg_subtitles_job.cc
parent6c092a6abef4bf38fe62112544f7b6247cdb07d0 (diff)
Remove FFmpeg::_packet.
Diffstat (limited to 'src/lib/examine_ffmpeg_subtitles_job.cc')
-rw-r--r--src/lib/examine_ffmpeg_subtitles_job.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/examine_ffmpeg_subtitles_job.cc b/src/lib/examine_ffmpeg_subtitles_job.cc
index 90589eb28..8c762d893 100644
--- a/src/lib/examine_ffmpeg_subtitles_job.cc
+++ b/src/lib/examine_ffmpeg_subtitles_job.cc
@@ -65,8 +65,11 @@ ExamineFFmpegSubtitlesJob::run ()
{
int64_t const len = _file_group.length ();
while (true) {
- int r = av_read_frame (_format_context, &_packet);
+ auto packet = av_packet_alloc ();
+ DCPOMATIC_ASSERT (packet);
+ int r = av_read_frame (_format_context, packet);
if (r < 0) {
+ av_packet_free (&packet);
break;
}
@@ -76,10 +79,10 @@ ExamineFFmpegSubtitlesJob::run ()
set_progress_unknown ();
}
- if (_content->subtitle_stream() && _content->subtitle_stream()->uses_index(_format_context, _packet.stream_index) && _content->only_text()->use()) {
+ if (_content->subtitle_stream() && _content->subtitle_stream()->uses_index(_format_context, packet->stream_index) && _content->only_text()->use()) {
int got_subtitle;
AVSubtitle sub;
- if (avcodec_decode_subtitle2(subtitle_codec_context(), &sub, &got_subtitle, &_packet) >= 0 && got_subtitle) {
+ if (avcodec_decode_subtitle2(subtitle_codec_context(), &sub, &got_subtitle, packet) >= 0 && got_subtitle) {
for (unsigned int i = 0; i < sub.num_rects; ++i) {
AVSubtitleRect const * rect = sub.rects[i];
if (rect->type == SUBTITLE_BITMAP) {
@@ -104,7 +107,7 @@ ExamineFFmpegSubtitlesJob::run ()
}
}
- av_packet_unref (&_packet);
+ av_packet_free (&packet);
}
set_progress (1);