diff mbox

[FFmpeg-devel] #7496: Access to the reference track (dolby vision) of a stream

Message ID AEB6F99C59AFC04FB890F68057924E510114B9D7@CQEX10.loewe.de
State Superseded
Headers show

Commit Message

Dmitrij.Gresserman@loewe.de Oct. 16, 2018, 5:25 p.m. UTC
Hello,

i need access to the reference track of a stream in a mp4 file.
ISO/IEC 14496-12:2005 describes this as the track_ID of the Track Reference Box.
Here is my approach attached as a patch.

Best regards
________________________________
Visit our website: https://www.loewe.tv/int

[Facebook]<https://www.facebook.com/LoeweDeutschland>  [Instagram] <https://www.instagram.com/loewe.international/>   [Pinterest] <https://www.pinterest.com/loewetv/>   [YouTube] <http://www.youtube.com/user/loewe>

Loewe Technologies GmbH, Industriestraße 11, 96317 Kronach
Tel. +49 9261 99-500 • Fax +49 9261 99-515
ccc@loewe.de<mailto:ccc@loewe.de> • www.loewe.tv<https://www.loewe.tv>

Executive Management: Mark Hüsges, Hans-Henning Doerr, Peter Nortmann, Dr. Ralf Vogt • Registered Office: Kronach • Commercial Register: Amtsgericht Coburg HRB 5443

Comments

Timo Rothenpieler Oct. 16, 2018, 6:22 p.m. UTC | #1
On 16.10.2018 19:25, Dmitrij.Gresserman@loewe.de wrote:
> Hello,
> 
> i need access to the reference track of a stream in a mp4 file.
> ISO/IEC 14496-12:2005 describes this as the track_ID of the Track Reference Box.
> Here is my approach attached as a patch.

Adding a field just for this seems a bit weird.
It probably should add this as side data via av_stream_add_side_data 
instead.
Hendrik Leppkes Oct. 16, 2018, 10:11 p.m. UTC | #2
On Tue, Oct 16, 2018 at 8:22 PM Timo Rothenpieler <timo@rothenpieler.org> wrote:
>
> On 16.10.2018 19:25, Dmitrij.Gresserman@loewe.de wrote:
> > Hello,
> >
> > i need access to the reference track of a stream in a mp4 file.
> > ISO/IEC 14496-12:2005 describes this as the track_ID of the Track Reference Box.
> > Here is my approach attached as a patch.
>
> Adding a field just for this seems a bit weird.
> It probably should add this as side data via av_stream_add_side_data
> instead.
>

 Agreed, definitely not a field in a global struct.

-  Hendrik
diff mbox

Patch

From 43832ef5034e9712a9d3bf943bf962df55cbe639 Mon Sep 17 00:00:00 2001
From: gressermdm <Dmitrij.Gresserman@loewe.de>
Date: Thu, 20 Sep 2018 16:32:03 +0200
Subject: [PATCH] Access to the reference track (dolby vision) of a stream

---
 libavformat/avformat.h |  7 +++++++
 libavformat/mov.c      | 14 ++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index fdaffa5..30ef7eb 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1220,6 +1220,13 @@  typedef struct AVStream {
      * Must not be accessed in any way by callers.
      */
     AVStreamInternal *internal;
+
+    /**
+     * A reference to another dolby track.
+     * 0 indicates that no reference track is available.
+     * Only used for decoding.
+     */
+    int reference_track_dolby;
 } AVStream;
 
 #if FF_API_FORMAT_GET_SET
diff --git a/libavformat/mov.c b/libavformat/mov.c
index ec57a05..0e57778 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6658,6 +6658,19 @@  static int mov_read_dops(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     return 0;
 }
 
+static int mov_read_vdep(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+    int track_id;
+    AVStream *st;
+
+    track_id = (int)avio_rb32(pb);
+
+    st = c->fc->streams[c->fc->nb_streams-1];
+    st->reference_track_dolby = track_id;
+
+    return 0;
+}
+
 static const MOVParseTableEntry mov_default_parse_table[] = {
 { MKTAG('A','C','L','R'), mov_read_aclr },
 { MKTAG('A','P','R','G'), mov_read_avid },
@@ -6751,6 +6764,7 @@  static const MOVParseTableEntry mov_default_parse_table[] = {
 { MKTAG('v','p','c','C'), mov_read_vpcc },
 { MKTAG('m','d','c','v'), mov_read_mdcv },
 { MKTAG('c','l','l','i'), mov_read_clli },
+{ MKTAG('v','d','e','p'), mov_read_vdep },
 { 0, NULL }
 };
 
-- 
2.7.4