Skip to content

Commit

Permalink
avformatdecoder.cpp: remove '#include "libavformat/internal.h"'
Browse files Browse the repository at this point in the history
refs: #428

ff_read_frame_flush() is an internal FFmpeg function.

However, in libavformat/utils.c:
int avformat_flush(AVFormatContext *s)
{
    ff_read_frame_flush(s);
    return 0;
}

avformat_flush() is exactly identical and is a public function,
so use it instead.

StreamHasRequiredParameters():
The audio check requiring the internal struct to be defined was disabled.
This should have no effect since these checks are *all* already done via
avformat_find_stream_info() in FindStreamInfo(), which should return < 0
if these checks fail.

This copy of an internal FFmpeg function feels unnecessary and like a bad idea
since FFmpeg already checks this itself.
  • Loading branch information
ulmus-scott authored and bennettpeter committed Jun 20, 2022
1 parent 4c1fd20 commit def1bfb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Expand Up @@ -17,7 +17,6 @@ extern "C" {
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
#include "libavformat/internal.h"
#include "libswscale/swscale.h"
#include "libavutil/stereo3d.h"
#include "libavutil/imgutils.h"
Expand Down Expand Up @@ -200,6 +199,7 @@ int get_avf_buffer_dxva2(struct AVCodecContext *c, AVFrame *pic, int flags);
return false; \
} while (false)

// This is a slightly modified static int has_codec_parameters() from libavformat/utils.c
static bool StreamHasRequiredParameters(AVCodecContext *Context, AVStream *Stream)
{
switch (Stream->codecpar->codec_type)
Expand Down Expand Up @@ -744,7 +744,7 @@ void AvFormatDecoder::SeekReset(long long newKey, uint skipFrames,
m_ptsDetected = false;
m_reorderedPtsDetected = false;

ff_read_frame_flush(m_ic);
avformat_flush(m_ic);

// Only reset the internal state if we're using our seeking,
// not when using libavformat's seeking
Expand Down

0 comments on commit def1bfb

Please sign in to comment.