Re: [FFmpeg-devel] [PATCH]Do not set bitrate for DTS-HD Master and High Resolution

2015-03-19 Thread Carl Eugen Hoyos
Marcus Johnson  gmail.com> writes:

> That's even worse, is there any way we can fix it?

No, users would be unhappy if opening a file meant 
reading the whole file.
The following works fine here to get the actual 
duration of a dts-hd master stream and is twice as 
fast as decoding the whole file:
$ ffmpeg -i input -acodec copy -vn -f null -

Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Blackmagic Design Intensity Pro 4K - Decklink - Problem to select RGB color space

2015-03-19 Thread Carl Eugen Hoyos
Gonzalo Berdeal  gmail.com> writes:

> l have just bought the new Intensity Pro 4K and I 
> can not make it work (however, it works fine with 
> official desktop software).

You mean it does not work for 8bit yuv?
In this case, you have to fix this first.

> I think the problem might be on the need of 
> specifying the color space. With the official 
> software I have to select "Capture File Format" 
> from between:
> 
> AVI 8-bitYUV
> AVI 10-bit YUV
> AVI 10-bit RGB
> AVI Motion JPEG
> DPX 10-bit RGB

Please look at this commit:
http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=97a27065
and test if Motion JPEG and DPX work like this.
If yes, instead of adding new options "bm_jpeg" 
and "bm_dpx", please add a new input_format 
option similar to the v4l2 option and deprecate 
bm_v210 (or make it an empty option).

> I have found definitions of pix_fmt for RGB444.

This is completely unrelated.

Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] doc: add a few note for sponsorship candidates.

2015-03-19 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 doc/Makefile |   1 +
 doc/sponsored_internships_howto.texi | 148 +++
 2 files changed, 149 insertions(+)
 create mode 100644 doc/sponsored_internships_howto.texi


Not sure if the best place is there or the wiki, but at either place,
something like that should be useful. Comments?


diff --git a/doc/Makefile b/doc/Makefile
index 697142f..8b76feb 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -26,6 +26,7 @@ HTMLPAGES   = $(AVPROGS-yes:%=doc/%.html) 
$(AVPROGS-yes:%=doc/%-all.html) $(COMP
   doc/git-howto.html\
   doc/nut.html  \
   doc/platform.html \
+  doc/sponsored_internships_howto.html  \
 
 TXTPAGES= doc/fate.txt  \
 
diff --git a/doc/sponsored_internships_howto.texi 
b/doc/sponsored_internships_howto.texi
new file mode 100644
index 000..eada355
--- /dev/null
+++ b/doc/sponsored_internships_howto.texi
@@ -0,0 +1,148 @@
+\input texinfo @c -*- texinfo -*-
+@documentencoding UTF-8
+
+@settitle Sponsored Internships HOWTO
+@titlepage
+@center @titlefont{Sponsored Internships HOWTO}
+@end titlepage
+
+@top
+
+@chapter So yeah, I would like to work on FFmpeg for 
@url{https://code.google.com/soc/, Google Summer of Code} / 
@url{http://sophia.estec.esa.int/socis/, ESA Summer of Code in Space} / 
@url{https://www.gnome.org/outreachy/, Outreachy} / [insert here the latest 
trendy program]. What must I do?
+
+For the organization that sposors the program, there is probably a lot of
+paperwork. But frankly, we do not care; if we liked paperwork, we would be
+managers, not hackers.
+
+For us, there is not much to do: choose a proposed project that you want to
+do, select a qualification task for that project that is not already taken
+by someone else, announce you are about to start working, and then do so.
+
+If at any point you have any question, do not hesitate to ask them.
+Actually, yes, hesitate a few seconds, in case this question will make you
+look dump. So read on.
+
+@chapter What is a qualification task?
+
+A qualification task is a small part of the project, or a small peripheral
+project, that serves to evaluate the candidates before starting the actual
+internship.
+
+There are a few qualification tasks with each proposed project on the
+@url{https://trac.ffmpeg.org/wiki/SponsoringPrograms, FFmpeg wiki}, and
+there is also usually a table with the declared candidate and their
+qualification tasks.
+
+@chapter So, how do I make sure @emph{I} get the internship?
+
+Hopefully, you realize that each Libre Software project has only one or a
+few slots in any sponsored program; and even if we have several slots, we
+can not have several interns working on the same project, or possibly even
+with the same mentor.
+
+So basically, this is a competition.
+
+You have to be better than the other. Or at least to look more interesting
+to work with.
+
+@chapter And how do I do that?
+
+Start simple: how did you reach this page? If you arrived here by yourself,
+congratulations, you win the first point.
+
+You are not expected to know everything, especially not details about how
+FFmpeg works, but when the answser to a question is easily available with a
+web search, you are expected to find it. Potential mentors get tired of
+replying always the same elementary things to candidates.
+
+So the first commandment: first try to find answers by yourself.
+
+@chapter How do I contact you? And, in fact, who are you?
+
+The people who work on FFmpeg do so mostly on their free time or as a
+complement to their regular job in computing or consulting. To contact us,
+you can use the devel mailing list or personal mail, depending on the
+contents of the message. Use discretion. You can also try the IRC channel.
+
+Some sponsoring organizations have an internal message system. Use it only
+in last resort. It is usually vastly inferior to the mail user agents we
+enjoy to use, and the notifications may not even reach us, or be classified
+as spam.
+
+@chapter How do I get to work?
+
+First, download FFmpeg. Not a prebuilt binary. Not a source snapshot. A full
+Git clone tree. If you do not know what that means, then you have reading to
+do.
+
+Then, build FFmpeg, and try to run it from the build tree, without
+installing it.
+
+Note: neither downloading nor building require privileges. If you had to
+@command{su} or @command{sudo} for anything other than installing missing
+external libraries or tools, then you did something wrong and it will make
+your life harder later.
+
+Then, try to make a trivial change, like rewording an error message or
+changing the default value of an option. Test that it works as expected.
+
+At this point, you are ready do look in the code for the way of doing your

[FFmpeg-devel] Patch proposal : Remove some unused variable

2015-03-19 Thread Martin Vignali
I'm not sure about ffmpeg choice for compiler warning.
An old post on the mailing list, say : it depends !!

So i propose remove some unused variables, to remove some 'unused variable'
warning.
(Clang compiler Mac os 10.9)

Patch in attach.

Martin


0001-remove-unused-var-in-vfpp7.patch
Description: Binary data


0002-remove-unused-var-dv100qstep.patch
Description: Binary data


0003-remove-unused-var-dvquantareas.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] avcodec: add profile define for DTS Express

2015-03-19 Thread Hendrik Leppkes
---
 libavcodec/avcodec.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index cdc8aa1..48e212f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2851,6 +2851,7 @@ typedef struct AVCodecContext {
 #define FF_PROFILE_DTS_96_24   40
 #define FF_PROFILE_DTS_HD_HRA  50
 #define FF_PROFILE_DTS_HD_MA   60
+#define FF_PROFILE_DTS_EXPRESS 70
 
 #define FF_PROFILE_MPEG2_4220
 #define FF_PROFILE_MPEG2_HIGH   1
-- 
1.9.5.msysgit.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] avcodec: add libdcadec decoder

2015-03-19 Thread Hendrik Leppkes
---
 configure  |   4 +
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libdcadec.c | 196 +
 4 files changed, 202 insertions(+)
 create mode 100644 libavcodec/libdcadec.c

diff --git a/configure b/configure
index 1bf8f80..a449bc7 100755
--- a/configure
+++ b/configure
@@ -210,6 +210,7 @@ External library support:
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
+  --enable-libdcadec   enable DCA decoding via libdcadec [no]
   --enable-libfaac enable AAC encoding via libfaac [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
@@ -1353,6 +1354,7 @@ EXTERNAL_LIBRARY_LIST="
 libcdio
 libcelt
 libdc1394
+libdcadec
 libfaac
 libfdk_aac
 libflite
@@ -2359,6 +2361,7 @@ vc1_parser_select="mpegvideo startcode vc1_decoder"
 # external libraries
 libaacplus_encoder_deps="libaacplus"
 libcelt_decoder_deps="libcelt"
+libdcadec_decoder_deps="libdcadec"
 libfaac_encoder_deps="libfaac"
 libfaac_encoder_select="audio_frame_queue"
 libfdk_aac_decoder_deps="libfdk_aac"
@@ -4922,6 +4925,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
  { check_lib celt/celt.h 
celt_decoder_create_custom -lcelt0 ||
die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 enabled libcaca   && require_pkg_config caca caca.h caca_create_canvas
+enabled libdcadec && require libdcadec dca_context.h 
dcadec_context_create -ldcadec
 enabled libfaac   && require2 libfaac "stdint.h faac.h" 
faacEncGetVersion -lfaac
 enabled libfdk_aac&& require libfdk_aac fdk-aac/aacenc_lib.h 
aacEncOpen -lfdk-aac
 flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 4173f88..1a0c734 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -732,6 +732,7 @@ OBJS-$(CONFIG_ELBG_FILTER) += elbg.o
 # external codec libraries
 OBJS-$(CONFIG_LIBAACPLUS_ENCODER) += libaacplus.o
 OBJS-$(CONFIG_LIBCELT_DECODER)+= libcelt_dec.o
+OBJS-$(CONFIG_LIBDCADEC_DECODER)  += libdcadec.o
 OBJS-$(CONFIG_LIBFAAC_ENCODER)+= libfaac.o
 OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
 OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 5194e74..bbf70a6 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -512,6 +512,7 @@ void avcodec_register_all(void)
 
 /* external libraries */
 REGISTER_DECODER(LIBCELT,   libcelt);
+REGISTER_DECODER(LIBDCADEC, libdcadec)
 REGISTER_ENCODER(LIBFAAC,   libfaac);
 REGISTER_ENCDEC (LIBFDK_AAC,libfdk_aac);
 REGISTER_ENCDEC (LIBGSM,libgsm);
diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c
new file mode 100644
index 000..3c8781d
--- /dev/null
+++ b/libavcodec/libdcadec.c
@@ -0,0 +1,196 @@
+/*
+ * libdcadec decoder wrapper
+ * Copyright (C) 2015 Hendrik Leppkes
+ *
+ * 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 "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "dca.h"
+#include "internal.h"
+
+typedef struct DCADecContext {
+struct dcadec_context *ctx;
+uint8_t *buffer;
+int buffer_size;
+} DCADecContext;
+
+static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
+   int *got_frame_ptr, AVPacket *avpkt)
+{
+DCADecContext *s = avctx->priv_data;
+AVFrame *frame = data;
+int ret, i, k;
+int **samples, nsamples, channel_mask, sample_rate, bits_per_sample, 
profile;
+uint32_t mrk;
+uint8_t *input = avpkt->data;
+int input_

Re: [FFmpeg-devel] [PATCH 2/2] avcodec: add libdcadec decoder

2015-03-19 Thread Hendrik Leppkes
On Thu, Mar 19, 2015 at 11:45 PM, Hendrik Leppkes  wrote:
> ---
>  configure  |   4 +
>  libavcodec/Makefile|   1 +
>  libavcodec/allcodecs.c |   1 +
>  libavcodec/libdcadec.c | 196 
> +
>  4 files changed, 202 insertions(+)
>  create mode 100644 libavcodec/libdcadec.c
>


This was against an old Git of ffmpeg, my bad. New version going to come soon...
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec: add libdcadec decoder

2015-03-19 Thread Hendrik Leppkes
---
 configure  |   4 +
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libdcadec.c | 197 +
 4 files changed, 203 insertions(+)
 create mode 100644 libavcodec/libdcadec.c

diff --git a/configure b/configure
index 1bf8f80..a449bc7 100755
--- a/configure
+++ b/configure
@@ -210,6 +210,7 @@ External library support:
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
+  --enable-libdcadec   enable DCA decoding via libdcadec [no]
   --enable-libfaac enable AAC encoding via libfaac [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
@@ -1353,6 +1354,7 @@ EXTERNAL_LIBRARY_LIST="
 libcdio
 libcelt
 libdc1394
+libdcadec
 libfaac
 libfdk_aac
 libflite
@@ -2359,6 +2361,7 @@ vc1_parser_select="mpegvideo startcode vc1_decoder"
 # external libraries
 libaacplus_encoder_deps="libaacplus"
 libcelt_decoder_deps="libcelt"
+libdcadec_decoder_deps="libdcadec"
 libfaac_encoder_deps="libfaac"
 libfaac_encoder_select="audio_frame_queue"
 libfdk_aac_decoder_deps="libfdk_aac"
@@ -4922,6 +4925,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
  { check_lib celt/celt.h 
celt_decoder_create_custom -lcelt0 ||
die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 enabled libcaca   && require_pkg_config caca caca.h caca_create_canvas
+enabled libdcadec && require libdcadec dca_context.h 
dcadec_context_create -ldcadec
 enabled libfaac   && require2 libfaac "stdint.h faac.h" 
faacEncGetVersion -lfaac
 enabled libfdk_aac&& require libfdk_aac fdk-aac/aacenc_lib.h 
aacEncOpen -lfdk-aac
 flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 4173f88..1a0c734 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -732,6 +732,7 @@ OBJS-$(CONFIG_ELBG_FILTER) += elbg.o
 # external codec libraries
 OBJS-$(CONFIG_LIBAACPLUS_ENCODER) += libaacplus.o
 OBJS-$(CONFIG_LIBCELT_DECODER)+= libcelt_dec.o
+OBJS-$(CONFIG_LIBDCADEC_DECODER)  += libdcadec.o
 OBJS-$(CONFIG_LIBFAAC_ENCODER)+= libfaac.o
 OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
 OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 5194e74..bbf70a6 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -512,6 +512,7 @@ void avcodec_register_all(void)
 
 /* external libraries */
 REGISTER_DECODER(LIBCELT,   libcelt);
+REGISTER_DECODER(LIBDCADEC, libdcadec)
 REGISTER_ENCODER(LIBFAAC,   libfaac);
 REGISTER_ENCDEC (LIBFDK_AAC,libfdk_aac);
 REGISTER_ENCDEC (LIBGSM,libgsm);
diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c
new file mode 100644
index 000..d060db5
--- /dev/null
+++ b/libavcodec/libdcadec.c
@@ -0,0 +1,197 @@
+/*
+ * libdcadec decoder wrapper
+ * Copyright (C) 2015 Hendrik Leppkes
+ *
+ * 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 "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "dca.h"
+#include "dca_syncwords.h"
+#include "internal.h"
+
+typedef struct DCADecContext {
+struct dcadec_context *ctx;
+uint8_t *buffer;
+int buffer_size;
+} DCADecContext;
+
+static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
+   int *got_frame_ptr, AVPacket *avpkt)
+{
+DCADecContext *s = avctx->priv_data;
+AVFrame *frame = data;
+int ret, i, k;
+int **samples, nsamples, channel_mask, sample_rate, bits_per_sample, 
profile;
+uint32_t mrk;
+uint8_t *input = 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec: add profile define for DTS Express

2015-03-19 Thread Michael Niedermayer
On Thu, Mar 19, 2015 at 11:45:39PM +0100, Hendrik Leppkes wrote:
> ---
>  libavcodec/avcodec.h | 1 +
>  1 file changed, 1 insertion(+)

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec: add libdcadec decoder

2015-03-19 Thread Michael Niedermayer
On Thu, Mar 19, 2015 at 11:56:22PM +0100, Hendrik Leppkes wrote:
> ---
>  configure  |   4 +
>  libavcodec/Makefile|   1 +
>  libavcodec/allcodecs.c |   1 +
>  libavcodec/libdcadec.c | 197 
> +
>  4 files changed, 203 insertions(+)
>  create mode 100644 libavcodec/libdcadec.c

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] doc: add a few note for sponsorship candidates.

2015-03-19 Thread Carl Eugen Hoyos
Nicolas George  nsup.org> writes:

> +At this point, you are ready do look

to look

> +Your qualification task is considered complete 
> +when the corresponding changes have been included 
> +in the official source repository.

Maybe "most qualification tasks" or "a typical 
qualification task": An alternative could be a 
poc for the actual project that is not supposed 
to be committed (but shows the the project is 
possible and possible for the student).

> +For that, the patch (or several patches) must be 
> +submitted to the devel mailing-list for review, 
> +not only by your mentor but by any developer
> +interested in that area of the code. For 
> +first-time proposals, it will probably take 
> +several round-trips of reworking the patch and 
> +re-sending it, so start proposing something early 
> +and try to do frequent updates.

... it will always take several round-trips...

I like it very much, thank you, Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] doc: add a few note for sponsorship candidates.

2015-03-19 Thread Ronald S. Bultje
Hi,

On Thu, Mar 19, 2015 at 4:53 PM, Nicolas George  wrote:

> +If at any point you have any question, do not hesitate to ask them.
> +Actually, yes, hesitate a few seconds, in case this question will make you
> +look dump. So read on.
>

s/dump/dumb/.

Also, I'm not sure that's a good attitude, we surely want students to be
able to look up google'able stuff themselves, but asking questions to their
mentor should be encouraged (and if the mentor thinks it's goole'able, he
should feel comfortable saying so).


> +At this point, you are ready do look in the code for the way of doing your
> +actual qualification task.
>

s/do/to/.

Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec: Fix libdcadec include dir

2015-03-19 Thread Kacper Michajłow
---
 configure  | 2 +-
 libavcodec/libdcadec.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index a449bc7..1ef83e3 100755
--- a/configure
+++ b/configure
@@ -4925,7 +4925,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
  { check_lib celt/celt.h 
celt_decoder_create_custom -lcelt0 ||
die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 enabled libcaca   && require_pkg_config caca caca.h caca_create_canvas
-enabled libdcadec && require libdcadec dca_context.h 
dcadec_context_create -ldcadec
+enabled libdcadec && require libdcadec libdcadec/dca_context.h 
dcadec_context_create -ldcadec
 enabled libfaac   && require2 libfaac "stdint.h faac.h" 
faacEncGetVersion -lfaac
 enabled libfdk_aac&& require libfdk_aac fdk-aac/aacenc_lib.h 
aacEncOpen -lfdk-aac
 flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c
index d060db5..a28b983 100644
--- a/libavcodec/libdcadec.c
+++ b/libavcodec/libdcadec.c
@@ -19,7 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include 
+#include 
 
 #include "libavutil/avassert.h"
 #include "libavutil/channel_layout.h"
-- 
2.3.1.167.g7f4ba4b

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec: Fix libdcadec include dir

2015-03-19 Thread Michael Niedermayer
On Fri, Mar 20, 2015 at 01:58:25AM +0100, Kacper Michajłow wrote:
> ---
>  configure  | 2 +-
>  libavcodec/libdcadec.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

applied

i needed this though, to make it work
--- a/Makefile
+++ b/Makefile
@@ -121,6 +121,6 @@ clean:

 install: $(OUT_LIB) $(OUT_DEC)
mkdir -p $(DESTDIR)/lib $(DESTDIR)/include/libdcadec $(DESTDIR)/bin
-   install -m 644 -s $(OUT_LIB) $(DESTDIR)/lib
+   install -m 644 $(OUT_LIB) $(DESTDIR)/lib
install -m 644 $(INC_LIB) $(DESTDIR)/include/libdcadec
install -s $(OUT_DEC) $(DESTDIR)/bin

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] GSoC project proposal + qualification task

2015-03-19 Thread Mariusz Szczepańczyk

Hello,

my name is Mariusz Szczepańczyk and I am currently finishing my 
bachelor's degree in Computer Science at the University of Warsaw in 
Poland. I have written few patches for other open source projects, like 
gif reading plugin for OpenImageIO, however I'm new to FFmpeg.


I'd like to work on the "Browsing content on the server" task as 
described on wiki extended by samba and possibly local zip archives if 
it gets a good reception. And maybe having rename and delete methods 
also could be nice. I reached out to Lukasz Marek, who is listed as 
backup mentor and he pointed me to his last year's patches that add 
directory listing api and implement some of the protocols. In a couple 
of minutes I'll send these patches rebased against current master plus 
my take on samba protocol.


Any comments and ideas are appreciated.

Thanks,
Mariusz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/7] [GSoC] lavf: add directory listing API

2015-03-19 Thread Mariusz Szczepańczyk
From: Lukasz Marek 

API allows protocol implementations to provide API that
allows to list directory content.
API is similar to POSIX opendir/readdir/closedir.

Signed-off-by: Lukasz Marek 
---
 libavformat/avio.c | 56 ++
 libavformat/avio.h | 72 +-
 libavformat/url.h  |  3 +++
 3 files changed, 130 insertions(+), 1 deletion(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 4896782..68c7114 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -23,6 +23,7 @@
 #include "libavutil/dict.h"
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
+#include "libavutil/avassert.h"
 #include "os_support.h"
 #include "avformat.h"
 #if CONFIG_NETWORK
@@ -418,6 +419,61 @@ int avio_check(const char *url, int flags)
 return ret;
 }
 
+int avio_open_dir(void **s, const char *url, AVDictionary **options)
+{
+URLContext *h = NULL;
+int ret;
+av_assert0(s);
+if ((ret = ffurl_alloc(&h, url, AVIO_FLAG_READ, NULL)) < 0)
+goto fail;
+
+if (h->prot->url_open_dir && h->prot->url_read_dir && 
h->prot->url_close_dir) {
+if (options && h->prot->priv_data_class &&
+(ret = av_opt_set_dict(h->priv_data, options)) < 0)
+goto fail;
+ret = h->prot->url_open_dir(h);
+}
+else
+ret = AVERROR(ENOSYS);
+if (ret < 0)
+goto fail;
+*s = h;
+return 0;
+
+  fail:
+*s = NULL;
+ffurl_close(h);
+return ret;
+}
+
+int avio_read_dir(void *s, AVIODirEntry **next)
+{
+URLContext *h = s;
+int ret;
+if ((ret = h->prot->url_read_dir(h, next)) < 0)
+avio_free_directory_entry(next);
+return ret;
+}
+
+int avio_close_dir(void **s)
+{
+URLContext *h;
+av_assert0(s);
+h = *s;
+h->prot->url_close_dir(h);
+ffurl_close(h);
+*s = NULL;
+return 0;
+}
+
+void avio_free_directory_entry(AVIODirEntry **entry)
+{
+if (!entry || !*entry)
+return;
+av_free((*entry)->name);
+av_freep(entry);
+}
+
 int64_t ffurl_size(URLContext *h)
 {
 int64_t pos, size;
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 8fc7e27..a6fdef1 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -34,7 +34,6 @@
 
 #include "libavformat/version.h"
 
-
 #define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
 
 /**
@@ -54,6 +53,41 @@ typedef struct AVIOInterruptCB {
 } AVIOInterruptCB;
 
 /**
+ * Directory entry types.
+ */
+enum AVIODirEntryType {
+AVIO_ENTRY_UNKNOWN,
+AVIO_ENTRY_BLOCK_DEVICE,
+AVIO_ENTRY_CHARACTER_DEVICE,
+AVIO_ENTRY_DIRECTORY,
+AVIO_ENTRY_NAMED_PIPE,
+AVIO_ENTRY_SYMBOLIC_LINK,
+AVIO_ENTRY_SOCKET,
+AVIO_ENTRY_FILE
+};
+
+/**
+ * Describes single entry of the directory.
+ *
+ * Only name and type fileds are guaranteed be set.
+ * Rest of fields are protocol or/and platform dependent and might be unknown.
+ */
+typedef struct AVIODirEntry {
+char *name;   /**< Filename */
+int utf8; /**< Set to 1 when name is encoded 
with UTF-8, 0 otherwise.
+   Name can be encoded with UTF-8 
eventhough 0 is set.
+   Encoding might be unknown. */
+enum AVIODirEntryType type;   /**< Type of the entry */
+int64_t size; /**< File size in bytes */
+int64_t modification_timestamp;   /**< Time of last modification in 
microseconds since unix epoch */
+int64_t access_timestamp; /**< Time of last access in 
microseconds since unix epoch */
+int64_t status_change_timestamp;  /**< Time of last status change in 
microseconds since unix epoch */
+uint32_t user_id; /**< User ID of owner */
+uint32_t group_id;/**< Group ID of owner */
+uint32_t filemode;/**< Unix file mode */
+} AVIODirEntry;
+
+/**
  * Bytestream IO Context.
  * New fields can be added to the end with minor version bumps.
  * Removal, reordering and changes to existing fields require a major
@@ -181,6 +215,42 @@ const char *avio_find_protocol_name(const char *url);
 int avio_check(const char *url, int flags);
 
 /**
+ * Open directory for reading.
+ *
+ * @param s   directory read context. Pointer to a NULL pointer must be 
passed.
+ * @param url directory to be listed.
+ * @param options protocol options.
+ * @return >=0 on success or negative on error.
+ */
+int avio_open_dir(void **s, const char *url, AVDictionary **options);
+
+/**
+ * Get next directory entry.
+ *
+ * Returned entry must be freed with avio_free_directory_entry().
+ *
+ * @param s directory read context.
+ * @param[out] next next entry or NULL when no more entries.
+ * @return >=0 on success or negative on error.
+ */
+int avio_read_dir(void *s, AVIODirEntry **next);
+
+/**
+ * Close directory.
+ *
+

[FFmpeg-devel] [PATCH 2/7] lavf/libssh: implement directory listing callbacks

2015-03-19 Thread Mariusz Szczepańczyk
From: Lukasz Marek 

Signed-off-by: Lukasz Marek 
---
 libavformat/libssh.c | 111 ---
 1 file changed, 105 insertions(+), 6 deletions(-)

diff --git a/libavformat/libssh.c b/libavformat/libssh.c
index fac6114..5ff05b8 100644
--- a/libavformat/libssh.c
+++ b/libavformat/libssh.c
@@ -24,6 +24,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/opt.h"
 #include "libavutil/attributes.h"
+#include "libavformat/avio.h"
 #include "avformat.h"
 #include "internal.h"
 #include "url.h"
@@ -33,6 +34,7 @@ typedef struct {
 ssh_session session;
 sftp_session sftp;
 sftp_file file;
+sftp_dir dir;
 int64_t filesize;
 int rw_timeout;
 int trunc;
@@ -187,11 +189,11 @@ static av_cold int libssh_close(URLContext *h)
 return 0;
 }
 
-static av_cold int libssh_open(URLContext *h, const char *url, int flags)
+static av_cold int libssh_connect(URLContext *h, const char *url, char *path, 
size_t path_size)
 {
 LIBSSHContext *libssh = h->priv_data;
-char proto[10], path[MAX_URL_SIZE], hostname[1024], credencials[1024];
-int port, ret;
+char proto[10], hostname[1024], credencials[1024];
+int port = 22, ret;
 const char *user = NULL, *pass = NULL;
 char *end = NULL;
 
@@ -199,7 +201,7 @@ static av_cold int libssh_open(URLContext *h, const char 
*url, int flags)
  credencials, sizeof(credencials),
  hostname, sizeof(hostname),
  &port,
- path, sizeof(path),
+ path, path_size,
  url);
 
 // a port of 0 will use a port from ~/.ssh/config or the default value 22
@@ -207,15 +209,27 @@ static av_cold int libssh_open(URLContext *h, const char 
*url, int flags)
 port = 0;
 
 if ((ret = libssh_create_ssh_session(libssh, hostname, port)) < 0)
-goto fail;
+return ret;
 
 user = av_strtok(credencials, ":", &end);
 pass = av_strtok(end, ":", &end);
 
 if ((ret = libssh_authentication(libssh, user, pass)) < 0)
-goto fail;
+return ret;
 
 if ((ret = libssh_create_sftp_session(libssh)) < 0)
+return ret;
+
+return 0;
+}
+
+static av_cold int libssh_open(URLContext *h, const char *url, int flags)
+{
+int ret;
+LIBSSHContext *libssh = h->priv_data;
+char path[MAX_URL_SIZE];
+
+if ((ret = libssh_connect(h, url, path, sizeof(path))) < 0)
 goto fail;
 
 if ((ret = libssh_open_file(libssh, flags, path)) < 0)
@@ -293,6 +307,88 @@ static int libssh_write(URLContext *h, const unsigned char 
*buf, int size)
 return bytes_written;
 }
 
+static int libssh_open_dir(URLContext *h)
+{
+LIBSSHContext *libssh = h->priv_data;
+int ret;
+char path[MAX_URL_SIZE];
+
+if ((ret = libssh_connect(h, h->filename, path, sizeof(path))) < 0)
+goto fail;
+
+if (!(libssh->dir = sftp_opendir(libssh->sftp, path))) {
+av_log(libssh, AV_LOG_ERROR, "Error opening sftp dir: %s\n", 
ssh_get_error(libssh->session));
+ret = AVERROR(EIO);
+goto fail;
+}
+
+return 0;
+
+  fail:
+libssh_close(h);
+return ret;
+}
+
+static int libssh_read_dir(URLContext *h, AVIODirEntry **next)
+{
+LIBSSHContext *libssh = h->priv_data;
+sftp_attributes attr = NULL;
+AVIODirEntry *entry;
+
+*next = entry = av_mallocz(sizeof(AVIODirEntry));
+if (!entry)
+return AVERROR(ENOMEM);
+
+do {
+if (attr)
+sftp_attributes_free(attr);
+attr = sftp_readdir(libssh->sftp, libssh->dir);
+if (!attr) {
+av_freep(next);
+if (sftp_dir_eof(libssh->dir))
+return 0;
+return AVERROR(EIO);
+}
+} while (!strcmp(attr->name, ".") || !strcmp(attr->name, ".."));
+
+entry->name = av_strdup(attr->name);
+entry->group_id = attr->gid;
+entry->user_id = attr->uid;
+entry->size = attr->size;
+entry->access_timestamp = INT64_C(100) * attr->atime;
+entry->modification_timestamp = INT64_C(100) * attr->mtime;
+entry->filemode = attr->permissions & 0777;
+switch(attr->type) {
+case SSH_FILEXFER_TYPE_REGULAR:
+entry->type = AVIO_ENTRY_FILE;
+break;
+case SSH_FILEXFER_TYPE_DIRECTORY:
+entry->type = AVIO_ENTRY_DIRECTORY;
+break;
+case SSH_FILEXFER_TYPE_SYMLINK:
+entry->type = AVIO_ENTRY_SYMBOLIC_LINK;
+break;
+case SSH_FILEXFER_TYPE_SPECIAL:
+/* Special type includes: sockets, char devices, block devices and 
pipes.
+   It is probably better to return unknown type, to not confuse 
anybody. */
+case SSH_FILEXFER_TYPE_UNKNOWN:
+default:
+entry->type = AVIO_ENTRY_UNKNOWN;
+}
+sftp_attributes_free(attr);
+return 0;
+}
+
+static int libssh_close_dir(URLContext *h)
+{
+LIBSSHContext *libssh = h->priv_data;
+if (libssh->dir)
+sftp_closedir(libssh->dir);
+libssh->dir = NULL;
+libssh

[FFmpeg-devel] [PATCH 5/7] lavf/file: implement directory listing callbacks

2015-03-19 Thread Mariusz Szczepańczyk
From: Lukasz Marek 

Signed-off-by: Lukasz Marek 
---
 libavformat/file.c | 87 ++
 1 file changed, 87 insertions(+)

diff --git a/libavformat/file.c b/libavformat/file.c
index 6511328..238ae85 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -23,6 +23,7 @@
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include 
 #include 
 #if HAVE_IO_H
 #include 
@@ -51,6 +52,7 @@ typedef struct FileContext {
 int fd;
 int trunc;
 int blocksize;
+DIR *dir;
 } FileContext;
 
 static const AVOption file_options[] = {
@@ -189,6 +191,88 @@ static int file_close(URLContext *h)
 return close(c->fd);
 }
 
+static int file_open_dir(URLContext *h)
+{
+FileContext *c = h->priv_data;
+
+c->dir = opendir(h->filename);
+if (!c->dir)
+return AVERROR(errno);
+
+return 0;
+}
+
+static int file_read_dir(URLContext *h, AVIODirEntry **next)
+{
+FileContext *c = h->priv_data;
+struct dirent *dir;
+char *fullpath = NULL;
+
+*next = av_mallocz(sizeof(AVIODirEntry));
+if (!*next)
+return AVERROR(ENOMEM);
+do {
+errno = 0;
+dir = readdir(c->dir);
+if (!dir) {
+av_freep(next);
+return AVERROR(errno);
+}
+} while (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."));
+
+fullpath = av_append_path_component(h->filename, dir->d_name);
+if (fullpath) {
+struct stat st;
+if (!stat(fullpath, &st)) {
+(*next)->group_id = st.st_gid;
+(*next)->user_id = st.st_uid;
+(*next)->size = st.st_size;
+(*next)->filemode = st.st_mode & 0777;
+(*next)->modification_timestamp = INT64_C(100) * st.st_mtime;
+(*next)->access_timestamp =  INT64_C(100) * st.st_atime;
+(*next)->status_change_timestamp = INT64_C(100) * st.st_ctime;
+}
+av_free(fullpath);
+}
+
+(*next)->name = av_strdup(dir->d_name);
+switch (dir->d_type) {
+case DT_FIFO:
+(*next)->type = AVIO_ENTRY_NAMED_PIPE;
+break;
+case DT_CHR:
+(*next)->type = AVIO_ENTRY_CHARACTER_DEVICE;
+break;
+case DT_DIR:
+(*next)->type = AVIO_ENTRY_DIRECTORY;
+break;
+case DT_BLK:
+(*next)->type = AVIO_ENTRY_BLOCK_DEVICE;
+break;
+case DT_REG:
+(*next)->type = AVIO_ENTRY_FILE;
+break;
+case DT_LNK:
+(*next)->type = AVIO_ENTRY_SYMBOLIC_LINK;
+break;
+case DT_SOCK:
+(*next)->type = AVIO_ENTRY_SOCKET;
+break;
+case DT_UNKNOWN:
+default:
+(*next)->type = AVIO_ENTRY_UNKNOWN;
+break;
+}
+return 0;
+}
+
+static int file_close_dir(URLContext *h)
+{
+FileContext *c = h->priv_data;
+closedir(c->dir);
+return 0;
+}
+
 URLProtocol ff_file_protocol = {
 .name= "file",
 .url_open= file_open,
@@ -200,6 +284,9 @@ URLProtocol ff_file_protocol = {
 .url_check   = file_check,
 .priv_data_size  = sizeof(FileContext),
 .priv_data_class = &file_class,
+.url_open_dir= file_open_dir,
+.url_read_dir= file_read_dir,
+.url_close_dir   = file_close_dir,
 };
 
 #endif /* CONFIG_FILE_PROTOCOL */
-- 
2.3.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 4/7] lavu/avstring: add av_append_path_component() funcion

2015-03-19 Thread Mariusz Szczepańczyk
From: Lukasz Marek 

TODO: bump minor, update doc/APIchanges

Convinient function to build paths.

Signed-off-by: Lukasz Marek 
---
 libavutil/avstring.c | 43 +++
 libavutil/avstring.h | 10 ++
 2 files changed, 53 insertions(+)

diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index 25c65b4..f105aa7 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -269,6 +269,35 @@ const char *av_dirname(char *path)
 return path;
 }
 
+char *av_append_path_component(const char *path, const char *component)
+{
+size_t p_len, c_len;
+char *fullpath;
+
+if (!path)
+return component ? av_strdup(component) : NULL;
+if (!component)
+return av_strdup(path);
+
+p_len = strlen(path);
+c_len = strlen(component);
+fullpath = malloc(p_len + c_len + 2);
+if (fullpath) {
+if (p_len) {
+strcpy(fullpath, path);
+if (c_len) {
+if (fullpath[p_len - 1] != '/' && component[0] != '/')
+fullpath[p_len++] = '/';
+else if (fullpath[p_len - 1] == '/' && component[0] == '/')
+p_len--;
+}
+}
+strcpy(&fullpath[p_len], component);
+fullpath[p_len + c_len] = 0;
+}
+return fullpath;
+}
+
 int av_escape(char **dst, const char *src, const char *special_chars,
   enum AVEscapeMode mode, int flags)
 {
@@ -427,6 +456,7 @@ int av_match_list(const char *name, const char *list, char 
separator)
 int main(void)
 {
 int i;
+char *fullpath;
 static const char * const strings[] = {
 "''",
 "",
@@ -467,6 +497,19 @@ int main(void)
 av_free(q);
 }
 
+printf("Testing av_append_path_component()\n");
+#define TEST_APPEND_PATH_COMPONENT(path, component, expected) \
+fullpath = av_append_path_component((path), (component)); \
+printf("%s = %s\n", fullpath, expected); \
+av_free(fullpath);
+TEST_APPEND_PATH_COMPONENT(NULL, NULL, "(null)")
+TEST_APPEND_PATH_COMPONENT("path", NULL, "path");
+TEST_APPEND_PATH_COMPONENT(NULL, "comp", "comp");
+TEST_APPEND_PATH_COMPONENT("path", "comp", "path/comp");
+TEST_APPEND_PATH_COMPONENT("path/", "comp", "path/comp");
+TEST_APPEND_PATH_COMPONENT("path", "/comp", "path/comp");
+TEST_APPEND_PATH_COMPONENT("path/", "/comp", "path/comp");
+TEST_APPEND_PATH_COMPONENT("path/path2/", "/comp/comp2", 
"path/path2/comp/comp2");
 return 0;
 }
 
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index ffb7aa6..466edaf 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -276,6 +276,16 @@ const char *av_dirname(char *path);
  */
 int av_match_name(const char *name, const char *names);
 
+/**
+ * Append path component to the existing path.
+ * Path separator '/' is placed between when needed.
+ * Resulting string have to be freed with av_free().
+ * @param path  base path
+ * @param component component to be appended
+ * @return new path or NULL on error.
+ */
+char *av_append_path_component(const char *path, const char *component);
+
 enum AVEscapeMode {
 AV_ESCAPE_MODE_AUTO,  ///< Use auto-selected escaping mode.
 AV_ESCAPE_MODE_BACKSLASH, ///< Use backslash escaping.
-- 
2.3.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/7] lavf/ftp: implement directory listing callbacks

2015-03-19 Thread Mariusz Szczepańczyk
From: Lukasz Marek 

Signed-off-by: Lukasz Marek 
---
 libavformat/ftp.c | 187 --
 1 file changed, 180 insertions(+), 7 deletions(-)

diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 7faf4a5..ffa96a1 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -19,6 +19,7 @@
  */
 
 #include "libavutil/avstring.h"
+#include "libavutil/parseutils.h"
 #include "avformat.h"
 #include "internal.h"
 #include "url.h"
@@ -27,12 +28,14 @@
 
 #define CONTROL_BUFFER_SIZE 1024
 #define CREDENTIALS_BUFFER_SIZE 128
+#define DIR_BUFFER_SIZE 4096
 
 typedef enum {
 UNKNOWN,
 READY,
 DOWNLOADING,
 UPLOADING,
+LISTING_DIR,
 DISCONNECTED
 } FTPState;
 
@@ -53,6 +56,10 @@ typedef struct {
 const char *anonymous_password;  /**< Password to be used for 
anonymous user. An email should be used. */
 int write_seekable;  /**< Control seekability, 0 = 
disable, 1 = enable. */
 FTPState state;  /**< State of data connection 
*/
+char *dir_buffer;
+size_t dir_buffer_size;
+size_t dir_buffer_offset;
+int utf8;
 } FTPContext;
 
 #define OFFSET(x) offsetof(FTPContext, x)
@@ -441,6 +448,28 @@ static int ftp_restart(FTPContext *s, int64_t pos)
 return 0;
 }
 
+static int ftp_set_dir(FTPContext *s)
+{
+static const int cwd_codes[] = {250, 550, 0}; /* 550 is incorrect code */
+char command[MAX_URL_SIZE];
+
+snprintf(command, sizeof(command), "CWD %s\r\n", s->path);
+if (ftp_send_command(s, command, cwd_codes, NULL) != 250)
+return AVERROR(EIO);
+return 0;
+}
+
+static int ftp_list(FTPContext *s)
+{
+static const char *command = "MLSD\r\n";
+static const int mlsd_codes[] = {150, 500, 0}; /* 500 is incorrect code */
+
+if (ftp_send_command(s, command, mlsd_codes, NULL) != 150)
+return AVERROR(ENOSYS);
+s->state = LISTING_DIR;
+return 0;
+}
+
 static int ftp_features(FTPContext *s)
 {
 static const char *feat_command= "FEAT\r\n";
@@ -450,8 +479,10 @@ static int ftp_features(FTPContext *s)
 char *feat = NULL;
 
 if (ftp_send_command(s, feat_command, feat_codes, &feat) == 211) {
-if (av_stristr(feat, "UTF8"))
-ftp_send_command(s, enable_utf8_command, opts_codes, NULL);
+if (av_stristr(feat, "UTF8")) {
+if (ftp_send_command(s, enable_utf8_command, opts_codes, NULL) == 
200)
+s->utf8 = 1;
+}
 }
 av_freep(&feat);
 
@@ -577,14 +608,12 @@ static int ftp_abort(URLContext *h)
 return 0;
 }
 
-static int ftp_open(URLContext *h, const char *url, int flags)
+static int ftp_connect(URLContext *h, const char *url)
 {
 char proto[10], path[MAX_URL_SIZE];
 int err;
 FTPContext *s = h->priv_data;
 
-av_dlog(h, "ftp protocol open\n");
-
 s->state = DISCONNECTED;
 s->filesize = -1;
 s->position = 0;
@@ -600,12 +629,26 @@ static int ftp_open(URLContext *h, const char *url, int 
flags)
 s->server_control_port = 21;
 
 if ((err = ftp_connect_control_connection(h)) < 0)
-goto fail;
+return err;
 
 if ((err = ftp_current_dir(s)) < 0)
-goto fail;
+return err;
+
 av_strlcat(s->path, path, sizeof(s->path));
 
+return 0;
+}
+
+static int ftp_open(URLContext *h, const char *url, int flags)
+{
+FTPContext *s = h->priv_data;
+int err;
+
+av_dlog(h, "ftp protocol open\n");
+
+if ((err = ftp_connect(h, url) < 0))
+goto fail;
+
 if (ftp_restart(s, 0) < 0) {
 h->is_streamed = 1;
 } else {
@@ -786,6 +829,133 @@ static int ftp_shutdown(URLContext *h, int flags)
 return AVERROR(EIO);
 }
 
+static int ftp_open_dir(URLContext *h)
+{
+FTPContext *s = h->priv_data;
+int ret;
+
+if ((ret = ftp_connect(h, h->filename)) < 0)
+goto fail;
+if ((ret = ftp_set_dir(s)) < 0)
+goto fail;
+if ((ret = ftp_connect_data_connection(h)) < 0)
+goto fail;
+if ((ret = ftp_list(s)) < 0)
+goto fail;
+s->dir_buffer = av_malloc(DIR_BUFFER_SIZE);
+if (!s->dir_buffer) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+s->dir_buffer[0] = 0;
+if (s->conn_data && s->state == LISTING_DIR)
+return 0;
+  fail:
+ffurl_closep(&s->conn_control);
+ffurl_closep(&s->conn_data);
+return ret;
+}
+
+static int64_t ftp_parse_date(const char *date)
+{
+struct tm tv;
+memset(&tv, 0, sizeof(struct tm));
+av_small_strptime(date, "%Y%m%d%H%M%S", &tv);
+return INT64_C(100) * av_timegm(&tv);
+}
+
+/**
+ * @return 0 on success, negative on error, positive on entry to discard.
+ */
+static int ftp_parse_entry(char *mlsd, AVIODirEntry *next)
+{
+char *fact, *value;
+av_dlog(NULL, "%s\n", mlsd);
+while(fact = av_strtok(mlsd, ";", &mlsd)) {
+if (fact[0] == ' ') {
+next->name = av_strdup(&fact[1]);
+continue;
+}
+   

[FFmpeg-devel] [PATCH 7/7] lavf/libsmbclient: implement directory listing callbacks

2015-03-19 Thread Mariusz Szczepańczyk
---
 libavformat/libsmbclient.c | 93 ++
 1 file changed, 93 insertions(+)

diff --git a/libavformat/libsmbclient.c b/libavformat/libsmbclient.c
index 8290d75..c97140d 100644
--- a/libavformat/libsmbclient.c
+++ b/libavformat/libsmbclient.c
@@ -28,6 +28,7 @@
 typedef struct {
 const AVClass *class;
 SMBCCTX *ctx;
+int dh;
 int fd;
 int64_t filesize;
 int trunc;
@@ -182,6 +183,95 @@ static int libsmbc_write(URLContext *h, const unsigned 
char *buf, int size)
 return bytes_written;
 }
 
+static int libsmbc_open_dir(URLContext *h)
+{
+LIBSMBContext *libsmbc = h->priv_data;
+int ret;
+
+if ((ret = libsmbc_connect(h)) < 0)
+goto fail;
+
+if ((libsmbc->dh = smbc_opendir(h->filename)) < 0) {
+ret = AVERROR(errno);
+av_log(h, AV_LOG_ERROR, "Error opening dir: %s\n", strerror(errno));
+goto fail;
+}
+
+return 0;
+
+  fail:
+libsmbc_close(h);
+return ret;
+}
+
+static int libsmbc_read_dir(URLContext *h, AVIODirEntry **next)
+{
+LIBSMBContext *libsmbc = h->priv_data;
+AVIODirEntry *entry;
+struct smbc_dirent *dirent = NULL;
+char *url = NULL;
+
+*next = entry = av_mallocz(sizeof(AVIODirEntry));
+if (!entry)
+return AVERROR(ENOMEM);
+
+do {
+dirent = smbc_readdir(libsmbc->dh);
+if (!dirent) {
+av_freep(next);
+return 0;
+}
+} while (!strcmp(dirent->name, ".") || !strcmp(dirent->name, ".."));
+
+entry->name = av_strdup(dirent->name);
+if (!entry->name) {
+av_freep(next);
+return AVERROR(ENOMEM);
+}
+
+url = av_append_path_component(h->filename, dirent->name);
+if (url) {
+struct stat st;
+if (!smbc_stat(url, &st)) {
+entry->group_id = st.st_gid;
+entry->user_id = st.st_uid;
+entry->size = st.st_size;
+entry->filemode = st.st_mode & 0777;
+entry->modification_timestamp = INT64_C(100) * st.st_mtime;
+entry->access_timestamp =  INT64_C(100) * st.st_atime;
+entry->status_change_timestamp = INT64_C(100) * st.st_ctime;
+}
+av_free(url);
+}
+
+switch (dirent->smbc_type) {
+case SMBC_DIR:
+entry->type = AVIO_ENTRY_DIRECTORY;
+break;
+case SMBC_FILE:
+entry->type = AVIO_ENTRY_FILE;
+break;
+default:
+/* TODO: Find out what other types stand for and their correct
+ * mappings. Probably some of them should be skipped. */
+entry->type = AVIO_ENTRY_UNKNOWN;
+break;
+}
+
+return 0;
+}
+
+static int libsmbc_close_dir(URLContext *h)
+{
+LIBSMBContext *libsmbc = h->priv_data;
+if (libsmbc->dh >= 0) {
+smbc_closedir(libsmbc->dh);
+libsmbc->dh = -1;
+}
+libsmbc_close(h);
+return 0;
+}
+
 #define OFFSET(x) offsetof(LIBSMBContext, x)
 #define D AV_OPT_FLAG_DECODING_PARAM
 #define E AV_OPT_FLAG_ENCODING_PARAM
@@ -206,6 +296,9 @@ URLProtocol ff_libsmbclient_protocol = {
 .url_write   = libsmbc_write,
 .url_seek= libsmbc_seek,
 .url_close   = libsmbc_close,
+.url_open_dir= libsmbc_open_dir,
+.url_read_dir= libsmbc_read_dir,
+.url_close_dir   = libsmbc_close_dir,
 .priv_data_size  = sizeof(LIBSMBContext),
 .priv_data_class = &libsmbclient_context_class,
 .flags   = URL_PROTOCOL_FLAG_NETWORK,
-- 
2.3.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 6/7] doc/examples: add directory listing example

2015-03-19 Thread Mariusz Szczepańczyk
From: Lukasz Marek 

---
 .gitignore   |  1 +
 configure|  2 +
 doc/Makefile |  1 +
 doc/examples/Makefile|  3 +-
 doc/examples/avio_list_dir.c | 99 
 5 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 doc/examples/avio_list_dir.c

diff --git a/.gitignore b/.gitignore
index d2088e5..71d4d64 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,7 @@
 /doc/avoptions_codec.texi
 /doc/avoptions_format.texi
 /doc/doxy/html/
+/doc/examples/avio_list_dir
 /doc/examples/avio_reading
 /doc/examples/decoding_encoding
 /doc/examples/demuxing_decoding
diff --git a/configure b/configure
index 1bf8f80..5e55db0 100755
--- a/configure
+++ b/configure
@@ -1320,6 +1320,7 @@ COMPONENT_LIST="
 
 EXAMPLE_LIST="
 avio_reading_example
+avio_list_dir_example
 decoding_encoding_example
 demuxing_decoding_example
 extract_mvs_example
@@ -2649,6 +2650,7 @@ zoompan_filter_deps="swscale"
 
 # examples
 avio_reading="avformat avcodec avutil"
+avio_list_dir="avformat avutil"
 avcodec_example_deps="avcodec avutil"
 decoding_encoding_example_deps="avcodec avformat avutil"
 demuxing_decoding_example_deps="avcodec avformat avutil"
diff --git a/doc/Makefile b/doc/Makefile
index 697142f..4573531 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -36,6 +36,7 @@ DOCS-$(CONFIG_MANPAGES)  += $(MANPAGES)
 DOCS-$(CONFIG_TXTPAGES)  += $(TXTPAGES)
 DOCS = $(DOCS-yes)
 
+DOC_EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir
 DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE)  += avio_reading
 DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE)   += avcodec
 DOC_EXAMPLES-$(CONFIG_DECODING_ENCODING_EXAMPLE) += decoding_encoding
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index 9f03f04..9699f11 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -11,7 +11,8 @@ CFLAGS += -Wall -g
 CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS)
 LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)
 
-EXAMPLES=   avio_reading   \
+EXAMPLES=   avio_list_dir  \
+avio_reading   \
 decoding_encoding  \
 demuxing_decoding  \
 extract_mvs\
diff --git a/doc/examples/avio_list_dir.c b/doc/examples/avio_list_dir.c
new file mode 100644
index 000..39ae8be
--- /dev/null
+++ b/doc/examples/avio_list_dir.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014 Lukasz Marek
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+
+static const char *type_string(int type)
+{
+switch (type) {
+case AVIO_ENTRY_DIRECTORY:
+return "";
+case AVIO_ENTRY_FILE:
+return "";
+case AVIO_ENTRY_BLOCK_DEVICE:
+return "";
+case AVIO_ENTRY_CHARACTER_DEVICE:
+return "";
+case AVIO_ENTRY_NAMED_PIPE:
+return "";
+case AVIO_ENTRY_SYMBOLIC_LINK:
+return "";
+case AVIO_ENTRY_SOCKET:
+return "";
+case AVIO_ENTRY_UNKNOWN:
+default:
+break;
+}
+return "";
+}
+
+int main(int argc, char *argv[])
+{
+const char *input_dir = NULL;
+AVIODirEntry *entry= NULL;
+void *ctx = NULL;
+int ret;
+
+av_log_set_level(AV_LOG_DEBUG);
+
+if (argc != 2) {
+fprintf(stderr, "usage: %s input_dir\n"
+"API example program to show how to list files in directory "
+"accessed through AVIOContext.\n", argv[0]);
+return 1;
+}
+input_dir = argv[1];
+
+/* register codecs and formats and other lavf/lavc components*/
+av_register_all();
+
+if ((ret = avio_open_dir(&ctx, input_dir, NULL)) < 0) {
+av_log(NULL, AV_LOG_ERROR, "Cannot open directory: %s.\n", 
av_err2str(ret));
+return 1;
+}
+
+fo

Re: [FFmpeg-devel] [PATCH] doc: add a few note for sponsorship candidates.

2015-03-19 Thread Michael Niedermayer
On Thu, Mar 19, 2015 at 09:53:12PM +0100, Nicolas George wrote:
> Signed-off-by: Nicolas George 
> ---
>  doc/Makefile |   1 +
>  doc/sponsored_internships_howto.texi | 148 
> +++
>  2 files changed, 149 insertions(+)
>  create mode 100644 doc/sponsored_internships_howto.texi
> 
> 
> Not sure if the best place is there or the wiki, but at either place,
> something like that should be useful. Comments?

overall very nice, i like it

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Patch proposal : Remove some unused variable

2015-03-19 Thread Michael Niedermayer
On Thu, Mar 19, 2015 at 10:42:10PM +0100, Martin Vignali wrote:
> I'm not sure about ffmpeg choice for compiler warning.
> An old post on the mailing list, say : it depends !!
> 
> So i propose remove some unused variables, to remove some 'unused variable'
> warning.
> (Clang compiler Mac os 10.9)
> 
> Patch in attach.

patches applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] doc: add a few note for sponsorship candidates.

2015-03-19 Thread Lou Logan
On Thu, 19 Mar 2015 21:53:12 +0100, Nicolas George wrote:

> +@chapter So yeah, I would like to work on FFmpeg for 
> @url{https://code.google.com/soc/, Google Summer of Code} / 
> @url{http://sophia.estec.esa.int/socis/, ESA Summer of Code in Space} / 
> @url{https://www.gnome.org/outreachy/, Outreachy} / [insert here the latest 
> trendy program]. What must I do?

Dump the "So yeah,".

> +For the organization that sposors the program, there is probably a lot of
> +paperwork. But frankly, we do not care; if we liked paperwork, we would be
> +managers, not hackers.

s/sposors/sponsors

However, I don't think this paragraph is very helpful as it is.

Maybe something like this:

"Refer to the homepage of the sponsor organization for information about
eligibility, timeline, required paperwork, etc. This process is the
full responsibility of the intern; the limited available FFmpeg mentor
time is best spent on providing help specific to coding."

> +For us, there is not much to do: choose a proposed project that you want to
> +do, select a qualification task for that project that is not already taken
> +by someone else, announce you are about to start working, and then do so.

"As for FFmpeg: choose a proposed project that you want to do, select a
qualification task for that project that is not already taken by
someone else, announce your chosen qualification task on the
ffmpeg-devel mailing list, then start coding."

> +If at any point you have any question, do not hesitate to ask them.

"...on the ffmpeg-devel mailing list or #ffmpeg-devel IRC channel."

I'm aware you mention contact info below, but I think it's good to
drill this info.

> +Actually, yes, hesitate a few seconds, in case this question will make you
> +look dump. So read on.

I think this do not contribute anything helpful and can be removed.

> +@chapter How do I contact you? And, in fact, who are you?
> +
> +The people who work on FFmpeg do so mostly on their free time or as a
> +complement to their regular job in computing or consulting. To contact us,
> +you can use the devel mailing list or personal mail, depending on the
> +contents of the message. Use discretion. You can also try the IRC channel.

"To @url{https://ffmpeg.org/contact.html, contact us}, you can use the
ffmpeg-devel mailing list or the mentor's personal mail"

s/devel/ffmpeg-devel

> +@chapter How do I get to work?
> +
> +First, download FFmpeg. Not a prebuilt binary. Not a source snapshot. A full
> +Git clone tree. If you do not know what that means, then you have reading to
> +do.

"See @url{https://ffmpeg.org/git-howto.html, Using git to develop
FFmpeg} for more info."

> +You should subscribe to it, because otherwise, your mails will be held for
> +approval instead of arriving in a few seconds.

"approval for up to 48 hours"

Hopefully that may stop at least one user from sending one or more
messages to the queue, then subscribing, then re-sending again
resulting in dupes depending on how vigilant/lazy I am while clearing
the queue.

> +Also, be aware that some mail user agents send mails that are unreadable
> +except by themselves; some have strange ideas about paragraph formatting and
> +apply them to code snippet too. You can have a look at the low-tech mail
> +archive on the FFmpeg site to see how your mails actually look like.

"low-tech @url{https://lists.ffmpeg.org/pipermail/ffmpeg-devel/,
mailing list archive}"

> +@chapter What if, in the end, I am not taken?

s/taken/accepted

The rest of it looks good to me. Thanks for taking the time to do this.

Lou
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] doc: add a few note for sponsorship candidates.

2015-03-19 Thread Michael Niedermayer
On Thu, Mar 19, 2015 at 09:53:12PM +0100, Nicolas George wrote:
> Signed-off-by: Nicolas George 
> ---
>  doc/Makefile |   1 +
>  doc/sponsored_internships_howto.texi | 148 
> +++
>  2 files changed, 149 insertions(+)
>  create mode 100644 doc/sponsored_internships_howto.texi
> 
> 

> Not sure if the best place is there or the wiki, but at either place,

iam not sure either but in general when in doubt i would probably
tend more toward the wiki as it can be edited and maintained by a
larger group of people, iam not sure this is relevant or not here

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel