Skip to content

Commit 7341a7a

Browse files
author
Clement Champetier
committed
StreamProperties: add getStreamType method
1 parent 88af4f6 commit 7341a7a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/AvTranscoder/mediaProperty/StreamProperties.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ float StreamProperties::getDuration() const
4343
return ( timeBase.num / (float) timeBase.den ) * _formatContext->streams[_streamIndex]->duration;
4444
}
4545

46+
AVMediaType StreamProperties::getStreamType() const
47+
{
48+
if( ! _formatContext )
49+
throw std::runtime_error( "unknown format context" );
50+
return _formatContext->streams[_streamIndex]->codec->codec_type;
51+
}
52+
4653
PropertyVector StreamProperties::getPropertiesAsVector() const
4754
{
4855
PropertyVector data;

src/AvTranscoder/mediaProperty/StreamProperties.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class AvExport StreamProperties
1919
size_t getStreamId() const;
2020
Rational getTimeBase() const;
2121
float getDuration() const; ///< in seconds
22+
AVMediaType getStreamType() const;
2223
const PropertyVector& getMetadatas() const { return _metadatas; }
2324

2425
#ifndef SWIG

0 commit comments

Comments
 (0)