Skip to content

Commit 88af4f6

Browse files
author
Clement Champetier
committed
InputStream: add getProperties method
1 parent 87c29ab commit 88af4f6

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/AvTranscoder/stream/IInputStream.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#ifndef _AV_TRANSCODER_CODED_STREAM_I_INPUT_STREAM_HPP_
22
#define _AV_TRANSCODER_CODED_STREAM_I_INPUT_STREAM_HPP_
33

4+
#include <AvTranscoder/mediaProperty/StreamProperties.hpp>
5+
46
#include <AvTranscoder/codec/AudioCodec.hpp>
57
#include <AvTranscoder/codec/VideoCodec.hpp>
68
#include <AvTranscoder/codec/DataCodec.hpp>
9+
710
#include <AvTranscoder/frame/Frame.hpp>
811

912
namespace avtranscoder
@@ -21,6 +24,12 @@ class AvExport IInputStream
2124
**/
2225
virtual bool readNextPacket( CodedData& data ) = 0;
2326

27+
/**
28+
* @note The returned object could be cast depending on the type of the stream (video, audio...)
29+
* @see VideoProperties, AudioProperties...
30+
* @return the properties of the stream
31+
*/
32+
virtual const StreamProperties& getProperties() const = 0;
2433
virtual size_t getStreamIndex() const = 0;
2534
virtual float getDuration() const = 0; ///< Get duration of the stream, in seconds
2635
virtual AVMediaType getStreamType() const = 0;

src/AvTranscoder/stream/InputStream.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ DataCodec& InputStream::getDataCodec()
108108
return *static_cast<DataCodec*>( _codec );
109109
}
110110

111+
const StreamProperties& InputStream::getProperties() const
112+
{
113+
return _inputFile->getProperties().getStreamPropertiesWithIndex( _streamIndex );
114+
}
115+
111116
AVMediaType InputStream::getStreamType() const
112117
{
113118
return _inputFile->getFormatContext().getAVStream( _streamIndex ).codec->codec_type;

src/AvTranscoder/stream/InputStream.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class AvExport InputStream : public IInputStream
2424

2525
bool readNextPacket( CodedData& data );
2626

27+
const StreamProperties& getProperties() const;
2728
size_t getStreamIndex() const { return _streamIndex; }
2829
float getDuration() const;
2930
AVMediaType getStreamType() const;

0 commit comments

Comments
 (0)