Re: [FFmpeg-devel] [PATCH 3/4] V13 - SCTE-35 support in hlsenc
04.10.2016, 02:14, Carlos Fernandez Sanz kirjoitti: > From: Carlos Fernandez > > Signed-off-by: Carlos Fernandez > --- > libavformat/Makefile | 2 +- > libavformat/hlsenc.c | 108 +-- > libavformat/scte_35.c | 527 > ++ > libavformat/scte_35.h | 86 > 4 files changed, 701 insertions(+), 22 deletions(-) > create mode 100644 libavformat/scte_35.c > create mode 100644 libavformat/scte_35.h > > diff --git a/libavformat/Makefile b/libavformat/Makefile > index 5d827d31..9218606 100644 > --- a/libavformat/Makefile > +++ b/libavformat/Makefile > @@ -205,7 +205,7 @@ OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o > OBJS-$(CONFIG_HEVC_DEMUXER) += hevcdec.o rawdec.o > OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o > OBJS-$(CONFIG_HLS_DEMUXER) += hls.o > -OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o > +OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o scte_35.o > OBJS-$(CONFIG_HNM_DEMUXER) += hnm.o > OBJS-$(CONFIG_ICO_DEMUXER) += icodec.o > OBJS-$(CONFIG_ICO_MUXER) += icoenc.o > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index c161937..44259ec 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -38,6 +38,7 @@ > #include "avio_internal.h" > #include "internal.h" > #include "os_support.h" > +#include "scte_35.h" > > #define KEYSIZE 16 > #define LINE_BUFFER_SIZE 1024 > @@ -48,6 +49,10 @@ typedef struct HLSSegment { > double duration; /* in seconds */ > int64_t pos; > int64_t size; > +struct scte_35_event *event; > +int out; At least 'out' should be documented (or renamed) here as it is not obvious what it means. > +int adv_count; > +int64_t start_pts; > > char key_uri[LINE_BUFFER_SIZE + 1]; > char iv_string[KEYSIZE*2 + 1]; > @@ -92,6 +97,8 @@ typedef struct HLSContext { > uint32_t flags;// enum HLSFlags > uint32_t pl_type; // enum PlaylistType > char *segment_filename; > +char *adv_filename; > +char *adv_subfilename; > > int use_localtime; ///< flag to expand filename with localtime > int use_localtime_mkdir;///< flag to mkdir dirname in timebased filename > @@ -108,6 +115,8 @@ typedef struct HLSContext { > int nb_entries; > int discontinuity_set; > > +int adv_count; > +struct scte_35_interface *scte_iface; > HLSSegment *segments; > HLSSegment *last_segment; > HLSSegment *old_segments; > @@ -241,6 +250,8 @@ static int hls_delete_old_segments(HLSContext *hls) { > av_freep(&path); > previous_segment = segment; > segment = previous_segment->next; > +if (hls->scte_iface) > +hls->scte_iface->unref_scte35_event(&previous_segment->event); > av_free(previous_segment); > } > > @@ -360,8 +371,8 @@ static int hls_mux_init(AVFormatContext *s) > } > > /* Create a new segment and append it to the segment list */ > -static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, > double duration, > - int64_t pos, int64_t size) > +static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, > double duration, int64_t pos, > + int64_t start_pts, struct scte_35_event > *event, int64_t size) > { > HLSSegment *en = av_malloc(sizeof(*en)); > char *tmp, *p; > @@ -397,9 +408,23 @@ static int hls_append_segment(struct AVFormatContext *s, > HLSContext *hls, double > > en->duration = duration; > en->pos = pos; > +en->event= event; > en->size = size; > +en->start_pts = start_pts; > en->next = NULL; > > +if (hls->scte_iface) { > +if (hls->scte_iface->event_state == EVENT_OUT_CONT) { > +en->adv_count = hls->adv_count;; Double semicolon. > +hls->adv_count++; > +en->out = hls->scte_iface->event_state; > +} else { > +hls->adv_count = 0; > +en->out = hls->scte_iface->event_state; Assignment could be moved outside the if condition. > +} > +} > + > + > if (hls->key_info_file) { > av_strlcpy(en->key_uri, hls->key_uri, sizeof(en->key_uri)); > av_strlcpy(en->iv_string, hls->iv_string, sizeof(en->iv_string)); > @@ -473,7 +498,7 @@ static int parse_playlist(AVFormatContext *s, const char > *url) > new_start_pos = avio_tell(hls->avf->pb); > hls->size = new_start_pos - hls->start_pos; > av_strlcpy(hls->avf->filename, line, sizeof(line)); > -ret = hls_append_segment(s, hls, hls->duration, > hls->start_pos, hls->size); > +ret = hls_append_segment(s, hls, hls->duration, > hls->start_pos, 0, NULL, hls->size); > if (ret < 0) > goto fail; > hls->start_pos = n
Re: [FFmpeg-devel] [PATCH] mov: move stsd finalization to an appropriate place
On Fri, Oct 14, 2016 at 3:21 PM, Carl Eugen Hoyos wrote: > 2016-10-14 13:56 GMT+02:00 Hendrik Leppkes : >> mov_finalize_stsd_codec parses stream information from the ALAC extradata, >> so run it after the extradata processing is completed in mov_read_stsd. > > Please mention ticket #5826 if your patch fixes the issue. > It probably should, it sounds like a similar issue. If there are no further comments, I'll apply tomorrow. It just moves this call down slightly, no real risk of breakage. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] lavf/mp3enc: write encoder delay/padding upon closing
On 05.10.2016 21:37, Jon Toohill wrote: > --- > libavformat/mp3enc.c | 34 +++--- > 1 file changed, 27 insertions(+), 7 deletions(-) > > diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c > index de63401..ddf4b93 100644 > --- a/libavformat/mp3enc.c > +++ b/libavformat/mp3enc.c [...] > @@ -345,10 +342,24 @@ static int mp3_write_audio_packet(AVFormatContext *s, > AVPacket *pkt) > #endif > > if (mp3->xing_offset) { > +uint8_t *side_data = NULL; > +int side_data_size = 0; > + > mp3_xing_add_frame(mp3, pkt); > mp3->audio_size += pkt->size; > mp3->audio_crc = av_crc(av_crc_get_table(AV_CRC_16_ANSI_LE), >mp3->audio_crc, pkt->data, pkt->size); > + > +side_data = av_packet_get_side_data(pkt, > +AV_PKT_DATA_SKIP_SAMPLES, > +&side_data_size); > +if (side_data && side_data_size >= 10) { > +mp3->padding = AV_RL32(side_data + 4) + 528 + 1; I think this should also use FFMAX(..., 0), as the side_data could theoretically contain a negative value. > +if (!mp3->delay) > +mp3->delay = FFMAX(AV_RL32(side_data) - 528 - 1, 0); > +} else { > +mp3->padding = 0; > +} > } > } > > @@ -381,7 +392,7 @@ static void mp3_update_xing(AVFormatContext *s) > AVReplayGain *rg; > uint16_t tag_crc; > uint8_t *toc; > -int i, rg_size; > +int i, rg_size, delay; This variable is not used. > /* replace "Xing" identification string with "Info" for CBR files. */ > if (!mp3->has_variable_bitrate) > @@ -422,6 +433,15 @@ static void mp3_update_xing(AVFormatContext *s) > } > } > > +/* write encoder delay/padding */ > +if (mp3->delay >= 1 << 12) { > +av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n"); I think this should cap mp3->delay to prevent setting unrelated bits in the header: mp3->delay = (1 << 12) - 1; > +} > +if (mp3->padding >= 1 << 12) { > +av_log(s, AV_LOG_WARNING, "Too many samples of trailing padding.\n"); Same as above. > +} > +AV_WB24(mp3->xing_frame + mp3->xing_offset + 141, (mp3->delay << 12) + > mp3->padding); > + > AV_WB32(mp3->xing_frame + mp3->xing_offset + XING_SIZE - 8, > mp3->audio_size); > AV_WB16(mp3->xing_frame + mp3->xing_offset + XING_SIZE - 4, > mp3->audio_crc); > > Otherwise this patch looks good (and is definitely better than my previous attempt of fixing this [1]). Best regards, Andreas 1: https://ffmpeg.org/pipermail/ffmpeg-devel/2015-December/185657.html ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavc/libmp3lame: send encoder delay/padding in packet side data
On 05.10.2016 21:37, Jon Toohill wrote: > --- > libavcodec/libmp3lame.c | 26 +- > 1 file changed, 25 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c > index 5642264..b3ba0d8 100644 > --- a/libavcodec/libmp3lame.c > +++ b/libavcodec/libmp3lame.c [...] > @@ -269,6 +270,29 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, > AVPacket *avpkt, > ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts, > &avpkt->duration); > > +discard_padding = avctx->frame_size - avpkt->duration; > +// Check if subtraction resulted in an overflow > +if ((discard_padding < avctx->frame_size) != (avpkt->duration > 0)) { > +av_packet_unref(avpkt); > +av_free(avpkt); It would be nice to have an av_log here reporting the problem. Otherwise patch LGTM. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] add hds demuxer
Le tridi 23 vendémiaire, an CCXXV, wm4 a écrit : > XML is very complex This is the usual, and often only, argument raised in this kind of situation. And unfortunately, I already addressed it in this very thread. XML is very complex, yes: processing instructions, entity definitions, DTSs and schemas, namespaces, etc. Fortunately, we do not need that. Manifests only use the most basic XML features: elements, attributes, text. Parsing that is easy. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] avcodec/utils: print Chroma Location string in verbose log level
It's container level information on some formats (Matroska, MXF, yuv4mpeg), so it should be printed at higher log levels than debug. Signed-off-by: James Almer --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index be1686e..ec67ad5 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3251,7 +3251,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) av_get_colorspace_name(enc->colorspace)); } -if (av_log_get_level() >= AV_LOG_DEBUG && +if (av_log_get_level() >= AV_LOG_VERBOSE && enc->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) av_strlcatf(detail, sizeof(detail), "%s, ", av_chroma_location_name(enc->chroma_sample_location)); -- 2.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/3] avformat/matroskadec: support parsing Chroma Location elements
Signed-off-by: James Almer --- libavformat/matroskadec.c | 4 1 file changed, 4 insertions(+) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index acf1ccb..cfe4692 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1826,6 +1826,10 @@ static int mkv_parse_video_color(AVStream *st, const MatroskaTrack *track) { if (track->video.color.range != AVCOL_RANGE_UNSPECIFIED && track->video.color.range <= AVCOL_RANGE_JPEG) st->codecpar->color_range = track->video.color.range; +if (track->video.color.chroma_siting_horz && track->video.color.chroma_siting_vert) +st->codecpar->chroma_location = +avcodec_chroma_pos_to_enum((track->video.color.chroma_siting_horz - 1) << 7, + (track->video.color.chroma_siting_vert - 1) << 7); if (has_mastering_primaries || has_mastering_luminance) { // Use similar rationals as other standards. -- 2.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3] avformat/matroskaenc: support writting Chroma Location elements
Signed-off-by: James Almer --- libavformat/matroskaenc.c | 8 1 file changed, 8 insertions(+) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index a48f5bb..d6557a1 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -829,6 +829,14 @@ static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre par->color_range < AVCOL_RANGE_NB) { put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORRANGE, par->color_range); } +if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED && +par->chroma_location <= AVCHROMA_LOC_TOP) { +int xpos, ypos; + +avcodec_enum_to_chroma_pos(&xpos, &ypos, par->chroma_location); +put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ, (xpos >> 7) + 1); +put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT, (ypos >> 7) + 1); +} if (side_data_size == sizeof(AVMasteringDisplayMetadata)) { ebml_master meta_element = start_ebml_master( dyn_cp, MATROSKA_ID_VIDEOCOLORMASTERINGMETA, 0); -- 2.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/tests/gitignore: add fifo_muxer entry
From a3ee9afc37331315e4ec57f1ebf881779b62bf60 Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Sun, 16 Oct 2016 00:09:25 +0800 Subject: [PATCH] avformat/tests/gitignore: add fifo_muxer entry --- libavformat/tests/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/tests/.gitignore b/libavformat/tests/.gitignore index c8adb86..7ceb7a3 100644 --- a/libavformat/tests/.gitignore +++ b/libavformat/tests/.gitignore @@ -1,3 +1,4 @@ +/fifo_muxer /movenc /noproxy /rtmpdh -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [OPW] OPW Project Proposal
I will makes the necessary changes. On Sat, Oct 15, 2016 at 5:45 AM, Michael Niedermayer wrote: > On Sat, Oct 15, 2016 at 03:33:27AM +0530, Pallavi Kumari wrote: > > Hi Michael, > > > > Please find the task at https://github.com/atana1/audio_stream > > The code should be a avfilter in libavfilter > also it should be using the existing fft code > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > It is dangerous to be right in matters on which the established authorities > are wrong. -- Voltaire > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] Improved Selftest Coverage for libavcodec
Added test for libavcodec/avpacket.c Function(s) tested: av_packet_clone() Signed-off-by: Thomas Turner --- libavcodec/Makefile | 3 +- libavcodec/tests/avpacket.c | 115 tests/fate/libavcodec.mak | 5 ++ 3 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 libavcodec/tests/avpacket.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index a1560ba..d64b8df 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1016,7 +1016,8 @@ SKIPHEADERS-$(CONFIG_VDA) += vda.h vda_vt_internal.h SKIPHEADERS-$(CONFIG_VDPAU)+= vdpau.h vdpau_internal.h SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vda_vt_internal.h -TESTPROGS = imgconvert \ +TESTPROGS = avpacket\ +imgconvert \ jpeg2000dwt \ mathops\ options \ diff --git a/libavcodec/tests/avpacket.c b/libavcodec/tests/avpacket.c new file mode 100644 index 000..d02f2e2 --- /dev/null +++ b/libavcodec/tests/avpacket.c @@ -0,0 +1,115 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include "libavcodec/avcodec.h" + + + +static void LOG_AVPACKET(AVPacket* avpkt, const char* message) +{ +char buf_info[256]; +char data_info[256]; + +if(avpkt->buf) +sprintf(buf_info, "{buffer: %p, data: %p, size: %d}", +avpkt->buf->buffer, avpkt->buf->data, avpkt->buf->size); +else +sprintf(buf_info, "{}"); + +if(avpkt->data) +snprintf(data_info, avpkt->size + 3, "{%s}", avpkt->data); +else +sprintf(data_info, "{}"); + +av_log(NULL, AV_LOG_INFO, + "%s:\n\n" + "buf\t\t: %p " + "%s\n" + "pts\t\t: %" PRId64 "\n" + "dts\t\t: %" PRId64 "\n" + "data\t\t: %p " + "%s\n" + "size\t\t: %d\n" + "stream_index\t: %d\n" + "flags\t\t: %d\n" + "side_data\t: %p\n" + "side_data_elems\t: %d\n" + "duration\t: %" PRId64 "\n" + "pos\t\t: %" PRId64 "\n\n", + message, + avpkt->buf, + buf_info, + avpkt->pts, + avpkt->dts, + avpkt->data, + data_info, + avpkt->size, + avpkt->stream_index, + avpkt->flags, + avpkt->side_data, + avpkt->side_data_elems, + avpkt->duration, + avpkt->pos +); +} + +static void TEST_AV_PACKET_CLONE(void) +{ + +AVPacket avpkt, *avpkt_ptr, *avpkt_clone; + +unsigned char buffer[] = "\x73\x65\x6c\x66\x74\x65\x73\x74\x20\x66\x6f\x72" +"\x20\x61\x76\x5f\x70\x61\x63\x6b\x65\x74\x5f\x63\x6c\x6f\x6e\x65\x28" +"\x2e\x2e\x2e\x29"; + +/* initialize avpkt */ +av_init_packet(&avpkt); + +/* try to make av_packet_clone fail */ +avpkt_clone = av_packet_clone(&avpkt); + +if(!avpkt_clone){ +av_log(NULL, AV_LOG_ERROR, "Error cloning packet.\n\n"); +} + +/* make av_packet_clone succeed */ + +/* fill data buffer */ +avpkt.data = buffer; +avpkt.size = sizeof(buffer); + +/* clone avpkt */ +avpkt_clone = av_packet_clone(&avpkt); + +if(avpkt_clone){ +avpkt_ptr= &avpkt; +LOG_AVPACKET(avpkt_ptr, "Original Packet info");
Re: [FFmpeg-devel] [PATCH] RTSP: pass TLS args for RTSPS
On Sat, Oct 01, 2016 at 04:20:39PM -0400, jayri...@gmail.com wrote: > From: Jay Ridgeway > > > This patch enables TLS args for RTSPS. This is necessary for client > certificates and cert validation. > > Squash changes from feedback into one patch. > > --- > libavformat/rtsp.c| 19 --- > libavformat/rtsp.h| 8 > libavformat/tls_gnutls.c | 7 +++ > libavformat/tls_openssl.c | 7 +++ > libavformat/tls_schannel.c| 7 +++ > libavformat/tls_securetransport.c | 7 +++ > 6 files changed, 52 insertions(+), 3 deletions(-) > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > index c6292c5..53ecb6c 100644 > --- a/libavformat/rtsp.c > +++ b/libavformat/rtsp.c > @@ -78,6 +78,7 @@ > { "reorder_queue_size", "set number of packets to buffer for handling of > reordered packets", OFFSET(reordering_queue_size), AV_OPT_TYPE_INT, { .i64 = > -1 }, -1, INT_MAX, DEC }, \ > { "buffer_size","Underlying protocol send/receive buffer size", > OFFSET(buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 > }, -1, INT_MAX, DEC|ENC } \ > > +#define NONNULLSTR(s) (s ? s : "") > > const AVOption ff_rtsp_options[] = { > { "initial_pause", "do not start playing the stream immediately", > OFFSET(initial_pause), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DEC }, > @@ -97,6 +98,10 @@ const AVOption ff_rtsp_options[] = { > { "stimeout", "set timeout (in microseconds) of socket TCP I/O > operations", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, > DEC }, > COMMON_OPTS(), > { "user-agent", "override User-Agent header", OFFSET(user_agent), > AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC }, > +{ "ca_file", "Certificate Authority database file", OFFSET(ca_file), > AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC|ENC }, > +{ "tls_verify", "verify the peer certificate", OFFSET(verify), > AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DEC|ENC}, > +{ "cert_file", "certificate file", OFFSET(cert_file), > AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC|ENC }, > +{ "key_file", "private key file", OFFSET(key_file), AV_OPT_TYPE_STRING, > {.str = NULL}, 0, 0, DEC|ENC }, > { NULL }, > }; > > @@ -1812,9 +1817,17 @@ redirect: > } else { > int ret; > /* open the tcp connection */ > -ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL, > -host, port, > -"?timeout=%d", rt->stimeout); > +if (strcmp("tls", lower_rtsp_proto) == 0) { > +ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL, > +host, port, > + > "?timeout=%d&verify=%d&cafile=%s&cert_file=%s&key_file=%s", > +rt->stimeout, rt->verify, NONNULLSTR(rt->ca_file), > +NONNULLSTR(rt->cert_file), NONNULLSTR(rt->key_file)); > +} else { > +ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL, > +host, port, > +"?timeout=%d", rt->stimeout); > +} > if ((ret = ffurl_open_whitelist(&rt->rtsp_hd, tcpname, > AVIO_FLAG_READ_WRITE, > &s->interrupt_callback, NULL, s->protocol_whitelist, > s->protocol_blacklist, NULL)) < 0) { > err = ret; > diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h > index 852fd67..fa872a8 100644 > --- a/libavformat/rtsp.h > +++ b/libavformat/rtsp.h > @@ -408,6 +408,14 @@ typedef struct RTSPState { > > char default_lang[4]; > int buffer_size; > + > +/** The following are used for RTSPS streams */ > +//@{ > +char *ca_file; > +int verify; > +char *cert_file; > +char *key_file; > +//@} > } RTSPState; > > #define RTSP_FLAG_FILTER_SRC 0x1/**< Filter incoming UDP packets - > diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c > index 991b36b..ecc80bf 100644 > --- a/libavformat/tls_gnutls.c > +++ b/libavformat/tls_gnutls.c > @@ -235,6 +235,12 @@ static int tls_write(URLContext *h, const uint8_t *buf, > int size) > return print_tls_error(h, ret); > } > > +static int tls_get_file_handle(URLContext *h) > +{ > +TLSContext *c = h->priv_data; > +return ffurl_get_file_handle(c->tls_shared.tcp); > +} > + > static const AVOption options[] = { > TLS_COMMON_OPTIONS(TLSContext, tls_shared), > { NULL } > @@ -253,6 +259,7 @@ const URLProtocol ff_tls_gnutls_protocol = { > .url_read = tls_read, > .url_write = tls_write, > .url_close = tls_close, > +.url_get_file_handle = tls_get_file_handle, > .priv_data_size = sizeof(TLSContext), > .flags = URL_PROTOCOL_FLAG_NETWORK, > .priv_data_class = &tls_class, > diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c > index 46eb3e6..1455392 100644 > --- a/libavformat/tls_openssl.c
Re: [FFmpeg-devel] [PATCH] Improved Selftest Coverage for libavcodec
On Sat, Oct 15, 2016 at 03:05:11AM -0700, Thomas Turner wrote: > Added test for libavcodec/avpacket.c > Function(s) tested: av_packet_clone() > > Signed-off-by: Thomas Turner > --- > libavcodec/Makefile | 3 +- > libavcodec/tests/avpacket.c | 115 > > tests/fate/libavcodec.mak | 5 ++ > 3 files changed, 122 insertions(+), 1 deletion(-) > create mode 100644 libavcodec/tests/avpacket.c > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index a1560ba..d64b8df 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -1016,7 +1016,8 @@ SKIPHEADERS-$(CONFIG_VDA) += vda.h > vda_vt_internal.h > SKIPHEADERS-$(CONFIG_VDPAU)+= vdpau.h vdpau_internal.h > SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vda_vt_internal.h > > -TESTPROGS = imgconvert \ > +TESTPROGS = avpacket\ > +imgconvert \ > jpeg2000dwt \ > mathops\ > options \ > diff --git a/libavcodec/tests/avpacket.c b/libavcodec/tests/avpacket.c > new file mode 100644 > index 000..d02f2e2 > --- /dev/null > +++ b/libavcodec/tests/avpacket.c > @@ -0,0 +1,115 @@ > +/* > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#include > +#include > +#include > +#include "libavcodec/avcodec.h" > + > + > + > +static void LOG_AVPACKET(AVPacket* avpkt, const char* message) > +{ > +char buf_info[256]; > +char data_info[256]; > + > +if(avpkt->buf) > +sprintf(buf_info, "{buffer: %p, data: %p, size: %d}", > +avpkt->buf->buffer, avpkt->buf->data, avpkt->buf->size); > +else > +sprintf(buf_info, "{}"); length checks (as in snprintf() are needed for saftey) also the code segfaults: #0 0x7764ca60 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00402ae3 in av_packet_ref (dst=0x60e040, src=0x7fffe350) at /usr/include/x86_64-linux-gnu/bits/string3.h:52 #2 0x00402bd1 in av_packet_clone (src=0x7fffe350) at libavcodec/avpacket.c:616 #3 0x004010d1 in TEST_AV_PACKET_CLONE () at libavcodec/tests/avpacket.c:87 #4 main () at libavcodec/tests/avpacket.c:11 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Improved Selftest Coverage for libavcodec
On Sat, Oct 15, 2016 at 03:05:11AM -0700, Thomas Turner wrote: > Added test for libavcodec/avpacket.c > Function(s) tested: av_packet_clone() The commit message should also have a first line that is "topic: short description" see the "Development Policy" for more information http://ffmpeg.org/developer.html#Development-Policy [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] RTSP: pass TLS args for RTSPS
Thank you for the feedback. I have been trying to get RTSPS cert validation incorporated for several weeks. I would greatly appreciate someone on the core team helping me guide this to completion. Please find your questions answered below. > the get_file_handle extensions should be in a spererate patch than > the rtsp changes I am process agnostic, but the RTSP changes are dependent on the TLS changes. There is a check for peer addr in RTSP that is based on the file descriptor. > also is it safe for all to use the input file handle that way ? > for example if one used a fifo the input state would not match the > relevant output neccessarily I do not think the peer addr check is necessary. My goal is a minimal patch, making RTSPS work with basic TLS options. Ideally, RTSPS would work with `rtsp://` scheme by recognizing TLS negotiation. I view this patch as an initial step. Thank you. Jay On Sat, Oct 15, 2016 at 3:04 PM Michael Niedermayer wrote: > On Sat, Oct 01, 2016 at 04:20:39PM -0400, jayri...@gmail.com wrote: > > > From: Jay Ridgeway > > > > > > > > > This patch enables TLS args for RTSPS. This is necessary for client > > > certificates and cert validation. > > > > > > Squash changes from feedback into one patch. > > > > > > --- > > > libavformat/rtsp.c| 19 --- > > > libavformat/rtsp.h| 8 > > > libavformat/tls_gnutls.c | 7 +++ > > > libavformat/tls_openssl.c | 7 +++ > > > libavformat/tls_schannel.c| 7 +++ > > > libavformat/tls_securetransport.c | 7 +++ > > > 6 files changed, 52 insertions(+), 3 deletions(-) > > > > > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > > > index c6292c5..53ecb6c 100644 > > > --- a/libavformat/rtsp.c > > > +++ b/libavformat/rtsp.c > > > @@ -78,6 +78,7 @@ > > > { "reorder_queue_size", "set number of packets to buffer for > handling of reordered packets", OFFSET(reordering_queue_size), > AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC }, \ > > > { "buffer_size","Underlying protocol send/receive buffer > size", OFFSET(buffer_size), AV_OPT_TYPE_INT, { > .i64 = -1 }, -1, INT_MAX, DEC|ENC } \ > > > > > > +#define NONNULLSTR(s) (s ? s : "") > > > > > > const AVOption ff_rtsp_options[] = { > > > { "initial_pause", "do not start playing the stream immediately", > OFFSET(initial_pause), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DEC }, > > > @@ -97,6 +98,10 @@ const AVOption ff_rtsp_options[] = { > > > { "stimeout", "set timeout (in microseconds) of socket TCP I/O > operations", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, > INT_MAX, DEC }, > > > COMMON_OPTS(), > > > { "user-agent", "override User-Agent header", OFFSET(user_agent), > AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC }, > > > +{ "ca_file", "Certificate Authority database file", > OFFSET(ca_file), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC|ENC }, > > > +{ "tls_verify", "verify the peer certificate", OFFSET(verify), > AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DEC|ENC}, > > > +{ "cert_file", "certificate file", OFFSET(cert_file), > AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC|ENC }, > > > +{ "key_file", "private key file", OFFSET(key_file), > AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC|ENC }, > > > { NULL }, > > > }; > > > > > > @@ -1812,9 +1817,17 @@ redirect: > > > } else { > > > int ret; > > > /* open the tcp connection */ > > > -ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL, > > > -host, port, > > > -"?timeout=%d", rt->stimeout); > > > +if (strcmp("tls", lower_rtsp_proto) == 0) { > > > +ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, > NULL, > > > +host, port, > > > + > "?timeout=%d&verify=%d&cafile=%s&cert_file=%s&key_file=%s", > > > +rt->stimeout, rt->verify, > NONNULLSTR(rt->ca_file), > > > +NONNULLSTR(rt->cert_file), > NONNULLSTR(rt->key_file)); > > > +} else { > > > +ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, > NULL, > > > +host, port, > > > +"?timeout=%d", rt->stimeout); > > > +} > > > if ((ret = ffurl_open_whitelist(&rt->rtsp_hd, tcpname, > AVIO_FLAG_READ_WRITE, > > > &s->interrupt_callback, NULL, > s->protocol_whitelist, s->protocol_blacklist, NULL)) < 0) { > > > err = ret; > > > diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h > > > index 852fd67..fa872a8 100644 > > > --- a/libavformat/rtsp.h > > > +++ b/libavformat/rtsp.h > > > @@ -408,6 +408,14 @@ typedef struct RTSPState { > > > > > > char default_lang[4]; > > > int buffer_size; > > > + > > > +/** The following are used for RTSPS streams */ > > > +//@{ > > > +char *ca_file; > > > +int ve
[FFmpeg-devel] Refund request for FFmpeg at LinuxCon 2016
Hi, I'd like to ask for refund of my expenses for LinuxCon (see thread "FFmpeg at LinuxCon 2016"): - 191 € for 2 * 675km by car I will contact Stefano if there are no objections. Best regards, Thomas. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avformat/matroskadec: set aspect ratio only when DisplayWidth and DisplayHeight are in pixels
A missing DisplayUnit element or one with the default value of 0 means DisplayWidth and DisplayHeight should be interpreted as pixels. The current code setting st->sample_aspect_ratio is wrong when DisplayUnit is anything else. Signed-off-by: James Almer --- libavformat/matroska.h| 8 libavformat/matroskadec.c | 14 -- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/libavformat/matroska.h b/libavformat/matroska.h index 15e401c..8ad89da 100644 --- a/libavformat/matroska.h +++ b/libavformat/matroska.h @@ -309,6 +309,14 @@ typedef enum { MATROSKA_VIDEO_STEREOMODE_TYPE_NB, } MatroskaVideoStereoModeType; +typedef enum { + MATROSKA_VIDEO_DISPLAYUNIT_PIXELS = 0, + MATROSKA_VIDEO_DISPLAYUNIT_CENTIMETERS = 1, + MATROSKA_VIDEO_DISPLAYUNIT_INCHES = 2, + MATROSKA_VIDEO_DISPLAYUNIT_DAR = 3, + MATROSKA_VIDEO_DISPLAYUNIT_UNKNOWN = 4, +} MatroskaVideoDisplayUnit; + /* * Matroska Codec IDs, strings */ diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index cfe4692..a0afbb9 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -168,6 +168,7 @@ typedef struct MatroskaTrackVideo { uint64_t pixel_width; uint64_t pixel_height; EbmlBin color_space; +uint64_t display_unit; uint64_t interlaced; uint64_t field_order; uint64_t stereo_mode; @@ -436,7 +437,7 @@ static const EbmlSyntax matroska_track_video[] = { { MATROSKA_ID_VIDEOPIXELCROPT, EBML_NONE }, { MATROSKA_ID_VIDEOPIXELCROPL, EBML_NONE }, { MATROSKA_ID_VIDEOPIXELCROPR, EBML_NONE }, -{ MATROSKA_ID_VIDEODISPLAYUNIT,EBML_NONE }, +{ MATROSKA_ID_VIDEODISPLAYUNIT,EBML_UINT, 0, offsetof(MatroskaTrackVideo, display_unit), { .u= MATROSKA_VIDEO_DISPLAYUNIT_PIXELS } }, { MATROSKA_ID_VIDEOFLAGINTERLACED, EBML_UINT, 0, offsetof(MatroskaTrackVideo, interlaced), { .u = MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED } }, { MATROSKA_ID_VIDEOFIELDORDER, EBML_UINT, 0, offsetof(MatroskaTrackVideo, field_order), { .u = MATROSKA_VIDEO_FIELDORDER_UNDETERMINED } }, { MATROSKA_ID_VIDEOSTEREOMODE, EBML_UINT, 0, offsetof(MatroskaTrackVideo, stereo_mode), { .u = MATROSKA_VIDEO_STEREOMODE_TYPE_NB } }, @@ -2300,11 +2301,12 @@ static int matroska_parse_tracks(AVFormatContext *s) if (track->video.stereo_mode && track->video.stereo_mode < MATROSKA_VIDEO_STEREOMODE_TYPE_NB) mkv_stereo_mode_display_mul(track->video.stereo_mode, &display_width_mul, &display_height_mul); -av_reduce(&st->sample_aspect_ratio.num, - &st->sample_aspect_ratio.den, - st->codecpar->height * track->video.display_width * display_width_mul, - st->codecpar->width * track->video.display_height * display_height_mul, - 255); +if (track->video.display_unit == MATROSKA_VIDEO_DISPLAYUNIT_PIXELS) +av_reduce(&st->sample_aspect_ratio.num, + &st->sample_aspect_ratio.den, + st->codecpar->height * track->video.display_width * display_width_mul, + st->codecpar->width * track->video.display_height * display_height_mul, + 255); if (st->codecpar->codec_id != AV_CODEC_ID_HEVC) st->need_parsing = AVSTREAM_PARSE_HEADERS; -- 2.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avformat/matroskaenc: write a DisplayUnit element when aspect ratio is unknown
We don't currently support values 1 (centimeters), 2 (inches) or 3 (DAR), only the default value 0 (pixels) which doesn't need to be written. The fate refs are updated as unknown SAR is now correctly propagated by the matroska demuxer. Signed-off-by: James Almer --- See the relevant discussion in https://mailarchive.ietf.org/arch/msg/cellar/x1F00MwqytPjrcNru6Kk2CWQ474 and https://github.com/Matroska-Org/matroska-specification/pull/34 libavformat/matroskaenc.c | 3 ++- tests/ref/fate/rgb24-mkv | 6 +++--- tests/ref/lavf/mkv| 8 tests/ref/seek/lavf-mkv | 44 ++-- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index d6557a1..d57f231 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1205,7 +1205,8 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, } else if (display_width_div != 1 || display_height_div != 1) { put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , par->width / display_width_div); put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, par->height / display_height_div); -} +} else +put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYUNIT, MATROSKA_VIDEO_DISPLAYUNIT_UNKNOWN); if (par->codec_id == AV_CODEC_ID_RAWVIDEO) { uint32_t color_space = av_le2ne32(par->codec_tag); diff --git a/tests/ref/fate/rgb24-mkv b/tests/ref/fate/rgb24-mkv index bf89ebb..19fd0e6 100644 --- a/tests/ref/fate/rgb24-mkv +++ b/tests/ref/fate/rgb24-mkv @@ -1,8 +1,8 @@ -5f43d628c76d97e30791bf30674ee485 *tests/data/fate/rgb24-mkv.matroska -58357 tests/data/fate/rgb24-mkv.matroska +7b8662e001bfb32a4bf709f4fe620138 *tests/data/fate/rgb24-mkv.matroska +58361 tests/data/fate/rgb24-mkv.matroska #tb 0: 1/10 #media_type 0: video #codec_id 0: rawvideo #dimensions 0: 160x120 -#sar 0: 1/1 +#sar 0: 0/1 0, 0, 0,1,57600, 0x3718ad00 diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv index 5f57083..de161bf 100644 --- a/tests/ref/lavf/mkv +++ b/tests/ref/lavf/mkv @@ -1,6 +1,6 @@ -a06683a6eb4af6fe8ffe5603c1942a97 *./tests/data/lavf/lavf.mkv -472755 ./tests/data/lavf/lavf.mkv +d23ff6ba071001256fa5073a0a528337 *./tests/data/lavf/lavf.mkv +472759 ./tests/data/lavf/lavf.mkv ./tests/data/lavf/lavf.mkv CRC=0xec6c3c68 -c1009a6b9b4ef7e0eb0775d227131415 *./tests/data/lavf/lavf.mkv -320599 ./tests/data/lavf/lavf.mkv +e33c89229c7d5014137c7217f4547467 *./tests/data/lavf/lavf.mkv +320603 ./tests/data/lavf/lavf.mkv ./tests/data/lavf/lavf.mkv CRC=0xec6c3c68 diff --git a/tests/ref/seek/lavf-mkv b/tests/ref/seek/lavf-mkv index 4bb26ef..cea34e9 100644 --- a/tests/ref/seek/lavf-mkv +++ b/tests/ref/seek/lavf-mkv @@ -1,48 +1,48 @@ -ret: 0 st: 1 flags:1 dts: 0.00 pts: 0.00 pos:830 size: 208 +ret: 0 st: 1 flags:1 dts: 0.00 pts: 0.00 pos:834 size: 208 ret: 0 st:-1 flags:0 ts:-1.00 -ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1046 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1050 size: 27837 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292472 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292476 size: 27834 ret: 0 st: 0 flags:0 ts: 0.788000 -ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292472 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292476 size: 27834 ret: 0 st: 0 flags:1 ts:-0.317000 -ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1046 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1050 size: 27837 ret:-1 st: 1 flags:0 ts: 2.577000 ret: 0 st: 1 flags:1 ts: 1.471000 -ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320313 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320317 size: 209 ret: 0 st:-1 flags:0 ts: 0.365002 -ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 147019 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 147023 size: 27925 ret: 0 st:-1 flags:1 ts:-0.740831 -ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1046 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1050 size: 27837 ret:-1 st: 0 flags:0 ts: 2.153000 ret: 0 st: 0 flags:1 ts: 1.048000 -ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292472 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292476 size: 27834 ret: 0 st: 1 flags:0 ts:-0.058000 -ret: 0 st: 1 flags:1 dts: 0.00 pts: 0.00 pos:830 size: 208 +ret: 0 st: 1 flags:1 dts: 0.00 pts: 0.00 pos:834 size: 208 ret: 0 st: 1 flags:1 ts: 2.
Re: [FFmpeg-devel] [PATCH] avfilter/showcqt: add csp option
On Fri, Oct 14, 2016 at 8:47 AM, Michael Niedermayer wrote: > On Fri, Oct 14, 2016 at 08:05:15AM +0700, Muhammad Faiz wrote: >> On Fri, Oct 14, 2016 at 3:20 AM, Michael Niedermayer >> wrote: >> > On Fri, Oct 14, 2016 at 02:50:52AM +0700, Muhammad Faiz wrote: >> >> On Thu, Oct 13, 2016 at 10:38 PM, Michael Niedermayer >> >> wrote: >> >> > On Thu, Oct 13, 2016 at 06:05:19AM +0700, Muhammad Faiz wrote: >> >> >> from colorspace filter >> >> >> >> >> >> Signed-off-by: Muhammad Faiz >> >> >> --- >> >> >> doc/filters.texi | 26 ++ >> >> >> libavfilter/avf_showcqt.c | 56 >> >> >> ++- >> >> >> libavfilter/avf_showcqt.h | 2 ++ >> >> >> 3 files changed, 79 insertions(+), 5 deletions(-) >> >> >> >> >> >> diff --git a/doc/filters.texi b/doc/filters.texi >> >> >> index 76265e7..a79972b 100644 >> >> >> --- a/doc/filters.texi >> >> >> +++ b/doc/filters.texi >> >> >> @@ -16884,6 +16884,32 @@ Enable/disable drawing text to the axis. If >> >> >> it is set to @code{0}, drawing to >> >> >> the axis is disabled, ignoring @var{fontfile} and @var{axisfile} >> >> >> option. >> >> >> Default value is @code{1}. >> >> >> >> >> >> +@item csp >> >> >> +Set colorspace. The accepted values are: >> >> >> +@table @samp >> >> >> +@item unspecified >> >> >> +Unspecified (default) >> >> >> + >> >> >> +@item bt709 >> >> >> +BT.709 >> >> >> + >> >> >> +@item fcc >> >> >> +FCC >> >> >> + >> >> >> +@item bt470bg >> >> >> +BT.470BG or BT.601-6 625 >> >> >> + >> >> >> +@item smpte170m >> >> >> +SMPTE-170M or BT.601-6 525 >> >> >> + >> >> >> +@item smpte240m >> >> >> +SMPTE-240M >> >> >> + >> >> >> +@item bt2020ncl >> >> >> +BT.2020 with non-constant luminance >> >> >> + >> >> >> +@end table >> >> >> + >> >> >> @end table >> >> >> >> >> >> @subsection Examples >> >> >> diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c >> >> >> index 16bb2be..7c76b1f 100644 >> >> >> --- a/libavfilter/avf_showcqt.c >> >> >> +++ b/libavfilter/avf_showcqt.c >> >> >> @@ -83,6 +83,14 @@ static const AVOption showcqt_options[] = { >> >> >> { "axisfile", "set axis image", OFFSET(axisfile), >> >> >> AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, CHAR_MAX, FLAGS }, >> >> >> { "axis", "draw axis", OFFSET(axis), >> >> >> AV_OPT_TYPE_BOOL, { .i64 = 1 },0, 1,FLAGS }, >> >> >> { "text", "draw axis", OFFSET(axis), >> >> >> AV_OPT_TYPE_BOOL, { .i64 = 1 },0, 1,FLAGS }, >> >> >> +{ "csp", "set color space", OFFSET(csp), >> >> >> AV_OPT_TYPE_INT, { .i64 = AVCOL_SPC_UNSPECIFIED }, 0, INT_MAX, FLAGS, >> >> >> "csp" }, >> >> >> +{ "unspecified", "unspecified", 0, >> >> >> AV_OPT_TYPE_CONST, { .i64 = AVCOL_SPC_UNSPECIFIED }, 0, 0, FLAGS, >> >> >> "csp" }, >> >> >> +{ "bt709", "bt709", 0, >> >> >> AV_OPT_TYPE_CONST, { .i64 = AVCOL_SPC_BT709 }, 0, 0, FLAGS, >> >> >> "csp" }, >> >> >> +{ "fcc", "fcc", 0, >> >> >> AV_OPT_TYPE_CONST, { .i64 = AVCOL_SPC_FCC }, 0, 0, FLAGS, >> >> >> "csp" }, >> >> >> +{ "bt470bg", "bt470bg", 0, >> >> >> AV_OPT_TYPE_CONST, { .i64 = AVCOL_SPC_BT470BG }, 0, 0, FLAGS, >> >> >> "csp" }, >> >> >> +{ "smpte170m", "smpte170m", 0, >> >> >> AV_OPT_TYPE_CONST, { .i64 = AVCOL_SPC_SMPTE170M }, 0, 0, FLAGS, >> >> >> "csp" }, >> >> >> +{ "smpte240m", "smpte240m", 0, >> >> >> AV_OPT_TYPE_CONST, { .i64 = AVCOL_SPC_SMPTE240M }, 0, 0, FLAGS, >> >> >> "csp" }, >> >> >> +{ "bt2020ncl", "bt2020ncl", 0, >> >> >> AV_OPT_TYPE_CONST, { .i64 = AVCOL_SPC_BT2020_NCL }, 0, 0, FLAGS, >> >> >> "csp" }, >> >> >> { NULL } >> >> >> }; >> >> >> >> >> >> @@ -656,7 +664,7 @@ static void rgb_from_cqt(ColorFloat *c, const >> >> >> FFTComplex *v, float g, int len) >> >> >> } >> >> >> } >> >> >> >> >> >> -static void yuv_from_cqt(ColorFloat *c, const FFTComplex *v, float >> >> >> gamma, int len) >> >> >> +static void yuv_from_cqt(ColorFloat *c, const FFTComplex *v, float >> >> >> gamma, int len, float cm[3][3]) >> >> >> { >> >> >> int x; >> >> >> for (x = 0; x < len; x++) { >> >> >> @@ -664,9 +672,9 @@ static void yuv_from_cqt(ColorFloat *c, const >> >> >> FFTComplex *v, float gamma, int le >> >> >> r = calculate_gamma(FFMIN(1.0f, v[x].re), gamma); >> >> >> g = calculate_gamma(FFMIN(1.0f, 0.5f * (v[x].re + v[x].im)), >> >> >> gamma); >> >> >> b = calculate_gamma(FFMIN(1.0f, v[x].im), gamma); >> >> >> -c[x].yuv.y = 65.481f * r + 128.553f * g + 24.966f * b; >> >> >> -c[x].yuv.u = -37.797f * r - 74.203f * g + 112.0f * b; >> >> >> -c[x].yuv.v = 112.0f * r - 93.786f * g - 18.214 * b; >> >> >> +c[x].yuv.y = cm[0][0] * r + cm[0][1]
Re: [FFmpeg-devel] [PATCH 1/2] avformat/matroskadec: set aspect ratio only when DisplayWidth and DisplayHeight are in pixels
2016-10-16 0:09 GMT+02:00 James Almer : > +if (track->video.display_unit == > MATROSKA_VIDEO_DISPLAYUNIT_PIXELS) If you don't mind please add braces here. Both patches make sense afaict. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/firequalizer: add scale option
Signed-off-by: Muhammad Faiz --- doc/filters.texi | 13 + libavfilter/af_firequalizer.c | 33 ++--- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index f5cc9b7..d4eec70 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -2565,6 +2565,19 @@ Enable zero phase mode by subtracting timestamp to compensate delay. Default is disabled. @end table +@item scale +Set scale used by gain. Acceptable values are: +@table @option +@item linlin +linear frequency, linear gain +@item linlog +linear frequency, logarithmic (in dB) gain (default) +@item loglin +logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain +@item loglog +logarithmic frequency, logarithmic gain +@end table + @subsection Examples @itemize @item diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c index c7569bb..78d7767 100644 --- a/libavfilter/af_firequalizer.c +++ b/libavfilter/af_firequalizer.c @@ -43,6 +43,14 @@ enum WindowFunc { NB_WFUNC }; +enum Scale { +SCALE_LINLIN, +SCALE_LINLOG, +SCALE_LOGLIN, +SCALE_LOGLOG, +NB_SCALE +}; + #define NB_GAIN_ENTRY_MAX 4096 typedef struct { double freq; @@ -84,6 +92,7 @@ typedef struct { int fixed; int multi; int zero_phase; +int scale; int nb_gain_entry; int gain_entry_err; @@ -112,6 +121,11 @@ static const AVOption firequalizer_options[] = { { "fixed", "set fixed frame samples", OFFSET(fixed), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { "multi", "set multi channels mode", OFFSET(multi), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { "zero_phase", "set zero phase mode", OFFSET(zero_phase), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, +{ "scale", "set gain scale", OFFSET(scale), AV_OPT_TYPE_INT, { .i64 = SCALE_LINLOG }, 0, NB_SCALE-1, FLAGS, "scale" }, +{ "linlin", "linear-freq linear-gain", 0, AV_OPT_TYPE_CONST, { .i64 = SCALE_LINLIN }, 0, 0, FLAGS, "scale" }, +{ "linlog", "linear-freq logarithmic-gain", 0, AV_OPT_TYPE_CONST, { .i64 = SCALE_LINLOG }, 0, 0, FLAGS, "scale" }, +{ "loglin", "logarithmic-freq linear-gain", 0, AV_OPT_TYPE_CONST, { .i64 = SCALE_LOGLIN }, 0, 0, FLAGS, "scale" }, +{ "loglog", "logarithmic-freq logarithmic-gain", 0, AV_OPT_TYPE_CONST, { .i64 = SCALE_LOGLOG }, 0, 0, FLAGS, "scale" }, { NULL } }; @@ -316,6 +330,8 @@ static int generate_kernel(AVFilterContext *ctx, const char *gain, const char *g double vars[VAR_NB]; AVExpr *gain_expr; int ret, k, center, ch; +int xlog = s->scale == SCALE_LOGLIN || s->scale == SCALE_LOGLOG; +int ylog = s->scale == SCALE_LINLOG || s->scale == SCALE_LOGLOG; s->nb_gain_entry = 0; s->gain_entry_err = 0; @@ -340,16 +356,27 @@ static int generate_kernel(AVFilterContext *ctx, const char *gain, const char *g vars[VAR_CHLAYOUT] = inlink->channel_layout; vars[VAR_SR] = inlink->sample_rate; for (ch = 0; ch < inlink->channels; ch++) { +double result; vars[VAR_CH] = ch; vars[VAR_CHID] = av_channel_layout_extract_channel(inlink->channel_layout, ch); vars[VAR_F] = 0.0; -s->analysis_buf[0] = pow(10.0, 0.05 * av_expr_eval(gain_expr, vars, ctx)); +if (xlog) +vars[VAR_F] = log2(0.05 * vars[VAR_F]); +result = av_expr_eval(gain_expr, vars, ctx); +s->analysis_buf[0] = ylog ? pow(10.0, 0.05 * result) : result; + vars[VAR_F] = 0.5 * inlink->sample_rate; -s->analysis_buf[1] = pow(10.0, 0.05 * av_expr_eval(gain_expr, vars, ctx)); +if (xlog) +vars[VAR_F] = log2(0.05 * vars[VAR_F]); +result = av_expr_eval(gain_expr, vars, ctx); +s->analysis_buf[1] = ylog ? pow(10.0, 0.05 * result) : result; for (k = 1; k < s->analysis_rdft_len/2; k++) { vars[VAR_F] = k * ((double)inlink->sample_rate /(double)s->analysis_rdft_len); -s->analysis_buf[2*k] = pow(10.0, 0.05 * av_expr_eval(gain_expr, vars, ctx)); +if (xlog) +vars[VAR_F] = log2(0.05 * vars[VAR_F]); +result = av_expr_eval(gain_expr, vars, ctx); +s->analysis_buf[2*k] = ylog ? pow(10.0, 0.05 * result) : result; s->analysis_buf[2*k+1] = 0.0; } -- 2.5.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avformat/matroskaenc: write a DisplayUnit element when aspect ratio is unknown
Hi, On Sat, Oct 15, 2016 at 11:09 PM, James Almer wrote: > > -#sar 0: 1/1 > +#sar 0: 0/1 > This commit looks very useful. A few archivists (including myself) encountered this issue, so this is a wonderful contribution! Thanks James! -Kieran. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avformat/matroskadec: set aspect ratio only when DisplayWidth and DisplayHeight are in pixels
On 10/15/2016 8:07 PM, Carl Eugen Hoyos wrote: > 2016-10-16 0:09 GMT+02:00 James Almer : > >> +if (track->video.display_unit == >> MATROSKA_VIDEO_DISPLAYUNIT_PIXELS) > > If you don't mind please add braces here. Added brackets, which i assume is what you meant. > > Both patches make sense afaict. > > Thank you, Carl Eugen Pushed. Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avformat/matroskaenc: write a DisplayUnit element when aspect ratio is unknown
> On Oct 15, 2016, at 7:54 PM, Kieran O Leary wrote: > > Hi, > > On Sat, Oct 15, 2016 at 11:09 PM, James Almer wrote: > >> >> -#sar 0: 1/1 >> +#sar 0: 0/1 >> > > This commit looks very useful. A few archivists (including myself) > encountered this issue, so this is a wonderful contribution! Thanks James! +1. Sometimes it makes sense to preserve uncertainty. Dave ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] RTSP: pass TLS args for RTSPS
On Sat, Oct 15, 2016 at 08:31:23PM +, Jay wrote: > Thank you for the feedback. I have been trying to get RTSPS cert validation > incorporated for several weeks. I would greatly appreciate someone on the > core team helping me guide this to completion. Please find your questions > answered below. > > > the get_file_handle extensions should be in a spererate patch than > > the rtsp changes > > I am process agnostic, but the RTSP changes are dependent on the TLS > changes. There is a check for peer addr in RTSP that is based on the file > descriptor. The TLS changes do not depend on the RTSP changes, they can be in a seperate patch, applied before. TLS and RTSP are seperate "modules" changes to them are cleaner if split > > > also is it safe for all to use the input file handle that way ? > > for example if one used a fifo the input state would not match the > > relevant output neccessarily > > I do not think the peer addr check is necessary. My goal is a minimal > patch, making RTSPS work with basic TLS options. Is that the only use of the file handle ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] img2: added support for %t output pattern
On 10/10/16, Roger Pack wrote: > On 9/22/16, Roger Pack wrote: >> On 1/4/12, Yuval Adam wrote: >>> From: Yuval Adam >>> >>> The image2 muxer now supports timestamps in output filenames. >>> When used in an output patterm '%t' will be replaced with the frames >>> timestamp in hours, minutes and seconds (hh:mm:ss). >> >> A somewhat updated (but not yet cleaned up) revision: >> >> https://gist.github.com/rdp/e518616f2a702367ae5a922b56e09e04 >> >> see also https://trac.ffmpeg.org/ticket/1452 > > OK attached is the "cleaned up" patch, ready for review/commit. > > how to test: > (apply then) run this: > > ./ffmpeg -i input -copyts -vsync vfr temp/abc-%d-%t.jpeg > and compare filenames with the timestamps from video packets of > ffprobe -show_packets. > > Probably a better way would have been to mix it into > av_bprint_strftime however I wasn't sure how to use that within > libavformat/utils.c av_get_frame_filename2 > > Adam's initial patch > (https://github.com/yuvadm/FFmpeg/commit/0eb002821a2076cb3593c823399aeef9fdd29525) > also deprecated av_get_frame_filename > > but I wasn't sure if we wanted that here or not so didn't include it. > Thank you for your consideration. bump (this last one is cleaned up enough to be considered for merge please...). -roger- ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] add hds demuxer
update 2016-10-15 0:08 GMT+08:00 Steven Liu : > patch update. > > test passed: > Linux: > ../configure > MingW: > ../configure --cc='ccache x86_64-w64-mingw32-gcc' --arch=x86_64 > --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --disable-yasm > > test passed with hds demux > Linux: > ../configure --enable-xml2 > OSX: > ../configure --disable-everything --enable-demuxer=hds --disable-yasm > --enable-protocol=file --enable-decoder=h264 --enable-decoder=aac > --enable-xml2 > > init add hds demuxer > TODO: xml parser from libxml to libexpat or simpleparser[implementation by > myself] > TODO: docs, version bump, > TODO: option passing support (as seperate commit/patch) > TODO: refine AMF parser > TODO: refine Metadata > > Based-on: patch by CORY MCCARTHY > Based-on: patch by Gorilla Maguila > Signed-off-by: Steven Liu > --- > configure |4 + > libavformat/Makefile |1 + > libavformat/allformats.c |2 +- > libavformat/amfmetadata.c | 219 + > libavformat/amfmetadata.h | 39 +++ > libavformat/f4fbox.c | 381 +++ > libavformat/f4fbox.h | 95 ++ > libavformat/f4mmanifest.c | 324 +++ > libavformat/f4mmanifest.h | 59 > libavformat/flvtag.c | 370 ++ > libavformat/flvtag.h | 32 ++ > libavformat/hdsdec.c | 759 ++ > +++ > 12 files changed, 2284 insertions(+), 1 deletions(-) > create mode 100644 libavformat/amfmetadata.c > create mode 100644 libavformat/amfmetadata.h > create mode 100644 libavformat/f4fbox.c > create mode 100644 libavformat/f4fbox.h > create mode 100644 libavformat/f4mmanifest.c > create mode 100644 libavformat/f4mmanifest.h > create mode 100644 libavformat/flvtag.c > create mode 100644 libavformat/flvtag.h > create mode 100644 libavformat/hdsdec.c > > diff --git a/configure b/configure > index 8d9b21b..6938b28 100755 > --- a/configure > +++ b/configure > @@ -295,6 +295,7 @@ External library support: > on OSX if openssl and gnutls are not used > [autodetect] >--enable-x11grab enable X11 grabbing (legacy) [no] >--disable-xlib disable xlib [autodetect] > + --enable-xml2enable XML parsing using the C library libxml2 > [no] >--disable-zlib disable zlib [autodetect] > >The following libraries provide various hardware acceleration features: > @@ -1552,6 +1553,7 @@ EXTERNAL_LIBRARY_LIST=" > videotoolbox > x11grab > xlib > +xml2 > zlib > " > > @@ -2854,6 +2856,7 @@ eac3_demuxer_select="ac3_parser" > f4v_muxer_select="mov_muxer" > fifo_muxer_deps="threads" > flac_demuxer_select="flac_parser" > +hds_demuxer_deps="xml2" > hds_muxer_select="flv_muxer" > hls_muxer_select="mpegts_muxer" > image2_alias_pix_demuxer_select="image2_demuxer" > @@ -5675,6 +5678,7 @@ enabled jni && { [ $target_os = > "android" ] && check_header jni.h > check_lib2 "dlfcn.h" dlopen -ldl; } > enabled ladspa&& { check_header ladspa.h || die "ERROR: > ladspa.h header not found"; } > enabled libiec61883 && require libiec61883 libiec61883/iec61883.h > iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883 > +enabled xml2 && { require_pkg_config libxml-2.0 > libxml2/libxml/xmlversion.h xmlCheckVersion || disabled-xml2; } > enabled libass&& require_pkg_config libass ass/ass.h > ass_library_init > enabled libbluray && require_pkg_config libbluray > libbluray/bluray.h bd_open > enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open > diff --git a/libavformat/Makefile b/libavformat/Makefile > index 5d827d3..e2b4dd4 100644 > --- a/libavformat/Makefile > +++ b/libavformat/Makefile > @@ -202,6 +202,7 @@ OBJS-$(CONFIG_H264_DEMUXER) += h264dec.o > rawdec.o > OBJS-$(CONFIG_H264_MUXER)+= rawenc.o > OBJS-$(CONFIG_HASH_MUXER)+= hashenc.o > OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o > +OBJS-$(CONFIG_HDS_DEMUXER) += hdsdec.o amfmetadata.o > f4mmanifest.o f4fbox.o flvtag.o > OBJS-$(CONFIG_HEVC_DEMUXER) += hevcdec.o rawdec.o > OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o > OBJS-$(CONFIG_HLS_DEMUXER) += hls.o > diff --git a/libavformat/allformats.c b/libavformat/allformats.c > index 6a216ef..39505c3 100644 > --- a/libavformat/allformats.c > +++ b/libavformat/allformats.c > @@ -146,9 +146,9 @@ void av_register_all(void) > REGISTER_MUXDEMUX(H263, h263); > REGISTER_MUXDEMUX(H264, h264); > REGISTER_MUXER (HASH, hash); > -REGISTER_MUXER (HDS, hds); > REGISTER_MUXDEMUX(HEVC, hevc); > REGISTER_MUXDEMUX(HLS, hls); > +REGISTER_MUXDEMUX(HDS, hds); > REGISTER_DEMUXER (HNM, hnm);