]> rtime.felk.cvut.cz Git - frescor/streamer.git/blobdiff - codec.c
Print * for every key frame
[frescor/streamer.git] / codec.c
diff --git a/codec.c b/codec.c
index 819343aa57d08051d93af230e5fb1b0714e7ad8d..31338a24744880439aa4d8b48636825b1d493b56 100644 (file)
--- a/codec.c
+++ b/codec.c
@@ -1,6 +1,15 @@
-#include "libavformat/avformat.h"
+/*
+ *  Copyright (c) 2008 Luca Abeni
+ *
+ *  This is free software; see GPL.txt
+ */
+/*#include "libavformat/avformat.h"
 #include "libavcodec/avcodec.h"
-#include "libswscale/swscale.h"
+#include "libswscale/swscale.h"*/
+
+#include <libavformat/avformat.h>
+#include <libavcodec/avcodec.h>
+#include <libswscale/swscale.h>
 
 struct resample_data {
   struct SwsContext *resample_ctx;
@@ -118,8 +127,8 @@ AVPacket *pkt_encode(AVFormatContext *ctx, AVFrame *frame)
   static AVPacket pkt;
   int res;
 
+  pkt.size = 256 * 1024;
   if (pkt.data == NULL) {
-    pkt.size = 256 * 1024;
     pkt.data = av_malloc(pkt.size);
   }
   res = avcodec_encode_video(c, pkt.data, pkt.size, frame);
@@ -130,6 +139,7 @@ AVPacket *pkt_encode(AVFormatContext *ctx, AVFrame *frame)
     return NULL;
   }
 
+  pkt.size = res;
   return &pkt;
 }