[vlc-commits] demux: hls: set ID3 time offset

Francois Cartegnie git at videolan.org
Wed Jun 26 22:13:06 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jun 26 22:08:33 2019 +0200| [cc646df5fd14e4201dbfa2e829528fbef8c34ae5] | committer: Francois Cartegnie

demux: hls: set ID3 time offset

callback lost or disabled ?

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cc646df5fd14e4201dbfa2e829528fbef8c34ae5
---

 modules/demux/hls/HLSStreams.cpp | 35 ++++++++++++++++++-----------------
 modules/demux/hls/HLSStreams.hpp |  3 ++-
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/modules/demux/hls/HLSStreams.cpp b/modules/demux/hls/HLSStreams.cpp
index 411fc162e8..b96414516b 100644
--- a/modules/demux/hls/HLSStreams.cpp
+++ b/modules/demux/hls/HLSStreams.cpp
@@ -49,24 +49,27 @@ HLSStream::~HLSStream()
         vlc_meta_Delete(p_meta);
 }
 
-void HLSStream::setTimeOffset(vlc_tick_t i_offset)
+void HLSStream::setMetadataTimeOffset(vlc_tick_t i_offset)
 {
     if(i_offset >= 0)
     {
-        if((unsigned)format == StreamFormat::PACKEDAAC)
-        {
-            if(!b_id3_timestamps_offset_set)
-            {
-                fakeEsOut()->setAssociatedTimestamp(i_offset);
-            }
-            return;
-        }
+        if(!b_id3_timestamps_offset_set)
+            fakeEsOut()->setAssociatedTimestamp(i_offset);
+        b_id3_timestamps_offset_set = true;
     }
     else
     {
+        fakeEsOut()->setAssociatedTimestamp(-1);
         b_id3_timestamps_offset_set = false;
     }
-    AbstractStream::setTimeOffset(i_offset);
+}
+
+bool HLSStream::setPosition(vlc_tick_t ts , bool b)
+{
+    bool ok = AbstractStream::setPosition(ts ,b);
+    if(b && ok)
+        b_id3_timestamps_offset_set = false;
+    return ok;
 }
 
 int HLSStream::ParseID3PrivTag(const uint8_t *p_payload, size_t i_payload)
@@ -74,19 +77,17 @@ int HLSStream::ParseID3PrivTag(const uint8_t *p_payload, size_t i_payload)
     if(i_payload == 53 &&
        !memcmp( p_payload, "com.apple.streaming.transportStreamTimestamp", 45))
     {
-        if(!b_id3_timestamps_offset_set)
-        {
-            const vlc_tick_t i_aac_offset = FROM_SCALE_NZ(GetQWBE(&p_payload[45]));
-            setTimeOffset(i_aac_offset);
-            b_id3_timestamps_offset_set = true;
-        }
+        setMetadataTimeOffset(FROM_SCALE_NZ(GetQWBE(&p_payload[45])));
     }
     return VLC_SUCCESS;
 }
 
 int HLSStream::ParseID3Tag(uint32_t i_tag, const uint8_t *p_payload, size_t i_payload)
 {
-    (void) ID3HandleTag(p_payload, i_payload, i_tag, p_meta, &b_meta_updated);
+    if(i_tag == VLC_FOURCC('P','R','I','V'))
+        (void) ParseID3PrivTag(p_payload, i_payload);
+    else
+        (void) ID3HandleTag(p_payload, i_payload, i_tag, p_meta, &b_meta_updated);
     return VLC_SUCCESS;
 }
 
diff --git a/modules/demux/hls/HLSStreams.hpp b/modules/demux/hls/HLSStreams.hpp
index 77dff6a434..ac56961bd8 100644
--- a/modules/demux/hls/HLSStreams.hpp
+++ b/modules/demux/hls/HLSStreams.hpp
@@ -33,15 +33,16 @@ namespace hls
             virtual ~HLSStream();
 
         protected:
-            virtual void setTimeOffset(vlc_tick_t); /* reimpl */
             virtual block_t *checkBlock(block_t *, bool); /* reimpl */
             virtual AbstractDemuxer * newDemux(demux_t *, const StreamFormat &,
                                                es_out_t *, AbstractSourceStream *) const; /* reimpl */
+            virtual bool setPosition(vlc_tick_t, bool);
 
         private:
             static int ID3TAG_Parse_Handler(uint32_t, const uint8_t *, size_t, void *);
             int ParseID3Tag(uint32_t, const uint8_t *, size_t);
             int ParseID3PrivTag(const uint8_t *, size_t);
+            void setMetadataTimeOffset(vlc_tick_t);
             bool b_id3_timestamps_offset_set;
             vlc_meta_t *p_meta;
             bool b_meta_updated;



More information about the vlc-commits mailing list