[FFmpeg-devel] [PATCH]Write valid free atom with -moov_size

2014-07-16 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes ticket #3769.

Please review, Carl Eugen
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b3287ca..4b9a4f1 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4398,8 +4398,7 @@ static int mov_write_trailer(AVFormatContext *s)
 }
 avio_wb32(pb, size);
 ffio_wfourcc(pb, "free");
-for (i = 0; i < size; i++)
-avio_w8(pb, 0);
+ffio_fill(pb, 0, size - 8);
 avio_seek(pb, moov_pos, SEEK_SET);
 } else {
 mov_write_moov_tag(pb, mov, s);
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]Write valid free atom with -moov_size

2014-07-16 Thread Michael Niedermayer
On Wed, Jul 16, 2014 at 01:45:47PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes ticket #3769.
> 
> Please review, Carl Eugen

>  movenc.c |3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> c040bdb810885856a278402be659e75e3afb8d1a  patchmoovfree.diff
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c

LGTM

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.


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


Re: [FFmpeg-devel] [PATCH] avcodec/mjpegenc_common: always store JFIF, idependent of the aspect ratio

2014-07-16 Thread Michael Niedermayer
On Wed, Jul 16, 2014 at 08:18:58AM +0200, Reimar Döffinger wrote:
> 
> 
> On 15.07.2014, at 16:31, Michael Niedermayer  wrote:
> 
> > Found-by: kriegero1
> > Signed-off-by: Michael Niedermayer 
> 
> Nit: iNdependent in commit message.

fixed


> 
> > +/* JFIF header */
> > +put_marker(p, APP0);
> > +put_bits(p, 16, 16);
> > +avpriv_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte 
> > too */
> > +put_bits(p, 16, 0x0102); /* v 1.02 */
> > +put_bits(p,  8, 0);  /* units type: 0 - aspect ratio */
> 
> Would an empty JFIF header possibly help as well? (I think it's a collection 
> of tags or am I wrong and it requires an aspect entry?)
> I don't like specifying a 1:1 aspect explicitly when we actually don't know 
> it.

from what i see in the spec this isnt optional, but i read just
a small part of the spec
also the spec isnt big ...


> Also, might the diff be more readable without reindenting?

probably, ill do it in case this is commited, one concern is still
if we need to special case this for mjpeg so it gets no jfif

[...]

-- 
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


Re: [FFmpeg-devel] [PATCH 1/3] get_bits: remove unused assignment

2014-07-16 Thread Michael Niedermayer
On Tue, Jul 15, 2014 at 08:56:28PM -0700, Timothy Gu wrote:
> Signed-off-by: Timothy Gu 
> ---
>  libavcodec/get_bits.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thanks

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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


Re: [FFmpeg-devel] [PATCH 2/3] vp9: remove unused assignment

2014-07-16 Thread Michael Niedermayer
On Tue, Jul 15, 2014 at 08:56:29PM -0700, Timothy Gu wrote:
> Signed-off-by: Timothy Gu 
> ---
> 
> Already OK'd by BBB on IRC:
> 19:04  the first two seem correct
> 19:04  yeah they’re all correct
> 19:05  Timothy_Gu_: patch to remove these is fine

applied

thx

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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


[FFmpeg-devel] [PATCH] [RFC] avcodec: export MB information in frame side data

2014-07-16 Thread Clément Bœsch
Also add an example exporting the MB information as a CSV stream.

---

A bunch of questions stand:

- Ideally the "source" for a given macroblock should be a specific
  reference to a future or paste frame (something like -4 or +2).
  Currently it's just ±1 depending on the direction. I don't see how I
  can extract that information.

- how the MB "type" should be exported? Like, what "generic" type we
  need to expose for the users

- Who is motivated to port -vismv & various other vis_* debug to a video
  filter? (The hard part will probably be writing its documentation...)

(TODO: avcodec version bump & APIChanges entry at least)
---
 .gitignore|   1 +
 configure |   2 +
 doc/Makefile  |   1 +
 doc/examples/Makefile |   1 +
 doc/examples/extract_mbinfo.c | 185 ++
 libavcodec/avcodec.h  |   1 +
 libavcodec/mpegvideo.c| 109 -
 libavcodec/options_table.h|   1 +
 libavutil/frame.h |   5 ++
 libavutil/mbinfo.h|  32 
 10 files changed, 337 insertions(+), 1 deletion(-)
 create mode 100644 doc/examples/extract_mbinfo.c
 create mode 100644 libavutil/mbinfo.h

diff --git a/.gitignore b/.gitignore
index 065fab1..8c38ed2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,6 +39,7 @@
 /doc/examples/avio_reading
 /doc/examples/decoding_encoding
 /doc/examples/demuxing_decoding
+/doc/examples/extract_mbinfo
 /doc/examples/filter_audio
 /doc/examples/filtering_audio
 /doc/examples/filtering_video
diff --git a/configure b/configure
index 51efc39..81eb69e 100755
--- a/configure
+++ b/configure
@@ -1299,6 +1299,7 @@ EXAMPLE_LIST="
 avio_reading_example
 decoding_encoding_example
 demuxing_decoding_example
+extract_mbinfo_example
 filter_audio_example
 filtering_audio_example
 filtering_video_example
@@ -2569,6 +2570,7 @@ zoompan_filter_deps="swscale"
 avio_reading="avformat avcodec avutil"
 avcodec_example_deps="avcodec avutil"
 demuxing_decoding_example_deps="avcodec avformat avutil"
+extract_mbinfo_example_deps="avcodec avformat avutil"
 filter_audio_example_deps="avfilter avutil"
 filtering_audio_example_deps="avfilter avcodec avformat avutil"
 filtering_video_example_deps="avfilter avcodec avformat avutil"
diff --git a/doc/Makefile b/doc/Makefile
index 99f588a..6b6f7c1 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -39,6 +39,7 @@ DOCS = $(DOCS-yes)
 DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE)  += avio_reading
 DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE)   += avcodec
 DOC_EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding
+DOC_EXAMPLES-$(CONFIG_EXTRACT_MBINFO_EXAMPLE)+= extract_mbinfo
 DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE)  += filter_audio
 DOC_EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE)   += filtering_audio
 DOC_EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE)   += filtering_video
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index 03c7021..2b394c3 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -14,6 +14,7 @@ LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)
 EXAMPLES=   avio_reading   \
 decoding_encoding  \
 demuxing_decoding  \
+extract_mbinfo \
 filtering_video\
 filtering_audio\
 metadata   \
diff --git a/doc/examples/extract_mbinfo.c b/doc/examples/extract_mbinfo.c
new file mode 100644
index 000..e437a21
--- /dev/null
+++ b/doc/examples/extract_mbinfo.c
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2012 Stefano Sabatini
+ * Copyright (c) 2014 Clément Bœsch
+ *
+ * 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 
+
+static AVFormatContext *fmt_ctx = NULL;
+static 

[FFmpeg-devel] Issue 3052

2014-07-16 Thread Benoit Fouet
Hi,

I had a look at https://trac.ffmpeg.org/ticket/3052.
The issue is that the last frame duration is lost. Is there any reason why the 
packet duration is not transmitted from the demuxer to the muxer?
Attached is a dumb patch, just to understand a bit more why things are done the 
way they are...

Cheers,
-- 
Ben
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 9fa8e16..7c009d7 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2063,6 +2063,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
 avpkt->size = 0;
 else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY))
 avpkt->pts = avpkt->dts = frame->pts;
+if (frame)
+avpkt->duration = av_frame_get_pkt_duration(frame);
 
 if (needs_realloc && avpkt->data) {
 ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] [RFC] avcodec: export MB information in frame side data

2014-07-16 Thread Clément Bœsch
On Wed, Jul 16, 2014 at 05:06:27PM +0200, Clément Bœsch wrote:
> Also add an example exporting the MB information as a CSV stream.
> 
> ---
> 
> A bunch of questions stand:
> 
> - Ideally the "source" for a given macroblock should be a specific
>   reference to a future or paste frame (something like -4 or +2).
>   Currently it's just ±1 depending on the direction. I don't see how I
>   can extract that information.
> 
> - how the MB "type" should be exported? Like, what "generic" type we
>   need to expose for the users
> 
> - Who is motivated to port -vismv & various other vis_* debug to a video
>   filter? (The hard part will probably be writing its documentation...)
> 

Ah and BTW, can we make the decode step faster somehow in the example
since we're only interested in the MB and not the final picture? I was
thinking of lowres, but maybe we can even skip the whole decode step with
some of the codecs?

[...]

-- 
Clément B.


pgpC4IHInEXGM.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Issue 3052

2014-07-16 Thread Benoit Fouet


- Mail original -
> Hi,
> 
> I had a look at https://trac.ffmpeg.org/ticket/3052.
> The issue is that the last frame duration is lost. Is there any
> reason why the packet duration is not transmitted from the demuxer
> to the muxer?
> Attached is a dumb patch, just to understand a bit more why things
> are done the way they are...
> 

e.g., by dumb, I mean that the duration should be corrected with the right 
timebase... But I just want to get feedback on the forwarding part.

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


Re: [FFmpeg-devel] [PATCH] avcodec/mjpegenc_common: always store JFIF, idependent of the aspect ratio

2014-07-16 Thread Andrey Utkin
2014-07-15 21:39 GMT+03:00 Andrey Utkin :
> 2014-07-15 19:16 GMT+03:00 Nicolas George :
>> Le septidi 27 messidor, an CCXXII, Andrey Utkin a écrit :
>>> Thanks, with this change streaming HTTP MJPEG stream into browsers
>>> work (with inserting boundaries, which is easy for scripting).
>>
>> Can you share your test procedure please?
>
> I'll work on providing it tomorrow.

Now i see i was wrong about the difference. But still, for the
interest of others, I'll provide HTTP MJPEG streaming example script.
https://dl.dropboxusercontent.com/u/43104344/mjpeg.php
https://dl.dropboxusercontent.com/u/43104344/page.php

Chromium browser doesn't playback produced HTTP MJPEG stream by direct
URL, but it plays it fine the stream referenced from  tag on HTML
page. That may be what caused my confusion. Firefox plays the produced
streams by direct URL. All above doesn't depend on FFmpeg being
patched with this patch.
However, I have upgraded a lot of packages on my PC yesterday, so
Chromium could get upgraded, causing behaviour change.
Also maybe the script is somewhat incorrect, and Chromium actually
plays (correct) streams by direct URLs.
If you're interested to test your browser, feel free to try
http://whdd.org/mjpeg.php
http://whdd.org/mjpeg.php?patched=1
http://whdd.org/page.php
http://whdd.org/page.php?patched=1

Still the patch slightly improves things - now the reliable "start
marker" can be longer (see in script).

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


Re: [FFmpeg-devel] Issue 3052

2014-07-16 Thread Michael Niedermayer
On Wed, Jul 16, 2014 at 05:40:35PM +0200, Benoit Fouet wrote:
> 
> 
> - Mail original -
> > Hi,
> > 
> > I had a look at https://trac.ffmpeg.org/ticket/3052.
> > The issue is that the last frame duration is lost. Is there any
> > reason why the packet duration is not transmitted from the demuxer
> > to the muxer?
> > Attached is a dumb patch, just to understand a bit more why things
> > are done the way they are...
> > 
> 
> e.g., by dumb, I mean that the duration should be corrected with the right 
> timebase... But I just want to get feedback on the forwarding part.

pkt_duration and pkt_timebase where primarly intended for the decoder
side, they could be used for encoder too but i guess filters dont
update them currently

that is:

@@ -2063,6 +2063,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
 avpkt->size = 0;
 else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY))
 avpkt->pts = avpkt->dts = frame->pts;
+if (frame && av_codec_get_pkt_timebase(avctx).num)
+avpkt->duration = av_rescale_q(av_frame_get_pkt_duration(frame),
+   av_codec_get_pkt_timebase(avctx),
+   avctx->time_base);

 if (needs_realloc && avpkt->data) {
 ret = av_buffer_realloc(&avpkt->buf, avpkt->size + 
FF_INPUT_BUFFER_PADDING_SIZE);

also there is
repeat_pict

which is the frame duration in codec time_base units
again, i suspect this is not updated by filters currently

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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


Re: [FFmpeg-devel] [PATCH] [RFC] avcodec: export MB information in frame side data

2014-07-16 Thread Michael Niedermayer
On Wed, Jul 16, 2014 at 05:31:47PM +0200, Clément Bœsch wrote:
> On Wed, Jul 16, 2014 at 05:06:27PM +0200, Clément Bœsch wrote:
> > Also add an example exporting the MB information as a CSV stream.
> > 
> > ---
> > 
> > A bunch of questions stand:
> > 
> > - Ideally the "source" for a given macroblock should be a specific
> >   reference to a future or paste frame (something like -4 or +2).
> >   Currently it's just ±1 depending on the direction. I don't see how I
> >   can extract that information.
> > 
> > - how the MB "type" should be exported? Like, what "generic" type we
> >   need to expose for the users
> > 
> > - Who is motivated to port -vismv & various other vis_* debug to a video
> >   filter? (The hard part will probably be writing its documentation...)
> > 
> 
> Ah and BTW, can we make the decode step faster somehow in the example
> since we're only interested in the MB and not the final picture? I was
> thinking of lowres, but maybe we can even skip the whole decode step with
> some of the codecs?

mc / idct could be skiped, we have a
AVCodecContext.skip_idct

also partitioned mpeg4 would allow decoding mb types and mvs without
ac coeffs but i guess its rare enough that supporting that isnt
worth it

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH 3/3] aaccoder: remove unused assignment

2014-07-16 Thread Michael Niedermayer
On Tue, Jul 15, 2014 at 08:56:30PM -0700, Timothy Gu wrote:
> Signed-off-by: Timothy Gu 
> ---
>  libavcodec/aaccoder.c | 2 --
>  1 file changed, 2 deletions(-)

applied

thanks

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

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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


Re: [FFmpeg-devel] [PATCH 3/4] armv6: Accelerate vector_fmul_window

2014-07-16 Thread Michael Niedermayer
On Fri, Jul 11, 2014 at 12:14:30AM +0100, Ben Avison wrote:
> I benchmarked the result by measuring the number of gperftools samples that
> hit anywhere in the AAC decoder (starting from aac_decode_frame()) or
> specifically in vector_fmul_window_c() / ff_vector_fmul_window_vfp() for the
> same sample AAC stream:
> 
> Before  After
> Mean   StdDev   Mean   StdDev  Confidence  Change
> Audio decode1598.2 47.4 1529.2 25.4100.0%  +4.5%
> vector_fmul_window  244.0  22.1 188.9  22.3100.0%  +29.2%
> ---
>  libavutil/arm/float_dsp_init_vfp.c |7 +-
>  libavutil/arm/float_dsp_vfp.S  |  204 
> 
>  2 files changed, 210 insertions(+), 1 deletions(-)

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 4/4] armv6: Accelerate butterflies_float

2014-07-16 Thread Michael Niedermayer
On Fri, Jul 11, 2014 at 12:14:31AM +0100, Ben Avison wrote:
> I benchmarked the result by measuring the number of gperftools samples that
> hit anywhere in the AAC decoder (starting from aac_decode_frame()) or
> specifically in butterflies_float_c() / ff_butterflies_float_vfp() for the
> same sample AAC stream:
> 
>Before  After
>Mean   StdDev   Mean   StdDev  Confidence  Change
> Audio decode   1542.8 43.7 1470.5 41.5100.0%  +4.9%
> butterflies_float  130.0  11.9 70.2   12.1100.0%  +85.2%
> ---
>  libavutil/arm/float_dsp_init_vfp.c |4 +
>  libavutil/arm/float_dsp_vfp.S  |  116 
> 
>  2 files changed, 120 insertions(+), 0 deletions(-)

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


[FFmpeg-devel] [PATCH] avformat/dvenc: Implement 32khz & 44.1khz for 25/50fps

2014-07-16 Thread Michael Niedermayer
3/1001 fps isnt implemented as i dont know which are the correct 
interleaving parameters,
pointers to the appropriate spec and page are welcome

Fixes Ticket2597

Signed-off-by: Michael Niedermayer 
---
 libavformat/dvenc.c |   54 +++
 1 file changed, 42 insertions(+), 12 deletions(-)

diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index 8f5277d..18fdf9f 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -72,8 +72,16 @@ static const int dv_aaux_packs_dist[12][9] = {
 { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
 };
 
-static int dv_audio_frame_size(const AVDVProfile* sys, int frame)
+static int dv_audio_frame_size(const AVDVProfile* sys, int frame, int 
sample_rate)
 {
+if ((sys->time_base.den == 25 || sys->time_base.den == 50) && 
sys->time_base.num == 1) {
+if  (sample_rate == 32000) return 1280;
+else if (sample_rate == 44100) return 1764;
+else   return 1920;
+}
+
+av_assert0(sample_rate == 48000);
+
 return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist) /
 
sizeof(sys->audio_samples_dist[0]))];
 }
@@ -84,6 +92,8 @@ static int dv_write_pack(enum dv_pack_type pack_id, 
DVMuxContext *c, uint8_t* bu
 time_t ct;
 uint32_t timecode;
 va_list ap;
+int audio_type = 0;
+int channel;
 
 buf[0] = (uint8_t)pack_id;
 switch (pack_id) {
@@ -94,10 +104,15 @@ static int dv_write_pack(enum dv_pack_type pack_id, 
DVMuxContext *c, uint8_t* bu
 break;
 case dv_audio_source:  /* AAUX source pack */
 va_start(ap, buf);
+channel = va_arg(ap, int);
+if (c->ast[channel]->codec->sample_rate == 44100) {
+audio_type = 1;
+} else if (c->ast[channel]->codec->sample_rate == 32000)
+audio_type = 2;
 buf[1] = (1 << 7) | /* locked mode -- SMPTE only supports locked mode 
*/
  (1 << 6) | /* reserved -- always 1 */
- (dv_audio_frame_size(c->sys, c->frames) -
-  c->sys->audio_min_samples[0]);
+ (dv_audio_frame_size(c->sys, c->frames, 
c->ast[channel]->codec->sample_rate) -
+  c->sys->audio_min_samples[audio_type]);
 /* # of samples  */
 buf[2] = (0 << 7) | /* multi-stereo  */
  (0 << 5) | /* #of audio channels per block: 0 -- 1 channel */
@@ -109,8 +124,9 @@ static int dv_write_pack(enum dv_pack_type pack_id, 
DVMuxContext *c, uint8_t* bu
  (c->sys->n_difchan & 2); /* definition: 0 -- 25Mbps, 2 -- 
50Mbps */
 buf[4] = (1 << 7) | /* emphasis: 1 -- off */
  (0 << 6) | /* emphasis time constant: 0 -- reserved */
- (0 << 3) | /* frequency: 0 -- 48kHz, 1 -- 44,1kHz, 2 -- 32kHz 
*/
+ (audio_type << 3) | /* frequency: 0 -- 48kHz, 1 -- 44,1kHz, 2 
-- 32kHz */
   0;/* quantization: 0 -- 16bit linear, 1 -- 12bit 
nonlinear */
+
 va_end(ap);
 break;
 case dv_audio_control:
@@ -170,12 +186,12 @@ static int dv_write_pack(enum dv_pack_type pack_id, 
DVMuxContext *c, uint8_t* bu
 static void dv_inject_audio(DVMuxContext *c, int channel, uint8_t* frame_ptr)
 {
 int i, j, d, of, size;
-size = 4 * dv_audio_frame_size(c->sys, c->frames);
+size = 4 * dv_audio_frame_size(c->sys, c->frames, 
c->ast[channel]->codec->sample_rate);
 frame_ptr += channel * c->sys->difseg_size * 150 * 80;
 for (i = 0; i < c->sys->difseg_size; i++) {
 frame_ptr += 6 * 80; /* skip DIF segment header */
 for (j = 0; j < 9; j++) {
-dv_write_pack(dv_aaux_packs_dist[i][j], c, &frame_ptr[3], i >= 
c->sys->difseg_size/2);
+dv_write_pack(dv_aaux_packs_dist[i][j], c, &frame_ptr[3], channel, 
i >= c->sys->difseg_size/2);
 for (d = 8; d < 80; d+=2) {
 of = c->sys->audio_shuffle[i][j] + (d - 8)/2 * 
c->sys->audio_stride;
 if (of*2 >= size)
@@ -228,7 +244,6 @@ static int dv_assemble_frame(DVMuxContext *c, AVStream* st,
 int i, reqasize;
 
 *frame = &c->frame_buf[0];
-reqasize = 4 * dv_audio_frame_size(c->sys, c->frames);
 
 switch (st->codec->codec_type) {
 case AVMEDIA_TYPE_VIDEO:
@@ -247,6 +262,8 @@ static int dv_assemble_frame(DVMuxContext *c, AVStream* st,
 av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. 
Insufficient video data or severe sync problem.\n", c->frames);
 av_fifo_generic_write(c->audio_data[i], data, data_size, NULL);
 
+reqasize = 4 * dv_audio_frame_size(c->sys, c->frames, 
st->codec->sample_rate);
+
 /* Let us see if we've got enough audio for one DV frame. */
 c->has_audio |= ((reqasize <= av_fifo_size(c->audio_data[i])) << i);
 
@@ -261,6 +278,7 @@ static int dv_assemble_frame(DVMuxContext *c, AVStream* st,
 c->has_audi

Re: [FFmpeg-devel] [PATCH] libavformat/segment: change segment_list_size behavior to match hls_list_size behavior.

2014-07-16 Thread Michael Niedermayer
On Wed, Jul 09, 2014 at 09:40:43PM +0200, Simon Thelen wrote:
> Make the segment muxer keep segment_list_size segments instead of
> segment_list_size + 1 segments. This patch also changes the
> documentation for segment_list_size to reduce possible confusion over
> how many segments are kept.
> 
> Signed-off-by: Simon Thelen 

applied

thanks

[...]
-- 
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


[FFmpeg-devel] [PATCH] avformat/dv: implement fallback in dv_extract_pack()

2014-07-16 Thread Michael Niedermayer
Fixes Ticket2340
Fixes Ticket2341

Based-on mail from Dave Rice 
Signed-off-by: Michael Niedermayer 
---
 libavformat/dv.c |   43 +++
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/libavformat/dv.c b/libavformat/dv.c
index 4f7b062..1e15c08 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -72,30 +72,33 @@ static inline uint16_t dv_audio_12to16(uint16_t sample)
 return result;
 }
 
-/*
- * This is the dumbest implementation of all -- it simply looks at
- * a fixed offset and if pack isn't there -- fails. We might want
- * to have a fallback mechanism for complete search of missing packs.
- */
 static const uint8_t *dv_extract_pack(uint8_t *frame, enum dv_pack_type t)
 {
 int offs;
+int c;
 
-switch (t) {
-case dv_audio_source:
-offs = (80 * 6 + 80 * 16 * 3 + 3);
-break;
-case dv_audio_control:
-offs = (80 * 6 + 80 * 16 * 4 + 3);
-break;
-case dv_video_control:
-offs = (80 * 5 + 48 + 5);
-break;
-case dv_timecode:
-offs = (80*1 + 3 + 3);
-break;
-default:
-return NULL;
+for (c = 0; c < 10; c++) {
+switch (t) {
+case dv_audio_source:
+if (c&1)offs = (80 * 6 + 80 * 16 * 0 + 3 + c*12000);
+elseoffs = (80 * 6 + 80 * 16 * 3 + 3 + c*12000);
+break;
+case dv_audio_control:
+if (c&1)offs = (80 * 6 + 80 * 16 * 1 + 3 + c*12000);
+elseoffs = (80 * 6 + 80 * 16 * 4 + 3 + c*12000);
+break;
+case dv_video_control:
+if (c&1)offs = (80 * 3 + 8  + c*12000);
+elseoffs = (80 * 5 + 48 + 5 + c*12000);
+break;
+case dv_timecode:
+offs = (80*1 + 3 + 3);
+break;
+default:
+return NULL;
+}
+if (frame[offs] == t)
+break;
 }
 
 return frame[offs] == t ? &frame[offs] : NULL;
-- 
1.7.9.5

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