static int64_t timer_start;
+static uint8_t *audio_buf;
+static uint8_t *audio_out;
+static uint8_t *audio_out2;
+
+static short *samples;
+
static AVBitStreamFilterContext *video_bitstream_filters=NULL;
static AVBitStreamFilterContext *audio_bitstream_filters=NULL;
static AVBitStreamFilterContext *subtitle_bitstream_filters=NULL;
powerpc_display_perf_report();
#endif /* CONFIG_POWERPC_PERF */
+ for (i=0;i<CODEC_TYPE_NB;i++)
+ av_free(avcodec_opts[i]);
+ av_free(avformat_opts);
+ av_free(sws_opts);
+ av_free(audio_buf);
+ av_free(audio_out);
+ av_free(audio_out2);
+ av_free(samples);
+
if (received_sigterm) {
fprintf(stderr,
"Received signal %d: terminating.\n",
unsigned char *buf, int size)
{
uint8_t *buftmp;
- static uint8_t *audio_buf = NULL;
- static uint8_t *audio_out = NULL;
- static uint8_t *audio_out2 = NULL;
const int audio_out_size= 4*MAX_AUDIO_PACKET_SIZE;
int size_out, frame_bytes, ret;
{
char buf[1024];
AVOutputStream *ost;
- AVFormatContext *oc, *os;
+ AVFormatContext *oc;
int64_t total_size;
AVCodecContext *enc;
int frame_number, vid, i;
vid = 0;
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
- os = output_files[ost->file_index];
enc = ost->st->codec;
if (vid && enc->codec_type == CODEC_TYPE_VIDEO) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ",
AVFrame picture;
void *buffer_to_free;
static unsigned int samples_size= 0;
- static short *samples= NULL;
AVSubtitle subtitle, *subtitle_to_free;
int got_subtitle;
AVPacket avpkt;
ret = 0;
/* encode any samples remaining in fifo */
if(fifo_bytes > 0 && enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
+ int osize = av_get_bits_per_sample_format(enc->sample_fmt) >> 3;
int fs_tmp = enc->frame_size;
- enc->frame_size = fifo_bytes / (2 * enc->channels);
+ enc->frame_size = fifo_bytes / (osize * enc->channels);
av_fifo_generic_read(ost->fifo, samples, fifo_bytes, NULL);
- ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, samples);
+ ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, samples);
+ pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den,
+ ost->st->time_base.num, enc->sample_rate);
enc->frame_size = fs_tmp;
}
if(ret <= 0) {
/* init pts */
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
- is = input_files[ist->file_index];
ist->pts = 0;
ist->next_pts = AV_NOPTS_VALUE;
ist->is_start = 1;
}
term_init();
- key = -1;
timer_start = av_gettime();
for(; received_sigterm == 0;) {