Re: [libav-devel] [PATCH] oggdec: fix streaming with continuous audio streams (issue2337)

2011-04-07 Thread Clément Bœsch
 From b686906d82d36b14236ce677bdf881f48a67bc02 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= ubi...@gmail.com
 Date: Tue, 5 Apr 2011 00:29:01 +0200
 Subject: [PATCH] oggdec: fix streaming with continuous audio streams 
 (issue2337)
 

New update following Luca's review on IRC: initmode renamed to page_begin,
and doxygen comment added.

-- 
Clément B.
From b129b2c17a8a4814a4a8ef70b2e6072b4ae33df7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= ubi...@gmail.com
Date: Tue, 5 Apr 2011 00:29:01 +0200
Subject: [PATCH] oggdec: fix streaming with continuous audio streams (issue2337)

---
 libavformat/oggdec.c |   16 
 libavformat/oggdec.h |1 +
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index cd866d4..5cf4faa 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -164,6 +164,7 @@ ogg_new_stream (AVFormatContext * s, uint32_t serial)
 os-bufsize = DECODER_BUFFER_SIZE;
 os-buf = av_malloc(os-bufsize);
 os-header = -1;
+os-page_begin = 1;
 
 st = av_new_stream (s, idx);
 if (!st)
@@ -241,12 +242,27 @@ ogg_read_page (AVFormatContext * s, int *str)
 
 idx = ogg_find_stream (ogg, serial);
 if (idx  0){
+for (i = 0; i  ogg-nstreams; i++) {
+if (!ogg-streams[i].page_begin) {
+int n;
+
+for (n = 0; n  ogg-nstreams; n++) {
+av_free(ogg-streams[n].buf);
+av_free(ogg-streams[n].private);
+}
+ogg-curidx   = -1;
+ogg-nstreams = 0;
+break;
+}
+}
 idx = ogg_new_stream (s, serial);
 if (idx  0)
 return -1;
 }
 
 os = ogg-streams + idx;
+if (!(flags  OGG_FLAG_BOS))
+os-page_begin = 0;
 os-page_pos = avio_tell(bc) - 27;
 
 if(os-psize  0)
diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h
index 7d66cd5..785cd81 100644
--- a/libavformat/oggdec.h
+++ b/libavformat/oggdec.h
@@ -75,6 +75,7 @@ struct ogg_stream {
 int incomplete; /// whether we're expecting a continuation in the next 
page
 int page_end;   /// current packet is the last one completed in the page
 int keyframe_seek;
+int page_begin; /// set to 1 if the stream only received a 
begin-of-stream packet, otherwise 0
 void *private;
 };
 
-- 
1.7.4.2



pgpIqz99qIDIe.pgp
Description: PGP signature
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] introduce side information in AVPacket

2011-04-07 Thread Kostya
On Thu, Apr 07, 2011 at 06:54:29AM +0200, Janne Grunau wrote:
 On Wed, Apr 06, 2011 at 10:26:08PM +0200, Kostya Shishkov wrote:
  This adds side information to AVPacket
  
  ---
   libavcodec/avcodec.h  |   21 +
   libavcodec/avpacket.c |   39 +++
   libavcodec/version.h  |2 +-
   3 files changed, 61 insertions(+), 1 deletions(-)
  
  diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
  index 95a933d..4b7bedc 100644
  --- a/libavcodec/avcodec.h
  +++ b/libavcodec/avcodec.h
  @@ -1054,6 +1054,14 @@ typedef struct AVPacket {
   int64_t dts;
   uint8_t *data;
   int   size;
  +/**
  + * Additional packet data that may be provided by container. If present
  + * it should declare side data type and size.
  + */
  +uint8_t *side_data;
  +int   side_data_size;
  +int   side_data_type;
  +
   int   stream_index;
   int   flags;
   /**
  @@ -1089,6 +1097,9 @@ typedef struct AVPacket {
   #define PKT_FLAG_KEY AV_PKT_FLAG_KEY
   #endif
   
  +#define AV_PKT_DATA_NONE 0 /// no packet side information
  +#define AV_PKT_DATA_PAL  1 /// packet side information contains new 
  palette
 
 enum?

not in that neighbourhood
 
  +
   /**
* Audio Video Frame.
* New fields can be added to the end of FF_COMMON_FRAME with minor version
  @@ -3190,6 +3201,16 @@ void av_shrink_packet(AVPacket *pkt, int size);
   int av_grow_packet(AVPacket *pkt, int grow_by);
   
   /**
  + * Allocate the side information of a packet.
  + *
  + * @param pkt packet
  + * @param type side information type (AV_PKT_DATA_*)
  + * @param size wanted side information size
  + * @return 0 if OK, AVERROR_xxx otherwise
  + */
  +int av_new_packet_side_data(AVPacket *pkt, int type, int size);
 
 av_packet_new_side_data() is less confusing

renamed
 
  +/**
* @warning This is a hack - the packet memory allocation stuff is broken. 
  The
* packet is allocated if it was not really allocated.
*/
  diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
  index f6aef20..ef16bbd 100644
  --- a/libavcodec/avpacket.c
  +++ b/libavcodec/avpacket.c
  @@ -26,12 +26,18 @@
   void av_destruct_packet_nofree(AVPacket *pkt)
   {
   pkt-data = NULL; pkt-size = 0;
  +pkt-side_data  = NULL;
  +pkt-side_data_size = 0;
 
 is av_destruct_packet_nofree only called on duplicated packets?
 otherwise this leaks memory in cases there only packet.data is used and
 freed.

yes, it's for duplicated packets only

From bb18bdff543fd8c5d3e3c89350520be7932594b9 Mon Sep 17 00:00:00 2001
From: Kostya Shishkov kostya.shish...@gmail.com
Date: Thu, 7 Apr 2011 09:45:47 +0200
Subject: [PATCH 1/2] introduce side information in AVPacket

---
 libavcodec/avcodec.h  |   21 +
 libavcodec/avpacket.c |   41 +
 libavcodec/version.h  |2 +-
 3 files changed, 63 insertions(+), 1 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 95a933d..3731a6c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1054,6 +1054,14 @@ typedef struct AVPacket {
 int64_t dts;
 uint8_t *data;
 int   size;
+/**
+ * Additional packet data that may be provided by container. If present
+ * it should declare side data type and size.
+ */
+uint8_t *side_data;
+int   side_data_size;
+int   side_data_type;
+
 int   stream_index;
 int   flags;
 /**
@@ -1089,6 +1097,9 @@ typedef struct AVPacket {
 #define PKT_FLAG_KEY AV_PKT_FLAG_KEY
 #endif
 
+#define AV_PKT_DATA_NONE 0 /// no packet side information
+#define AV_PKT_DATA_PAL  1 /// packet side information contains new palette
+
 /**
  * Audio Video Frame.
  * New fields can be added to the end of FF_COMMON_FRAME with minor version
@@ -3190,6 +3201,16 @@ void av_shrink_packet(AVPacket *pkt, int size);
 int av_grow_packet(AVPacket *pkt, int grow_by);
 
 /**
+ * Allocate the side information of a packet.
+ *
+ * @param pkt packet
+ * @param type side information type (AV_PKT_DATA_*)
+ * @param size wanted side information size
+ * @return 0 if OK, AVERROR_xxx otherwise
+ */
+int av_packet_new_side_data(AVPacket *pkt, int type, int size);
+
+/**
  * @warning This is a hack - the packet memory allocation stuff is broken. The
  * packet is allocated if it was not really allocated.
  */
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index f6aef20..2cce0f1 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -26,12 +26,18 @@
 void av_destruct_packet_nofree(AVPacket *pkt)
 {
 pkt-data = NULL; pkt-size = 0;
+pkt-side_data  = NULL;
+pkt-side_data_size = 0;
 }
 
 void av_destruct_packet(AVPacket *pkt)
 {
 av_free(pkt-data);
 pkt-data = NULL; pkt-size = 0;
+av_free(pkt-side_data);
+pkt-side_data  = NULL;
+pkt-side_data_size = 0;
+pkt-side_data_type = AV_PKT_DATA_NONE;
 }
 
 void av_init_packet(AVPacket *pkt)
@@ -44,6 +50,9 @@ void 

Re: [libav-devel] [PATCH 3/3] Make demuxers and codecs use AVPacket for passing new palette

2011-04-07 Thread Kostya
On Wed, Apr 06, 2011 at 10:27:41PM +0200, Kostya Shishkov wrote:
 

Refreshed version for av_new_packet_side_data() - av_packet_new_size_data()
rename.
From 46cc7e3047b196dc616d58ffeca2d69731627aa9 Mon Sep 17 00:00:00 2001
From: Kostya Shishkov kostya.shish...@gmail.com
Date: Thu, 7 Apr 2011 10:16:31 +0200
Subject: [PATCH 2/2] make demuxers and codecs use AVPacket for passing new palette

---
 libavcodec/8bps.c   |   18 --
 libavcodec/cinepak.c|   18 +-
 libavcodec/idcinvideo.c |   11 +--
 libavcodec/interplayvideo.c |   16 ++--
 libavcodec/kmvc.c   |   15 +--
 libavcodec/msrle.c  |   15 +++
 libavcodec/msvideo1.c   |   20 +---
 libavcodec/qpeg.c   |   11 ---
 libavcodec/qtrle.c  |   10 ++
 libavcodec/rawdec.c |7 ---
 libavcodec/smc.c|   12 +++-
 libavcodec/targa.c  |7 ---
 libavcodec/tscc.c   |8 +---
 libavformat/asf.h   |2 ++
 libavformat/asfdec.c|   18 --
 libavformat/avidec.c|   22 +-
 libavformat/idcin.c |   14 --
 libavformat/ipmovie.c   |   19 +++
 libavformat/isom.h  |2 ++
 libavformat/mov.c   |   17 -
 20 files changed, 131 insertions(+), 131 deletions(-)

diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
index 1c6d406..c6081aa 100644
--- a/libavcodec/8bps.c
+++ b/libavcodec/8bps.c
@@ -50,6 +50,8 @@ typedef struct EightBpsContext {
 
 unsigned char planes;
 unsigned char planemap[4];
+
+uint32_t pal[256];
 } EightBpsContext;
 
 
@@ -129,13 +131,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
 }
 }
 
-if (avctx-palctrl) {
-memcpy (c-pic.data[1], avctx-palctrl-palette, AVPALETTE_SIZE);
-if (avctx-palctrl-palette_changed) {
+if (avctx-bits_per_coded_sample = 8) {
+if (avpkt-side_data_type == AV_PKT_DATA_PAL) {
 c-pic.palette_has_changed = 1;
-avctx-palctrl-palette_changed = 0;
-} else
-c-pic.palette_has_changed = 0;
+memcpy(c-pal, avpkt-side_data, AVPALETTE_SIZE);
+}
+
+memcpy (c-pic.data[1], c-pal, AVPALETTE_SIZE);
 }
 
 *data_size = sizeof(AVFrame);
@@ -164,10 +166,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
 avctx-pix_fmt = PIX_FMT_PAL8;
 c-planes = 1;
 c-planemap[0] = 0; // 1st plane is palette indexes
-if (avctx-palctrl == NULL) {
-av_log(avctx, AV_LOG_ERROR, Error: PAL8 format but no palette from demuxer.\n);
-return -1;
-}
 break;
 case 24:
 avctx-pix_fmt = avctx-get_format(avctx, pixfmt_rgb24);
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
index f325bdb..a441372 100644
--- a/libavcodec/cinepak.c
+++ b/libavcodec/cinepak.c
@@ -67,6 +67,7 @@ typedef struct CinepakContext {
 
 int sega_film_skip_bytes;
 
+uint32_t pal[256];
 } CinepakContext;
 
 static void cinepak_decode_codebook (cvid_codebook *codebook,
@@ -395,7 +396,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx)
 s-sega_film_skip_bytes = -1;  /* uninitialized state */
 
 // check for paletted data
-if ((avctx-palctrl == NULL) || (avctx-bits_per_coded_sample == 40)) {
+if (avctx-bits_per_coded_sample != 8) {
 s-palette_video = 0;
 avctx-pix_fmt = PIX_FMT_YUV420P;
 } else {
@@ -427,16 +428,15 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
 return -1;
 }
 
+if (s-palette_video  avpkt-side_data_type == AV_PKT_DATA_PAL) {
+s-frame.palette_has_changed = 1;
+memcpy(s-pal, avpkt-side_data, AVPALETTE_SIZE);
+}
+
 cinepak_decode(s);
 
-if (s-palette_video) {
-memcpy (s-frame.data[1], avctx-palctrl-palette, AVPALETTE_SIZE);
-if (avctx-palctrl-palette_changed) {
-s-frame.palette_has_changed = 1;
-avctx-palctrl-palette_changed = 0;
-} else
-s-frame.palette_has_changed = 0;
-}
+if (s-palette_video)
+memcpy (s-frame.data[1], s-pal, AVPALETTE_SIZE);
 
 *data_size = sizeof(AVFrame);
 *(AVFrame*)data = s-frame;
diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c
index b8d47ad..5ccdecb 100644
--- a/libavcodec/idcinvideo.c
+++ b/libavcodec/idcinvideo.c
@@ -72,6 +72,7 @@ typedef struct IdcinContext {
 hnode huff_nodes[256][HUF_TOKENS*2];
 int num_huff_nodes[256];
 
+uint32_t pal[256];
 } 

Re: [libav-devel] [PATCH 1/3] introduce side information in AVPacket

2011-04-07 Thread Luca Barbato
On 04/07/2011 06:54 AM, Janne Grunau wrote:
 On Wed, Apr 06, 2011 at 10:26:08PM +0200, Kostya Shishkov wrote:
 This adds side information to AVPacket

 ---
  libavcodec/avcodec.h  |   21 +
  libavcodec/avpacket.c |   39 +++
  libavcodec/version.h  |2 +-
  3 files changed, 61 insertions(+), 1 deletions(-)

 diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
 index 95a933d..4b7bedc 100644
 --- a/libavcodec/avcodec.h
 +++ b/libavcodec/avcodec.h
 @@ -1054,6 +1054,14 @@ typedef struct AVPacket {
  int64_t dts;
  uint8_t *data;
  int   size;
 +/**
 + * Additional packet data that may be provided by container. If present
 + * it should declare side data type and size.
 + */
 +uint8_t *side_data;
 +int   side_data_size;
 +int   side_data_type;
 +
  int   stream_index;
  int   flags;
  /**
 @@ -1089,6 +1097,9 @@ typedef struct AVPacket {
  #define PKT_FLAG_KEY AV_PKT_FLAG_KEY
  #endif
  
 +#define AV_PKT_DATA_NONE 0 /// no packet side information
 +#define AV_PKT_DATA_PAL  1 /// packet side information contains new palette
 
 enum?
 
 +
  /**
   * Audio Video Frame.
   * New fields can be added to the end of FF_COMMON_FRAME with minor version
 @@ -3190,6 +3201,16 @@ void av_shrink_packet(AVPacket *pkt, int size);
  int av_grow_packet(AVPacket *pkt, int grow_by);
  
  /**
 + * Allocate the side information of a packet.
 + *
 + * @param pkt packet
 + * @param type side information type (AV_PKT_DATA_*)
 + * @param size wanted side information size
 + * @return 0 if OK, AVERROR_xxx otherwise
 + */
 +int av_new_packet_side_data(AVPacket *pkt, int type, int size);
 
 av_packet_new_side_data() is less confusing

I'd rather have avpacket_ as namespace.

lu

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] oggdec: fix streaming with continuous audio streams (issue2337)

2011-04-07 Thread Luca Barbato
On 04/07/2011 10:23 AM, Clément Bœsch wrote:
 ---
  libavformat/oggdec.c |   16 
  libavformat/oggdec.h |1 +
  2 files changed, 17 insertions(+), 0 deletions(-)
 

Looks fine, I hope there aren't ogg files that break because somebody
decided putting streams around would be fun.

lu

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] introduce side information in AVPacket

2011-04-07 Thread Kostya
On Thu, Apr 07, 2011 at 09:53:11AM +0200, Luca Barbato wrote:
 On 04/07/2011 06:54 AM, Janne Grunau wrote:
  On Wed, Apr 06, 2011 at 10:26:08PM +0200, Kostya Shishkov wrote:
  This adds side information to AVPacket
 
  ---
   libavcodec/avcodec.h  |   21 +
   libavcodec/avpacket.c |   39 +++
   libavcodec/version.h  |2 +-
   3 files changed, 61 insertions(+), 1 deletions(-)
 
  diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
  index 95a933d..4b7bedc 100644
  --- a/libavcodec/avcodec.h
  +++ b/libavcodec/avcodec.h
  @@ -1054,6 +1054,14 @@ typedef struct AVPacket {
   int64_t dts;
   uint8_t *data;
   int   size;
  +/**
  + * Additional packet data that may be provided by container. If 
  present
  + * it should declare side data type and size.
  + */
  +uint8_t *side_data;
  +int   side_data_size;
  +int   side_data_type;
  +
   int   stream_index;
   int   flags;
   /**
  @@ -1089,6 +1097,9 @@ typedef struct AVPacket {
   #define PKT_FLAG_KEY AV_PKT_FLAG_KEY
   #endif
   
  +#define AV_PKT_DATA_NONE 0 /// no packet side information
  +#define AV_PKT_DATA_PAL  1 /// packet side information contains new 
  palette
  
  enum?
  
  +
   /**
* Audio Video Frame.
* New fields can be added to the end of FF_COMMON_FRAME with minor 
  version
  @@ -3190,6 +3201,16 @@ void av_shrink_packet(AVPacket *pkt, int size);
   int av_grow_packet(AVPacket *pkt, int grow_by);
   
   /**
  + * Allocate the side information of a packet.
  + *
  + * @param pkt packet
  + * @param type side information type (AV_PKT_DATA_*)
  + * @param size wanted side information size
  + * @return 0 if OK, AVERROR_xxx otherwise
  + */
  +int av_new_packet_side_data(AVPacket *pkt, int type, int size);
  
  av_packet_new_side_data() is less confusing
 
 I'd rather have avpacket_ as namespace.

Nothing (except for mail size limit in mailer) prevents you from sending such
rename patch.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] lavf: update AVStream.nb_frames when muxing.

2011-04-07 Thread Anton Khirnov
On Wed, Apr 06, 2011 at 05:33:32PM -0400, Ronald S. Bultje wrote:
 Hi,
 
 On Tue, Mar 29, 2011 at 1:38 PM, Anton Khirnov an...@khirnov.net wrote:
  On Tue, Mar 29, 2011 at 10:09:35AM -0700, Ronald S. Bultje wrote:
  Hi,
 
  On Tue, Mar 29, 2011 at 9:55 AM, Anton Khirnov an...@khirnov.net wrote:
   On Tue, Mar 29, 2011 at 05:59:49AM -0700, Ronald S. Bultje wrote:
  
   Not really. Can you confirm (likely requires a little debugging) that
   either with or without that piece of code, the number of mp2/3 frames
   written into a Xing or MPEG file is correct?
  
   Number of frames written is the same in both cases, since mp3 isn't
   interleaved and no frames get written in av_write_trailer().
   In any case, I don't see why the number of frames would be off by one.
   If anything, wouldn't it be off by a huge amount when frame != packet?
  
   Anyways, what we can do is:
   1) abuse nb_frames field with a note that it will be wrong when packet
   != frame (slightly evil)
   2) add a nb_packets field (somewhat bloaty)
   3) have each muxer manage this by itself (evil)
 
  You're confusing av_write_frame()/interleaved_frame() with
  av_write_packet(). They do exactly what you think they do (I hope).
 
  There is no av_write_packet() =p
 
  AFAIU (and please correct me if I am wrong), there is av_write_frame,
  which takes an AVPacket and directly writes it to the output file and
  av_interleaved_write_frame(), which also takes an AVPacket and adds it
  to queue for proper interleaving.
 
 Blegh. Anyway, can you confirm please that writing a MP3 (either
 stream-copy from whatever source, e.g. MPEG-1 system stream) as well
 as encoded MP3 using lame both writes out the correct number of frames
 in the Xing header?
 

Encoding with the libmp3lame wrapper adds one frame of silence at the
end, so number of frames written is one higher then with -acodec copy.
Encoding with lame commandline tool adds a frame of silence at the
beginning and a frame of silence at then end, so number of frames
written is two higher than with -acodec copy.

-- 
Anton Khirnov


signature.asc
Description: Digital signature
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] introduce side information in AVPacket

2011-04-07 Thread Luca Barbato
On 04/07/2011 10:40 AM, Kostya wrote:
 Nothing (except for mail size limit in mailer) prevents you from sending such
 rename patch.

Will do soon =)

lu

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [ANNOUNCEMENT] vo-aacenc 0.1.0 and vo-amrwbenc 0.1.0

2011-04-07 Thread Martin Storsjö
Hi,

When Google released the code for Android Gingerbread in December, they 
released source code for two new Apache 2.0 licensed audio encoders 
provided by VisualOn, for AAC and AMR-WB.

These encoders are now wrapped up in standalone encoder libraries, 
vo-aacenc and vo-amrwbenc, just as for opencore-amr (which included an 
AMR-NB encoder and decoder, and an AMR-WB decoder) before.

These projects, while not sharing any code with opencore-amr, are quite 
similar in their heritage and style (being a standalone wrapping of codecs 
from another framework), and are hosted under the opencore-amr sourceforge 
project for now. The release files are available at 
https://sourceforge.net/projects/opencore-amr/files/, and the code is 
available in git at 
git://opencore-amr.git.sourceforge.net/gitroot/opencore-amr/vo-aacenc
and 
git://opencore-amr.git.sourceforge.net/gitroot/opencore-amr/vo-amrwbenc 
respectively.

The same code is also available on github, at 
https://github.com/mstorsjo/vo-aacenc and 
https://github.com/mstorsjo/vo-amrwbenc for easier collaboration.

The vo-amrwbenc library provides a very minimal interface similar to what 
the old, unredistributable libamrwb used, so any code that used that 
library can easily be adapted to use vo-amrwbenc instead. The vo-aacenc 
library, on the other hand, directly exposes the VisualOn audio codec 
interface. Both libraries come with an optional example program showing 
how to use their interfaces.

The code in these libraries are (just as for opencore-amr) relicensed 
versions of 3GPP reference code, but all of it has, to the best of my 
knowledge, been checked for legal correctness by Google.

In addition to the original reference code, they also contain some 
optimizations for ARM, initially done by VisualOn, and further improved by 
Mans Rullgard.

Regards,
// Martin Storsjo
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/2] Add an AAC encoder by using the libvo-aacenc library

2011-04-07 Thread Martin Storsjö
---
 Changelog |1 +
 configure |6 ++
 libavcodec/Makefile   |1 +
 libavcodec/allcodecs.c|1 +
 libavcodec/libvo-aacenc.c |  132 +
 5 files changed, 141 insertions(+), 0 deletions(-)
 create mode 100644 libavcodec/libvo-aacenc.c

diff --git a/Changelog b/Changelog
index ec09c28..6a255d4 100644
--- a/Changelog
+++ b/Changelog
@@ -83,6 +83,7 @@ version next:
 - Linux framebuffer input device added
 - Chronomaster DFA decoder
 - Mobotix MxPEG decoder
+- AAC encoding via libvo-aacenc
 
 
 version 0.6:
diff --git a/configure b/configure
index 92a809f..8880fba 100755
--- a/configure
+++ b/configure
@@ -178,6 +178,7 @@ External library support:
   --enable-libschroedinger enable Dirac support via libschroedinger [no]
   --enable-libspeexenable Speex decoding via libspeex [no]
   --enable-libtheora   enable Theora encoding via libtheora [no]
+  --enable-libvo-aacencenable AAC encoding via libvo-aacenc [no]
   --enable-libvorbis   enable Vorbis encoding via libvorbis,
native implementation exists [no]
   --enable-libvpx  enable VP8 support via libvpx [no]
@@ -937,6 +938,7 @@ CONFIG_LIST=
 libschroedinger
 libspeex
 libtheora
+libvo_aacenc
 libvorbis
 libvpx
 libx264
@@ -1384,6 +1386,7 @@ libschroedinger_decoder_deps=libschroedinger
 libschroedinger_encoder_deps=libschroedinger
 libspeex_decoder_deps=libspeex
 libtheora_encoder_deps=libtheora
+libvo_aacenc_encoder_deps=libvo_aacenc
 libvorbis_encoder_deps=libvorbis
 libvpx_decoder_deps=libvpx
 libvpx_encoder_deps=libvpx
@@ -2525,6 +2528,7 @@ die_license_disabled nonfree libfaac
 
 die_license_disabled version3 libopencore_amrnb
 die_license_disabled version3 libopencore_amrwb
+die_license_disabled version3 libvo_aacenc
 
 enabled version3  { enabled gpl  enable gplv3 || enable lgplv3; }
 
@@ -2864,6 +2868,7 @@ enabled librtmp require_pkg_config librtmp 
librtmp/rtmp.h RTMP_Socket
 enabled libschroedinger  require_pkg_config schroedinger-1.0 
schroedinger/schro.h schro_init
 enabled libspeexrequire  libspeex speex/speex.h speex_decoder_init 
-lspeex
 enabled libtheora   require  libtheora theora/theoraenc.h th_info_init 
-ltheoraenc -ltheoradec -logg
+enabled libvo_aacenc  require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI 
-lvo-aacenc
 enabled libvorbis   require  libvorbis vorbis/vorbisenc.h vorbis_info_init 
-lvorbisenc -lvorbis -logg
 enabled libvpx  {
 enabled libvpx_decoder  { check_lib2 vpx/vpx_decoder.h vpx/vp8dx.h 
vpx_codec_dec_init_ver -lvpx ||
@@ -3132,6 +3137,7 @@ echo libschroedinger enabled   ${libschroedinger-no}
 echo libspeex enabled  ${libspeex-no}
 echo libtheora enabled ${libtheora-no}
 echo libva enabled ${vaapi-no}
+echo libvo-aacenc support  ${libvo_aacenc-no}
 echo libvorbis enabled ${libvorbis-no}
 echo libvpx enabled${libvpx-no}
 echo libx264 enabled   ${libx264-no}
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 837f7e2..e9c40e4 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -568,6 +568,7 @@ OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER)+= 
libschroedingerenc.o \
  libdirac_libschro.o
 OBJS-$(CONFIG_LIBSPEEX_DECODER)   += libspeexdec.o
 OBJS-$(CONFIG_LIBTHEORA_ENCODER)  += libtheoraenc.o
+OBJS-$(CONFIG_LIBVO_AACENC_ENCODER)   += libvo-aacenc.o mpeg4audio.o
 OBJS-$(CONFIG_LIBVORBIS_ENCODER)  += libvorbis.o vorbis_data.o
 OBJS-$(CONFIG_LIBVPX_DECODER) += libvpxdec.o
 OBJS-$(CONFIG_LIBVPX_ENCODER) += libvpxenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 7636392..e0323ac 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -366,6 +366,7 @@ void avcodec_register_all(void)
 REGISTER_ENCDEC  (LIBSCHROEDINGER, libschroedinger);
 REGISTER_DECODER (LIBSPEEX, libspeex);
 REGISTER_ENCODER (LIBTHEORA, libtheora);
+REGISTER_ENCODER (LIBVO_AACENC, libvo_aacenc);
 REGISTER_ENCODER (LIBVORBIS, libvorbis);
 REGISTER_ENCDEC  (LIBVPX, libvpx);
 REGISTER_ENCODER (LIBX264, libx264);
diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c
new file mode 100644
index 000..34389f1
--- /dev/null
+++ b/libavcodec/libvo-aacenc.c
@@ -0,0 +1,132 @@
+/*
+ * AAC encoder wrapper
+ * Copyright (c) 2010 Martin Storsjo
+ *
+ * This file is part of Libav.
+ *
+ * Libav 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.
+ *
+ * Libav 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 

[libav-devel] [PATCH 2/2] Add support for AMR-WB encoding via libvo-amrwbenc

2011-04-07 Thread Martin Storsjö
The wrapper code is based on the libamr wrapper removed in SVN rev 19365.
---
 Changelog   |1 +
 configure   |6 ++
 doc/general.texi|3 +-
 libavcodec/Makefile |1 +
 libavcodec/allcodecs.c  |1 +
 libavcodec/libvo-amrwbenc.c |  128 +++
 6 files changed, 139 insertions(+), 1 deletions(-)
 create mode 100644 libavcodec/libvo-amrwbenc.c

diff --git a/Changelog b/Changelog
index 6a255d4..87ec036 100644
--- a/Changelog
+++ b/Changelog
@@ -84,6 +84,7 @@ version next:
 - Chronomaster DFA decoder
 - Mobotix MxPEG decoder
 - AAC encoding via libvo-aacenc
+- AMR-WB encoding via libvo-amrwbenc
 
 
 version 0.6:
diff --git a/configure b/configure
index 8880fba..c632ce5 100755
--- a/configure
+++ b/configure
@@ -179,6 +179,7 @@ External library support:
   --enable-libspeexenable Speex decoding via libspeex [no]
   --enable-libtheora   enable Theora encoding via libtheora [no]
   --enable-libvo-aacencenable AAC encoding via libvo-aacenc [no]
+  --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
   --enable-libvorbis   enable Vorbis encoding via libvorbis,
native implementation exists [no]
   --enable-libvpx  enable VP8 support via libvpx [no]
@@ -939,6 +940,7 @@ CONFIG_LIST=
 libspeex
 libtheora
 libvo_aacenc
+libvo_amrwbenc
 libvorbis
 libvpx
 libx264
@@ -1387,6 +1389,7 @@ libschroedinger_encoder_deps=libschroedinger
 libspeex_decoder_deps=libspeex
 libtheora_encoder_deps=libtheora
 libvo_aacenc_encoder_deps=libvo_aacenc
+libvo_amrwbenc_encoder_deps=libvo_amrwbenc
 libvorbis_encoder_deps=libvorbis
 libvpx_decoder_deps=libvpx
 libvpx_encoder_deps=libvpx
@@ -2529,6 +2532,7 @@ die_license_disabled nonfree libfaac
 die_license_disabled version3 libopencore_amrnb
 die_license_disabled version3 libopencore_amrwb
 die_license_disabled version3 libvo_aacenc
+die_license_disabled version3 libvo_amrwbenc
 
 enabled version3  { enabled gpl  enable gplv3 || enable lgplv3; }
 
@@ -2869,6 +2873,7 @@ enabled libschroedinger  require_pkg_config 
schroedinger-1.0 schroedinger/schr
 enabled libspeexrequire  libspeex speex/speex.h speex_decoder_init 
-lspeex
 enabled libtheora   require  libtheora theora/theoraenc.h th_info_init 
-ltheoraenc -ltheoradec -logg
 enabled libvo_aacenc  require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI 
-lvo-aacenc
+enabled libvo_amrwbenc  require libvo_amrwbenc vo-amrwbenc/enc_if.h 
E_IF_init -lvo-amrwbenc
 enabled libvorbis   require  libvorbis vorbis/vorbisenc.h vorbis_info_init 
-lvorbisenc -lvorbis -logg
 enabled libvpx  {
 enabled libvpx_decoder  { check_lib2 vpx/vpx_decoder.h vpx/vp8dx.h 
vpx_codec_dec_init_ver -lvpx ||
@@ -3138,6 +3143,7 @@ echo libspeex enabled  ${libspeex-no}
 echo libtheora enabled ${libtheora-no}
 echo libva enabled ${vaapi-no}
 echo libvo-aacenc support  ${libvo_aacenc-no}
+echo libvo-amrwbenc support${libvo_amrwbenc-no}
 echo libvorbis enabled ${libvorbis-no}
 echo libvpx enabled${libvpx-no}
 echo libx264 enabled   ${libx264-no}
diff --git a/doc/general.texi b/doc/general.texi
index 5d66e42..d4cdc3b 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -588,7 +588,8 @@ following image formats are supported:
 @item ADPCM Yamaha   @tab  X  @tab  X
 @item AMR-NB @tab  E  @tab  X
 @tab encoding supported through external library libopencore-amrnb
-@item AMR-WB @tab @tab  X
+@item AMR-WB @tab  E  @tab  X
+@tab encoding supported through external library libvo-amrwbenc
 @item Apple lossless audio   @tab  X  @tab  X
 @tab QuickTime fourcc 'alac'
 @item Atrac 1@tab @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index e9c40e4..1cdae2c 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -569,6 +569,7 @@ OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER)+= 
libschroedingerenc.o \
 OBJS-$(CONFIG_LIBSPEEX_DECODER)   += libspeexdec.o
 OBJS-$(CONFIG_LIBTHEORA_ENCODER)  += libtheoraenc.o
 OBJS-$(CONFIG_LIBVO_AACENC_ENCODER)   += libvo-aacenc.o mpeg4audio.o
+OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
 OBJS-$(CONFIG_LIBVORBIS_ENCODER)  += libvorbis.o vorbis_data.o
 OBJS-$(CONFIG_LIBVPX_DECODER) += libvpxdec.o
 OBJS-$(CONFIG_LIBVPX_ENCODER) += libvpxenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index e0323ac..40a7e23 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -367,6 +367,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER (LIBSPEEX, libspeex);
 REGISTER_ENCODER (LIBTHEORA, libtheora);
 REGISTER_ENCODER (LIBVO_AACENC, libvo_aacenc);
+REGISTER_ENCODER (LIBVO_AMRWBENC, libvo_amrwbenc);
 REGISTER_ENCODER (LIBVORBIS, libvorbis);
 REGISTER_ENCDEC  (LIBVPX, 

Re: [libav-devel] [PATCH 1/2] Add an AAC encoder by using the libvo-aacenc library

2011-04-07 Thread Martin Storsjö
On Thu, 7 Apr 2011, Jindřich Makovička wrote:

 On Thu, Apr 7, 2011 at 11:18, Martin Storsjö mar...@martin.st wrote:
 
  +    memset(params, 0, sizeof(params));
  +    params.sampleRate = avctx-sample_rate;
  +    params.bitRate = avctx-bit_rate;
  +    params.nChannels = avctx-channels;
  +    params.adtsUsed = 0;
 
 I think adtsUsed should be set based on CODEC_FLAG_GLOBAL_HEADER ,
 otherwise the AAC output muxed into MPEG-TS won't be playable.
 
 i.e. params.adtsUsed = !(avctx-flags  CODEC_FLAG_GLOBAL_HEADER)

Good point, fixed locally.

Actually, .ts files with data encoded with this encoder, without this fix, 
apprears to work with ffplay at least, but other decoders might of course 
not be so tolerant.

// Martin___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] proto: include os_support.h in network.h

2011-04-07 Thread Luca Barbato
Fix compilation on systems without poll()
---
 libavformat/network.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/libavformat/network.h b/libavformat/network.h
index 6943bc6..84a8f53 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -22,6 +22,7 @@
 #define AVFORMAT_NETWORK_H
 
 #include config.h
+#include os_support.h
 
 #if HAVE_WINSOCK2_H
 #include winsock2.h
-- 
1.7.4.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] Add an AAC encoder by using the libvo-aacenc library

2011-04-07 Thread Alex Converse
On Thu, Apr 7, 2011 at 2:18 AM, Martin Storsjö mar...@martin.st wrote:
 ---
  Changelog                 |    1 +
  configure                 |    6 ++
  libavcodec/Makefile       |    1 +
  libavcodec/allcodecs.c    |    1 +
  libavcodec/libvo-aacenc.c |  132 
 +
  5 files changed, 141 insertions(+), 0 deletions(-)
  create mode 100644 libavcodec/libvo-aacenc.c


Perhaps we should remove faac then? Do we need two third party aac encoders?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] Add an AAC encoder by using the libvo-aacenc library

2011-04-07 Thread Martin Storsjö
On Thu, 7 Apr 2011, Alex Converse wrote:

 On Thu, Apr 7, 2011 at 2:18 AM, Martin Storsjö mar...@martin.st wrote:
  ---
   Changelog                 |    1 +
   configure                 |    6 ++
   libavcodec/Makefile       |    1 +
   libavcodec/allcodecs.c    |    1 +
   libavcodec/libvo-aacenc.c |  132 
  +
   5 files changed, 141 insertions(+), 0 deletions(-)
   create mode 100644 libavcodec/libvo-aacenc.c
 
 
 Perhaps we should remove faac then? Do we need two third party aac encoders?

Probably not, if there aren't any particular features of libfaac that 
vo-aacenc doesn't have, that we care about. libfaac seems to support 
different profiles, and I'm not sure that the visualon code has support 
for that, at least not in the external api at the moment.

// Martin___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] configure: fail if an element is explicitely configured but dependencies are not enabled

2011-04-07 Thread Måns Rullgård
Reinhard Tartler siret...@tauware.de writes:

 On Sun, Apr 03, 2011 at 15:42:43 (CEST), Måns Rullgård wrote:

 There is nothing confusing at all.  Two simple rules:

 1. Everything is enabled by default.
 2. External libs must be explicitly enabled.

 Thus far, nobody has complained about this.  Until someone does, I'm not
 changing it.  Your meta-complaint does not count.

 Can we have a switch (not necessarily a configure switch) to change
 policy 2?

 Background: The configure line in the debian package is awfully long
 because I try to enable any external libraries that are available in
 Debian, which makes /usr/bin/ffmpeg output a configuration string of
 several lines.

Weren't we going to prune the default console spam?

-- 
Måns Rullgård
m...@mansr.com
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/2] avio: deprecate av_protocol_next().

2011-04-07 Thread Anton Khirnov
---
 cmdutils.c |   20 
 libavformat/avio.c |2 ++
 libavformat/avio.h |4 +++-
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index 6901f56..cc10b48 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -653,20 +653,16 @@ void show_bsfs(void)
 
 void show_protocols(void)
 {
-URLProtocol *up=NULL;
+void *opaque = NULL;
+const char *name;
 
 printf(Supported file protocols:\n
-   I.. = Input  supported\n
-   .O. = Output supported\n
-   ..S = Seek   supported\n
-   FLAGS NAME\n
-   - \n);
-while((up = av_protocol_next(up)))
-printf(%c%c%c   %s\n,
-   up-url_read  ? 'I' : '.',
-   up-url_write ? 'O' : '.',
-   up-url_seek  ? 'S' : '.',
-   up-name);
+   Input:\n);
+while ((name = avio_enum_protocols(opaque, 0)))
+printf(%s\n, name);
+printf(Output:\n);
+while ((name = avio_enum_protocols(opaque, 1)))
+printf(%s\n, name);
 }
 
 void show_filters(void)
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 0ea66b3..e68ae99 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -51,11 +51,13 @@ static int default_interrupt_cb(void);
 URLProtocol *first_protocol = NULL;
 URLInterruptCB *url_interrupt_cb = default_interrupt_cb;
 
+#if FF_API_OLD_AVIO
 URLProtocol *av_protocol_next(URLProtocol *p)
 {
 if(p) return p-next;
 else  return first_protocol;
 }
+#endif
 
 const char *avio_enum_protocols(void **opaque, int output)
 {
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 294afcb..f182794 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -167,12 +167,14 @@ extern URLProtocol *first_protocol;
 extern URLInterruptCB *url_interrupt_cb;
 #endif
 
+#if FF_API_OLD_AVIO
 /**
  * If protocol is NULL, returns the first registered protocol,
  * if protocol is non-NULL, returns the next registered protocol after 
protocol,
  * or NULL if protocol is the last one.
  */
-URLProtocol *av_protocol_next(URLProtocol *p);
+attribute_deprecated URLProtocol *av_protocol_next(URLProtocol *p);
+#endif
 
 #if FF_API_REGISTER_PROTOCOL
 /**
-- 
1.7.4.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/2] avio: add a function for iterating though protocol names.

2011-04-07 Thread Anton Khirnov
---
 libavformat/avio.c |   10 ++
 libavformat/avio.h |   13 +
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 1d40da6..0ea66b3 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -57,6 +57,16 @@ URLProtocol *av_protocol_next(URLProtocol *p)
 else  return first_protocol;
 }
 
+const char *avio_enum_protocols(void **opaque, int output)
+{
+URLProtocol **p = opaque;
+*p =   *p ? (*p)-next : first_protocol;
+if (!*p) return NULL;
+if ((output  (*p)-url_write) || (!output  (*p)-url_read))
+return (*p)-name;
+return avio_enum_protocols(opaque, output);
+}
+
 int ffurl_register_protocol(URLProtocol *protocol, int size)
 {
 URLProtocol **p;
diff --git a/libavformat/avio.h b/libavformat/avio.h
index e9aa499..294afcb 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -597,4 +597,17 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
 int udp_get_file_handle(URLContext *h);
 #endif
 
+/**
+ * Iterate through names of available protocols.
+ *
+ * @param opaque A private pointer representing current protocol.
+ *It must be a pointer to NULL on first iteration and will
+ *be updated by successive calls to avio_enum_protocols.
+ * @param output If set to 1, iterate over output protocols,
+ *   otherwise over input protocols.
+ *
+ * @return A static string containing the name of current protocol or NULL
+ */
+const char *avio_enum_protocols(void **opaque, int output);
+
 #endif /* AVFORMAT_AVIO_H */
-- 
1.7.4.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] proto: include os_support.h in network.h

2011-04-07 Thread Martin Storsjö
On Thu, 7 Apr 2011, Luca Barbato wrote:

 Fix compilation on systems without poll()
 ---
  libavformat/network.h |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
 
 diff --git a/libavformat/network.h b/libavformat/network.h
 index 6943bc6..84a8f53 100644
 --- a/libavformat/network.h
 +++ b/libavformat/network.h
 @@ -22,6 +22,7 @@
  #define AVFORMAT_NETWORK_H
  
  #include config.h
 +#include os_support.h
  
  #if HAVE_WINSOCK2_H
  #include winsock2.h
 -- 
 1.7.4.1

OK

// Martin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] Last bits of avio cleanup

2011-04-07 Thread Anton Khirnov
Hi,
with those patches, the avio cleanup is finally complete.

I'm not very sure about url_exist. It's used in ffmpeg, ffserver and
img2, but there were some problems with it [1]. There were patches from
Stefano adding a replacement [2] [3] [4], but they didn't get much
attention. Maybe we could revive them.

[1] http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2010-January/081756.html
[2] http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2010-September/097863.html
[3] http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2010-September/097864.html
[4] http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2010-September/097865.html

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/6] avio: deprecate the typedef for URLInterruptCB

2011-04-07 Thread Anton Khirnov
There's no particular reason to pollute the namespace with a typedef for
it.
---
 libavformat/avio.c |4 ++--
 libavformat/avio.h |6 ++
 libavformat/url.h  |2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index e68ae99..cdf18f6 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -49,7 +49,7 @@ static const AVClass urlcontext_class =
 static int default_interrupt_cb(void);
 
 URLProtocol *first_protocol = NULL;
-URLInterruptCB *url_interrupt_cb = default_interrupt_cb;
+int (*url_interrupt_cb)(void) = default_interrupt_cb;
 
 #if FF_API_OLD_AVIO
 URLProtocol *av_protocol_next(URLProtocol *p)
@@ -401,7 +401,7 @@ static int default_interrupt_cb(void)
 return 0;
 }
 
-void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb)
+void avio_set_interrupt_cb(int (*interrupt_cb)(void))
 {
 if (!interrupt_cb)
 interrupt_cb = default_interrupt_cb;
diff --git a/libavformat/avio.h b/libavformat/avio.h
index f182794..b27ec80 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -90,11 +90,9 @@ typedef struct URLPollEntry {
  * silently ignored.
  */
 #define URL_FLAG_NONBLOCK 4
-#endif
 
 typedef int URLInterruptCB(void);
 
-#if FF_API_OLD_AVIO
 /**
  * @defgroup old_url_funcs Old url_* functions
  * @deprecated use the buffered API based on AVIOContext instead
@@ -117,7 +115,7 @@ attribute_deprecated void url_get_filename(URLContext *h, 
char *buf, int buf_siz
 attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
 attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
   int64_t timestamp, int flags);
-attribute_deprecated void url_set_interrupt_cb(URLInterruptCB *interrupt_cb);
+attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void));
 #endif
 
 /**
@@ -132,7 +130,7 @@ int url_exist(const char *url);
  * in this case by the interrupted function. 'NULL' means no interrupt
  * callback is given.
  */
-void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb);
+void avio_set_interrupt_cb(int (*interrupt_cb)(void));
 
 #if FF_API_OLD_AVIO
 /* not implemented */
diff --git a/libavformat/url.h b/libavformat/url.h
index 7482611..941b8af 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -31,7 +31,7 @@
 #if !FF_API_OLD_AVIO
 #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /* The protocol name can be the 
first part of a nested protocol scheme */
 
-extern URLInterruptCB *url_interrupt_cb;
+extern int (*url_interrupt_cb)(void);
 #endif
 
 /**
-- 
1.7.4.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 4/6] avio: move two ff_udp_* functions from avio_internal to url.h

2011-04-07 Thread Luca Barbato
On 04/07/2011 09:16 PM, Anton Khirnov wrote:
 ---
  libavformat/avio_internal.h |4 
  libavformat/url.h   |4 
  2 files changed, 4 insertions(+), 4 deletions(-)

Ok.


-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [rfc] Protocol API

2011-04-07 Thread Anton Khirnov
On Thu, Apr 07, 2011 at 10:25:12PM +0200, Luca Barbato wrote:
 The old URLFoo api is now private, so we can try to shape it up aiming
 to have it ready and usable for the 0.8 (that means mid or end summer).
 

I am not entirely convinced that protocols should be public at all. Lavf
is primarily a muxer/demuxer library, protocols aren't its main focus.

Of course it all depends on demand for such a thing, so who wants direct
access to protocols, please speak up now.

-- 
Anton Khirnov


signature.asc
Description: Digital signature
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/6] avio: avio_ prefix for url_exist().

2011-04-07 Thread Anton Khirnov
On Thu, Apr 07, 2011 at 04:34:39PM -0400, Ronald S. Bultje wrote:
 Hi,
 
 On Thu, Apr 7, 2011 at 3:16 PM, Anton Khirnov an...@khirnov.net wrote:
  ---
   ffmpeg.c           |    2 +-
   ffserver.c         |    4 ++--
   libavformat/avio.c |    6 +-
   libavformat/avio.h |    3 ++-
   libavformat/img2.c |    6 +++---
   5 files changed, 13 insertions(+), 8 deletions(-)
 
 Should this be public? I don't think it should. For local files, it's
 trivial to re-implement in each place where it's needed. Does it work
 for non-file://-URIs?
 

It uses url_open, so I see no reason why it wouldn't.

-- 
Anton Khirnov


signature.asc
Description: Digital signature
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 3/6] asfdec: remove a forgotten declaration of nonexistent function

2011-04-07 Thread Diego Biurrun
On Thu, Apr 07, 2011 at 09:16:20PM +0200, Anton Khirnov wrote:
 ---
  libavformat/asfdec.c |2 --
  1 files changed, 0 insertions(+), 2 deletions(-)

OK

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/2] Add support for AMR-WB encoding via libvo-amrwbenc

2011-04-07 Thread Diego Biurrun
On Thu, Apr 07, 2011 at 12:45:13PM +0300, Martin Storsjö wrote:
 
 --- /dev/null
 +++ b/libavcodec/libvo-amrwbenc.c
 @@ -0,0 +1,126 @@
 +
 +#include avcodec.h
 +#include vo-amrwbenc/enc_if.h

Place system headers before local headers, separate by an empty line.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] Add an AAC encoder by using the libvo-aacenc library

2011-04-07 Thread Diego Biurrun
On Thu, Apr 07, 2011 at 12:18:53PM +0300, Martin Storsjö wrote:
 ---
  Changelog |1 +
  configure |6 ++
  libavcodec/Makefile   |1 +
  libavcodec/allcodecs.c|1 +
  libavcodec/libvo-aacenc.c |  132 
 +
  5 files changed, 141 insertions(+), 0 deletions(-)
  create mode 100644 libavcodec/libvo-aacenc.c

minor bump, docs update

 --- /dev/null
 +++ b/libavcodec/libvo-aacenc.c
 @@ -0,0 +1,132 @@
 +/*
 + * AAC encoder wrapper
 + * Copyright (c) 2010 Martin Storsjo

2011?

 +#include avcodec.h
 +#include vo-aacenc/voAAC.h
 +#include vo-aacenc/cmnMemory.h
 +#include mpeg4audio.h

Place system headers before local headers, separate by an empty line.

 +typedef struct AACContext {
 +VO_AUDIO_CODECAPI codec_api;
 +VO_HANDLE handle;
 +VO_MEM_OPERATOR mem_operator;
 +VO_CODEC_INIT_USERDATA user_data;
 +} AACContext;
 +
 +static av_cold int aac_encode_init(AVCodecContext *avctx)
 +{
 +AACContext *s = avctx-priv_data;
 +AACENC_PARAM params;
 +int index;
 +
 +memset(params, 0, sizeof(params));

Why not initialize params to 0 instead?

 +avctx-coded_frame = avcodec_alloc_frame();
 +avctx-frame_size = 1024;

 +s-mem_operator.Alloc = cmnMemAlloc;
 +s-mem_operator.Copy = cmnMemCopy;
 +s-mem_operator.Free = cmnMemFree;
 +s-mem_operator.Set = cmnMemSet;
 +s-mem_operator.Check = cmnMemCheck;
 +s-user_data.memflag = VO_IMF_USERMEMOPERATOR;
 +s-user_data.memData = s-mem_operator;
 +s-codec_api.Init(s-handle, VO_AUDIO_CodingAAC, s-user_data);

 +params.sampleRate = avctx-sample_rate;
 +params.bitRate = avctx-bit_rate;
 +params.nChannels = avctx-channels;
 +params.adtsUsed = 0;

 +avctx-extradata_size = 2;
 +avctx-extradata = av_mallocz(avctx-extradata_size +
 +  FF_INPUT_BUFFER_PADDING_SIZE);

nit: align the '='

 +static int aac_encode_frame(AVCodecContext *avctx,
 +unsigned char *frame/*out*/,
 +int buf_size, void *data/*in*/)
 +{
 +AACContext *s = avctx-priv_data;
 +VO_CODECBUFFER input, output;
 +VO_AUDIO_OUTPUTINFO output_info;
 +
 +memset(input,   0, sizeof(input));
 +memset(output,  0, sizeof(output));
 +memset(output_info, 0, sizeof(output_info));

same, initialize to 0

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] Add an AAC encoder by using the libvo-aacenc library

2011-04-07 Thread Martin Storsjö
On Fri, 8 Apr 2011, Diego Biurrun wrote:

 On Thu, Apr 07, 2011 at 12:18:53PM +0300, Martin Storsjö wrote:
  ---
   Changelog |1 +
   configure |6 ++
   libavcodec/Makefile   |1 +
   libavcodec/allcodecs.c|1 +
   libavcodec/libvo-aacenc.c |  132 
  +
   5 files changed, 141 insertions(+), 0 deletions(-)
   create mode 100644 libavcodec/libvo-aacenc.c
 
 minor bump, docs update

Added

  --- /dev/null
  +++ b/libavcodec/libvo-aacenc.c
  @@ -0,0 +1,132 @@
  +/*
  + * AAC encoder wrapper
  + * Copyright (c) 2010 Martin Storsjo
 
 2011?

I actually wrote this in December, I've only done minor touchups since.

  +#include avcodec.h
  +#include vo-aacenc/voAAC.h
  +#include vo-aacenc/cmnMemory.h
  +#include mpeg4audio.h
 
 Place system headers before local headers, separate by an empty line.

Done

  +typedef struct AACContext {
  +VO_AUDIO_CODECAPI codec_api;
  +VO_HANDLE handle;
  +VO_MEM_OPERATOR mem_operator;
  +VO_CODEC_INIT_USERDATA user_data;
  +} AACContext;
  +
  +static av_cold int aac_encode_init(AVCodecContext *avctx)
  +{
  +AACContext *s = avctx-priv_data;
  +AACENC_PARAM params;
  +int index;
  +
  +memset(params, 0, sizeof(params));
 
 Why not initialize params to 0 instead?

Fixed

  +avctx-coded_frame = avcodec_alloc_frame();
  +avctx-frame_size = 1024;
 
  +s-mem_operator.Alloc = cmnMemAlloc;
  +s-mem_operator.Copy = cmnMemCopy;
  +s-mem_operator.Free = cmnMemFree;
  +s-mem_operator.Set = cmnMemSet;
  +s-mem_operator.Check = cmnMemCheck;
  +s-user_data.memflag = VO_IMF_USERMEMOPERATOR;
  +s-user_data.memData = s-mem_operator;
  +s-codec_api.Init(s-handle, VO_AUDIO_CodingAAC, s-user_data);
 
  +params.sampleRate = avctx-sample_rate;
  +params.bitRate = avctx-bit_rate;
  +params.nChannels = avctx-channels;
  +params.adtsUsed = 0;
 
  +avctx-extradata_size = 2;
  +avctx-extradata = av_mallocz(avctx-extradata_size +
  +  FF_INPUT_BUFFER_PADDING_SIZE);
 
 nit: align the '='

Done

  +static int aac_encode_frame(AVCodecContext *avctx,
  +unsigned char *frame/*out*/,
  +int buf_size, void *data/*in*/)
  +{
  +AACContext *s = avctx-priv_data;
  +VO_CODECBUFFER input, output;
  +VO_AUDIO_OUTPUTINFO output_info;
  +
  +memset(input,   0, sizeof(input));
  +memset(output,  0, sizeof(output));
  +memset(output_info, 0, sizeof(output_info));
 
 same, initialize to 0

Done

// MartinFrom b7a823b2da26d59976464b42d0b7e528cb7980fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= mar...@martin.st
Date: Sun, 19 Dec 2010 21:40:23 +0200
Subject: [PATCH 1/2] Add an AAC encoder by using the libvo-aacenc library

---
 Changelog |1 +
 configure |6 ++
 doc/general.texi  |2 +-
 libavcodec/Makefile   |1 +
 libavcodec/allcodecs.c|1 +
 libavcodec/libvo-aacenc.c |  128 +
 libavcodec/version.h  |2 +-
 7 files changed, 139 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/libvo-aacenc.c

diff --git a/Changelog b/Changelog
index ec09c28..6a255d4 100644
--- a/Changelog
+++ b/Changelog
@@ -83,6 +83,7 @@ version next:
 - Linux framebuffer input device added
 - Chronomaster DFA decoder
 - Mobotix MxPEG decoder
+- AAC encoding via libvo-aacenc
 
 
 version 0.6:
diff --git a/configure b/configure
index 92a809f..8880fba 100755
--- a/configure
+++ b/configure
@@ -178,6 +178,7 @@ External library support:
   --enable-libschroedinger enable Dirac support via libschroedinger [no]
   --enable-libspeexenable Speex decoding via libspeex [no]
   --enable-libtheora   enable Theora encoding via libtheora [no]
+  --enable-libvo-aacencenable AAC encoding via libvo-aacenc [no]
   --enable-libvorbis   enable Vorbis encoding via libvorbis,
native implementation exists [no]
   --enable-libvpx  enable VP8 support via libvpx [no]
@@ -937,6 +938,7 @@ CONFIG_LIST=
 libschroedinger
 libspeex
 libtheora
+libvo_aacenc
 libvorbis
 libvpx
 libx264
@@ -1384,6 +1386,7 @@ libschroedinger_decoder_deps=libschroedinger
 libschroedinger_encoder_deps=libschroedinger
 libspeex_decoder_deps=libspeex
 libtheora_encoder_deps=libtheora
+libvo_aacenc_encoder_deps=libvo_aacenc
 libvorbis_encoder_deps=libvorbis
 libvpx_decoder_deps=libvpx
 libvpx_encoder_deps=libvpx
@@ -2525,6 +2528,7 @@ die_license_disabled nonfree libfaac
 
 die_license_disabled version3 libopencore_amrnb
 die_license_disabled version3 libopencore_amrwb
+die_license_disabled version3 libvo_aacenc
 
 enabled version3  { enabled gpl  enable gplv3 || enable lgplv3; }
 
@@ -2864,6 +2868,7 @@ enabled librtmp require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
 

Re: [libav-devel] [PATCH 2/2] Add support for AMR-WB encoding via libvo-amrwbenc

2011-04-07 Thread Martin Storsjö
On Fri, 8 Apr 2011, Diego Biurrun wrote:

 On Thu, Apr 07, 2011 at 12:45:13PM +0300, Martin Storsjö wrote:
  
  --- /dev/null
  +++ b/libavcodec/libvo-amrwbenc.c
  @@ -0,0 +1,126 @@
  +
  +#include avcodec.h
  +#include vo-amrwbenc/enc_if.h
 
 Place system headers before local headers, separate by an empty line.

Done

// MartinFrom da5a20a118336f68ef504d0cf712d18ccaa7ce50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= mar...@martin.st
Date: Tue, 29 Dec 2009 16:48:09 +0200
Subject: [PATCH 2/2] Add support for AMR-WB encoding via libvo-amrwbenc

The wrapper code is based on the libamr wrapper removed in SVN rev 19365.
---
 Changelog   |1 +
 configure   |6 ++
 doc/general.texi|3 +-
 libavcodec/Makefile |1 +
 libavcodec/allcodecs.c  |1 +
 libavcodec/libvo-amrwbenc.c |  127 +++
 libavcodec/version.h|2 +-
 7 files changed, 139 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/libvo-amrwbenc.c

diff --git a/Changelog b/Changelog
index 6a255d4..87ec036 100644
--- a/Changelog
+++ b/Changelog
@@ -84,6 +84,7 @@ version next:
 - Chronomaster DFA decoder
 - Mobotix MxPEG decoder
 - AAC encoding via libvo-aacenc
+- AMR-WB encoding via libvo-amrwbenc
 
 
 version 0.6:
diff --git a/configure b/configure
index 8880fba..c632ce5 100755
--- a/configure
+++ b/configure
@@ -179,6 +179,7 @@ External library support:
   --enable-libspeexenable Speex decoding via libspeex [no]
   --enable-libtheora   enable Theora encoding via libtheora [no]
   --enable-libvo-aacencenable AAC encoding via libvo-aacenc [no]
+  --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
   --enable-libvorbis   enable Vorbis encoding via libvorbis,
native implementation exists [no]
   --enable-libvpx  enable VP8 support via libvpx [no]
@@ -939,6 +940,7 @@ CONFIG_LIST=
 libspeex
 libtheora
 libvo_aacenc
+libvo_amrwbenc
 libvorbis
 libvpx
 libx264
@@ -1387,6 +1389,7 @@ libschroedinger_encoder_deps=libschroedinger
 libspeex_decoder_deps=libspeex
 libtheora_encoder_deps=libtheora
 libvo_aacenc_encoder_deps=libvo_aacenc
+libvo_amrwbenc_encoder_deps=libvo_amrwbenc
 libvorbis_encoder_deps=libvorbis
 libvpx_decoder_deps=libvpx
 libvpx_encoder_deps=libvpx
@@ -2529,6 +2532,7 @@ die_license_disabled nonfree libfaac
 die_license_disabled version3 libopencore_amrnb
 die_license_disabled version3 libopencore_amrwb
 die_license_disabled version3 libvo_aacenc
+die_license_disabled version3 libvo_amrwbenc
 
 enabled version3  { enabled gpl  enable gplv3 || enable lgplv3; }
 
@@ -2869,6 +2873,7 @@ enabled libschroedinger  require_pkg_config schroedinger-1.0 schroedinger/schr
 enabled libspeexrequire  libspeex speex/speex.h speex_decoder_init -lspeex
 enabled libtheora   require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
 enabled libvo_aacenc  require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
+enabled libvo_amrwbenc  require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
 enabled libvorbis   require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
 enabled libvpx  {
 enabled libvpx_decoder  { check_lib2 vpx/vpx_decoder.h vpx/vp8dx.h vpx_codec_dec_init_ver -lvpx ||
@@ -3138,6 +3143,7 @@ echo libspeex enabled  ${libspeex-no}
 echo libtheora enabled ${libtheora-no}
 echo libva enabled ${vaapi-no}
 echo libvo-aacenc support  ${libvo_aacenc-no}
+echo libvo-amrwbenc support${libvo_amrwbenc-no}
 echo libvorbis enabled ${libvorbis-no}
 echo libvpx enabled${libvpx-no}
 echo libx264 enabled   ${libx264-no}
diff --git a/doc/general.texi b/doc/general.texi
index a8fab31..2c7949d 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -588,7 +588,8 @@ following image formats are supported:
 @item ADPCM Yamaha   @tab  X  @tab  X
 @item AMR-NB @tab  E  @tab  X
 @tab encoding supported through external library libopencore-amrnb
-@item AMR-WB @tab @tab  X
+@item AMR-WB @tab  E  @tab  X
+@tab encoding supported through external library libvo-amrwbenc
 @item Apple lossless audio   @tab  X  @tab  X
 @tab QuickTime fourcc 'alac'
 @item Atrac 1@tab @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index e9c40e4..1cdae2c 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -569,6 +569,7 @@ OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER)+= libschroedingerenc.o \
 OBJS-$(CONFIG_LIBSPEEX_DECODER)   += libspeexdec.o
 OBJS-$(CONFIG_LIBTHEORA_ENCODER)  += libtheoraenc.o
 OBJS-$(CONFIG_LIBVO_AACENC_ENCODER)   += libvo-aacenc.o mpeg4audio.o
+OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
 OBJS-$(CONFIG_LIBVORBIS_ENCODER)  += libvorbis.o 

Re: [libav-devel] [PATCH 1/3] introduce side information in AVPacket

2011-04-07 Thread Diego Biurrun
On Thu, Apr 07, 2011 at 10:28:25AM +0200, Kostya wrote:
 
 --- a/libavcodec/avcodec.h
 +++ b/libavcodec/avcodec.h
 @@ -1054,6 +1054,14 @@ typedef struct AVPacket {
  int   size;
 +/**
 + * Additional packet data that may be provided by container. If present

by the container

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] Experimental DCA encoder

2011-04-07 Thread Benjamin Larsson
MvH
Benjamin Larsson
From 72e6371e0c98e344275173452cec98940a33ef39 Mon Sep 17 00:00:00 2001
From: Alexander E. Patrakov patra...@gmail.com
Date: Fri, 8 Apr 2011 01:33:21 +0200
Subject: [PATCH] Experimental DCA encoder

---
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |2 +-
 libavcodec/dcaenc.c|  581 
 libavcodec/dcaenc.h|  544 +
 4 files changed, 1127 insertions(+), 1 deletions(-)
 create mode 100644 libavcodec/dcaenc.c
 create mode 100644 libavcodec/dcaenc.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 837f7e2..195469d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -104,6 +104,7 @@ OBJS-$(CONFIG_COOK_DECODER)+= cook.o
 OBJS-$(CONFIG_CSCD_DECODER)+= cscd.o
 OBJS-$(CONFIG_CYUV_DECODER)+= cyuv.o
 OBJS-$(CONFIG_DCA_DECODER) += dca.o synth_filter.o dcadsp.o
+OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o
 OBJS-$(CONFIG_DFA_DECODER) += dfa.o
 OBJS-$(CONFIG_DNXHD_DECODER)   += dnxhddec.o dnxhddata.o
 OBJS-$(CONFIG_DNXHD_ENCODER)   += dnxhdenc.o dnxhddata.o   \
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 7636392..9530358 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -238,7 +238,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER (BINKAUDIO_DCT, binkaudio_dct);
 REGISTER_DECODER (BINKAUDIO_RDFT, binkaudio_rdft);
 REGISTER_DECODER (COOK, cook);
-REGISTER_DECODER (DCA, dca);
+REGISTER_ENCDEC  (DCA, dca);
 REGISTER_DECODER (DSICINAUDIO, dsicinaudio);
 REGISTER_DECODER (EAC3, eac3);
 REGISTER_ENCDEC  (FLAC, flac);
diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
new file mode 100644
index 000..0362485
--- /dev/null
+++ b/libavcodec/dcaenc.c
@@ -0,0 +1,581 @@
+/*
+ * DCA encoder
+ * Copyright (C) 2008 Alexander E. Patrakov
+ *   2010 Benjamin Larsson
+ *   2011 Xiang Wang
+ * This file is part of Libav.
+ *
+ * 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 libavutil/common.h
+#include libavutil/avassert.h
+#include libavutil/audioconvert.h
+#include avcodec.h
+#include get_bits.h
+#include put_bits.h
+#include dcaenc.h
+#include dcadata.h
+
+#undef NDEBUG
+
+#define MAX_CHANNELS 6
+#define DCA_SUBBANDS_32 32
+#define DCA_MAX_FRAME_SIZE 16383
+#define DCA_HEADER_SIZE 13
+
+#define DCA_SUBBANDS 32 /// Subband activity count
+#define QUANTIZER_BITS 16
+#define SUBFRAMES 1
+#define SUBSUBFRAMES 4
+#define PCM_SAMPLES (SUBFRAMES*SUBSUBFRAMES*8)
+#define LFE_BITS 8
+#define LFE_INTERPOLATION 64
+#define LFE_PRESENT 2
+#define LFE_MISSING 0
+
+static const int8_t dca_lfe_index[] = {
+1,2,2,2,2,3,2,3,2,3,2,3,1,3,2,3
+};
+
+static const int8_t dca_channel_reorder_lfe[][9] = {
+{ 0, -1, -1, -1, -1, -1, -1, -1, -1},
+{ 0,  1, -1, -1, -1, -1, -1, -1, -1},
+{ 0,  1, -1, -1, -1, -1, -1, -1, -1},
+{ 0,  1, -1, -1, -1, -1, -1, -1, -1},
+{ 0,  1, -1, -1, -1, -1, -1, -1, -1},
+{ 1,  2,  0, -1, -1, -1, -1, -1, -1},
+{ 0,  1, -1,  2, -1, -1, -1, -1, -1},
+{ 1,  2,  0, -1,  3, -1, -1, -1, -1},
+{ 0,  1, -1,  2,  3, -1, -1, -1, -1},
+{ 1,  2,  0, -1,  3,  4, -1, -1, -1},
+{ 2,  3, -1,  0,  1,  4,  5, -1, -1},
+{ 1,  2,  0, -1,  3,  4,  5, -1, -1},
+{ 0, -1,  4,  5,  2,  3,  1, -1, -1},
+{ 3,  4,  1, -1,  0,  2,  5,  6, -1},
+{ 2,  3, -1,  5,  7,  0,  1,  4,  6},
+{ 3,  4,  1, -1,  0,  2,  5,  7,  6},
+};
+
+static const int8_t dca_channel_reorder_nolfe[][9] = {
+{ 0, -1, -1, -1, -1, -1, -1, -1, -1},
+{ 0,  1, -1, -1, -1, -1, -1, -1, -1},
+{ 0,  1, -1, -1, -1, -1, -1, -1, -1},
+{ 0,  1, -1, -1, -1, -1, -1, -1, -1},
+{ 0,  1, -1, -1, -1, -1, -1, -1, -1},
+{ 1,  2,  0, -1, -1, -1, -1, -1, -1},
+{ 0,  1,  2, -1, -1, -1, -1, -1, -1},
+{ 1,  2,  0,  3, -1, -1, -1, -1, -1},
+{ 0,  1,  2,  3, -1, -1, -1, -1, -1},
+{ 1,  2,  0,  3,  4, -1, -1, -1, -1},
+{ 2,  3,  0,  1,  4,  5, -1, -1, -1},
+{ 1,  2,  0,  3,  4,  5, -1, -1, -1},
+{ 0,  4,  5,  2,  3,  1, -1, -1, -1},
+{ 3,  4,  1,  0,  2,  5,  6, -1, -1},
+{ 2,  3,  5,  7,  0,  1,  4,  6, -1},
+{ 3,  4,  1,  0,  2,  5,  7,  6, -1},
+};
+

Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-07 Thread rukhsana afroz
On Wed, Apr 6, 2011 at 9:24 AM, Michael Niedermayer michae...@gmx.atwrote:

 I suspect the If statement is there as the implementation only supports
 cblk_style==0
 the others simply are not implemented

 Do you think you can implement them?

 Hi all,

I have submitted my proposal on GSoC this year. And Michael, I believe, I
shall be able to implement the missing features of the current
decoder/encoder. Particularly for this missing feature, I will get back to
you soon about the way I will implement this missing feature.

Thanks
Ruby

-- 
Rukhsana Ruby
Phd Student
Department of Electrical  Computer Engineering
The University of British Columbia

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-07 Thread rukhsana afroz
On Wed, Apr 6, 2011 at 9:24 AM, Michael Niedermayer michae...@gmx.atwrote:


 I suspect the If statement is there as the implementation only supports
 cblk_style==0
 the others simply are not implemented

 Do you think you can implement them?



Hi all,

I have submitted my proposal on GSoC this year. And Michael, I believe, I
shall be able to implement the missing features of the current
decoder/encoder. Particularly for this missing feature, I will get back to
you soon about the way I will implement this missing feature.

Thanks
Ruby

-- 
Rukhsana Ruby
Phd Student
Department of Electrical  Computer Engineering
The University of British Columbia

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/6] avio: avio_ prefix for url_exist().

2011-04-07 Thread Ronald S. Bultje
Hi,

On Thu, Apr 7, 2011 at 4:40 PM, Anton Khirnov an...@khirnov.net wrote:
 On Thu, Apr 07, 2011 at 04:34:39PM -0400, Ronald S. Bultje wrote:
 On Thu, Apr 7, 2011 at 3:16 PM, Anton Khirnov an...@khirnov.net wrote:
  ---
   ffmpeg.c           |    2 +-
   ffserver.c         |    4 ++--
   libavformat/avio.c |    6 +-
   libavformat/avio.h |    3 ++-
   libavformat/img2.c |    6 +++---
   5 files changed, 13 insertions(+), 8 deletions(-)

 Should this be public? I don't think it should. For local files, it's
 trivial to re-implement in each place where it's needed. Does it work
 for non-file://-URIs?

 It uses url_open, so I see no reason why it wouldn't.

I guess it's fine. I'm not very comfortable with it being in lavf but
who am I to say it doesn't belong there if our top committer of the
year thinks otherwise? :-).

Ronald
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Experimental DCA encoder

2011-04-07 Thread Ronald S. Bultje
Hi,

2011/4/7 Benjamin Larsson ba...@ludd.ltu.se:
 +static inline int32_t mul32(int32_t a, int32_t b)
 +{
 +/* on =i686, gcc compiles this into a single imull instruction */
 +int64_t r = (int64_t)a * b;
 +/* round the result before truncating - improves accuracy */
 +return (r + 0x8000)  32;
 +}

I believe this is what the MUL64() macro is for, then it works on
non-x86 archs also, but that doesn't round...

 +static int32_t cos_table[128];
[..]
 +static void qmf_init(void)

There should probably be a static inited = 0; that you set after
succesful init, since this function only has to run once, not every
time the codec re-inits.

 +int i;
 +int32_t c[17], s[17];
 +s[0] = 0;   /* sin(index * PI / 64) * 0x7fff */
 +c[0] = 0x7fff;  /* cos(index * PI / 64) * 0x7fff */
 +
 +for (i = 1; i = 16; i++) {
 +s[i] = 2 * (mul32(c[i-1], 105372028) + mul32(s[i-1], 2144896908));
 +c[i] = 2 * (mul32(c[i-1], 2144896908) - mul32(s[i-1], 105372028));
 +}
 +
 +for (i = 0; i  16; i++) {
 +cos_table[i] = c[i]  3; /* so that the output doesn't overflow */
 +cos_table[i+16] = s[16-i]  3;
 +cos_table[i+32] = -s[i]  3;
 +cos_table[i+48] = -c[16-i]  3;
 +cos_table[i+64] = -c[i]  3;
 +cos_table[i+80] = -s[16-i]  3;
 +cos_table[i+96] = s[i]  3;
 +cos_table[i+112] = c[16-i]  3;
 +}

For the cos-table, can you use libavcodec/sinewin.h functions? If not,
does this look like a proper int-implementation of the same thing that
we might want to share? E.g. does acenc_fixed.c have fixed-point cos
table generation also?

(I know, this is minor, ignore for now, not critical.)

 +static void qmf_decompose(DCAContext *c, int32_t in[32], int32_t out[32], 
 int channel)
 +{
 +int band, i, j, k;
 +int32_t resp;
 +int32_t accum[DCA_SUBBANDS_32];
 +
 +add_new_samples(c, in, DCA_SUBBANDS_32, channel);
 +
 +/* Calculate the dot product of the signal with the (possibly inverted)
 +   reference decoder's response to this vector:
 +   (0.0, 0.0, ..., 0.0, -1.0, 1.0, 0.0, ..., 0.0)
 +   so that -1.0 cancels 1.0 from the previous step */
 +
 +memset(accum,0,sizeof(accum));
 +
 +for (k = 48, j = 0, i = c-start[channel]; i  512; k++, j++, i++)
 +accum[(k  32) ? (31 - (k  31)) : (k  31)] += 
 mul32(c-history[channel][i], UnQMF[j]);
 +for (i = 0; i  c-start[channel]; k++, j++, i++)
 +accum[(k  32) ? (31 - (k  31)) : (k  31)] += 
 mul32(c-history[channel][i], UnQMF[j]);
 +
 +resp = 0;
 +/* TODO: implement FFT instead of this naive calculation */
 +for (band = 0; band  DCA_SUBBANDS_32; band++) {
 +for (j = 0; j  32; j++)
 +resp += mul32(accum[j], band_delta_factor(band, j));
 +
 +out[band] = (band  2) ? (-resp) : resp;
 +}
 +}

I'll probably sound very naive, but what does this piece of the code do?

 +static void init_lfe_fir(void){
 +static int initialized;
 +int i;
 +if(initialized)
 +return;
 +for(i=0; i512; i++)
 +lfe_fir_64i[i] = lfe_fir_64[i] * (125); //float - int32_t
 +initialized = 1;
 +}

This kind of stuff, along with cos tables, FFT etc, raises the
question why this wasn't implemented in float... Realistically, if
!CONFIG_SMALL, the table should be hardcoded.

The bitstream stuff I didn't review because I'm not very familiar with it...

 +static int DCA_encode_init(AVCodecContext *avctx) {
[..]
 +for(i=0; i16; i++){
 +if(dca_sample_rates[i] == avctx-sample_rate)
 +break;
 +}
 +if(i==16){
 +av_log(avctx, AV_LOG_ERROR, Sample rate %iHz not supported\n, 
 avctx-sample_rate);
 +return -1;
 +}
 +c-sample_rate_code = i;

That is pretty unhelpful. What samplerates _are_ supported? Better
yet, how would the user accomplish the resampling within ffmpeg?

 diff --git a/libavcodec/dcaenc.h b/libavcodec/dcaenc.h
[..]
 +/* This is a scaled version of the response of the reference decoder to
 +   this vector of subband samples: ( 1.0 0.0 0.0 ... 0.0 )
 +   */
 +
 +static const int32_t UnQMF[512] = {

??? What is that?

Ronald
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/2] add MicroDVD muxer and demuxer

2011-04-07 Thread Ronald S. Bultje
Hi,

On Thu, Apr 7, 2011 at 1:01 AM, Alexander Strange astra...@ithinksw.com wrote:
 On Apr 6, 2011, at 5:44 PM, Ronald S. Bultje wrote:
 On Tue, Apr 5, 2011 at 3:08 PM, Luca Barbato lu_z...@gentoo.org wrote:
 +    if (buffer[0]  !(res = av_new_packet(pkt, len))) {
 +        memcpy(pkt-data, buffer, len);
 +        pkt-flags |= AV_PKT_FLAG_KEY;
 +        pkt-pos = pos;
 +        pkt-pts = pkt-dts = get_pts(buffer);
 +    }

 Sets no duration? Or is this one of those crazy formats where duration
 lasts until the next (potentially empty) subtitle?

 I didn't look very thoroughly, but it looks OK from a quick glance at it.

 Ronald

 MicroDVD looks like this:

 {1025}{1110}Oh no!

 The first {} is the start frame and the {} is the end frame.

 It is certainly failing to parse the duration, so I guess it's up to
 you if half a demuxer is better than none.

 Storing the entire line as the packet reminds me of the ASS format
 which is good for nothing except having a small ASS muxer.

As opposed to stuffing multiple lines in a single AVPacket? I don't
care too much about that, subtitles (except for their rendering) are
largely irrelevant to performance of a video player...

Having the (convergance_)duration set would still be nice though.

Ronald
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] avio: make URLContext internal.

2011-04-07 Thread Ronald S. Bultje
Hi,

On Thu, Apr 7, 2011 at 3:16 PM, Anton Khirnov an...@khirnov.net wrote:
 ---
  ffserver.c                   |    6 ++--
  libavformat/applehttp.c      |    2 +-
  libavformat/applehttpproto.c |   10 +++---
  libavformat/avio.c           |   76 
 +-
  libavformat/avio.h           |    3 +-
  libavformat/avio_internal.h  |    7 ++--
  libavformat/aviobuf.c        |   12 +++---
  libavformat/concat.c         |   14 
  libavformat/file.c           |   15 
  libavformat/gopher.c         |   12 +++---
  libavformat/http.c           |   32 +-
  libavformat/http.h           |   10 +++---
  libavformat/librtmp.c        |   15 
  libavformat/md5proto.c       |   10 +++---
  libavformat/mms.h            |    4 +-
  libavformat/mmsh.c           |    6 ++--
  libavformat/mmst.c           |    6 ++--
  libavformat/rtmppkt.c        |    4 +-
  libavformat/rtmppkt.h        |    5 ++-
  libavformat/rtmpproto.c      |   38 ++--
  libavformat/rtpdec.c         |    4 +-
  libavformat/rtpdec.h         |   15 
  libavformat/rtpenc_chain.c   |    2 +-
  libavformat/rtpenc_chain.h   |    3 +-
  libavformat/rtpproto.c       |   22 ++--
  libavformat/rtsp.c           |    2 +-
  libavformat/rtsp.h           |    8 ++--
  libavformat/sapdec.c         |    2 +-
  libavformat/sapenc.c         |    4 +-
  libavformat/tcp.c            |   10 +++---
  libavformat/udp.c            |   14 
  libavformat/url.h            |   45 -
  32 files changed, 219 insertions(+), 199 deletions(-)

 diff --git a/ffserver.c b/ffserver.c
 index 021b2e5..f4ea029 100644
 --- a/ffserver.c
 +++ b/ffserver.c
 @@ -174,7 +174,7 @@ typedef struct HTTPContext {
     AVFormatContext *rtp_ctx[MAX_STREAMS];

     /* RTP/UDP specific */
 -    URLContext *rtp_handles[MAX_STREAMS];
 +    FFURLContext *rtp_handles[MAX_STREAMS];

There isn't actually any reason to rename these. Their names aren't
exposed in our API. Internal structures (as opposed to functions,
which are non-static and thus exposed) are hidden (like static
functions, basically) and their name is thus free-form.

Ronald
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 6/6] avio: make URLProtocol internal.

2011-04-07 Thread Ronald S. Bultje
Hi,

On Thu, Apr 7, 2011 at 3:16 PM, Anton Khirnov an...@khirnov.net wrote:
 ---
  libavformat/allformats.c     |    2 +-
  libavformat/applehttpproto.c |    2 +-
  libavformat/avio.c           |   26 +-
  libavformat/avio.h           |    6 +-
  libavformat/concat.c         |    2 +-
  libavformat/file.c           |    4 ++--
  libavformat/gopher.c         |    2 +-
  libavformat/http.c           |    2 +-
  libavformat/librtmp.c        |   10 +-
  libavformat/md5proto.c       |    2 +-
  libavformat/mmsh.c           |    2 +-
  libavformat/mmst.c           |    2 +-
  libavformat/rtmpproto.c      |    2 +-
  libavformat/rtpproto.c       |    2 +-
  libavformat/tcp.c            |    2 +-
  libavformat/udp.c            |    2 +-
  libavformat/url.h            |   28 
  17 files changed, 61 insertions(+), 37 deletions(-)

 diff --git a/libavformat/allformats.c b/libavformat/allformats.c
 index 9398d34..652a8e8 100644
 --- a/libavformat/allformats.c
 +++ b/libavformat/allformats.c
 @@ -34,7 +34,7 @@
  #define REGISTER_MUXDEMUX(X,x)  REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x)

  #define REGISTER_PROTOCOL(X,x) { \
 -    extern URLProtocol ff_##x##_protocol; \
 +    extern FFURLProtocol ff_##x##_protocol; \

Same here, rename isn't necessary because the struct name won't be
exposed in the binary, api, symbol table or anything.

Ronald
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/6] avio: avio_ prefix for url_exist().

2011-04-07 Thread Anton Khirnov
On Thu, Apr 07, 2011 at 09:50:28PM -0400, Ronald S. Bultje wrote:
 Hi,
 
 On Thu, Apr 7, 2011 at 4:40 PM, Anton Khirnov an...@khirnov.net wrote:
  On Thu, Apr 07, 2011 at 04:34:39PM -0400, Ronald S. Bultje wrote:
  On Thu, Apr 7, 2011 at 3:16 PM, Anton Khirnov an...@khirnov.net wrote:
   ---
    ffmpeg.c           |    2 +-
    ffserver.c         |    4 ++--
    libavformat/avio.c |    6 +-
    libavformat/avio.h |    3 ++-
    libavformat/img2.c |    6 +++---
    5 files changed, 13 insertions(+), 8 deletions(-)
 
  Should this be public? I don't think it should. For local files, it's
  trivial to re-implement in each place where it's needed. Does it work
  for non-file://-URIs?
 
  It uses url_open, so I see no reason why it wouldn't.
 
 I guess it's fine. I'm not very comfortable with it being in lavf but
 who am I to say it doesn't belong there if our top committer of the
 year thinks otherwise? :-).
 

See the first mail in the thread - I'm not exactly happy with it either.

-- 
Anton Khirnov


signature.asc
Description: Digital signature
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] lavf: use designated initializers for all protocols

2011-04-07 Thread Anton Khirnov
This is more readable and makes it easier to reorder URLProtocol
members.
---
 libavformat/applehttpproto.c |   12 ++---
 libavformat/concat.c |   11 ++---
 libavformat/file.c   |   20 +-
 libavformat/gopher.c |   11 ++---
 libavformat/http.c   |   16 
 libavformat/librtmp.c|   90 ++---
 libavformat/mmst.c   |   10 ++---
 libavformat/rtmpproto.c  |   11 ++---
 libavformat/rtpproto.c   |   11 ++---
 libavformat/tcp.c|   11 ++---
 libavformat/udp.c|   11 ++---
 11 files changed, 97 insertions(+), 117 deletions(-)

diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c
index 52645f7..8842bd4 100644
--- a/libavformat/applehttpproto.c
+++ b/libavformat/applehttpproto.c
@@ -298,11 +298,9 @@ static int applehttp_close(URLContext *h)
 }
 
 URLProtocol ff_applehttp_protocol = {
-applehttp,
-applehttp_open,
-applehttp_read,
-NULL, /* write */
-NULL, /* seek */
-applehttp_close,
-.flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
+.name  = applehttp,
+.url_open  = applehttp_open,
+.url_read  = applehttp_read,
+.url_close = applehttp_close,
+.flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
 };
diff --git a/libavformat/concat.c b/libavformat/concat.c
index dbacc69..da9bee2 100644
--- a/libavformat/concat.c
+++ b/libavformat/concat.c
@@ -190,10 +190,9 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int 
whence)
 }
 
 URLProtocol ff_concat_protocol = {
-concat,
-concat_open,
-concat_read,
-NULL,
-concat_seek,
-concat_close,
+.name  = concat,
+.url_open  = concat_open,
+.url_read  = concat_read,
+.url_seek  = concat_seek,
+.url_close = concat_close,
 };
diff --git a/libavformat/file.c b/libavformat/file.c
index 729061a..3293a53 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -95,12 +95,12 @@ static int file_close(URLContext *h)
 }
 
 URLProtocol ff_file_protocol = {
-file,
-file_open,
-file_read,
-file_write,
-file_seek,
-file_close,
+.name= file,
+.url_open= file_open,
+.url_read= file_read,
+.url_write   = file_write,
+.url_seek= file_seek,
+.url_close   = file_close,
 .url_get_file_handle = file_get_handle,
 };
 
@@ -131,10 +131,10 @@ static int pipe_open(URLContext *h, const char *filename, 
int flags)
 }
 
 URLProtocol ff_pipe_protocol = {
-pipe,
-pipe_open,
-file_read,
-file_write,
+.name= pipe,
+.url_open= pipe_open,
+.url_read= file_read,
+.url_write   = file_write,
 .url_get_file_handle = file_get_handle,
 };
 
diff --git a/libavformat/gopher.c b/libavformat/gopher.c
index cfc4424..cfc07e7 100644
--- a/libavformat/gopher.c
+++ b/libavformat/gopher.c
@@ -121,10 +121,9 @@ static int gopher_read(URLContext *h, uint8_t *buf, int 
size)
 
 
 URLProtocol ff_gopher_protocol = {
-gopher,
-gopher_open,
-gopher_read,
-gopher_write,
-NULL, /*seek*/
-gopher_close,
+.name  = gopher,
+.url_open  = gopher_open,
+.url_read  = gopher_read,
+.url_write = gopher_write,
+.url_close = gopher_close,
 };
diff --git a/libavformat/http.c b/libavformat/http.c
index 8d20527..bcfce80 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -505,13 +505,13 @@ http_get_file_handle(URLContext *h)
 }
 
 URLProtocol ff_http_protocol = {
-http,
-http_open,
-http_read,
-http_write,
-http_seek,
-http_close,
+.name= http,
+.url_open= http_open,
+.url_read= http_read,
+.url_write   = http_write,
+.url_seek= http_seek,
+.url_close   = http_close,
 .url_get_file_handle = http_get_file_handle,
-.priv_data_size = sizeof(HTTPContext),
-.priv_data_class = httpcontext_class,
+.priv_data_size  = sizeof(HTTPContext),
+.priv_data_class = httpcontext_class,
 };
diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c
index f980402..5770e59 100644
--- a/libavformat/librtmp.c
+++ b/libavformat/librtmp.c
@@ -158,66 +158,56 @@ static int rtmp_get_file_handle(URLContext *s)
 }
 
 URLProtocol ff_rtmp_protocol = {
-rtmp,
-rtmp_open,
-rtmp_read,
-rtmp_write,
-NULL,   /* seek */
-rtmp_close,
-NULL,   /* next */
-rtmp_read_pause,
-rtmp_read_seek,
-rtmp_get_file_handle
+.name= rtmp,
+.url_open= rtmp_open,
+.url_read= rtmp_read,
+.url_write   = rtmp_write,
+.url_close   = rtmp_close,
+.url_read_pause  = rtmp_read_pause,
+.url_read_seek   = rtmp_read_seek,
+.url_get_file_handle = rtmp_get_file_handle
 };
 
 URLProtocol ff_rtmpt_protocol = {
-rtmpt,
-