AVPKit
IndexEntry.cpp
1 /*******************************************************************************
2  * Copyright (c) 2024, 2026, Olivier Ayache. All rights reserved.
3  *
4  * This file is part of AVPKit.
5  *
6  * AVPKit is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * AVPKit is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with AVPKit. If not, see <http://www.gnu.org/licenses/>.
18  *******************************************************************************/
19 
20 /*
21  * IndexEntry.cpp
22  *
23  * Created on: Mar 20, 2009
24  * Author: aclarke
25  */
26 
27 #include <com/avpkit/ferry/Logger.h>
28 #include <com/avpkit/core/IndexEntry.h>
29 
30 #include <cstring>
31 #include <stdexcept>
32 
33 VS_LOG_SETUP(VS_CPP_PACKAGE);
34 
35 namespace com { namespace avpkit { namespace core
36 {
37 
38 IndexEntry :: IndexEntry()
39 {
40 }
41 
42 IndexEntry :: ~IndexEntry()
43 {
44 
45 }
46 
47 int64_t
49 {
50  return mEntry.pos;
51 }
52 
53 int64_t
55 {
56  return mEntry.timestamp;
57 }
58 
59 int32_t
61 {
62  return mEntry.flags;
63 }
64 
65 int32_t
67 {
68  return mEntry.size;
69 }
70 
71 int32_t
73 {
74  return mEntry.min_distance;
75 }
76 
77 bool
79 {
80  return mEntry.flags & AVINDEX_KEYFRAME;
81 }
82 
84 IndexEntry::make(int64_t position, int64_t timeStamp,
85  int32_t flags, int32_t size, int32_t minDistance)
86 {
87  IndexEntry* retval = make();
88  if (retval) {
89  retval->mEntry.pos = position;
90  retval->mEntry.timestamp = timeStamp;
91  retval->mEntry.flags = flags;
92  retval->mEntry.size = size;
93  retval->mEntry.min_distance = minDistance;
94  }
95  return retval;
96 }
97 }}}
virtual int32_t getMinDistance()
Minimum number of index entries between this index entry and the last keyframe in the index,...
Definition: IndexEntry.cpp:72
virtual int64_t getTimeStamp()
The actual time stamp, in units of IStream#getTimeBase(), of the frame this entry points to.
Definition: IndexEntry.cpp:54
virtual int64_t getPosition()
The position in bytes of the frame corresponding to this index entry in the IContainer.
Definition: IndexEntry.cpp:48
virtual int32_t getSize()
The size of bytes of the frame this index entry points to.
Definition: IndexEntry.cpp:66
virtual bool isKeyFrame()
Is this index entry pointing to a key frame.
Definition: IndexEntry.cpp:78
virtual int32_t getFlags()
Flags set for this entry.
Definition: IndexEntry.cpp:60
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...