AVFrame *frame = ist->sub2video.frame;
av_frame_unref(frame);
- ist->sub2video.frame->width = ist->sub2video.w;
- ist->sub2video.frame->height = ist->sub2video.h;
+ ist->sub2video.frame->width = ist->dec_ctx->width ? ist->dec_ctx->width : ist->sub2video.w;
+ ist->sub2video.frame->height = ist->dec_ctx->height ? ist->dec_ctx->height : ist->sub2video.h;
ist->sub2video.frame->format = AV_PIX_FMT_RGB32;
if ((ret = av_frame_get_buffer(frame, 32)) < 0)
return ret;
return;
}
if (r->x < 0 || r->x + r->w > w || r->y < 0 || r->y + r->h > h) {
- av_log(NULL, AV_LOG_WARNING, "sub2video: rectangle overflowing\n");
+ av_log(NULL, AV_LOG_WARNING, "sub2video: rectangle (%d %d %d %d) overflowing %d %d\n",
+ r->x, r->y, r->w, r->h, w, h
+ );
return;
}
static void sub2video_update(InputStream *ist, AVSubtitle *sub)
{
- int w = ist->sub2video.w, h = ist->sub2video.h;
AVFrame *frame = ist->sub2video.frame;
int8_t *dst;
int dst_linesize;
dst = frame->data [0];
dst_linesize = frame->linesize[0];
for (i = 0; i < num_rects; i++)
- sub2video_copy_rect(dst, dst_linesize, w, h, sub->rects[i]);
+ sub2video_copy_rect(dst, dst_linesize, frame->width, frame->height, sub->rects[i]);
sub2video_push_ref(ist, pts);
ist->sub2video.end_pts = end_pts;
}
if (ist->sub2video.end_pts < INT64_MAX)
sub2video_update(ist, NULL);
for (i = 0; i < ist->nb_filters; i++)
- av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
+ av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
}
/* end of sub2video hack */
is_pipe = !GetConsoleMode(input_handle, &dw);
}
- if (stdin->_cnt > 0) {
- read(0, &ch, 1);
- return ch;
- }
if (is_pipe) {
/* When running under a GUI, you will end here. */
if (!PeekNamedPipe(input_handle, NULL, 0, NULL, &nchars, NULL)) {
int ret;
if (!ost->st->codec->extradata_size && ost->enc_ctx->extradata_size) {
- ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (ost->st->codec->extradata) {
memcpy(ost->st->codec->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size);
ost->st->codec->extradata_size = ost->enc_ctx->extradata_size;
ost->frame_number++;
}
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
+ int i;
uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS,
NULL);
ost->quality = sd ? AV_RL32(sd) : -1;
+ ost->pict_type = sd ? sd[4] : AV_PICTURE_TYPE_NONE;
+
+ for (i = 0; i<FF_ARRAY_ELEMS(ost->error); i++) {
+ if (sd && i < sd[5])
+ ost->error[i] = AV_RL64(sd + 8 + 8*i);
+ else
+ ost->error[i] = -1;
+ }
}
if (bsfc)
pkt->data, pkt->size,
pkt->flags & AV_PKT_FLAG_KEY);
if(a == 0 && new_pkt.data != pkt->data && new_pkt.destruct) {
- uint8_t *t = av_malloc(new_pkt.size + FF_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow
+ uint8_t *t = av_malloc(new_pkt.size + AV_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow
if(t) {
memcpy(t, new_pkt.data, new_pkt.size);
- memset(t + new_pkt.size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ memset(t + new_pkt.size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
new_pkt.data = t;
new_pkt.buf = NULL;
a = 1;
int got_packet, forced_keyframe = 0;
double pts_time;
- if (enc->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME) &&
+ if (enc->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) &&
ost->top_field_first >= 0)
in_picture->top_field_first = !!ost->top_field_first;
av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &enc->time_base));
}
- if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY))
+ if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & AV_CODEC_CAP_DELAY))
pkt.pts = ost->sync_opts;
av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base);
fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number,
ost->quality / (float)FF_QP2LAMBDA);
- if (enc->coded_frame && (enc->flags&CODEC_FLAG_PSNR))
- fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0] / (enc->width * enc->height * 255.0 * 255.0)));
+ if (ost->error[0]>=0 && (enc->flags & AV_CODEC_FLAG_PSNR))
+ fprintf(vstats_file, "PSNR= %6.2f ", psnr(ost->error[0] / (enc->width * enc->height * 255.0 * 255.0)));
fprintf(vstats_file,"f_size= %6d ", frame_size);
/* compute pts value */
avg_bitrate = (double)(ost->data_size * 8) / ti1 / 1000.0;
fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
(double)ost->data_size / 1024, ti1, bitrate, avg_bitrate);
- fprintf(vstats_file, "type= %c\n", enc->coded_frame ? av_get_picture_type_char(enc->coded_frame->pict_type) : 'I');
+ fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(ost->pict_type));
}
}
do_video_out(of->ctx, ost, filtered_frame, float_pts);
break;
case AVMEDIA_TYPE_AUDIO:
- if (!(enc->codec->capabilities & CODEC_CAP_PARAM_CHANGE) &&
+ if (!(enc->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE) &&
enc->channels != av_frame_get_channels(filtered_frame)) {
av_log(NULL, AV_LOG_ERROR,
"Audio filter graph output is not normalized and encoder does not support parameter changes\n");
}
extra_size += ost->enc_ctx->extradata_size;
data_size += ost->data_size;
- if ( (ost->enc_ctx->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))
- != CODEC_FLAG_PASS1)
+ if ( (ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))
+ != AV_CODEC_FLAG_PASS1)
pass1_used = 0;
}
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1)));
}
- if ((enc->flags&CODEC_FLAG_PSNR) && (enc->coded_frame || is_last_report)) {
+ if ((enc->flags & AV_CODEC_FLAG_PSNR) && (ost->pict_type != AV_PICTURE_TYPE_NONE || is_last_report)) {
int j;
double error, error_sum = 0;
double scale, scale_sum = 0;
error = enc->error[j];
scale = enc->width * enc->height * 255.0 * 255.0 * frame_number;
} else {
- error = enc->coded_frame->error[j];
+ error = ost->error[j];
scale = enc->width * enc->height * 255.0 * 255.0;
}
if (j)
if (ist->dec_ctx->codec_id == AV_CODEC_ID_H264) {
ist->st->codec->has_b_frames = ist->dec_ctx->has_b_frames;
} else
- av_log_ask_for_sample(
- ist->dec_ctx,
- "has_b_frames is larger in decoder than demuxer %d > %d ",
- ist->dec_ctx->has_b_frames,
- ist->st->codec->has_b_frames
- );
+ av_log(ist->dec_ctx, AV_LOG_WARNING,
+ "has_b_frames is larger in decoder than demuxer %d > %d.\n"
+ "If you want to help, upload a sample "
+ "of this file to ftp://upload.ffmpeg.org/incoming/ "
+ "and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)",
+ ist->dec_ctx->has_b_frames,
+ ist->st->codec->has_b_frames);
}
if (*got_output || ret<0)
{
int i, ret;
for (i = 0; i < ist->nb_filters; i++) {
-#if 1
- ret = av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
-#else
ret = av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
-#endif
if (ret < 0)
return ret;
}
ist->dts = ist->next_dts;
if (avpkt.size && avpkt.size != pkt->size &&
- !(ist->dec->capabilities & CODEC_CAP_SUBFRAMES)) {
+ !(ist->dec->capabilities & AV_CODEC_CAP_SUBFRAMES)) {
av_log(NULL, ist->showed_multi_packet_warning ? AV_LOG_VERBOSE : AV_LOG_WARNING,
"Multiple frames in a packet from stream %d\n", pkt->stream_index);
ist->showed_multi_packet_warning = 1;
return ret;
}
if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
- !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
+ !(ost->enc->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE))
av_buffersink_set_frame_size(ost->filter->filter,
ost->enc_ctx->frame_size);
assert_avoptions(ost->encoder_opts);
if (!encoder_string)
exit_program(1);
- if (!(format_flags & AVFMT_FLAG_BITEXACT) && !(codec_flags & CODEC_FLAG_BITEXACT))
+ if (!(format_flags & AVFMT_FLAG_BITEXACT) && !(codec_flags & AV_CODEC_FLAG_BITEXACT))
av_strlcpy(encoder_string, LIBAVCODEC_IDENT " ", encoder_string_len);
else
av_strlcpy(encoder_string, "Lavc ", encoder_string_len);
av_assert0(ist && !ost->filter);
- extra_size = (uint64_t)dec_ctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE;
+ extra_size = (uint64_t)dec_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE;
if (extra_size > INT_MAX) {
return AVERROR(EINVAL);
if(!debug) debug = 1;
while(debug & (FF_DEBUG_DCT_COEFF|FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) //unsupported, would just crash
debug += debug;
- }else
- if(scanf("%d", &debug)!=1)
+ }else{
+ char buf[32];
+ int k = 0;
+ i = 0;
+ while ((k = read_key()) != '\n' && k != '\r' && i < sizeof(buf)-1)
+ if (k > 0)
+ buf[i++] = k;
+ buf[i] = 0;
+ if (k <= 0 || sscanf(buf, "%d", &debug)!=1)
fprintf(stderr,"error parsing debug value\n");
+ }
for(i=0;i<nb_input_streams;i++) {
input_streams[i]->st->codec->debug = debug;
}
av_freep(&ost->apad);
av_freep(&ost->disposition);
av_dict_free(&ost->encoder_opts);
+ av_dict_free(&ost->sws_dict);
av_dict_free(&ost->swr_opts);
av_dict_free(&ost->resample_opts);
av_dict_free(&ost->bsf_args);