Re: [FFmpeg-devel] [PATCH 2/2] [RFC]lavf/ffm: update with more options.
On date Monday 2014-11-03 00:54:01 +0100, Lukasz Marek encoded: On 03.11.2014 00:40, Stefano Sabatini wrote: On date Sunday 2014-11-02 19:19:14 +0100, Lukasz Marek encoded: TODO: bump micro Many common codec options are not via ffm protocol. This commit adds common A/V encoding options to protocol. Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- libavformat/ffmdec.c | 78 libavformat/ffmenc.c | 60 2 files changed, 138 insertions(+) My idea was to let the protocol specify the option using the AVOption interface. This way you don't have to update the protocol every time a new option is added to libavcodec, *AND* you can support private codec options. (in near future I will add posibility to set them) I'm curious about that, since that was in my (much neglected) todo list. How do you plan to do that? The only way I see is to fiddle with FFM. To not spam other thread with offtopic I moved your question here. I'm not sure yet. In config I wanted to something like that: VideoCodec libx264 #common options: AVOptionVideo flags +global_header #private option AVOptionVideo libx264:crf 23 Why do you think the prefix with the name of the codec is needed? In ffm my first idea was to serialize it as strings in separate section. I haven't really thought about it yet. Maybe serializing common options would be also good idea. And send only set values. My idea was to generalize the format and serialize the option key/values. -- FFmpeg = Fiendish Faithless Minimalistic Plastic Extravagant Gadget ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] [RFC]lavf/ffm: update with more options.
On 3 November 2014 01:31, Michael Niedermayer michae...@gmx.at wrote: On Sun, Nov 02, 2014 at 07:19:14PM +0100, Lukasz Marek wrote: shouldnt all these values be checked to be within the allowed ranges for the corresponding AVOptions? being able to set so many field so arbitrarily could be usefull to some kind of exploit ... Yes, it wouldn't hurt to set them via AVOption API which implies validation. OTOH most options doesn't set any reasonable range, just INT_MIN - INT_MAX Remarkable example: {ac, set number of audio channels, OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E}, I try to implement sending private options now and we will see how it works. Maybe then I will change sending common options as well using AVOption API. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] [RFC]lavf/ffm: update with more options.
On Mon, Nov 03, 2014 at 01:05:53PM +0100, Lukasz Marek wrote: On 3 November 2014 01:31, Michael Niedermayer michae...@gmx.at wrote: On Sun, Nov 02, 2014 at 07:19:14PM +0100, Lukasz Marek wrote: shouldnt all these values be checked to be within the allowed ranges for the corresponding AVOptions? being able to set so many field so arbitrarily could be usefull to some kind of exploit ... Yes, it wouldn't hurt to set them via AVOption API which implies validation. OTOH most options doesn't set any reasonable range, just INT_MIN - INT_MAX Remarkable example: {ac, set number of audio channels, OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E}, fixed the negative side of the range thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] [RFC]lavf/ffm: update with more options.
On date Sunday 2014-11-02 19:19:14 +0100, Lukasz Marek encoded: TODO: bump micro Many common codec options are not via ffm protocol. This commit adds common A/V encoding options to protocol. Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- libavformat/ffmdec.c | 78 libavformat/ffmenc.c | 60 2 files changed, 138 insertions(+) My idea was to let the protocol specify the option using the AVOption interface. This way you don't have to update the protocol every time a new option is added to libavcodec, *AND* you can support private codec options. [...] -- FFmpeg = Faithful and Fierce Mastodontic Political Empowered Guru ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] [RFC]lavf/ffm: update with more options.
On 03.11.2014 00:40, Stefano Sabatini wrote: On date Sunday 2014-11-02 19:19:14 +0100, Lukasz Marek encoded: TODO: bump micro Many common codec options are not via ffm protocol. This commit adds common A/V encoding options to protocol. Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- libavformat/ffmdec.c | 78 libavformat/ffmenc.c | 60 2 files changed, 138 insertions(+) My idea was to let the protocol specify the option using the AVOption interface. This way you don't have to update the protocol every time a new option is added to libavcodec, *AND* you can support private codec options. (in near future I will add posibility to set them) I'm curious about that, since that was in my (much neglected) todo list. How do you plan to do that? The only way I see is to fiddle with FFM. To not spam other thread with offtopic I moved your question here. I'm not sure yet. In config I wanted to something like that: VideoCodec libx264 #common options: AVOptionVideo flags +global_header #private option AVOptionVideo libx264:crf 23 In ffm my first idea was to serialize it as strings in separate section. I haven't really thought about it yet. Maybe serializing common options would be also good idea. And send only set values. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] [RFC]lavf/ffm: update with more options.
On Sun, Nov 02, 2014 at 07:19:14PM +0100, Lukasz Marek wrote: TODO: bump micro Many common codec options are not via ffm protocol. This commit adds common A/V encoding options to protocol. Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- libavformat/ffmdec.c | 78 libavformat/ffmenc.c | 60 2 files changed, 138 insertions(+) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index e95c139..8f5338f 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -233,6 +233,12 @@ FF_ENABLE_DEPRECATION_WARNINGS return 0; } +static void ffm_report_old_version(AVFormatContext *s) +{ +av_log(s, AV_LOG_WARNING, + Old version of feed file detected. Consider deleting feed files.\n); +} + static int ffm2_read_header(AVFormatContext *s) { FFMContext *ffm = s-priv_data; @@ -294,6 +300,17 @@ static int ffm2_read_header(AVFormatContext *s) if (ff_get_extradata(codec, pb, avio_rb32(pb)) 0) return AVERROR(ENOMEM); } +if (avio_tell(pb) next) { +codec-slices = avio_r8(pb); +codec-thread_type = avio_r8(pb); +codec-compression_level = avio_rb32(pb); +codec-global_quality = avio_rb32(pb); +codec-ticks_per_frame = avio_rb32(pb); +codec-trellis = avio_rb32(pb); +codec-profile = avio_rb32(pb); +} +if (avio_tell(pb) next) +ffm_report_old_version(s); avio_seek(pb, next, SEEK_SET); id = avio_rb32(pb); size = avio_rb32(pb); @@ -348,11 +365,72 @@ FF_ENABLE_DEPRECATION_WARNINGS codec-qblur = av_int2double(avio_rb64(pb)); codec-max_qdiff = avio_rb32(pb); codec-refs = avio_rb32(pb); +if (avio_tell(pb) next) { +codec-bidir_refine = avio_rb32(pb); +codec-brd_scale = avio_rb32(pb); +codec-b_sensitivity = avio_rb32(pb); +codec-chromaoffset = avio_rb32(pb); +codec-chroma_sample_location = avio_r8(pb); +codec-color_primaries = avio_r8(pb); +codec-color_range = avio_r8(pb); +codec-colorspace = avio_r8(pb); +codec-color_trc = avio_r8(pb); +codec-context_model = avio_rb32(pb); +codec-dia_size = avio_rb32(pb); +codec-field_order = avio_r8(pb); +codec-frame_skip_exp = avio_rb32(pb); +codec-frame_skip_factor = avio_rb32(pb); +codec-frame_skip_threshold = avio_rb32(pb); +codec-idct_algo = avio_rb16(pb); +codec-ildct_cmp = avio_rb16(pb); +codec-inter_quant_bias = avio_rb32(pb); +codec-intra_quant_bias = avio_rb32(pb); +codec-last_predictor_count = avio_rb32(pb); +codec-mb_cmp = avio_rb32(pb); +codec-mb_lmin = avio_rb16(pb); +codec-mb_lmax = avio_rb16(pb); +codec-lumi_masking = av_int2double(avio_rb64(pb)); +codec-dark_masking = av_int2double(avio_rb64(pb)); +codec-me_penalty_compensation = avio_rb32(pb); +codec-me_pre_cmp = avio_rb32(pb); +codec-me_sub_cmp = avio_rb32(pb); +codec-mv0_threshold = avio_rb32(pb); +codec-noise_reduction = avio_rb32(pb); +codec-p_masking = av_int2double(avio_rb32(pb)); +codec-pre_dia_size = avio_rb32(pb); +codec-prediction_method = avio_r8(pb); +codec-pre_me = avio_rb32(pb); +codec-rc_initial_buffer_occupancy = avio_rb32(pb); +codec-rc_max_available_vbv_use = av_int2double(avio_rb32(pb)); +codec-rc_min_vbv_overflow_use = av_int2double(avio_rb32(pb)); +codec-rtp_payload_size = avio_rb32(pb); +codec-sample_aspect_ratio.num = avio_rb32(pb); +codec-sample_aspect_ratio.den = avio_rb32(pb); +codec-spatial_cplx_masking = av_int2double(avio_rb32(pb)); +codec-temporal_cplx_masking = av_int2double(avio_rb32(pb)); +codec-timecode_frame_start = avio_rb64(pb); +} +if (avio_tell(pb) next) +ffm_report_old_version(s); break; case MKBETAG('S', 'T', 'A', 'U'): codec-sample_rate = avio_rb32(pb); codec-channels =