diff --git a/avconv.c b/avconv.c index 974d464e34806..dd26849e2438e 100644 --- a/avconv.c +++ b/avconv.c @@ -1262,7 +1262,20 @@ static void do_video_out(AVFormatContext *s, sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize, 0, ost->resample_height, final_picture->data, final_picture->linesize); } +#else + if (resample_changed) { + avfilter_graph_free(&ost->graph); + if (configure_video_filters(ist, ost)) { + fprintf(stderr, "Error reinitialising filters!\n"); + exit_program(1); + } + } #endif + if (resample_changed) { + ost->resample_width = dec->width; + ost->resample_height = dec->height; + ost->resample_pix_fmt = dec->pix_fmt; + } /* duplicates frame if needed */ for(i=0;ist->codec, 0); assert_avoptions(ost->opts); - //if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) - // ist->st->codec->flags |= CODEC_FLAG_REPEAT_FIELD; } } diff --git a/common.mak b/common.mak index b1f62d90f7704..0b44034ca1fef 100644 --- a/common.mak +++ b/common.mak @@ -27,7 +27,7 @@ IFLAGS := -I. -I$(SRC_PATH)/ CPPFLAGS := $(IFLAGS) $(CPPFLAGS) CFLAGS += $(ECFLAGS) CCFLAGS = $(CFLAGS) -YASMFLAGS += $(IFLAGS) -Pconfig.asm +YASMFLAGS += $(IFLAGS) -I$(SRC_PATH)/libavutil/x86/ -Pconfig.asm HOSTCFLAGS += $(IFLAGS) LDFLAGS := $(ALLFFLIBS:%=-Llib%) $(LDFLAGS) diff --git a/doc/developer.texi b/doc/developer.texi index 6bfbbba523e17..ca8f9cab11a5f 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -327,7 +327,7 @@ send a reminder by email. Your patch should eventually be dealt with. @enumerate @item - Does 'make fate' pass with the patch applied? + Does @code{make fate} pass with the patch applied? @item Was the patch generated with git format-patch or send-email? @item diff --git a/ffmpeg.c b/ffmpeg.c index f0013c4ad7c18..ad592881f542a 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -2482,8 +2482,6 @@ static int transcode(AVFormatContext **output_files, } assert_codec_experimental(ist->st->codec, 0); assert_avoptions(ost->opts); - //if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) - // ist->st->codec->flags |= CODEC_FLAG_REPEAT_FIELD; } } diff --git a/ffplay.c b/ffplay.c index 61f4bc086c804..d35983d333a28 100644 --- a/ffplay.c +++ b/ffplay.c @@ -1728,6 +1728,8 @@ static int video_thread(void *arg) #if CONFIG_AVFILTER AVFilterGraph *graph = avfilter_graph_alloc(); AVFilterContext *filt_out = NULL; + int last_w = is->video_st->codec->width; + int last_h = is->video_st->codec->height; if ((ret = configure_video_filters(graph, is, vfilters)) < 0) goto the_end; @@ -1744,6 +1746,18 @@ static int video_thread(void *arg) while (is->paused && !is->videoq.abort_request) SDL_Delay(10); #if CONFIG_AVFILTER + if ( last_w != is->video_st->codec->width + || last_h != is->video_st->codec->height) { + av_dlog(NULL, "Changing size %dx%d -> %dx%d\n", last_w, last_h, + is->video_st->codec->width, is->video_st->codec->height); + avfilter_graph_free(&graph); + graph = avfilter_graph_alloc(); + if ((ret = configure_video_filters(graph, is, vfilters)) < 0) + goto the_end; + filt_out = is->out_video_filter; + last_w = is->video_st->codec->width; + last_h = is->video_st->codec->height; + } ret = av_vsink_buffer_get_video_buffer_ref(filt_out, &picref, 0); if (picref) { avfilter_fill_frame_from_video_buffer_ref(frame, picref); diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 91937c820c121..3d9935b20398d 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -2296,18 +2296,6 @@ static int mpeg_decode_frame(AVCodecContext *avctx, return buf_size; } -#if 0 - if (s->repeat_field % 2 == 1) { - s->repeat_field++; - //fprintf(stderr,"\nRepeating last frame: %d -> %d! pict: %d %d", avctx->frame_number-1, avctx->frame_number, - // s2->picture_number, s->repeat_field); - if (avctx->flags & CODEC_FLAG_REPEAT_FIELD) { - *data_size = sizeof(AVPicture); - goto the_end; - } - } -#endif - if(s->mpeg_enc_ctx_allocated==0 && avctx->codec_tag == AV_RL32("VCR2")) vcr2_init_sequence(avctx); diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm index 59157b7219bea..8c958a17ee9b6 100644 --- a/libavcodec/x86/ac3dsp.asm +++ b/libavcodec/x86/ac3dsp.asm @@ -19,8 +19,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA diff --git a/libavcodec/x86/dct32_sse.asm b/libavcodec/x86/dct32_sse.asm index bd69fe118c5e8..9a2a6ea88c48c 100644 --- a/libavcodec/x86/dct32_sse.asm +++ b/libavcodec/x86/dct32_sse.asm @@ -19,8 +19,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA 32 diff --git a/libavcodec/x86/deinterlace.asm b/libavcodec/x86/deinterlace.asm index a09473bdae480..2997787beba15 100644 --- a/libavcodec/x86/deinterlace.asm +++ b/libavcodec/x86/deinterlace.asm @@ -20,8 +20,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index ddd151dba8bdb..96983773da848 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -2579,11 +2579,11 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_mmx2; #endif #if HAVE_7REGS - if( mm_flags&AV_CPU_FLAG_3DNOW ) + if (HAVE_AMD3DNOW && (mm_flags & AV_CPU_FLAG_3DNOW)) c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov; #endif - } else if (mm_flags & AV_CPU_FLAG_3DNOW) { + } else if (HAVE_AMD3DNOW && (mm_flags & AV_CPU_FLAG_3DNOW)) { c->prefetch = prefetch_3dnow; if (!high_bit_depth) { @@ -2732,11 +2732,11 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) } #endif - if(mm_flags & AV_CPU_FLAG_3DNOW){ + if (HAVE_AMD3DNOW && (mm_flags & AV_CPU_FLAG_3DNOW)) { c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow; c->vector_fmul = vector_fmul_3dnow; } - if(mm_flags & AV_CPU_FLAG_3DNOWEXT){ + if (HAVE_AMD3DNOWEXT && (mm_flags & AV_CPU_FLAG_3DNOWEXT)) { c->vector_fmul_reverse = vector_fmul_reverse_3dnow2; #if HAVE_6REGS c->vector_fmul_window = vector_fmul_window_3dnow2; @@ -2767,7 +2767,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->scalarproduct_float = ff_scalarproduct_float_sse; #endif } - if(mm_flags & AV_CPU_FLAG_3DNOW) + if (HAVE_AMD3DNOW && (mm_flags & AV_CPU_FLAG_3DNOW)) c->vector_fmul_add = vector_fmul_add_3dnow; // faster than sse if(mm_flags & AV_CPU_FLAG_SSE2){ #if HAVE_YASM diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm index 7a646a2d36034..1f5a4f68c7608 100644 --- a/libavcodec/x86/dsputil_yasm.asm +++ b/libavcodec/x86/dsputil_yasm.asm @@ -19,7 +19,7 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" +%include "x86inc.asm" SECTION_RODATA pb_f: times 16 db 15 diff --git a/libavcodec/x86/dsputilenc_yasm.asm b/libavcodec/x86/dsputilenc_yasm.asm index c08f53d39d3e2..016b354d6cf1a 100644 --- a/libavcodec/x86/dsputilenc_yasm.asm +++ b/libavcodec/x86/dsputilenc_yasm.asm @@ -21,8 +21,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;***************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION .text diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm index 8e5436770ec80..15fb67654c02f 100644 --- a/libavcodec/x86/fft_mmx.asm +++ b/libavcodec/x86/fft_mmx.asm @@ -28,7 +28,7 @@ ; in blocks as conventient to the vector size. ; i.e. {4x real, 4x imaginary, 4x real, ...} (or 2x respectively) -%include "libavutil/x86/x86inc.asm" +%include "x86inc.asm" %ifdef ARCH_X86_64 %define pointer resq diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm index 2deb577ca6cbf..598e412f73352 100644 --- a/libavcodec/x86/fmtconvert.asm +++ b/libavcodec/x86/fmtconvert.asm @@ -19,8 +19,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_TEXT diff --git a/libavcodec/x86/h264_chromamc.asm b/libavcodec/x86/h264_chromamc.asm index 72aecc016343e..e9091f7059eb2 100644 --- a/libavcodec/x86/h264_chromamc.asm +++ b/libavcodec/x86/h264_chromamc.asm @@ -20,8 +20,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA diff --git a/libavcodec/x86/h264_chromamc_10bit.asm b/libavcodec/x86/h264_chromamc_10bit.asm index 56c05118573c2..9d075434fe418 100644 --- a/libavcodec/x86/h264_chromamc_10bit.asm +++ b/libavcodec/x86/h264_chromamc_10bit.asm @@ -22,8 +22,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA diff --git a/libavcodec/x86/h264_deblock.asm b/libavcodec/x86/h264_deblock.asm index 9595c0ab55a6a..ca90f3f4c2304 100644 --- a/libavcodec/x86/h264_deblock.asm +++ b/libavcodec/x86/h264_deblock.asm @@ -24,8 +24,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION .text diff --git a/libavcodec/x86/h264_deblock_10bit.asm b/libavcodec/x86/h264_deblock_10bit.asm index b34867a36d511..ee316258d3347 100644 --- a/libavcodec/x86/h264_deblock_10bit.asm +++ b/libavcodec/x86/h264_deblock_10bit.asm @@ -24,8 +24,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA diff --git a/libavcodec/x86/h264_idct.asm b/libavcodec/x86/h264_idct.asm index dd13bcd72fff1..3b3dabe601e7f 100644 --- a/libavcodec/x86/h264_idct.asm +++ b/libavcodec/x86/h264_idct.asm @@ -26,8 +26,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;***************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA diff --git a/libavcodec/x86/h264_idct_10bit.asm b/libavcodec/x86/h264_idct_10bit.asm index a9c12da5a2274..54636a95d09e1 100644 --- a/libavcodec/x86/h264_idct_10bit.asm +++ b/libavcodec/x86/h264_idct_10bit.asm @@ -22,8 +22,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm index ed3bda7721e66..a178a335edab7 100644 --- a/libavcodec/x86/h264_intrapred.asm +++ b/libavcodec/x86/h264_intrapred.asm @@ -22,8 +22,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA diff --git a/libavcodec/x86/h264_intrapred_10bit.asm b/libavcodec/x86/h264_intrapred_10bit.asm index 5a06896afeb02..e14e31a38c157 100644 --- a/libavcodec/x86/h264_intrapred_10bit.asm +++ b/libavcodec/x86/h264_intrapred_10bit.asm @@ -22,8 +22,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA diff --git a/libavcodec/x86/h264_qpel_10bit.asm b/libavcodec/x86/h264_qpel_10bit.asm index 30d0913cd1e7f..15dd72ca3662f 100644 --- a/libavcodec/x86/h264_qpel_10bit.asm +++ b/libavcodec/x86/h264_qpel_10bit.asm @@ -22,8 +22,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA 32 diff --git a/libavcodec/x86/h264_weight.asm b/libavcodec/x86/h264_weight.asm index bb0af86097cbb..87544ae28805e 100644 --- a/libavcodec/x86/h264_weight.asm +++ b/libavcodec/x86/h264_weight.asm @@ -21,7 +21,7 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" +%include "x86inc.asm" SECTION .text diff --git a/libavcodec/x86/h264_weight_10bit.asm b/libavcodec/x86/h264_weight_10bit.asm index affc4ce5c4b5a..1c58d72d94a5b 100644 --- a/libavcodec/x86/h264_weight_10bit.asm +++ b/libavcodec/x86/h264_weight_10bit.asm @@ -22,8 +22,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA 32 diff --git a/libavcodec/x86/vc1dsp_yasm.asm b/libavcodec/x86/vc1dsp_yasm.asm index 572aa0be1e293..a353c5f9edccb 100644 --- a/libavcodec/x86/vc1dsp_yasm.asm +++ b/libavcodec/x86/vc1dsp_yasm.asm @@ -19,8 +19,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" cextern pw_4 cextern pw_5 diff --git a/libavcodec/x86/vp3dsp.asm b/libavcodec/x86/vp3dsp.asm index 8dac6ab295846..328f94ca60672 100644 --- a/libavcodec/x86/vp3dsp.asm +++ b/libavcodec/x86/vp3dsp.asm @@ -19,8 +19,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" ; MMX-optimized functions cribbed from the original VP3 source code. diff --git a/libavcodec/x86/vp56dsp.asm b/libavcodec/x86/vp56dsp.asm index 98d8505c8a740..6da3ce30e3498 100644 --- a/libavcodec/x86/vp56dsp.asm +++ b/libavcodec/x86/vp56dsp.asm @@ -20,8 +20,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" cextern pw_64 diff --git a/libavcodec/x86/vp8dsp.asm b/libavcodec/x86/vp8dsp.asm index 833c88a1a0d39..14b49705dc3c3 100644 --- a/libavcodec/x86/vp8dsp.asm +++ b/libavcodec/x86/vp8dsp.asm @@ -20,8 +20,8 @@ ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** -%include "libavutil/x86/x86inc.asm" -%include "libavutil/x86/x86util.asm" +%include "x86inc.asm" +%include "x86util.asm" SECTION_RODATA diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c index 5e2f2a88970ce..11c6e92928619 100644 --- a/libavdevice/alsa-audio-dec.c +++ b/libavdevice/alsa-audio-dec.c @@ -61,14 +61,6 @@ static av_cold int audio_read_header(AVFormatContext *s1, enum CodecID codec_id; double o; -#if FF_API_FORMAT_PARAMETERS - if (ap->sample_rate > 0) - s->sample_rate = ap->sample_rate; - - if (ap->channels > 0) - s->channels = ap->channels; -#endif - st = av_new_stream(s1, 0); if (!st) { av_log(s1, AV_LOG_ERROR, "Cannot add stream\n"); diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c index 9c1afe518be65..2792fcf07fcca 100644 --- a/libavdevice/bktr.c +++ b/libavdevice/bktr.c @@ -251,17 +251,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) AVRational framerate; int ret = 0; -#if FF_API_FORMAT_PARAMETERS - if (ap->standard) { - if (!strcasecmp(ap->standard, "pal")) - s->standard = PAL; - else if (!strcasecmp(ap->standard, "secam")) - s->standard = SECAM; - else if (!strcasecmp(ap->standard, "ntsc")) - s->standard = NTSC; - } -#endif - if ((ret = av_parse_video_size(&width, &height, s->video_size)) < 0) { av_log(s1, AV_LOG_ERROR, "Could not parse video size '%s'.\n", s->video_size); goto out; @@ -281,14 +270,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) av_log(s1, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", s->framerate); goto out; } -#if FF_API_FORMAT_PARAMETERS - if (ap->width > 0) - width = ap->width; - if (ap->height > 0) - height = ap->height; - if (ap->time_base.num) - framerate = (AVRational){ap->time_base.den, ap->time_base.num}; -#endif st = av_new_stream(s1, 0); if (!st) { diff --git a/libavdevice/dv1394.c b/libavdevice/dv1394.c index 63eff2aec8b53..779117aee3a8a 100644 --- a/libavdevice/dv1394.c +++ b/libavdevice/dv1394.c @@ -90,18 +90,6 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap if (!dv->dv_demux) goto failed; -#if FF_API_FORMAT_PARAMETERS - if (ap->standard) { - if (!strcasecmp(ap->standard, "pal")) - dv->format = DV1394_PAL; - else - dv->format = DV1394_NTSC; - } - - if (ap->channel) - dv->channel = ap->channel; -#endif - /* Open and initialize DV1394 device */ dv->fd = open(context->filename, O_RDONLY); if (dv->fd < 0) { diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c index 8f7fc676ac88c..70a904c5720a9 100644 --- a/libavdevice/fbdev.c +++ b/libavdevice/fbdev.c @@ -107,10 +107,6 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx, av_log(avctx, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", fbdev->framerate); return ret; } -#if FF_API_FORMAT_PARAMETERS - if (ap->time_base.num) - fbdev->framerate_q = (AVRational){ap->time_base.den, ap->time_base.num}; -#endif if (!(st = av_new_stream(avctx, 0))) return AVERROR(ENOMEM); diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c index f78a2c91646e2..bdf5eb8f9e725 100644 --- a/libavdevice/jack_audio.c +++ b/libavdevice/jack_audio.c @@ -26,6 +26,7 @@ #include "libavutil/log.h" #include "libavutil/fifo.h" +#include "libavutil/opt.h" #include "libavcodec/avcodec.h" #include "libavformat/timefilter.h" #include "avdevice.h" @@ -36,6 +37,7 @@ #define FIFO_PACKETS_NUM 16 typedef struct { + AVClass *class; jack_client_t * client; int activated; sem_t packet_count; @@ -136,7 +138,7 @@ static int supply_new_packets(JackData *self, AVFormatContext *context) return 0; } -static int start_jack(AVFormatContext *context, AVFormatParameters *params) +static int start_jack(AVFormatContext *context) { JackData *self = context->priv_data; jack_status_t status; @@ -153,7 +155,6 @@ static int start_jack(AVFormatContext *context, AVFormatParameters *params) sem_init(&self->packet_count, 0, 0); self->sample_rate = jack_get_sample_rate(self->client); - self->nports = params->channels; self->ports = av_malloc(self->nports * sizeof(*self->ports)); self->buffer_size = jack_get_buffer_size(self->client); @@ -225,10 +226,7 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param AVStream *stream; int test; - if (params->sample_rate <= 0 || params->channels <= 0) - return -1; - - if ((test = start_jack(context, params))) + if ((test = start_jack(context))) return test; stream = av_new_stream(context, 0); @@ -314,6 +312,19 @@ static int audio_read_close(AVFormatContext *context) return 0; } +#define OFFSET(x) offsetof(JackData, x) +static const AVOption options[] = { + { "channels", "Number of audio channels.", OFFSET(nports), FF_OPT_TYPE_INT, { 2 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { NULL }, +}; + +static const AVClass jack_indev_class = { + .class_name = "JACK indev", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + AVInputFormat ff_jack_demuxer = { "jack", NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"), @@ -323,4 +334,5 @@ AVInputFormat ff_jack_demuxer = { audio_read_packet, audio_read_close, .flags = AVFMT_NOFILE, + .priv_class = &jack_indev_class, }; diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c index a1f0cbd3d03f9..73cb575bb9da8 100644 --- a/libavdevice/oss_audio.c +++ b/libavdevice/oss_audio.c @@ -209,13 +209,6 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap) AVStream *st; int ret; -#if FF_API_FORMAT_PARAMETERS - if (ap->sample_rate > 0) - s->sample_rate = ap->sample_rate; - if (ap->channels > 0) - s->channels = ap->channels; -#endif - st = av_new_stream(s1, 0); if (!st) { return AVERROR(ENOMEM); diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c index 3014fd2787dd4..6e386c6d99177 100644 --- a/libavdevice/sndio_dec.c +++ b/libavdevice/sndio_dec.c @@ -34,13 +34,6 @@ static av_cold int audio_read_header(AVFormatContext *s1, AVStream *st; int ret; -#if FF_API_FORMAT_PARAMETERS - if (ap->sample_rate > 0) - s->sample_rate = ap->sample_rate; - if (ap->channels > 0) - s->channels = ap->channels; -#endif - st = av_new_stream(s1, 0); if (!st) return AVERROR(ENOMEM); diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c index 28a4e94599e31..642af9529d9ae 100644 --- a/libavdevice/v4l.c +++ b/libavdevice/v4l.c @@ -142,16 +142,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) /* set tv standard */ if (!ioctl(video_fd, VIDIOCGTUNER, &tuner)) { -#if FF_API_FORMAT_PARAMETERS - if (ap->standard) { - if (!strcasecmp(ap->standard, "pal")) - s->standard = VIDEO_MODE_PAL; - else if (!strcasecmp(ap->standard, "secam")) - s->standard = VIDEO_MODE_SECAM; - else - s->standard = VIDEO_MODE_NTSC; - } -#endif tuner.mode = s->standard; ioctl(video_fd, VIDIOCSTUNER, &tuner); } diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 468c133f60e70..9682d21151e85 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -447,12 +447,6 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap) av_log(s1, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", s->framerate); return ret; } -#if FF_API_FORMAT_PARAMETERS - if (ap->channel > 0) - s->channel = ap->channel; - if (ap->time_base.num) - framerate_q = (AVRational){ap->time_base.den, ap->time_base.num}; -#endif /* set tv video input */ input.index = s->channel; @@ -469,13 +463,6 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap) return AVERROR(EIO); } -#if FF_API_FORMAT_PARAMETERS - if (ap->standard) { - av_freep(&s->standard); - s->standard = av_strdup(ap->standard); - } -#endif - if (s->standard) { av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s\n", s->standard); @@ -589,14 +576,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) res = AVERROR(EINVAL); goto out; } -#if FF_API_FORMAT_PARAMETERS - if (ap->width > 0) - s->width = ap->width; - if (ap->height > 0) - s->height = ap->height; - if (ap->pix_fmt) - pix_fmt = ap->pix_fmt; -#endif capabilities = 0; s->fd = device_open(s1, &capabilities); diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c index 7279817529e56..b8b0e70c371e8 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -265,11 +265,6 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(EIO); } -#if FF_API_FORMAT_PARAMETERS - if (ap->time_base.num) - framerate_q = (AVRational){ap->time_base.den, ap->time_base.num}; -#endif - ctx->hwnd = capCreateCaptureWindow(NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0); if(!ctx->hwnd) { av_log(s, AV_LOG_ERROR, "Could not create capture window.\n"); @@ -327,12 +322,6 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap) goto fail_bi; } } -#if FF_API_FORMAT_PARAMETERS - if (ap->width > 0) - bi->bmiHeader.biWidth = ap->width; - if (ap->height > 0) - bi->bmiHeader.biHeight = ap->height; -#endif if (0) { /* For testing yet unsupported compressions diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c index a41733480f6b3..7debe9dcbb2c2 100644 --- a/libavdevice/x11grab.c +++ b/libavdevice/x11grab.c @@ -183,14 +183,6 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) av_log(s1, AV_LOG_ERROR, "Could not parse framerate: %s.\n", x11grab->framerate); goto out; } -#if FF_API_FORMAT_PARAMETERS - if (ap->width > 0) - x11grab->width = ap->width; - if (ap->height > 0) - x11grab->height = ap->height; - if (ap->time_base.num) - framerate = (AVRational){ap->time_base.den, ap->time_base.num}; -#endif av_log(s1, AV_LOG_INFO, "device: %s -> display: %s x: %d y: %d width: %d height: %d\n", s1->filename, dpyname, x_off, y_off, x11grab->width, x11grab->height); diff --git a/libavformat/img2.c b/libavformat/img2.c index 0531a1a8deb00..77145cb1cf6ed 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -237,16 +237,6 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate); return ret; } -#if FF_API_FORMAT_PARAMETERS - if (ap->pix_fmt != PIX_FMT_NONE) - pix_fmt = ap->pix_fmt; - if (ap->width > 0) - width = ap->width; - if (ap->height > 0) - height = ap->height; - if (ap->time_base.num) - framerate = (AVRational){ap->time_base.den, ap->time_base.num}; -#endif #if FF_API_LOOP_INPUT if (s1->loop_input) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 16e76456527ad..68e3a7681721e 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1529,13 +1529,6 @@ static int mpegts_read_header(AVFormatContext *s, int len; int64_t pos; -#if FF_API_FORMAT_PARAMETERS - if (ap) { - if (ap->mpeg2ts_compute_pcr) - ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr; - } -#endif - /* read the first 1024 bytes to get packet size */ pos = avio_tell(pb); len = avio_read(pb, buf, sizeof(buf)); diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index da47b8b14fe63..2c455cac931e2 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -49,13 +49,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) case AVMEDIA_TYPE_AUDIO: { RawAudioDemuxerContext *s1 = s->priv_data; -#if FF_API_FORMAT_PARAMETERS - if (ap->sample_rate) - st->codec->sample_rate = ap->sample_rate; - if (ap->channels) - st->codec->channels = ap->channels; - else st->codec->channels = 1; -#endif + st->codec->channels = 1; if (s1->sample_rate) st->codec->sample_rate = s1->sample_rate; @@ -87,16 +81,6 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate); goto fail; } -#if FF_API_FORMAT_PARAMETERS - if (ap->width > 0) - width = ap->width; - if (ap->height > 0) - height = ap->height; - if (ap->pix_fmt) - pix_fmt = ap->pix_fmt; - if (ap->time_base.num) - framerate = (AVRational){ap->time_base.den, ap->time_base.num}; -#endif av_set_pts_info(st, 64, framerate.den, framerate.num); st->codec->width = width; st->codec->height = height; @@ -171,10 +155,6 @@ int ff_raw_video_read_header(AVFormatContext *s, av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate); goto fail; } -#if FF_API_FORMAT_PARAMETERS - if (ap->time_base.num) - framerate = (AVRational){ap->time_base.den, ap->time_base.num}; -#endif st->codec->time_base = (AVRational){framerate.den, framerate.num}; av_set_pts_info(st, 64, 1, 1200000); diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index effb7d3a00dd6..461c45c81c141 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -307,16 +307,6 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, // av_log(s, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2); st->codec->time_base.den = fps * st->codec->time_base.num; - //XXX: do we really need that? - switch(st->codec->extradata[4]>>4){ - case 1: st->codec->codec_id = CODEC_ID_RV10; break; - case 2: st->codec->codec_id = CODEC_ID_RV20; break; - case 3: st->codec->codec_id = CODEC_ID_RV30; break; - case 4: st->codec->codec_id = CODEC_ID_RV40; break; - default: - av_log(st->codec, AV_LOG_ERROR, "extra:%02X %02X %02X %02X %02X\n", st->codec->extradata[0], st->codec->extradata[1], st->codec->extradata[2], st->codec->extradata[3], st->codec->extradata[4]); - goto fail1; - } } skip: diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 8fe58e7351397..c2a81f25ea58f 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -164,11 +164,6 @@ static int rtsp_read_header(AVFormatContext *s, return AVERROR(ENOMEM); rt->real_setup = rt->real_setup_cache + s->nb_streams; -#if FF_API_FORMAT_PARAMETERS - if (ap->initial_pause) - rt->initial_pause = ap->initial_pause; -#endif - if (rt->initial_pause) { /* do not start immediately */ } else { diff --git a/libavformat/tty.c b/libavformat/tty.c index ddf283d8a3c9d..1e653e1e09e4e 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -95,23 +95,11 @@ static int read_header(AVFormatContext *avctx, av_log(avctx, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate); goto fail; } -#if FF_API_FORMAT_PARAMETERS - if (ap->width > 0) - width = ap->width; - if (ap->height > 0) - height = ap->height; - if (ap->time_base.num) - framerate = (AVRational){ap->time_base.den, ap->time_base.num}; -#endif st->codec->width = width; st->codec->height = height; av_set_pts_info(st, 60, framerate.den, framerate.num); /* simulate tty display speed */ -#if FF_API_FORMAT_PARAMETERS - if (ap->sample_rate) - s->chars_per_frame = ap->sample_rate; -#endif s->chars_per_frame = FFMAX(av_q2d(st->time_base)*s->chars_per_frame, 1); if (avctx->pb->seekable) {