Lines 1861-1872
Link Here
|
1861 |
} |
1861 |
} |
1862 |
|
1862 |
|
1863 |
cImageInCache::~cImageInCache() { |
1863 |
cImageInCache::~cImageInCache() { |
1864 |
#if defined(LIBAV) || (defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
1864 |
#if (defined(LIBAV)&&(LIBAVVERSIONINT<=9) || defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
1865 |
if (FrameBufferYUV->opaque) { |
1865 |
if (FrameBufferYUV->opaque) { |
1866 |
avfilter_unref_buffer((AVFilterBufferRef *)FrameBufferYUV->opaque); |
1866 |
avfilter_unref_buffer((AVFilterBufferRef *)FrameBufferYUV->opaque); |
1867 |
FrameBufferYUV->opaque=NULL; |
1867 |
FrameBufferYUV->opaque=NULL; |
1868 |
} |
1868 |
} |
1869 |
#elif defined(FFMPEG) && (FFMPEGVERSIONINT>=201) |
1869 |
#else |
1870 |
if (FiltFrame) { |
1870 |
if (FiltFrame) { |
1871 |
av_frame_unref(FiltFrame); |
1871 |
av_frame_unref(FiltFrame); |
1872 |
av_frame_free(&FiltFrame); |
1872 |
av_frame_free(&FiltFrame); |
Lines 2239-2245
Link Here
|
2239 |
LibavFile->streams[VideoStreamNumber]->discard=AVDISCARD_DEFAULT; // Setup STREAM options |
2239 |
LibavFile->streams[VideoStreamNumber]->discard=AVDISCARD_DEFAULT; // Setup STREAM options |
2240 |
|
2240 |
|
2241 |
// Setup decoder options |
2241 |
// Setup decoder options |
2242 |
LibavFile->streams[VideoStreamNumber]->codec->debug_mv =0; // Debug level (0=nothing) |
2242 |
//LibavFile->streams[VideoStreamNumber]->codec->debug_mv =0; // Debug level (0=nothing) |
2243 |
LibavFile->streams[VideoStreamNumber]->codec->debug =0; // Debug level (0=nothing) |
2243 |
LibavFile->streams[VideoStreamNumber]->codec->debug =0; // Debug level (0=nothing) |
2244 |
LibavFile->streams[VideoStreamNumber]->codec->workaround_bugs =1; // Work around bugs in encoders which sometimes cannot be detected automatically : 1=autodetection |
2244 |
LibavFile->streams[VideoStreamNumber]->codec->workaround_bugs =1; // Work around bugs in encoders which sometimes cannot be detected automatically : 1=autodetection |
2245 |
LibavFile->streams[VideoStreamNumber]->codec->idct_algo =FF_IDCT_AUTO; // IDCT algorithm, 0=auto |
2245 |
LibavFile->streams[VideoStreamNumber]->codec->idct_algo =FF_IDCT_AUTO; // IDCT algorithm, 0=auto |
Lines 2256-2267
Link Here
|
2256 |
if (avcodec_open2(LibavFile->streams[VideoStreamNumber]->codec,Codec,NULL)>=0) { |
2256 |
if (avcodec_open2(LibavFile->streams[VideoStreamNumber]->codec,Codec,NULL)>=0) { |
2257 |
// Get Aspect Ratio |
2257 |
// Get Aspect Ratio |
2258 |
|
2258 |
|
2259 |
AspectRatio=double(LibavFile->streams[VideoStreamNumber]->codec->sample_aspect_ratio.num)/double(LibavFile->streams[VideoStreamNumber]->codec->sample_aspect_ratio.den); |
2259 |
if (LibavFile->streams[VideoStreamNumber]->codec->sample_aspect_ratio.num!=0) |
2260 |
|
2260 |
AspectRatio=double(LibavFile->streams[VideoStreamNumber]->codec->sample_aspect_ratio.num)/double(LibavFile->streams[VideoStreamNumber]->codec->sample_aspect_ratio.den); |
2261 |
if (LibavFile->streams[VideoStreamNumber]->sample_aspect_ratio.num!=0) |
2261 |
else if (LibavFile->streams[VideoStreamNumber]->sample_aspect_ratio.num!=0) |
2262 |
AspectRatio=double(LibavFile->streams[VideoStreamNumber]->sample_aspect_ratio.num)/double(LibavFile->streams[VideoStreamNumber]->sample_aspect_ratio.den); |
2262 |
AspectRatio=double(LibavFile->streams[VideoStreamNumber]->sample_aspect_ratio.num)/double(LibavFile->streams[VideoStreamNumber]->sample_aspect_ratio.den); |
2263 |
|
2263 |
else |
2264 |
if (AspectRatio==0) AspectRatio=1; |
2264 |
AspectRatio=1; |
2265 |
|
2265 |
|
2266 |
// Special case for DVD mode video without PAR |
2266 |
// Special case for DVD mode video without PAR |
2267 |
if ((AspectRatio==1)&&(LibavFile->streams[VideoStreamNumber]->codec->coded_width==720)&&((LibavFile->streams[VideoStreamNumber]->codec->coded_height==576)||(LibavFile->streams[VideoStreamNumber]->codec->coded_height==480))) |
2267 |
if ((AspectRatio==1)&&(LibavFile->streams[VideoStreamNumber]->codec->coded_width==720)&&((LibavFile->streams[VideoStreamNumber]->codec->coded_height==576)||(LibavFile->streams[VideoStreamNumber]->codec->coded_height==480))) |
Lines 2384-2390
Link Here
|
2384 |
AVCodec *ThumbDecoderCodec=avcodec_find_decoder(ThumbStream->codec->codec_id); |
2384 |
AVCodec *ThumbDecoderCodec=avcodec_find_decoder(ThumbStream->codec->codec_id); |
2385 |
|
2385 |
|
2386 |
// Setup decoder options |
2386 |
// Setup decoder options |
2387 |
ThumbStream->codec->debug_mv =0; // Debug level (0=nothing) |
2387 |
//ThumbStream->codec->debug_mv =0; // Debug level (0=nothing) |
2388 |
ThumbStream->codec->debug =0; // Debug level (0=nothing) |
2388 |
ThumbStream->codec->debug =0; // Debug level (0=nothing) |
2389 |
ThumbStream->codec->workaround_bugs =1; // Work around bugs in encoders which sometimes cannot be detected automatically : 1=autodetection |
2389 |
ThumbStream->codec->workaround_bugs =1; // Work around bugs in encoders which sometimes cannot be detected automatically : 1=autodetection |
2390 |
ThumbStream->codec->idct_algo =FF_IDCT_AUTO; // IDCT algorithm, 0=auto |
2390 |
ThumbStream->codec->idct_algo =FF_IDCT_AUTO; // IDCT algorithm, 0=auto |
Lines 2552-2558
Link Here
|
2552 |
} |
2552 |
} |
2553 |
|
2553 |
|
2554 |
if (FrameBufferYUV!=NULL) { |
2554 |
if (FrameBufferYUV!=NULL) { |
2555 |
#if defined(LIBAV) || (defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
2555 |
#if (defined(LIBAV)&&(LIBAVVERSIONINT<=9) || defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
2556 |
if (FrameBufferYUV->opaque) { |
2556 |
if (FrameBufferYUV->opaque) { |
2557 |
avfilter_unref_buffer((AVFilterBufferRef *)FrameBufferYUV->opaque); |
2557 |
avfilter_unref_buffer((AVFilterBufferRef *)FrameBufferYUV->opaque); |
2558 |
FrameBufferYUV->opaque=NULL; |
2558 |
FrameBufferYUV->opaque=NULL; |
Lines 2572-2578
Link Here
|
2572 |
if (RSC) { |
2572 |
if (RSC) { |
2573 |
#if defined(LIBAV) && (LIBAVVERSIONINT<=8) |
2573 |
#if defined(LIBAV) && (LIBAVVERSIONINT<=8) |
2574 |
audio_resample_close(RSC); |
2574 |
audio_resample_close(RSC); |
2575 |
#elif defined(LIBAV) && (LIBAVVERSIONINT<=9) |
2575 |
#elif defined(LIBAV) |
2576 |
avresample_close(RSC); |
2576 |
avresample_close(RSC); |
2577 |
avresample_free(&RSC); |
2577 |
avresample_free(&RSC); |
2578 |
#elif defined(FFMPEG) |
2578 |
#elif defined(FFMPEG) |
Lines 2619-2625
Link Here
|
2619 |
1, // linear |
2619 |
1, // linear |
2620 |
0); // cutoff |
2620 |
0); // cutoff |
2621 |
if (!RSC) ToLog(LOGMSG_CRITICAL,QString("CheckResampler: av_audio_resample_init failed")); |
2621 |
if (!RSC) ToLog(LOGMSG_CRITICAL,QString("CheckResampler: av_audio_resample_init failed")); |
2622 |
#elif defined(LIBAV) && (LIBAVVERSIONINT<=9) |
2622 |
#elif defined(LIBAV) |
2623 |
this->RSC_InChannelLayout =RSC_InChannelLayout; |
2623 |
this->RSC_InChannelLayout =RSC_InChannelLayout; |
2624 |
this->RSC_OutChannelLayout=RSC_OutChannelLayout; |
2624 |
this->RSC_OutChannelLayout=RSC_OutChannelLayout; |
2625 |
RSC=avresample_alloc_context(); |
2625 |
RSC=avresample_alloc_context(); |
Lines 2704-2710
Link Here
|
2704 |
AVFilterInOut *outputs = (AVFilterInOut *)av_malloc(sizeof(AVFilterInOut)); |
2704 |
AVFilterInOut *outputs = (AVFilterInOut *)av_malloc(sizeof(AVFilterInOut)); |
2705 |
AVFilterInOut *inputs = (AVFilterInOut *)av_malloc(sizeof(AVFilterInOut)); |
2705 |
AVFilterInOut *inputs = (AVFilterInOut *)av_malloc(sizeof(AVFilterInOut)); |
2706 |
|
2706 |
|
2707 |
#elif defined(LIBAV) && (LIBAVVERSIONINT<=9) |
2707 |
#elif defined(LIBAV) |
2708 |
|
2708 |
|
2709 |
QString args=QString("%1:%2:%3:%4:%5:%6:%7") |
2709 |
QString args=QString("%1:%2:%3:%4:%5:%6:%7") |
2710 |
.arg(LibavVideoFile->streams[VideoStreamNumber]->codec->width) |
2710 |
.arg(LibavVideoFile->streams[VideoStreamNumber]->codec->width) |
Lines 2768-2777
Link Here
|
2768 |
inputs->pad_idx = 0; |
2768 |
inputs->pad_idx = 0; |
2769 |
inputs->next = NULL; |
2769 |
inputs->next = NULL; |
2770 |
|
2770 |
|
2771 |
#if defined(LIBAV) && (LIBAVVERSIONINT<=8) |
2771 |
#if defined(LIBAV) |
2772 |
if ((result=avfilter_graph_parse(VideoFilterGraph,QString("yadif=1:-1").toLocal8Bit().constData(),inputs,outputs,NULL))<0) { |
2772 |
if ((result=avfilter_graph_parse(VideoFilterGraph,QString("yadif=1:-1").toLocal8Bit().constData(),inputs,outputs,NULL))<0) { |
2773 |
#elif (defined(LIBAV) && (LIBAVVERSIONINT<=9)) |
|
|
2774 |
if ((result=avfilter_graph_parse(VideoFilterGraph,QString("yadif=deint=interlaced:mode=send_frame:parity=auto").toLocal8Bit().constData(),inputs,outputs,NULL))<0) { |
2775 |
#elif (defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
2773 |
#elif (defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
2776 |
if ((result=avfilter_graph_parse(VideoFilterGraph,QString("yadif=deint=interlaced:mode=send_frame:parity=auto").toLocal8Bit().constData(),&inputs,&outputs,NULL))<0) { |
2774 |
if ((result=avfilter_graph_parse(VideoFilterGraph,QString("yadif=deint=interlaced:mode=send_frame:parity=auto").toLocal8Bit().constData(),&inputs,&outputs,NULL))<0) { |
2777 |
#elif defined(FFMPEG)&&(FFMPEGVERSIONINT>=201) |
2775 |
#elif defined(FFMPEG)&&(FFMPEGVERSIONINT>=201) |
Lines 2799-2805
Link Here
|
2799 |
|
2797 |
|
2800 |
//==================================================================================================================== |
2798 |
//==================================================================================================================== |
2801 |
|
2799 |
|
2802 |
#if defined(LIBAV) || (FFMPEGVERSIONINT<201) |
2800 |
#if (defined(LIBAV)&&(LIBAVVERSIONINT<=9) || defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
2803 |
int cVideoFile::VideoFilter_Process() { |
2801 |
int cVideoFile::VideoFilter_Process() { |
2804 |
#if defined(LIBAV) && (LIBAVVERSIONINT<=8) |
2802 |
#if defined(LIBAV) && (LIBAVVERSIONINT<=8) |
2805 |
// LIBAV 8 |
2803 |
// LIBAV 8 |
Lines 2831-2837
Link Here
|
2831 |
FrameBufferYUV->opaque=(void *)avfilter_ref_buffer(VideoFilterOut->inputs[0]->cur_buf,AV_PERM_READ); |
2829 |
FrameBufferYUV->opaque=(void *)avfilter_ref_buffer(VideoFilterOut->inputs[0]->cur_buf,AV_PERM_READ); |
2832 |
} |
2830 |
} |
2833 |
|
2831 |
|
2834 |
#elif defined(LIBAV) && (LIBAVVERSIONINT<=9) |
2832 |
#elif defined(LIBAV) |
2835 |
// LIBAV9 |
2833 |
// LIBAV9 |
2836 |
AVFilterBufferRef *m_pBufferRef=NULL; |
2834 |
AVFilterBufferRef *m_pBufferRef=NULL; |
2837 |
int Ret=av_buffersrc_write_frame(VideoFilterIn,FrameBufferYUV); |
2835 |
int Ret=av_buffersrc_write_frame(VideoFilterIn,FrameBufferYUV); |
Lines 2964-2970
Link Here
|
2964 |
#if defined(LIBAV) && (LIBAVVERSIONINT<=8) |
2962 |
#if defined(LIBAV) && (LIBAVVERSIONINT<=8) |
2965 |
Data=(u_int8_t *)av_malloc(MaxAudioLenDecoded); |
2963 |
Data=(u_int8_t *)av_malloc(MaxAudioLenDecoded); |
2966 |
if (Data) *SizeDecoded=audio_resample(RSC,(short int*)Data,(short int*)Frame->data[0],Frame->nb_samples)*DstSampleSize; |
2964 |
if (Data) *SizeDecoded=audio_resample(RSC,(short int*)Data,(short int*)Frame->data[0],Frame->nb_samples)*DstSampleSize; |
2967 |
#elif defined(LIBAV) && (LIBAVVERSIONINT<=9) |
2965 |
#elif defined(LIBAV) |
2968 |
u_int8_t *in_data[RESAMPLE_MAX_CHANNELS]={0}; |
2966 |
u_int8_t *in_data[RESAMPLE_MAX_CHANNELS]={0}; |
2969 |
int in_linesize=0; |
2967 |
int in_linesize=0; |
2970 |
Data=Frame->data[0]; |
2968 |
Data=Frame->data[0]; |
Lines 2979-2985
Link Here
|
2979 |
} else if (av_samples_fill_arrays(out_data,&out_linesize,Data,RSC_OutChannels,out_samples,RSC_OutSampleFmt,1)<0) { |
2977 |
} else if (av_samples_fill_arrays(out_data,&out_linesize,Data,RSC_OutChannels,out_samples,RSC_OutSampleFmt,1)<0) { |
2980 |
ToLog(LOGMSG_CRITICAL,QString("failed out_data fill arrays")); |
2978 |
ToLog(LOGMSG_CRITICAL,QString("failed out_data fill arrays")); |
2981 |
} else { |
2979 |
} else { |
2982 |
*SizeDecoded=avresample_convert(RSC,out_data,out_linesize,out_samples,in_data,in_linesize,Frame->nb_samples)*DstSampleSize; |
2980 |
*SizeDecoded=avresample_convert(RSC,out_data,out_linesize,out_samples,Frame->data,in_linesize,Frame->nb_samples)*DstSampleSize; |
2983 |
} |
2981 |
} |
2984 |
} |
2982 |
} |
2985 |
#elif defined(FFMPEG) |
2983 |
#elif defined(FFMPEG) |
Lines 3024-3030
Link Here
|
3024 |
|
3022 |
|
3025 |
if (!FPSDuration) { |
3023 |
if (!FPSDuration) { |
3026 |
if (PreviewMode) FPSDuration=double(AV_TIME_BASE)/((cApplicationConfig *)ApplicationConfig)->PreviewFPS; |
3024 |
if (PreviewMode) FPSDuration=double(AV_TIME_BASE)/((cApplicationConfig *)ApplicationConfig)->PreviewFPS; |
3027 |
else if (VideoStream) FPSDuration=double(VideoStream->r_frame_rate.den*AV_TIME_BASE)/double(VideoStream->r_frame_rate.num); |
3025 |
else if (VideoStream) FPSDuration=double(VideoStream->avg_frame_rate.den*AV_TIME_BASE)/double(VideoStream->avg_frame_rate.num); |
3028 |
else FPSDuration=double(AV_TIME_BASE)/double(SoundTrackBloc->SamplingRate); |
3026 |
else FPSDuration=double(AV_TIME_BASE)/double(SoundTrackBloc->SamplingRate); |
3029 |
} |
3027 |
} |
3030 |
// If position >= end of file : disable audio |
3028 |
// If position >= end of file : disable audio |
Lines 3164-3170
Link Here
|
3164 |
Data=Frame->data[0]; |
3162 |
Data=Frame->data[0]; |
3165 |
#if (defined(LIBAV)&&(LIBAVVERSIONINT<=8)) |
3163 |
#if (defined(LIBAV)&&(LIBAVVERSIONINT<=8)) |
3166 |
SizeDecoded=Frame->nb_samples*av_get_bytes_per_sample(AudioStream->codec->sample_fmt)*AudioStream->codec->channels; |
3164 |
SizeDecoded=Frame->nb_samples*av_get_bytes_per_sample(AudioStream->codec->sample_fmt)*AudioStream->codec->channels; |
3167 |
#elif (defined(LIBAV)&&(LIBAVVERSIONINT<=9)) |
3165 |
#elif defined(LIBAV) |
3168 |
SizeDecoded=av_samples_get_buffer_size(NULL,AudioStream->codec->channels,Frame->nb_samples,AudioStream->codec->sample_fmt,0); |
3166 |
SizeDecoded=av_samples_get_buffer_size(NULL,AudioStream->codec->channels,Frame->nb_samples,AudioStream->codec->sample_fmt,0); |
3169 |
#elif defined(FFMPEG) |
3167 |
#elif defined(FFMPEG) |
3170 |
SizeDecoded=Frame->nb_samples*av_get_bytes_per_sample(AudioStream->codec->sample_fmt)*AudioStream->codec->channels; |
3168 |
SizeDecoded=Frame->nb_samples*av_get_bytes_per_sample(AudioStream->codec->sample_fmt)*AudioStream->codec->channels; |
Lines 3290-3296
Link Here
|
3290 |
if (FrameBufferYUV==NULL) FrameBufferYUV=ALLOCFRAME(); |
3288 |
if (FrameBufferYUV==NULL) FrameBufferYUV=ALLOCFRAME(); |
3291 |
if (FrameBufferYUV) { |
3289 |
if (FrameBufferYUV) { |
3292 |
|
3290 |
|
3293 |
#if defined(LIBAV) || (defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
3291 |
#if (defined(LIBAV)&&(LIBAVVERSIONINT<=9) || defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
3294 |
if (FrameBufferYUV->opaque) { |
3292 |
if (FrameBufferYUV->opaque) { |
3295 |
avfilter_unref_buffer((AVFilterBufferRef *)FrameBufferYUV->opaque); |
3293 |
avfilter_unref_buffer((AVFilterBufferRef *)FrameBufferYUV->opaque); |
3296 |
FrameBufferYUV->opaque=NULL; |
3294 |
FrameBufferYUV->opaque=NULL; |
Lines 3324-3337
Link Here
|
3324 |
if ((Deinterlace)&&(!VideoFilterGraph)) VideoFilter_Open(); |
3322 |
if ((Deinterlace)&&(!VideoFilterGraph)) VideoFilter_Open(); |
3325 |
else if ((!Deinterlace)&&(VideoFilterGraph)) VideoFilter_Close(); |
3323 |
else if ((!Deinterlace)&&(VideoFilterGraph)) VideoFilter_Close(); |
3326 |
|
3324 |
|
3327 |
#if defined(LIBAV) || (defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
3325 |
#if (defined(LIBAV)&&(LIBAVVERSIONINT<=9) || defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
3328 |
if (VideoFilterGraph) VideoFilter_Process(); |
3326 |
if (VideoFilterGraph) VideoFilter_Process(); |
3329 |
#elif defined(FFMPEG)&&(FFMPEGVERSIONINT>=201) |
3327 |
#elif (defined(LIBAV)&&(LIBAVVERSIONINT>=10) || defined(FFMPEG)&&(FFMPEGVERSIONINT>=201)) |
3330 |
AVFrame *FiltFrame=NULL; |
3328 |
AVFrame *FiltFrame=NULL; |
3331 |
if (VideoFilterGraph) { |
3329 |
if (VideoFilterGraph) { |
3332 |
// FFMPEG 2.0 |
3330 |
// FFMPEG 2.0 / LIBAV 10 |
3333 |
// push the decoded frame into the filtergraph |
3331 |
// push the decoded frame into the filtergraph |
3334 |
if (av_buffersrc_add_frame_flags(VideoFilterIn,FrameBufferYUV,AV_BUFFERSRC_FLAG_KEEP_REF)<0) { |
3332 |
if (av_buffersrc_write_frame(VideoFilterIn,FrameBufferYUV)<0) { |
3335 |
ToLog(LOGMSG_INFORMATION,"IN:cVideoFile::ReadFrame : Error while feeding the filtergraph"); |
3333 |
ToLog(LOGMSG_INFORMATION,"IN:cVideoFile::ReadFrame : Error while feeding the filtergraph"); |
3336 |
} else { |
3334 |
} else { |
3337 |
FiltFrame=av_frame_alloc(); |
3335 |
FiltFrame=av_frame_alloc(); |
Lines 3364-3370
Link Here
|
3364 |
|
3362 |
|
3365 |
// Append this frame |
3363 |
// Append this frame |
3366 |
cImageInCache *ObjImage= |
3364 |
cImageInCache *ObjImage= |
3367 |
#if defined(LIBAV) || (defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
3365 |
#if (defined(LIBAV)&&(LIBAVVERSIONINT<=9) || defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
3368 |
new cImageInCache(FrameBufferYUVPosition,NULL,FrameBufferYUV); |
3366 |
new cImageInCache(FrameBufferYUVPosition,NULL,FrameBufferYUV); |
3369 |
#else |
3367 |
#else |
3370 |
new cImageInCache(FrameBufferYUVPosition,FiltFrame,FrameBufferYUV); |
3368 |
new cImageInCache(FrameBufferYUVPosition,FiltFrame,FrameBufferYUV); |
Lines 3386-3392
Link Here
|
3386 |
IsVideoFind=Nbr>0; |
3384 |
IsVideoFind=Nbr>0; |
3387 |
} |
3385 |
} |
3388 |
if (FreeFrames) { |
3386 |
if (FreeFrames) { |
3389 |
#if defined(LIBAV) || (defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
3387 |
#if (defined(LIBAV)&&(LIBAVVERSIONINT<=9) || defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
3390 |
if (FrameBufferYUV->opaque) { |
3388 |
if (FrameBufferYUV->opaque) { |
3391 |
avfilter_unref_buffer((AVFilterBufferRef *)FrameBufferYUV->opaque); |
3389 |
avfilter_unref_buffer((AVFilterBufferRef *)FrameBufferYUV->opaque); |
3392 |
FrameBufferYUV->opaque=NULL; |
3390 |
FrameBufferYUV->opaque=NULL; |
Lines 3401-3407
Link Here
|
3401 |
FREEFRAME(&FrameBufferYUV); |
3399 |
FREEFRAME(&FrameBufferYUV); |
3402 |
} else { |
3400 |
} else { |
3403 |
FrameBufferYUV=NULL; |
3401 |
FrameBufferYUV=NULL; |
3404 |
#if defined(FFMPEG)&&(FFMPEGVERSIONINT>=201) |
3402 |
#if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=201) || defined(LIBAV)&&(LIBAVVERSIONINT>=10)) |
3405 |
FiltFrame =NULL; |
3403 |
FiltFrame =NULL; |
3406 |
#endif |
3404 |
#endif |
3407 |
} |
3405 |
} |
Lines 3490-3496
Link Here
|
3490 |
|
3488 |
|
3491 |
if (img_convert_ctx!=NULL) { |
3489 |
if (img_convert_ctx!=NULL) { |
3492 |
int ret; |
3490 |
int ret; |
3493 |
#if defined(LIBAV) || (defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
3491 |
#if (defined(LIBAV)&&(LIBAVVERSIONINT<=9) || defined(FFMPEG)&&(FFMPEGVERSIONINT<201)) |
3494 |
if (Frame->opaque) { |
3492 |
if (Frame->opaque) { |
3495 |
AVFilterBufferRef *Buf=(AVFilterBufferRef *)Frame->opaque; |
3493 |
AVFilterBufferRef *Buf=(AVFilterBufferRef *)Frame->opaque; |
3496 |
ret = sws_scale( |
3494 |
ret = sws_scale( |
Lines 3565-3576
Link Here
|
3565 |
int cVideoFile::getThreadFlags(AVCodecID ID) { |
3563 |
int cVideoFile::getThreadFlags(AVCodecID ID) { |
3566 |
int Ret=0; |
3564 |
int Ret=0; |
3567 |
switch (ID) { |
3565 |
switch (ID) { |
3568 |
case CODEC_ID_PRORES: |
3566 |
case AV_CODEC_ID_PRORES: |
3569 |
case CODEC_ID_MPEG1VIDEO: |
3567 |
case AV_CODEC_ID_MPEG1VIDEO: |
3570 |
case CODEC_ID_DVVIDEO: |
3568 |
case AV_CODEC_ID_DVVIDEO: |
3571 |
case CODEC_ID_MPEG2VIDEO: Ret=FF_THREAD_SLICE; break; |
3569 |
case AV_CODEC_ID_MPEG2VIDEO: Ret=FF_THREAD_SLICE; break; |
3572 |
case CODEC_ID_H264 : Ret=FF_THREAD_FRAME|FF_THREAD_SLICE; break; |
3570 |
case AV_CODEC_ID_H264 : Ret=FF_THREAD_FRAME|FF_THREAD_SLICE; break; |
3573 |
default: Ret=FF_THREAD_FRAME; break; |
3571 |
default: Ret=FF_THREAD_FRAME; break; |
3574 |
} |
3572 |
} |
3575 |
return Ret; |
3573 |
return Ret; |
3576 |
} |
3574 |
} |
Lines 3607-3613
Link Here
|
3607 |
AudioDecoderCodec=avcodec_find_decoder(AudioStream->codec->codec_id); |
3605 |
AudioDecoderCodec=avcodec_find_decoder(AudioStream->codec->codec_id); |
3608 |
|
3606 |
|
3609 |
// Setup decoder options |
3607 |
// Setup decoder options |
3610 |
AudioStream->codec->debug_mv =0; // Debug level (0=nothing) |
3608 |
//AudioStream->codec->debug_mv =0; // Debug level (0=nothing) |
3611 |
AudioStream->codec->debug =0; // Debug level (0=nothing) |
3609 |
AudioStream->codec->debug =0; // Debug level (0=nothing) |
3612 |
AudioStream->codec->workaround_bugs =1; // Work around bugs in encoders which sometimes cannot be detected automatically : 1=autodetection |
3610 |
AudioStream->codec->workaround_bugs =1; // Work around bugs in encoders which sometimes cannot be detected automatically : 1=autodetection |
3613 |
AudioStream->codec->idct_algo =FF_IDCT_AUTO; // IDCT algorithm, 0=auto |
3611 |
AudioStream->codec->idct_algo =FF_IDCT_AUTO; // IDCT algorithm, 0=auto |
Lines 3648-3654
Link Here
|
3648 |
VideoDecoderCodec=avcodec_find_decoder(VideoStream->codec->codec_id); |
3646 |
VideoDecoderCodec=avcodec_find_decoder(VideoStream->codec->codec_id); |
3649 |
|
3647 |
|
3650 |
// Setup decoder options |
3648 |
// Setup decoder options |
3651 |
VideoStream->codec->debug_mv =0; // Debug level (0=nothing) |
3649 |
//VideoStream->codec->debug_mv =0; // Debug level (0=nothing) |
3652 |
VideoStream->codec->debug =0; // Debug level (0=nothing) |
3650 |
VideoStream->codec->debug =0; // Debug level (0=nothing) |
3653 |
VideoStream->codec->workaround_bugs =1; // Work around bugs in encoders which sometimes cannot be detected automatically : 1=autodetection |
3651 |
VideoStream->codec->workaround_bugs =1; // Work around bugs in encoders which sometimes cannot be detected automatically : 1=autodetection |
3654 |
VideoStream->codec->idct_algo =FF_IDCT_AUTO; // IDCT algorithm, 0=auto |
3652 |
VideoStream->codec->idct_algo =FF_IDCT_AUTO; // IDCT algorithm, 0=auto |
Lines 3662-3668
Link Here
|
3662 |
// Hack to correct wrong frame rates that seem to be generated by some codecs |
3660 |
// Hack to correct wrong frame rates that seem to be generated by some codecs |
3663 |
if (VideoStream->codec->time_base.num>1000 && VideoStream->codec->time_base.den==1) |
3661 |
if (VideoStream->codec->time_base.num>1000 && VideoStream->codec->time_base.den==1) |
3664 |
VideoStream->codec->time_base.den=1000; |
3662 |
VideoStream->codec->time_base.den=1000; |
3665 |
|
3663 |
|
|
|
3664 |
if (VideoStream->codec->time_base.num == 0) { |
3665 |
VideoStream->codec->time_base.num = VideoStream->avg_frame_rate.den; |
3666 |
VideoStream->codec->time_base.den = VideoStream->avg_frame_rate.num; |
3667 |
} |
3668 |
|
3669 |
if (VideoStream->codec->sample_aspect_ratio.num == 0) { |
3670 |
if (VideoStream->sample_aspect_ratio.num == 0) |
3671 |
VideoStream->codec->sample_aspect_ratio.num = VideoStream->codec->sample_aspect_ratio.den = 1; |
3672 |
else |
3673 |
VideoStream->codec->sample_aspect_ratio = VideoStream->sample_aspect_ratio; |
3674 |
} |
3675 |
|
3666 |
if ((VideoDecoderCodec==NULL)||(avcodec_open2(VideoStream->codec,VideoDecoderCodec,NULL)<0)) return false; |
3676 |
if ((VideoDecoderCodec==NULL)||(avcodec_open2(VideoStream->codec,VideoDecoderCodec,NULL)<0)) return false; |
3667 |
LibavStartTime=LibavVideoFile->start_time; |
3677 |
LibavStartTime=LibavVideoFile->start_time; |
3668 |
} |
3678 |
} |