Fixes a bug in read_frame
This commit is contained in:
parent
521f16063b
commit
1a3589e689
4 changed files with 3 additions and 17 deletions
|
@ -53,7 +53,8 @@ namespace av {
|
|||
|
||||
|
||||
packet read_frame(format_context& ctx, packet_buffer& p){
|
||||
if(!av_read_frame(ctx.get(), &p)){
|
||||
auto ret = av_read_frame(ctx.get(), &p);
|
||||
if(ret < 0){
|
||||
return {nullptr, &av_free_packet};
|
||||
} else {
|
||||
return {&p, &av_free_packet};
|
||||
|
|
|
@ -4,15 +4,10 @@
|
|||
|
||||
extern "C" {
|
||||
#include <libavutil/pixfmt.h>
|
||||
#include <libavcodec/avcodec.h> // only needed for AVCodecID
|
||||
#include <libavcodec/avcodec.h> // only needed for AVCodecID and AVPacket
|
||||
|
||||
typedef struct AVDictionary AVDictionary;
|
||||
typedef struct AVFormatContext AVFormatContext;
|
||||
typedef struct AVInputFormat AVInputFormat;
|
||||
typedef struct AVCodecContext AVCodecContext;
|
||||
typedef struct AVCodec AVCodec;
|
||||
typedef struct AVPacket AVPacket;
|
||||
typedef struct AVFrame AVFrame;
|
||||
}
|
||||
|
||||
#include <memory>
|
||||
|
|
|
@ -12,15 +12,6 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
template<class Archive, class T, size_t N>
|
||||
void serialize(Archive & ar, std::array<T,N> & a, const unsigned int /*version*/) {
|
||||
ar & make_array(a.data(), a.size());
|
||||
}
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
|
||||
namespace fingerprints {
|
||||
struct wvlt_rgb {
|
||||
|
|
|
@ -72,7 +72,6 @@ av::frame open_image(std::string const & filename){
|
|||
// some decoders need extra passes
|
||||
while(!finished) {
|
||||
avcodec_decode_video2(codec_context.get(), frame.get(), &finished, &empty_packet);
|
||||
av_free_packet(&empty_packet);
|
||||
}
|
||||
|
||||
return frame;
|
||||
|
|
Reference in a new issue