projects
/
goodguy
/
history.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sams transition icons, misc fixes, youtube formats
[goodguy/history.git]
/
cinelerra-5.1
/
cinelerra
/
ffmpeg.C
diff --git
a/cinelerra-5.1/cinelerra/ffmpeg.C
b/cinelerra-5.1/cinelerra/ffmpeg.C
index 511d37dd58944ea94f5f001c84639fb88083216a..3d51c70f28e5a8315adc4b871af940bdb59d5c14 100644
(file)
--- a/
cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/
cinelerra-5.1/cinelerra/ffmpeg.C
@@
-328,6
+328,8
@@
int FFStream::decode_activate()
if( decoder->capabilities & AV_CODEC_CAP_DR1 )
avctx->flags |= CODEC_FLAG_EMU_EDGE;
avcodec_parameters_to_context(avctx, st->codecpar);
if( decoder->capabilities & AV_CODEC_CAP_DR1 )
avctx->flags |= CODEC_FLAG_EMU_EDGE;
avcodec_parameters_to_context(avctx, st->codecpar);
+ if( !av_dict_get(copts, "threads", NULL, 0) )
+ avctx->thread_count = ffmpeg->ff_cpus();
ret = avcodec_open2(avctx, decoder, &copts);
}
if( ret >= 0 ) {
ret = avcodec_open2(avctx, decoder, &copts);
}
if( ret >= 0 ) {
@@
-396,9
+398,7
@@
int FFStream::decode(AVFrame *frame)
int FFStream::load_filter(AVFrame *frame)
{
int FFStream::load_filter(AVFrame *frame)
{
- av_frame_unref(frame);
- int ret = av_buffersrc_add_frame_flags(buffersrc_ctx,
- frame, AV_BUFFERSRC_FLAG_KEEP_REF);
+ int ret = av_buffersrc_add_frame_flags(buffersrc_ctx, frame, 0);
if( ret < 0 )
eprintf(_("av_buffersrc_add_frame_flags failed\n"));
return ret;
if( ret < 0 )
eprintf(_("av_buffersrc_add_frame_flags failed\n"));
return ret;
@@
-690,6
+690,7
@@
int FFAudioStream::decode_frame(AVFrame *frame)
int FFAudioStream::encode_activate()
{
if( writing >= 0 ) return writing;
int FFAudioStream::encode_activate()
{
if( writing >= 0 ) return writing;
+ if( !avctx->codec ) return writing = 0;
frame_sz = avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE ?
10000 : avctx->frame_size;
return FFStream::encode_activate();
frame_sz = avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE ?
10000 : avctx->frame_size;
return FFStream::encode_activate();
@@
-1742,8
+1743,11
@@
int FFMPEG::open_decoder()
estimated = 1;
}
}
estimated = 1;
}
}
- if( estimated )
+ static int notified = 0;
+ if( !notified && estimated ) {
+ notified = 1;
printf("FFMPEG::open_decoder: some stream times estimated\n");
printf("FFMPEG::open_decoder: some stream times estimated\n");
+ }
ff_lock("FFMPEG::open_decoder");
int ret = 0, bad_time = 0;
ff_lock("FFMPEG::open_decoder");
int ret = 0, bad_time = 0;
@@
-1985,6
+1989,7
@@
int FFMPEG::open_encoder(const char *type, const char *spec)
break;
}
ctx->time_base = (AVRational) { frame_rate.den, frame_rate.num };
break;
}
ctx->time_base = (AVRational) { frame_rate.den, frame_rate.num };
+ st->avg_frame_rate = frame_rate;
st->time_base = ctx->time_base;
vid->writing = -1;
vid->interlaced = asset->interlace_mode == ILACE_MODE_TOP_FIRST ||
st->time_base = ctx->time_base;
vid->writing = -1;
vid->interlaced = asset->interlace_mode == ILACE_MODE_TOP_FIRST ||
@@
-2003,6
+2008,8
@@
int FFMPEG::open_encoder(const char *type, const char *spec)
av_dict_set(&sopts, "cin_bitrate", 0, 0);
av_dict_set(&sopts, "cin_quality", 0, 0);
av_dict_set(&sopts, "cin_bitrate", 0, 0);
av_dict_set(&sopts, "cin_quality", 0, 0);
+ if( !av_dict_get(sopts, "threads", NULL, 0) )
+ ctx->thread_count = ff_cpus();
ret = avcodec_open2(ctx, codec, &sopts);
if( ret >= 0 ) {
ret = avcodec_parameters_from_context(st->codecpar, ctx);
ret = avcodec_open2(ctx, codec, &sopts);
if( ret >= 0 ) {
ret = avcodec_parameters_from_context(st->codecpar, ctx);
@@
-2530,6
+2537,10
@@
int FFMPEG::ff_video_pid(int stream)
return ffvideo[stream]->st->id;
}
return ffvideo[stream]->st->id;
}
+int FFMPEG::ff_video_mpeg_color_range(int stream)
+{
+ return ffvideo[stream]->st->codecpar->color_range == AVCOL_RANGE_MPEG ? 1 : 0;
+}
int FFMPEG::ff_cpus()
{
int FFMPEG::ff_cpus()
{
@@
-2684,6
+2695,8
@@
int FFMPEG::scan(IndexState *index_state, int64_t *scan_position, int *canceled)
}
if( ret >= 0 ) {
avcodec_parameters_to_context(avctx, st->codecpar);
}
if( ret >= 0 ) {
avcodec_parameters_to_context(avctx, st->codecpar);
+ if( !av_dict_get(copts, "threads", NULL, 0) )
+ avctx->thread_count = ff_cpus();
ret = avcodec_open2(avctx, decoder, &copts);
}
av_dict_free(&copts);
ret = avcodec_open2(avctx, decoder, &copts);
}
av_dict_free(&copts);