Re: [FFmpeg-devel] [PATCH 3/3] avutil/buffer: Avoid moving the AVBufferRef to a new place in memory in av_buffer_make_writable()

2015-03-11 Thread Michael Niedermayer
On Thu, Jan 15, 2015 at 01:04:56AM +0100, Michael Niedermayer wrote:
 This allows making a AVBufferRef writable without the need to
 update all pointers to it
 
 Signed-off-by: Michael Niedermayer michae...@gmx.at
 ---

applied

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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


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


Re: [FFmpeg-devel] [PATCH 3/3] avutil/buffer: Avoid moving the AVBufferRef to a new place in memory in av_buffer_make_writable()

2015-01-15 Thread wm4
On Thu, 15 Jan 2015 01:04:56 +0100
Michael Niedermayer michae...@gmx.at wrote:

 This allows making a AVBufferRef writable without the need to
 update all pointers to it
 
 Signed-off-by: Michael Niedermayer michae...@gmx.at
 ---
  libavutil/buffer.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/libavutil/buffer.c b/libavutil/buffer.c
 index b31f034..bb112c2 100644
 --- a/libavutil/buffer.c
 +++ b/libavutil/buffer.c
 @@ -159,8 +159,8 @@ int av_buffer_make_writable(AVBufferRef **pbuf)
  return AVERROR(ENOMEM);
  
  memcpy(newbuf-data, buf-data, buf-size);
 -av_buffer_unref(pbuf);
 -*pbuf = newbuf;
 +
 +buffer_replace(pbuf, newbuf);
  
  return 0;
  }

So this pretty much makes the double pointer pointless, and the
signature could be:

int av_buffer_make_writable(AVBufferRef *pbuf);

?

(I wonder why the API didn't do this originally.)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] avutil/buffer: Avoid moving the AVBufferRef to a new place in memory in av_buffer_make_writable()

2015-01-15 Thread Michael Niedermayer
On Thu, Jan 15, 2015 at 12:10:10PM +0100, wm4 wrote:
 On Thu, 15 Jan 2015 01:04:56 +0100
 Michael Niedermayer michae...@gmx.at wrote:
 
  This allows making a AVBufferRef writable without the need to
  update all pointers to it
  
  Signed-off-by: Michael Niedermayer michae...@gmx.at
  ---
   libavutil/buffer.c |4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
  
  diff --git a/libavutil/buffer.c b/libavutil/buffer.c
  index b31f034..bb112c2 100644
  --- a/libavutil/buffer.c
  +++ b/libavutil/buffer.c
  @@ -159,8 +159,8 @@ int av_buffer_make_writable(AVBufferRef **pbuf)
   return AVERROR(ENOMEM);
   
   memcpy(newbuf-data, buf-data, buf-size);
  -av_buffer_unref(pbuf);
  -*pbuf = newbuf;
  +
  +buffer_replace(pbuf, newbuf);
   
   return 0;
   }
 
 So this pretty much makes the double pointer pointless, and the
 signature could be:
 
 int av_buffer_make_writable(AVBufferRef *pbuf);

 ?

yes, if the change wouldnt break ABI/API


 
 (I wonder why the API didn't do this originally.)
 ___
 ffmpeg-devel mailing list
 ffmpeg-devel@ffmpeg.org
 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


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


[FFmpeg-devel] [PATCH 3/3] avutil/buffer: Avoid moving the AVBufferRef to a new place in memory in av_buffer_make_writable()

2015-01-14 Thread Michael Niedermayer
This allows making a AVBufferRef writable without the need to
update all pointers to it

Signed-off-by: Michael Niedermayer michae...@gmx.at
---
 libavutil/buffer.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index b31f034..bb112c2 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -159,8 +159,8 @@ int av_buffer_make_writable(AVBufferRef **pbuf)
 return AVERROR(ENOMEM);
 
 memcpy(newbuf-data, buf-data, buf-size);
-av_buffer_unref(pbuf);
-*pbuf = newbuf;
+
+buffer_replace(pbuf, newbuf);
 
 return 0;
 }
-- 
1.7.9.5

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