File tree Expand file tree Collapse file tree 3 files changed +6
-7
lines changed
Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 88
99#include < optional>
1010#include < string>
11- #include < utility>
1211#include < vector>
1312
1413extern " C" {
1514#include < libavcodec/avcodec.h>
1615#include < libavutil/avutil.h>
16+ #include < libavutil/rational.h>
1717}
1818
1919namespace facebook ::torchcodec {
@@ -46,7 +46,7 @@ struct StreamMetadata {
4646 // Video-only fields derived from the AVCodecContext.
4747 std::optional<int64_t > width;
4848 std::optional<int64_t > height;
49- std::optional<std::pair< int , int > > sampleAspectRatio;
49+ std::optional<AVRational > sampleAspectRatio;
5050
5151 // Audio-only fields
5252 std::optional<int64_t > sampleRate;
Original file line number Diff line number Diff line change @@ -459,9 +459,8 @@ void SingleStreamDecoder::addVideoStream(
459459
460460 streamMetadata.width = streamInfo.codecContext ->width ;
461461 streamMetadata.height = streamInfo.codecContext ->height ;
462- streamMetadata.sampleAspectRatio = {
463- streamInfo.codecContext ->sample_aspect_ratio .num ,
464- streamInfo.codecContext ->sample_aspect_ratio .den };
462+ streamMetadata.sampleAspectRatio =
463+ streamInfo.codecContext ->sample_aspect_ratio ;
465464}
466465
467466void SingleStreamDecoder::addAudioStream (
Original file line number Diff line number Diff line change @@ -603,9 +603,9 @@ std::string get_stream_json_metadata(
603603 }
604604 if (streamMetadata.sampleAspectRatio .has_value ()) {
605605 map[" sampleAspectRatioNum" ] =
606- std::to_string ((*streamMetadata.sampleAspectRatio ).first );
606+ std::to_string ((*streamMetadata.sampleAspectRatio ).num );
607607 map[" sampleAspectRatioDen" ] =
608- std::to_string ((*streamMetadata.sampleAspectRatio ).second );
608+ std::to_string ((*streamMetadata.sampleAspectRatio ).den );
609609 }
610610 if (streamMetadata.averageFpsFromHeader .has_value ()) {
611611 map[" averageFpsFromHeader" ] =
You can’t perform that action at this time.
0 commit comments