Browse Source

Fixes a bug in read_frame

master
Joshua Moerman 10 years ago
parent
commit
1a3589e689
  1. 3
      lib/av/av.cpp
  2. 7
      lib/av/av.hpp
  3. 9
      lib/fingerprints/wvlt_rgb.hpp
  4. 1
      lib/image_io.cpp

3
lib/av/av.cpp

@ -53,7 +53,8 @@ namespace av {
packet read_frame(format_context& ctx, packet_buffer& p){ 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}; return {nullptr, &av_free_packet};
} else { } else {
return {&p, &av_free_packet}; return {&p, &av_free_packet};

7
lib/av/av.hpp

@ -4,15 +4,10 @@
extern "C" { extern "C" {
#include <libavutil/pixfmt.h> #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 AVFormatContext AVFormatContext;
typedef struct AVInputFormat AVInputFormat; typedef struct AVInputFormat AVInputFormat;
typedef struct AVCodecContext AVCodecContext;
typedef struct AVCodec AVCodec;
typedef struct AVPacket AVPacket;
typedef struct AVFrame AVFrame;
} }
#include <memory> #include <memory>

9
lib/fingerprints/wvlt_rgb.hpp

@ -12,15 +12,6 @@
#include <utility> #include <utility>
#include <vector> #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 { namespace fingerprints {
struct wvlt_rgb { struct wvlt_rgb {

1
lib/image_io.cpp

@ -72,7 +72,6 @@ av::frame open_image(std::string const & filename){
// some decoders need extra passes // some decoders need extra passes
while(!finished) { while(!finished) {
avcodec_decode_video2(codec_context.get(), frame.get(), &finished, &empty_packet); avcodec_decode_video2(codec_context.get(), frame.get(), &finished, &empty_packet);
av_free_packet(&empty_packet);
} }
return frame; return frame;

Loading…
Cancel
Save