<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 2/15/22 22:23, Scott Theisen wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:48e7a000-f1a3-f0a0-836b-c14f075e124d@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Peter,<br>
      <br>
      My harmonization of mpegts-mythtv.* is almost complete.  (This is
      on top of my rebase/4.4m3 branch, but should have no issues being
      applied on top of mythtv/FFmpeg/master.)<br>
      <br>
      See <a class="moz-txt-link-freetext"
        href="https://github.com/ulmus-scott/FFmpeg/commits/harmonize"
        moz-do-not-send="true">https://github.com/ulmus-scott/FFmpeg/commits/harmonize</a>
      for the original commit order and <a
        class="moz-txt-link-freetext"
        href="https://github.com/ulmus-scott/FFmpeg/commits/harmonize2"
        moz-do-not-send="true">https://github.com/ulmus-scott/FFmpeg/commits/harmonize2</a>
      for reordered with problematic commits moved to the end.<br>
      <br>
      I have been testing with some of my local stations and the samples
      from <a class="moz-txt-link-freetext"
        href="https://code.mythtv.org/trac/ticket/13557"
        moz-do-not-send="true">https://code.mythtv.org/trac/ticket/13557</a>
      / <a class="moz-txt-link-freetext"
        href="https://github.com/MythTV/mythtv/issues/351"
        moz-do-not-send="true">https://github.com/MythTV/mythtv/issues/351</a>
      and everything is fine through  <a moz-do-not-send="true"
href="https://github.com/ulmus-scott/FFmpeg/commit/c22901ac83f9955f3846d33f79f4ddb8a07aeb8d">mpegts-mythtv.c:
        harmonize ff_parse_mpeg2_descriptor() part 1</a>.<br>
      <br>
      I have been banging my head against the brick wall that is
      pat_cb() and pmt_cb().  (It started out fairly straightforward,
      but dealing with those two functions and the 17 year old changes
      buried under updates has been increasingly frustrating.)<br>
      <br>
      <a moz-do-not-send="true"
href="https://github.com/ulmus-scott/FFmpeg/commit/58cc290d552169f2388e83384e1a28a22a710ae7">mpegts-mythtv.c:
        pmt_cb(): harmonize part 6</a> appears to actually work fine;
      however, the logic for calling the <span class="pl-smi">streams_changed()
        callback is wrong, so it isn't called when it was previously.  <a
          moz-do-not-send="true"
href="https://github.com/ulmus-scott/FFmpeg/commit/8a8dc3d5599bd61368c26ed410248cad20f7fa25">Correcting
          it</a>, sort of (it updates on every different PMT, instead of
        if the streams actually changed), causes a segmentation fault in
        <a class="moz-txt-link-freetext"
href="https://github.com/MythTV/mythtv/blob/709d05c0d6928e927ea1b0cc2b2c46bc80d40055/mythtv/libs/libmythtv/decoders/avformatdecoder.cpp#L2652"
          moz-do-not-send="true">https://github.com/MythTV/mythtv/blob/709d05c0d6928e927ea1b0cc2b2c46bc80d40055/mythtv/libs/libmythtv/decoders/avformatdecoder.cpp#L2652</a>
        .<br>
        <br>
        I suspect that is because the PSIPTable does not create a copy
        of its input data, which is then freed while the PMT table is
        being accessed.<br>
        <br>
        <a moz-do-not-send="true"
href="https://github.com/ulmus-scott/FFmpeg/commit/6887b3127bcc2b8211e0fd7ab9828965ffe847f0">mpegts-mythtv.c:
          pat_cb() harmonization part 3</a> causes a different
        segmentation fault in FFmpeg (dump.c trying to read the
        st->metadata AVDictionary for the "language").  I wouldn't
        worry about this one right now since I feel pmt_cb() has a
        higher priority, so ff_parse_mpeg2_descriptor() can be minimally
        modified.<br>
        <br>
        <br>
        Let me know if you want me to open another set of pull requests
        with the "good" commits for easier testing.<br>
        <br>
        Any thoughts on how to complete the harmonization would also be
        appreciated.<br>
        <br>
        Regards,<br>
        <br>
        Scott</span></blockquote>
    <p>I don't think I can help much here. I have stayed away from the
      internals of FFmpeg except where necessary to fix errors when
      merging new versions. I do not have any understanding of the
      internals of Transport Streams or why MythTV needs to make so many
      changes to FFmpeg. The changes that were done are very old, as you
      have noted, and were done by others who are no longer around. I
      don't know if any other developers of MythTV have better insight
      into this.</p>
    <p>Peter<br>
    </p>
    <p><span class="pl-smi">
        <style type="text/css">p { line-height: 115%; margin-bottom: 0.1in; background: transparent }a:visited { color: #800000; so-language: zxx; text-decoration: underline }a:link { color: #000080; so-language: zxx; text-decoration: underline }</style></span>
    </p>
  </body>
</html>