anthwlock / untrunc

Restore a truncated mp4/mov. Improved version of ponchio/untrunc
GNU General Public License v2.0
2k stars 191 forks source link

some deprecated warnings when building under Debian testing #13

Closed shirishag75 closed 5 years ago

shirishag75 commented 5 years ago

Got some deprecated warnings, maybe you would want to look into that -

~/games/untrunc$ g++ -o untrunc -O3 *.cpp -lavformat -lavcodec -lavutil -std=c++11
codec.cpp: In member function ‘int Codec::getSize(const uchar*, uint, int&)’:
codec.cpp:196:73: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
   int consumed = avcodec_decode_audio4(context_, frame, &got_frame, &avp);
                                                                         ^
In file included from codec.cpp:9:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4722:5: note: declared here
 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
     ^~~~~~~~~~~~~~~~~~~~~
codec.cpp:196:73: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
   int consumed = avcodec_decode_audio4(context_, frame, &got_frame, &avp);
                                                                         ^
In file included from codec.cpp:9:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4722:5: note: declared here
 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
     ^~~~~~~~~~~~~~~~~~~~~
mp4.cpp: In member function ‘void Mp4::parseOk(std::__cxx11::string&)’:
mp4.cpp:71:18: warning: ‘void av_register_all()’ is deprecated [-Wdeprecated-declarations]
  av_register_all();
                  ^
In file included from mp4.cpp:28:
/usr/include/x86_64-linux-gnu/libavformat/avformat.h:2043:6: note: declared here
 void av_register_all(void);
      ^~~~~~~~~~~~~~~
mp4.cpp:71:18: warning: ‘void av_register_all()’ is deprecated [-Wdeprecated-declarations]
  av_register_all();
                  ^
In file included from mp4.cpp:28:
/usr/include/x86_64-linux-gnu/libavformat/avformat.h:2043:6: note: declared here
 void av_register_all(void);
      ^~~~~~~~~~~~~~~
mp4.cpp: In member function ‘void Mp4::parseTracks()’:
mp4.cpp:320:47: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
   Track track(traks[i], context_->streams[i]->codec);
                                               ^~~~~
In file included from mp4.cpp:28:
/usr/include/x86_64-linux-gnu/libavformat/avformat.h:878:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
mp4.cpp:320:47: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
   Track track(traks[i], context_->streams[i]->codec);
                                               ^~~~~
In file included from mp4.cpp:28:
/usr/include/x86_64-linux-gnu/libavformat/avformat.h:878:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
mp4.cpp:320:47: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
   Track track(traks[i], context_->streams[i]->codec);
                                               ^~~~~
In file included from mp4.cpp:28:
/usr/include/x86_64-linux-gnu/libavformat/avformat.h:878:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
nal.cpp: In constructor ‘NalInfo::NalInfo(const uchar*, int)’:
nal.cpp:16:67: warning: passing NULL to non-pointer argument 1 of ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = unsigned char; _Alloc = std::allocator<unsigned char>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<unsigned char>]’ [-Wconversion-null]
 NalInfo::NalInfo(const uchar* start, int max_size) : payload_(NULL){                                                                   ^

Package: libavformat-dev Version: 7:4.1-1 Severity: normal

-- System Information: Debian Release: buster/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental') Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=en_IN, LC_CTYPE=en_IN (charmap=UTF-8), LANGUAGE=en_IN:en (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled

Versions of packages libavformat-dev depends on: ii libavcodec-dev 7:4.1-1 ii libavformat58 7:4.1-1 ii libavutil-dev 7:4.1-1 ii libswresample-dev 7:4.1-1

libavformat-dev recommends no packages.

libavformat-dev suggests no packages.

-- no debconf information

anthwlock commented 5 years ago

Thanks for the report. I tried to fix most of the problems, however I was not able to replace avcodec_decode_audio4. The problem is that avcodec_receive_frame always returns 0. The relevant code is currently at codec.cpp:195:

/* new API does not work, why? */
// avcodec_send_packet(context_, &avp);
// int consumed = avcodec_receive_frame(context_, frame);

/* using deprecated API instead */
int consumed = avcodec_decode_audio4(context_, frame, &got_frame, &avp);