Re: [FFmpeg-devel] [PATCH 2/2] lavfi/vf_zoompan: fix PTS logic.
On Mon, Dec 01, 2014 at 04:43:17PM +0100, Nicolas George wrote: > Fix non-monotonic output PTS when input PTS and duration > are set with compatible values. > > Signed-off-by: Nicolas George > --- > libavfilter/vf_zoompan.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) with these 2 patches and the zoompan example from the docs ./ffmpeg -f lavfi -i testsrc -vf "zoompan=z='min(zoom+0.0015,1.5)':d=700:x='if(gte(zoom,1.5),x,x+1/a)':y='if(gte(zoom,1.5),y,y+1)':s=640x360" -qscale 1 test.avi i get frame= 729 fps= 69 q=1.0 Lsize=2735kB time=00:00:29.16 bitrate= 768.5kbits/s dup=0 drop=19571 that is a pretty huge number of dropped frames is this intended ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavformat/mxfdec.c: support demuxing opatom audio without index
hi, Media Composer generates audio OPAtom mxf files that don't have index segments. All the uncompressed pcm audio essence data contained in a single KLV packet. This is my initial attempt to get demuxing working, I'm not too familiar with demuxing audio or generating packets. I'm sure I'm not setting pts and dts correctly. Using the mxf_read_packet_old function also works too but it reads the entire essence KLV packet in to memory and these mxf files can be gigs. I haven't seen any raw video data encoded the same way yet, so this patch only enables demuxing uncompressed pcm audio mxf files without indexs. I uploaded a sample mxf encoded to ftp://upload.ffmpeg.org/incoming opatom_missing_index.mxf I can also provide more samples if need. Mark Reid (1): libavformat/mxfdec.c: support demuxing opatom audio without index libavformat/mxfdec.c | 66 +--- 1 file changed, 63 insertions(+), 3 deletions(-) -- 2.0.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavformat/mxfdec.c: support demuxing opatom audio without index
--- libavformat/mxfdec.c | 66 +--- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 4715169..92c864f 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -152,6 +152,8 @@ typedef struct { int intra_only; uint64_t sample_count; int64_t original_duration; /* st->duration in SampleRate/EditRate units */ +int64_t essence_offset; +int64_t essence_length; } MXFTrack; typedef struct { @@ -2422,6 +2424,28 @@ static void mxf_handle_small_eubc(AVFormatContext *s) mxf->edit_units_per_packet = 1920; } +static int mxf_handle_opatom_missing_index(AVFormatContext *s) +{ +KLVPacket klv; +MXFTrack *track = NULL; + +/* TODO: support raw video without a index if they exist */ +if (s->nb_streams != 1 || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO || !is_pcm(s->streams[0]->codec->codec_id)) +return AVERROR_INVALIDDATA; + +if (klv_read_packet(&klv, s->pb) != 0) +return AVERROR_INVALIDDATA; + +if (!(IS_KLV_KEY(klv.key, mxf_essence_element_key) || IS_KLV_KEY(klv.key, mxf_avid_essence_element_key))) +return AVERROR_INVALIDDATA; + +track = s->streams[0]->priv_data; +track->essence_offset = avio_tell(s->pb); +track->essence_length = klv.length; + +return 0; +} + static void mxf_read_random_index_pack(AVFormatContext *s) { MXFContext *mxf = s->priv_data; @@ -2592,9 +2616,11 @@ static int mxf_read_header(AVFormatContext *s) av_log(mxf->fc, AV_LOG_INFO, "got %i index tables - only the first one (IndexSID %i) will be used\n", mxf->nb_index_tables, mxf->index_tables[0].index_sid); } else if (mxf->nb_index_tables == 0 && mxf->op == OPAtom) { -av_log(mxf->fc, AV_LOG_ERROR, "cannot demux OPAtom without an index\n"); -ret = AVERROR_INVALIDDATA; -goto fail; +if (mxf_handle_opatom_missing_index(s) != 0) { +av_log(mxf->fc, AV_LOG_ERROR, "cannot demux OPAtom without an index\n"); +ret = AVERROR_INVALIDDATA; +goto fail; +} } mxf_handle_small_eubc(s); @@ -2807,6 +2833,37 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt) return avio_feof(s->pb) ? AVERROR_EOF : ret; } +#define RAW_SAMPLES 1024 +static int mxf_read_raw_opatom_packet(AVFormatContext *s, AVPacket *pkt) +{ +AVStream *st = s->streams[0]; +MXFTrack *track = st->priv_data; +int64_t pos, packet_size, sample_size; +int ret; + +pos = avio_tell(s->pb) - track->essence_offset; +sample_size = (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3; +packet_size = RAW_SAMPLES * sample_size; + +if (pos >= track->essence_length) +return AVERROR_EOF; + +if(pos < 0 || pos % packet_size){ +/* align to nearest packet position */ +pos = FFMAX(0, pos - (pos % packet_size)); +if ((ret = avio_seek(s->pb, track->essence_offset + pos, SEEK_SET)) < 0) +return ret; +} + +ret = av_get_packet(s->pb, pkt, FFMIN(packet_size, track->essence_length - pos)); +pkt->pts = pkt->dts = pos / sample_size; +pkt->stream_index = 0; + +if (ret < 0) +return ret; +return 0; +} + static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) { MXFContext *mxf = s->priv_data; @@ -2819,6 +2876,9 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) if (mxf->op != OPAtom) return mxf_read_packet_old(s, pkt); +if (mxf->nb_index_tables <= 0) +return mxf_read_raw_opatom_packet(s, pkt); + /* OPAtom - clip wrapped demuxing */ /* NOTE: mxf_read_header() makes sure nb_index_tables > 0 for OPAtom */ st = s->streams[0]; -- 2.0.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/tcp: apply minor fixes to documentation
On Wed, Nov 12, 2014 at 04:14:11PM +0100, Stefano Sabatini wrote: > In particular, add an Examples section and correct the unit of the > listen_timeout option value, from microseconds to milliseconds. > --- > doc/protocols.texi | 21 +++-- > libavformat/tcp.c | 6 +++--- > 2 files changed, 18 insertions(+), 9 deletions(-) probably ok indepenant of this, I suggest that all timeout values should be changed to proper SI units currently we have a mix of micro and milli seconds as shown by git grep '"timeout"' if the user writes -timeout 123ms that should result in 123 milli seconds [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd/avdevice: remove av_ prefix from private function
On Sun, Dec 21, 2014 at 09:03:49PM +0100, Lukasz Marek wrote: > Signed-off-by: Lukasz Marek > --- > libavdevice/avdevice.c | 20 ++-- > 1 file changed, 10 insertions(+), 10 deletions(-) LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Its not that you shouldnt use gotos but rather that you should write readable code and code with gotos often but not always is less readable signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] tools/probetest: support testing a single specified input format
This reduces the time the test takes significantly when only one formats needs to be tested Signed-off-by: Michael Niedermayer --- tools/probetest.c | 37 +++-- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/tools/probetest.c b/tools/probetest.c index 78327de..74045eb 100644 --- a/tools/probetest.c +++ b/tools/probetest.c @@ -29,6 +29,7 @@ static int score_array[MAX_FORMATS]; static int64_t time_array[MAX_FORMATS]; static int failures = 0; +static const char *single_format; #ifndef AV_READ_TIME #define AV_READ_TIME(x) 0 @@ -42,7 +43,9 @@ static void probe(AVProbeData *pd, int type, int p, int size) while ((fmt = av_iformat_next(fmt))) { if (fmt->flags & AVFMT_NOFILE) continue; -if (fmt->read_probe) { +if (fmt->read_probe && +(!single_format || !strcmp(single_format, fmt->name)) +) { int score; int64_t start = AV_READ_TIME(); score = fmt->read_probe(pd); @@ -75,6 +78,17 @@ static void print_times(void) } } +static int read_int(char *arg) { +int ret; + +if (!arg || !*arg) +return -1; +ret = strtol(arg, &arg, 0); +if (*arg) +return -1; +return ret; +} + int main(int argc, char **argv) { unsigned int p, i, type, size, retry; @@ -83,11 +97,22 @@ int main(int argc, char **argv) PutBitContext pb; int retry_count= 4097; int max_size = 65537; - -if(argc >= 2) -retry_count = atoi(argv[1]); -if(argc >= 3) -max_size = atoi(argv[2]); +int j; + +for (j = i = 1; i0 && j == 1) { +retry_count = read_int(argv[i]); +j++; +} else if (read_int(argv[i])>0 && j == 2) { +max_size = read_int(argv[i]); +j++; +} else { +fprintf(stderr, "probetest [-f ] [ []]\n"); +return 1; +} +} if (max_size > 10U/8) { fprintf(stderr, "max_size out of bounds\n"); -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] tools/probetest: support testing a single specified input format
On Sun, Dec 21, 2014 at 10:36:10PM +0100, Reimar Döffinger wrote: > On 21.12.2014, at 21:09, Michael Niedermayer wrote: > > +int j; > > + > > +for (j = i = 1; i > +if (av_isdigit(argv[i][0])) { > > +if (j++ == 1) { > > +retry_count = atoi(argv[i]); > > +} else > > +max_size = atoi(argv[i]); > > +} else { > > +single_format = argv[i]; > > +} > > +} > > I'm not sure it is worth spending much effort on, but it is messy. > For example it will silently accept multiple non-integers and overwrite > single_format. > Also strtol would be nicer than atoi which does no checking (related insofar > as it would be an alternative to isdigit). > But maybe it would be best to simply check av_isdigit(argv[1][0]) and based > on that go into the one or the other path, no loops or anything and allowing > any arbitrary order... not so hacky solution posted [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides 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] lavd/v4l2: implement list device callback
On 21.12.2014 22:43, Lukasz Marek wrote: Signed-off-by: Lukasz Marek --- libavdevice/v4l2.c | 58 ++ 1 file changed, 58 insertions(+) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 2969980..9d4d7ae 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -1006,6 +1006,63 @@ static int v4l2_read_close(AVFormatContext *ctx) return 0; } +static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_list) +{ +struct video_data *s = ctx->priv_data; +AVDeviceInfo *device = NULL; +struct v4l2_capability cap; +int i, ret = 0; + +if (!device_list) +return AVERROR(EINVAL); + +for (i = 0; i <= 31; i++) { +snprintf(ctx->filename, sizeof(ctx->filename), "/dev/video%d", i); I wasn't sure this is correct. I changed this loop to opendir/readdir - similar way v4l-utils does. >From e2efb8e8b803b461d5c27b22435318e38639a2c8 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Sun, 21 Dec 2014 22:37:18 +0100 Subject: [PATCH] lavd/v4l2: implement list device callback Signed-off-by: Lukasz Marek --- libavdevice/v4l2.c | 77 ++ 1 file changed, 77 insertions(+) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 2969980..8337cf5 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -31,6 +31,7 @@ */ #include "v4l2-common.h" +#include #if CONFIG_LIBV4L2 #include @@ -1006,6 +1007,81 @@ static int v4l2_read_close(AVFormatContext *ctx) return 0; } +static int v4l2_is_v4l_dev(const char *name) +{ +return !strncmp(name, "video", 5) || + !strncmp(name, "radio", 5) || + !strncmp(name, "vbi", 3) || + !strncmp(name, "v4l-subdev", 10); +} + +static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_list) +{ +struct video_data *s = ctx->priv_data; +DIR *dir; +struct dirent *entry; +AVDeviceInfo *device = NULL; +struct v4l2_capability cap; +int ret = 0; + +if (!device_list) +return AVERROR(EINVAL); + +dir = opendir("/dev"); +if (!dir) { +ret = AVERROR(errno); +av_log(ctx, AV_LOG_ERROR, "Couldn't open the directory: %s\n", av_err2str(ret)); +return ret; +} +while ((entry = readdir(dir))) { +if (!v4l2_is_v4l_dev(entry->d_name)) +continue; + +snprintf(ctx->filename, sizeof(ctx->filename), "/dev/%s", entry->d_name); +if ((s->fd = device_open(ctx)) < 0) +continue; + +if (v4l2_ioctl(s->fd, VIDIOC_QUERYCAP, &cap) < 0) { +ret = AVERROR(errno); +av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n", av_err2str(ret)); +goto fail; +} + +device = av_mallocz(sizeof(AVDeviceInfo)); +if (!device) { +ret = AVERROR(ENOMEM); +goto fail; +} +device->device_name = av_strdup(ctx->filename); +device->device_description = av_strdup(cap.card); +if (!device->device_name || !device->device_description) { +ret = AVERROR(ENOMEM); +goto fail; +} + +if ((ret = av_dynarray_add_nofree(&device_list->devices, + &device_list->nb_devices, device)) < 0) +goto fail; + +v4l2_close(s->fd); +s->fd = -1; +continue; + + fail: +if (device) { +av_freep(&device->device_name); +av_freep(&device->device_description); +av_freep(&device); +} +if (s->fd >= 0) +v4l2_close(s->fd); +s->fd = -1; +break; +} +closedir(dir); +return ret; +} + #define OFFSET(x) offsetof(struct video_data, x) #define DEC AV_OPT_FLAG_DECODING_PARAM @@ -1050,6 +1126,7 @@ AVInputFormat ff_v4l2_demuxer = { .read_header= v4l2_read_header, .read_packet= v4l2_read_packet, .read_close = v4l2_read_close, +.get_device_list = v4l2_get_device_list, .flags = AVFMT_NOFILE, .priv_class = &v4l2_class, }; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec.h: document needed buffer size for av_get_codec_tag_string()
On 21.12.2014, at 00:10, Nicolas George wrote: > Le primidi 1er nivôse, an CCXXIII, Thomas Volkert a écrit : >> If the code is changed, the documentation should be changed as well. > > That will not update applications written with the documentation for the old > version but built with the new version. Or applications using shared > libraries. > > Documentation must tell how an API should be used, not how it works. Either way, in order to allow even better source compatibility, a define would be preferable over purely documentation. Binary compatibility we can handle via a major bump in the worst case, but if everyone has to manually change their code manually it gets messy. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] cmdutils: use av_match_name to filter devices
Device name may be coma-separated list. Use dedicated funtion to compare. Signed-off-by: Lukasz Marek --- cmdutils.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index fb1883a..4a4f311 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -2173,7 +2173,7 @@ int show_sources(void *optctx, const char *opt, const char *arg) if (fmt) { if (!strcmp(fmt->name, "lavfi")) continue; //it's pointless to probe lavfi -if (dev && strcmp(fmt->name, dev)) +if (dev && !av_match_name(dev, fmt->name)) continue; print_device_sources(fmt, opts); } @@ -2181,7 +2181,7 @@ int show_sources(void *optctx, const char *opt, const char *arg) do { fmt = av_input_video_device_next(fmt); if (fmt) { -if (dev && strcmp(fmt->name, dev)) +if (dev && !av_match_name(dev, fmt->name)) continue; print_device_sources(fmt, opts); } @@ -2209,7 +2209,7 @@ int show_sinks(void *optctx, const char *opt, const char *arg) do { fmt = av_output_audio_device_next(fmt); if (fmt) { -if (dev && strcmp(fmt->name, dev)) +if (dev && !av_match_name(dev, fmt->name)) continue; print_device_sinks(fmt, opts); } @@ -2217,7 +2217,7 @@ int show_sinks(void *optctx, const char *opt, const char *arg) do { fmt = av_output_video_device_next(fmt); if (fmt) { -if (dev && strcmp(fmt->name, dev)) +if (dev && !av_match_name(dev, fmt->name)) continue; print_device_sinks(fmt, opts); } -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavd/v4l2: implement list device callback
Signed-off-by: Lukasz Marek --- libavdevice/v4l2.c | 58 ++ 1 file changed, 58 insertions(+) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 2969980..9d4d7ae 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -1006,6 +1006,63 @@ static int v4l2_read_close(AVFormatContext *ctx) return 0; } +static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_list) +{ +struct video_data *s = ctx->priv_data; +AVDeviceInfo *device = NULL; +struct v4l2_capability cap; +int i, ret = 0; + +if (!device_list) +return AVERROR(EINVAL); + +for (i = 0; i <= 31; i++) { +snprintf(ctx->filename, sizeof(ctx->filename), "/dev/video%d", i); + +if (avio_check(ctx->filename, AVIO_FLAG_READ) != AVIO_FLAG_READ || +(s->fd = device_open(ctx)) < 0) +continue; + +if (v4l2_ioctl(s->fd, VIDIOC_QUERYCAP, &cap) < 0) { +ret = AVERROR(errno); +av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n", av_err2str(ret)); +goto fail_device; +} + +device = av_mallocz(sizeof(AVDeviceInfo)); +if (!device) { +ret = AVERROR(ENOMEM); +goto fail_device; +} +device->device_name = av_strdup(ctx->filename); +device->device_description = av_strdup(cap.card); +if (!device->device_name || !device->device_description) { +ret = AVERROR(ENOMEM); +goto fail_device; +} + +if ((ret = av_dynarray_add_nofree(&device_list->devices, + &device_list->nb_devices, device)) < 0) +goto fail_device; + +v4l2_close(s->fd); +s->fd = -1; +continue; + + fail_device: +if (device) { +av_freep(&device->device_name); +av_freep(&device->device_description); +av_freep(&device); +} +if (s->fd >= 0) +v4l2_close(s->fd); +s->fd = -1; +return ret; +} +return 0; +} + #define OFFSET(x) offsetof(struct video_data, x) #define DEC AV_OPT_FLAG_DECODING_PARAM @@ -1050,6 +1107,7 @@ AVInputFormat ff_v4l2_demuxer = { .read_header= v4l2_read_header, .read_packet= v4l2_read_packet, .read_close = v4l2_read_close, +.get_device_list = v4l2_get_device_list, .flags = AVFMT_NOFILE, .priv_class = &v4l2_class, }; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] tools/probetest: support testing a single specified input format
On 21.12.2014, at 21:09, Michael Niedermayer wrote: > +int j; > + > +for (j = i = 1; i +if (av_isdigit(argv[i][0])) { > +if (j++ == 1) { > +retry_count = atoi(argv[i]); > +} else > +max_size = atoi(argv[i]); > +} else { > +single_format = argv[i]; > +} > +} I'm not sure it is worth spending much effort on, but it is messy. For example it will silently accept multiple non-integers and overwrite single_format. Also strtol would be nicer than atoi which does no checking (related insofar as it would be an alternative to isdigit). But maybe it would be best to simply check av_isdigit(argv[1][0]) and based on that go into the one or the other path, no loops or anything and allowing any arbitrary order... ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavfi: Port fspp to FFmpeg
On Fri, 19 Dec 2014, Clément Bsch wrote: > On Fri, Dec 19, 2014 at 04:40:21PM +0100, Michael Niedermayer wrote: > [...] > > then one filter that i remember was requested (longer ago) is > > nnedi3 but that would need to have its asm removed or ported which > > is not trivial i suspect > > > > The problem with nnedi3 is that it requires 13MB of learned data. http://akuvian.org/src/x264/nnedi.git.tar.bz2 is my version of nnedi3 (upscaling mode only, not the larger deinterlacing filters) with yasm. Also, the learned data relevant to upscaling mode is 800k (source) or 200k (compiled). --Loren Merritt___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] tools/probetest: support testing a single specified input format
This reduces the time the test takes significantly when only one formats needs to be tested Signed-off-by: Michael Niedermayer --- tools/probetest.c | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/probetest.c b/tools/probetest.c index 78327de..cbd9f89 100644 --- a/tools/probetest.c +++ b/tools/probetest.c @@ -22,6 +22,7 @@ #include "libavformat/avformat.h" #include "libavcodec/put_bits.h" +#include "libavutil/avstring.h" #include "libavutil/lfg.h" #include "libavutil/timer.h" @@ -29,6 +30,7 @@ static int score_array[MAX_FORMATS]; static int64_t time_array[MAX_FORMATS]; static int failures = 0; +static const char *single_format; #ifndef AV_READ_TIME #define AV_READ_TIME(x) 0 @@ -42,7 +44,9 @@ static void probe(AVProbeData *pd, int type, int p, int size) while ((fmt = av_iformat_next(fmt))) { if (fmt->flags & AVFMT_NOFILE) continue; -if (fmt->read_probe) { +if (fmt->read_probe && +(!single_format || !strcmp(single_format, fmt->name)) +) { int score; int64_t start = AV_READ_TIME(); score = fmt->read_probe(pd); @@ -83,11 +87,18 @@ int main(int argc, char **argv) PutBitContext pb; int retry_count= 4097; int max_size = 65537; - -if(argc >= 2) -retry_count = atoi(argv[1]); -if(argc >= 3) -max_size = atoi(argv[2]); +int j; + +for (j = i = 1; i 10U/8) { fprintf(stderr, "max_size out of bounds\n"); -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] cmdutils: use helper functions for listing sinks/sources
List device callback must be able to return valid list without opening device. This callback should return input values for open function, not vice-versa. Read header funtion is very likey to fail without proper configuration provided. Signed-off-by: Lukasz Marek --- cmdutils.c | 27 ++- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index 2b4ab9e..fb1883a 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -2076,9 +2076,7 @@ void *grow_array(void *array, int elem_size, int *size, int new_size) static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts) { int ret, i; -AVFormatContext *dev = NULL; AVDeviceInfoList *device_list = NULL; -AVDictionary *tmp_opts = NULL; if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category)) return AVERROR(EINVAL); @@ -2090,15 +2088,7 @@ static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts) goto fail; } -/* TODO: avformat_open_input calls read_header callback which is not necessary. - Function like avformat_alloc_output_context2 for input could be helpful here. */ -av_dict_copy(&tmp_opts, opts, 0); -if ((ret = avformat_open_input(&dev, NULL, fmt, &tmp_opts)) < 0) { -printf("Cannot open device: %s.\n", fmt->name); -goto fail; -} - -if ((ret = avdevice_list_devices(dev, &device_list)) < 0) { +if ((ret = avdevice_list_input_sources(fmt, NULL, opts, &device_list)) < 0) { printf("Cannot list sources.\n"); goto fail; } @@ -2109,18 +2099,14 @@ static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts) } fail: -av_dict_free(&tmp_opts); avdevice_free_list_devices(&device_list); -avformat_close_input(&dev); return ret; } static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts) { int ret, i; -AVFormatContext *dev = NULL; AVDeviceInfoList *device_list = NULL; -AVDictionary *tmp_opts = NULL; if (!fmt || !fmt->priv_class || !AV_IS_OUTPUT_DEVICE(fmt->priv_class->category)) return AVERROR(EINVAL); @@ -2132,14 +2118,7 @@ static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts) goto fail; } -if ((ret = avformat_alloc_output_context2(&dev, fmt, NULL, NULL)) < 0) { -printf("Cannot open device: %s.\n", fmt->name); -goto fail; -} -av_dict_copy(&tmp_opts, opts, 0); -av_opt_set_dict2(dev, &tmp_opts, AV_OPT_SEARCH_CHILDREN); - -if ((ret = avdevice_list_devices(dev, &device_list)) < 0) { +if ((ret = avdevice_list_output_sinks(fmt, NULL, opts, &device_list)) < 0) { printf("Cannot list sinks.\n"); goto fail; } @@ -2150,9 +2129,7 @@ static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts) } fail: -av_dict_free(&tmp_opts); avdevice_free_list_devices(&device_list); -avformat_free_context(dev); return ret; } -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavd/avdevice: remove av_ prefix from private function
Signed-off-by: Lukasz Marek --- libavdevice/avdevice.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c index d59e99a..72e573d 100644 --- a/libavdevice/avdevice.c +++ b/libavdevice/avdevice.c @@ -77,8 +77,8 @@ const char * avdevice_license(void) return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1; } -static void *av_device_next(void *prev, int output, -AVClassCategory c1, AVClassCategory c2) +static void *device_next(void *prev, int output, + AVClassCategory c1, AVClassCategory c2) { const AVClass *pc; AVClassCategory category = AV_CLASS_CATEGORY_NA; @@ -101,26 +101,26 @@ static void *av_device_next(void *prev, int output, AVInputFormat *av_input_audio_device_next(AVInputFormat *d) { -return av_device_next(d, 0, AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT, - AV_CLASS_CATEGORY_DEVICE_INPUT); +return device_next(d, 0, AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT, + AV_CLASS_CATEGORY_DEVICE_INPUT); } AVInputFormat *av_input_video_device_next(AVInputFormat *d) { -return av_device_next(d, 0, AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT, - AV_CLASS_CATEGORY_DEVICE_INPUT); +return device_next(d, 0, AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT, + AV_CLASS_CATEGORY_DEVICE_INPUT); } AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d) { -return av_device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT, - AV_CLASS_CATEGORY_DEVICE_OUTPUT); +return device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT, + AV_CLASS_CATEGORY_DEVICE_OUTPUT); } AVOutputFormat *av_output_video_device_next(AVOutputFormat *d) { -return av_device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT, - AV_CLASS_CATEGORY_DEVICE_OUTPUT); +return device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT, + AV_CLASS_CATEGORY_DEVICE_OUTPUT); } int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToDevMessageType type, -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavd/avdevice: introduce helper functions for sink/sources listing
TODO: bump minor, update doc/APIchanges Signed-off-by: Lukasz Marek --- libavdevice/Makefile | 1 + libavdevice/avdevice.c | 39 + libavdevice/avdevice.h | 22 +++ libavdevice/internal.h | 27 +++ libavdevice/utils.c| 59 ++ 5 files changed, 148 insertions(+) create mode 100644 libavdevice/internal.h create mode 100644 libavdevice/utils.c diff --git a/libavdevice/Makefile b/libavdevice/Makefile index 6b8ab2e..872504b 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -7,6 +7,7 @@ HEADERS = avdevice.h \ OBJS= alldevices.o \ avdevice.o\ + utils.o \ # input/output devices OBJS-$(CONFIG_ALSA_INDEV)+= alsa-audio-common.o \ diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c index 72e573d..72e1b67 100644 --- a/libavdevice/avdevice.c +++ b/libavdevice/avdevice.c @@ -21,6 +21,7 @@ #include "libavutil/pixfmt.h" #include "libavcodec/avcodec.h" #include "avdevice.h" +#include "internal.h" #include "config.h" #include "libavutil/ffversion.h" @@ -208,6 +209,44 @@ int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list) return ret; } +static int list_devices_for_context(AVFormatContext *s, AVDictionary *options, +AVDeviceInfoList **device_list) +{ +AVDictionary *tmp = NULL; +int ret; + +av_dict_copy(&tmp, options, 0); +if ((ret = av_opt_set_dict2(s, &tmp, AV_OPT_SEARCH_CHILDREN)) < 0) +goto fail; +ret = avdevice_list_devices(s, device_list); + fail: +av_dict_free(&tmp); +avformat_free_context(s); +return ret; +} + +int avdevice_list_input_sources(AVInputFormat *device, const char *device_name, +AVDictionary *device_options, AVDeviceInfoList **device_list) +{ +AVFormatContext *s = NULL; +int ret; + +if ((ret = ff_alloc_input_device_context(&s, device, device_name)) < 0) +return ret; +return list_devices_for_context(s, device_options, device_list); +} + +int avdevice_list_output_sinks(AVOutputFormat *device, const char *device_name, + AVDictionary *device_options, AVDeviceInfoList **device_list) +{ +AVFormatContext *s = NULL; +int ret; + +if ((ret = avformat_alloc_output_context2(&s, device, device_name, NULL)) < 0) +return ret; +return list_devices_for_context(s, device_options, device_list); +} + void avdevice_free_list_devices(AVDeviceInfoList **device_list) { AVDeviceInfoList *list; diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h index a395228..2d675b0 100644 --- a/libavdevice/avdevice.h +++ b/libavdevice/avdevice.h @@ -484,4 +484,26 @@ int avdevice_list_devices(struct AVFormatContext *s, AVDeviceInfoList **device_l */ void avdevice_free_list_devices(AVDeviceInfoList **device_list); +/** + * List devices. + * + * Returns available device names and their parameters. + * These are convinient wrappers for avdevice_list_devices(). + * Device context is allocated and deallocated internally. + * + * @param device device format. May be NULL if device name is set. + * @param device_name device name. May be NULL if device format is set. + * @param device_options An AVDictionary filled with device-private options. May be NULL. + * The same options must be passed later to avformat_write_header() for output + * devices or avformat_open_input() for input devices, or at any other place + * that affects device-private options. + * @param[out] device_list list of autodetected devices + * @return count of autodetected devices, negative on error. + * @note device argument takes precedence over device_name when both are set. + */ +int avdevice_list_input_sources(struct AVInputFormat *device, const char *device_name, +AVDictionary *device_options, AVDeviceInfoList **device_list); +int avdevice_list_output_sinks(struct AVOutputFormat *device, const char *device_name, + AVDictionary *device_options, AVDeviceInfoList **device_list); + #endif /* AVDEVICE_AVDEVICE_H */ diff --git a/libavdevice/internal.h b/libavdevice/internal.h new file mode 100644 index 000..3cd1b06 --- /dev/null +++ b/libavdevice/internal.h @@ -0,0 +1,27 @@ +/* + * 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 i
[FFmpeg-devel] [PATCH] avfilter/vf_boxblur: generate supported pixfmt list instead of hardcoding
This adds support for several more >8bit planar formats Signed-off-by: Michael Niedermayer --- libavfilter/vf_boxblur.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/libavfilter/vf_boxblur.c b/libavfilter/vf_boxblur.c index d292780..89cf015 100644 --- a/libavfilter/vf_boxblur.c +++ b/libavfilter/vf_boxblur.c @@ -117,20 +117,18 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { -static const enum AVPixelFormat pix_fmts[] = { -AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P, -AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUVA420P, -AV_PIX_FMT_YUV440P, AV_PIX_FMT_GRAY8, -AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P, -AV_PIX_FMT_YUVJ440P, -AV_PIX_FMT_GBRP, -AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV420P10, -AV_PIX_FMT_YUVA420P10, -AV_PIX_FMT_GBRP10, -AV_PIX_FMT_NONE -}; - -ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); +AVFilterFormats *formats = NULL; +int fmt; + +for (fmt = 0; av_pix_fmt_desc_get(fmt); fmt++) { +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt); +if (!(desc->flags & (AV_PIX_FMT_FLAG_HWACCEL | AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_PAL)) && +(desc->flags & AV_PIX_FMT_FLAG_PLANAR || desc->nb_components == 1) && +!(desc->flags & AV_PIX_FMT_FLAG_BE) == !HAVE_BIGENDIAN) +ff_add_format(&formats, fmt); +} + +ff_set_common_formats(ctx, formats); return 0; } -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] configure: fix convoluted shlib code
Fixes Ticket 4199 Signed-off-by: Michael Niedermayer --- configure |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 87be058..e73d15c 100755 --- a/configure +++ b/configure @@ -2684,7 +2684,6 @@ docdir_default='${prefix}/share/doc/ffmpeg' incdir_default='${prefix}/include' libdir_default='${prefix}/lib' mandir_default='${prefix}/share/man' -shlibdir_default='${LIBDIR}' # toolchain ar_default="ar" @@ -4324,6 +4323,9 @@ echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFI check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic +set_default libdir +: ${shlibdir_default:="$libdir"} + set_default $PATHS_LIST set_default nm -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: fix convoluted shlib code
On Sun, Dec 21, 2014 at 03:54:33AM +0100, Michael Niedermayer wrote: > Fixes Ticket 4199 > > Signed-off-by: Michael Niedermayer > --- > configure |4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) forget this patch, this fails to set the default correctly on mingw32 ill send a better one [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No human being will ever know the Truth, for even if they happen to say it by chance, they would not even known they had done so. -- Xenophanes signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel