File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
torchvision/csrc/io/decoder Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -7,13 +7,13 @@ namespace ffmpeg {
7
7
8
8
namespace {
9
9
bool operator ==(const AudioFormat& x, const AVFrame& y) {
10
- return static_cast < int >( x.samples ) == y.sample_rate &&
11
- static_cast < int >(x. channels ) == y. channels && x.format == y.format ;
10
+ return x.samples == y.sample_rate && x. channels == y. channels &&
11
+ x.format == y.format ;
12
12
}
13
13
14
14
bool operator ==(const AudioFormat& x, const AVCodecContext& y) {
15
- return static_cast < int >( x.samples ) == y.sample_rate &&
16
- static_cast < int >(x. channels ) == y. channels && x.format == y.sample_fmt ;
15
+ return x.samples == y.sample_rate && x. channels == y. channels &&
16
+ x.format == y.sample_fmt ;
17
17
}
18
18
19
19
AudioFormat& toAudioFormat (AudioFormat& x, const AVFrame& y) {
Original file line number Diff line number Diff line change @@ -196,6 +196,8 @@ int64_t Decoder::seekCallback(int64_t offset, int whence) {
196
196
void Decoder::initOnce () {
197
197
static std::once_flag flagInit;
198
198
std::call_once (flagInit, []() {
199
+ av_register_all ();
200
+ avcodec_register_all ();
199
201
avformat_network_init ();
200
202
// register ffmpeg lock manager
201
203
av_lockmgr_register (&ffmpeg_lock);
@@ -395,10 +397,10 @@ bool Decoder::init(
395
397
}
396
398
397
399
bool Decoder::openStreams (std::vector<DecoderMetadata>* metadata) {
398
- for (int i = 0 ; i < static_cast < int >( inputCtx_->nb_streams ) ; i++) {
400
+ for (int i = 0 ; i < inputCtx_->nb_streams ; i++) {
399
401
// - find the corespondent format at params_.formats set
400
402
MediaFormat format;
401
- const auto media = inputCtx_->streams [i]->codecpar ->codec_type ;
403
+ const auto media = inputCtx_->streams [i]->codec ->codec_type ;
402
404
if (!mapFfmpegType (media, &format.type )) {
403
405
VLOG (1 ) << " Stream media: " << media << " at index " << i
404
406
<< " gets ignored, unknown type" ;
You can’t perform that action at this time.
0 commit comments