Skip to content

Commit

Permalink
FFmpeg: MythTV changes to support ffmpeg 4.4.1
Browse files Browse the repository at this point in the history
A couple of changed names to be fixed.
  • Loading branch information
bennettpeter committed Nov 27, 2021
1 parent cd0654f commit cf6f5df
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 4 deletions.
97 changes: 97 additions & 0 deletions mythtv/external/FFmpeg-sync-instructions.txt
@@ -0,0 +1,97 @@
This code was resynced upstream to:

git://source.ffmpeg.org/ffmpeg.git at n3.0-1-g0aa2fbd on February 19th, 2016 (jya) (release/3.0 branch, release 3.0)
git://source.ffmpeg.org/ffmpeg.git at n3.0-3-gb80083a on February 26th, 2016 (jya) (release/3.0 branch, release 3.0)
git://source.ffmpeg.org/ffmpeg.git at n3.2-3-g7568b0f on November 14th, 2016 (jya) (release/3.2 branch, release 3.2)
git://source.ffmpeg.org/ffmpeg.git at n3.4.1-5-g4a53ecb on February 5th, 2018 (Peter Bennett) (release/3.4 branch, release 3.4.1)

As of May 22 2018 we resync the code to the MythTV fork of FFmpeg (git@github.com:MythTV/FFmpeg.git).
All changes to the FFmpeg code must be made in that repository, master branch and cherry-picked to release branch currently in use.

git@github.com:MythTV/FFmpeg.git at n4.0-43-ge4e7472e73 on May 24, 2018 (release/4.0 branch)
git@github.com:FFmpeg/FFmpeg.git at n4.0-39-gda399903c7 (Peter Bennett)

I am no longer documenting each merge here. To find merge history use "git log mythtv/external/FFmpeg".

Procedure for FFmpeg resync
===========================

- In your MytTV/mythtv clone, master branch, get up to date
git pull
- Clone MythTV FFmpeg fork into a new directory:
git clone git@github.com:MythTV/FFmpeg.git
- create a branch to track the latest ffmpeg release branch that is
- currently in use in MythTV (e.g release/4.3)
git branch --track release/4.3 remotes/origin/release/4.3
- Add a remote for main FFmpeg
git remote add ffmpeg git@github.com:FFmpeg/FFmpeg.git
git fetch ffmpeg
- Look for any changes that are in MythTV FFmpeg since last sync.
In your mythtv directory.
git log mythtv/external/FFmpeg/
- If the log contains any changes check if they are in the MythTV/FFmpeg repository
and if not commit them into MythTV/FFmpeg/master.
Make sure that the commits are only updating files in FFmpeg, ot other parts of
MythTV.
For each one:
in mythtv directory
git show <commit-hash> > commit_n.patch
in FFmpeg directory
git apply -p 4 commit_n.patch
Then commit the result and cherry-pick into the current release branch (e.g. release/4.3).
- Check for a new branch. From FFmpeg clone directory:
git branch -a
- Check list from above command to see if there is any new release branch in
remotes/ffmpeg that is not in remotes/origin.
- Merge the next available branch. If there are more than 1 branch since the one you are on,
you should do them all in sequence. If you skip a version you will not be easily
able to go to that version in the event the later one is not working.

- for the first new branch ffmpeg/release/x.x:
- find its base as follows:
git merge-base remotes/ffmpeg/master remotes/ffmpeg/release/x.x
- Take note of the commit hash returned. Merge up to that commit as follow:
git checkout master
git merge <commit-hash-from-above>
suggested comment - Merge from FFmpeg up to branch point of x.x
- If that says "Already up to date.", there is a problem. The previous merge will need to
be redone.
- Create new branch with the name of the new branch found
git checkout -b release/x.x
- Find tag of latest release
git show-ref
- Choose the latest tag of the branch you are merging, e.g. n4.4.1
git merge nx.x.x
- Only push this after validating everything is ok (see below)
git push origin -u release/x.x

- If there is no new branch:
- Merge updates with the latest branch in use:
git checkout master
git merge ffmpeg/master
git checkout release/x.x
git merge ffmpeg/release/x.x

- Checkout release/x.x and in MythTV directory checkout master.
- Delete entire FFmpeg directory structure from MythTV directory and copy
in the contents of the ffmpeg repository (except for the .git directory).
- Test MythTV build and playback.
- Add and commit all changes with comments identifying
ffmpeg/FFmpeg Release/x.x description (git describe)
MythTV/FFmpeg Release/x.x description (git describe).

- Push all branches you updated to MythTV/FFmpeg

This file (README.sync) will no longer contain details of each FFmpeg resync

Procedure for making FFMpeg changes
===================================

- Apply changes to the MythTV/FFmpeg repository, master branch.
- Cherry-pick them into the MythTV/FFmpeg repository, release/4.3 branch.
- Copy the code into the MythTV/mythtv repository, master branch

Note: The code in MythTV/mythtv repository master branch, FFmpeg directory is a copy of the code
in MythTV/FFmpeg repository, latest branch. so after making changes in MythTV/FFmpeg
repository and cherry-picking into release/4.3 you can just copy the modules over
into the MythTv/mythtv repository master branch without fear of losing any changes.
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp
Expand Up @@ -1719,8 +1719,8 @@ bool HLSRingBuffer::TestForHTTPLiveStreaming(const QString &filename)

// Do a peek on the URL to test the format
MythMediaBuffer::AVFormatInitNetwork();
int ret = ffurl_open(&context, filename.toLatin1(),
AVIO_FLAG_READ, nullptr, nullptr);
int ret = ffurl_open_whitelist(&context, filename.toLatin1(),
AVIO_FLAG_READ, nullptr, nullptr, nullptr, nullptr, nullptr);
if (ret >= 0)
{
std::array<uint8_t,1024> buffer {};
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Expand Up @@ -237,7 +237,7 @@ static bool StreamHasRequiredParameters(AVCodecContext *Context, AVStream *Strea
// FAIL("Unspecified audio sample rate");
//if (!Stream->codecpar->channels)
// FAIL("Unspecified number of audio channels");
if (!Stream->nb_decoded_frames && Context->codec_id == AV_CODEC_ID_DTS)
if (!Stream->internal->nb_decoded_frames && Context->codec_id == AV_CODEC_ID_DTS)
FAIL("No decodable DTS frames");
break;

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/io/mythstreamingbuffer.cpp
Expand Up @@ -61,7 +61,7 @@ bool MythStreamingBuffer::OpenFile(const QString &Filename, std::chrono::millise
if (url.path().endsWith(QLatin1String("m3u8"), Qt::CaseInsensitive))
url.setScheme("hls+http");

int res = ffurl_open(&m_context, url.toString().toLatin1(), AVIO_FLAG_READ, nullptr, nullptr);
int res = ffurl_open_whitelist(&m_context, url.toString().toLatin1(), AVIO_FLAG_READ, nullptr, nullptr, nullptr, nullptr, nullptr);
if (res >= 0 && m_context && !m_context->is_streamed && ffurl_seek(m_context, 0, SEEK_SET) >= 0)
{
m_streamed = false;
Expand Down

0 comments on commit cf6f5df

Please sign in to comment.