[haiku-commits] haiku: hrev52206 - src/add-ons/media/plugins/ffmpeg

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 11 Aug 2018 06:02:02 -0400 (EDT)

hrev52206 adds 1 changeset to branch 'master'
old head: 0ea01389659e68afd986c26147d366538185f186
new head: 3bd0b6ec8105c293cb54e1e22e201ea2cbab5d44
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=3bd0b6ec8105+%5E0ea01389659e

----------------------------------------------------------------------------

3bd0b6ec8105: ffmpeg: do not compute a duration for streaming streams.
  
  Streaming means the stream is endless, so don't compute a duration.
  
  ffmpeg computes an estimation using what it thinks is the file size, but
  is instead some internal buffer size from BAdapterIO.
  
  Fixes second part of #14326.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev52206
Commit:      3bd0b6ec8105c293cb54e1e22e201ea2cbab5d44
URL:         https://git.haiku-os.org/haiku/commit/?id=3bd0b6ec8105
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sat Aug 11 09:59:09 2018 UTC

Ticket:      https://dev.haiku-os.org/ticket/14326

----------------------------------------------------------------------------

2 files changed, 9 insertions(+), 2 deletions(-)
src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp | 5 +++--
src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp | 6 ++++++

----------------------------------------------------------------------------

diff --git a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp 
b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
index 8eb21e1547..1c781026c4 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
@@ -1740,8 +1740,9 @@ AVCodecDecoder::_InitFilterGraph(enum AVPixelFormat 
pixfmt, int32 width,
        fFilterGraph = avfilter_graph_alloc();
 
        BString arguments;
-       
arguments.SetToFormat("buffer=video_size=%dx%d:pix_fmt=%d:time_base=1/1:"
-               "pixel_aspect=0/1[in];[in]yadif[out];[out]buffersink", width, 
height,
+       arguments.SetToFormat("buffer=video_size=%" B_PRId32 "x%" B_PRId32
+               ":pix_fmt=%d:time_base=1/1:pixel_aspect=0/1[in];[in]yadif[out];"
+               "[out]buffersink", width, height,
                pixfmt);
        AVFilterInOut* inputs = NULL;
        AVFilterInOut* outputs = NULL;
diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp 
b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
index 5dfa7bd75c..d09f40afa6 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
@@ -429,6 +429,12 @@ StreamBase::Duration() const
        // for a couple of streams and are in line with the documentation, but
        // unfortunately, libavformat itself seems to set the time_base and
        // duration wrongly sometimes. :-(
+
+       int32 flags;
+       fSource->GetFlags(&flags);
+       if ((flags & B_MEDIA_STREAMING) != 0)
+               return 0;
+
        if ((int64)fStream->duration != AV_NOPTS_VALUE)
                return _ConvertFromStreamTimeBase(fStream->duration);
        else if ((int64)fContext->duration != AV_NOPTS_VALUE)


Other related posts:

  • » [haiku-commits] haiku: hrev52206 - src/add-ons/media/plugins/ffmpeg - Adrien Destugues