|
|
@@ -18,8 +18,8 @@ |
|
|
|
#include <stdio.h> |
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
#include <avformat.h> |
|
|
|
#include <swscale.h> |
|
|
|
#include <libavformat/avformat.h> |
|
|
|
#include <libswscale/swscale.h> |
|
|
|
|
|
|
|
#include <pipi.h> |
|
|
|
|
|
|
@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) |
|
|
|
pipi_image_t *image; |
|
|
|
pipi_pixels_t *p; |
|
|
|
uint8_t *buffer, *tmp; |
|
|
|
int len; |
|
|
|
int f, len; |
|
|
|
|
|
|
|
if(argc < 2) |
|
|
|
return EXIT_FAILURE; |
|
|
@@ -73,7 +73,12 @@ int main(int argc, char *argv[]) |
|
|
|
ctx->height = HEIGHT; |
|
|
|
ctx->sample_aspect_ratio.num = PAR_NUM; |
|
|
|
ctx->sample_aspect_ratio.den = PAR_DEN; |
|
|
|
ctx->codec_id = fmt->oformat->video_codec; |
|
|
|
//ctx->codec_id = fmt->oformat->video_codec; |
|
|
|
//ctx->codec_id = CODEC_ID_FFV1; |
|
|
|
//ctx->codec_id = CODEC_ID_THEORA; |
|
|
|
//ctx->codec_id = CODEC_ID_SNOW; |
|
|
|
//ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL; /* Snow */ |
|
|
|
ctx->codec_id = CODEC_ID_MJPEG; |
|
|
|
ctx->codec_type = CODEC_TYPE_VIDEO; |
|
|
|
ctx->bit_rate = BITRATE; |
|
|
|
ctx->time_base.num = 1; |
|
|
@@ -114,7 +119,7 @@ int main(int argc, char *argv[]) |
|
|
|
|
|
|
|
av_write_header(fmt); |
|
|
|
|
|
|
|
for(;;) |
|
|
|
for(f = 0; ; f++) |
|
|
|
{ |
|
|
|
uint8_t *start; |
|
|
|
int w = 0, h = 0, bytes, pitch; |
|
|
@@ -162,8 +167,12 @@ int main(int argc, char *argv[]) |
|
|
|
packet.size = bytes; |
|
|
|
if(av_interleaved_write_frame(fmt, &packet) < 0) |
|
|
|
return EXIT_FAILURE; |
|
|
|
|
|
|
|
fprintf(stderr, "frame %d\r", f); |
|
|
|
} |
|
|
|
|
|
|
|
fprintf(stderr, "\n"); |
|
|
|
|
|
|
|
av_write_trailer(fmt); |
|
|
|
|
|
|
|
avcodec_close(stream->codec); |
|
|
|