|
|
@@ -54,12 +54,9 @@ typedef struct |
|
|
|
ffmpeg_codec_t; |
|
|
|
#endif |
|
|
|
|
|
|
|
#define PAR_NUM 1 |
|
|
|
#define PAR_DEN 1 |
|
|
|
#define BITRATE (16 * 1024 * 1024) |
|
|
|
|
|
|
|
pipi_sequence_t *pipi_open_sequence(char const *file, |
|
|
|
int width, int height, int fps) |
|
|
|
int width, int height, int fps, |
|
|
|
int par_num, int par_den, int bitrate) |
|
|
|
{ |
|
|
|
#if defined USE_FFMPEG |
|
|
|
static int initialised = 0; |
|
|
@@ -104,18 +101,18 @@ pipi_sequence_t *pipi_open_sequence(char const *file, |
|
|
|
if (!ff->stream) |
|
|
|
goto error; |
|
|
|
|
|
|
|
ff->stream->sample_aspect_ratio.num = PAR_NUM; |
|
|
|
ff->stream->sample_aspect_ratio.den = PAR_DEN; |
|
|
|
ff->stream->sample_aspect_ratio.num = par_num; |
|
|
|
ff->stream->sample_aspect_ratio.den = par_den; |
|
|
|
|
|
|
|
ff->cod_ctx = ff->stream->codec; |
|
|
|
|
|
|
|
ff->cod_ctx->width = width; |
|
|
|
ff->cod_ctx->height = height; |
|
|
|
ff->cod_ctx->sample_aspect_ratio.num = PAR_NUM; |
|
|
|
ff->cod_ctx->sample_aspect_ratio.den = PAR_DEN; |
|
|
|
ff->cod_ctx->sample_aspect_ratio.num = par_num; |
|
|
|
ff->cod_ctx->sample_aspect_ratio.den = par_den; |
|
|
|
ff->cod_ctx->codec_id = ff->fmt_ctx->oformat->video_codec; |
|
|
|
ff->cod_ctx->codec_type = CODEC_TYPE_VIDEO; |
|
|
|
ff->cod_ctx->bit_rate = BITRATE; |
|
|
|
ff->cod_ctx->bit_rate = bitrate; |
|
|
|
ff->cod_ctx->time_base.num = 1; |
|
|
|
ff->cod_ctx->time_base.den = fps; |
|
|
|
ff->cod_ctx->gop_size = fps * 3 / 4; /* empirical */ |
|
|
@@ -168,7 +165,8 @@ error: |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
int pipi_feed_sequence(pipi_sequence_t *seq, uint8_t *buffer, int width, int height) |
|
|
|
int pipi_feed_sequence(pipi_sequence_t *seq, uint8_t const *buffer, |
|
|
|
int width, int height) |
|
|
|
{ |
|
|
|
#if defined USE_FFMPEG |
|
|
|
AVPacket packet; |
|
|
|