On Tue, Jan 08, 2013 at 03:35:05PM +0100, Anton Khirnov wrote:
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -34,6 +34,7 @@
>  #include "libavutil/log.h"
>  #include "libavutil/pixfmt.h"
>  #include "libavutil/rational.h"
> +#include "libavutil/buffer.h"

These were previously ordered.

> @@ -889,18 +890,24 @@ enum AVPacketSideDataType {
>   * ABI. Thus it may be allocated on stack and no new fields can be added to 
> it
>   * without libavcodec and libavformat major bump.
>   *
> - * The semantics of data ownership depends on the destruct field.
> - * If it is set, the packet data is dynamically allocated and is valid
> - * indefinitely until av_free_packet() is called (which in turn calls the
> - * destruct callback to free the data). If destruct is not set, the packet 
> data
> - * is typically backed by some static buffer somewhere and is only valid for 
> a
> - * limited time (e.g. until the next read call when demuxing).
> + * The semantics of data ownership depends on the buf or destruct 
> (deprecated)

depend

>  typedef struct AVPacket {
>      /**
> +     * A reference to the reference counted buffer where the packet data is

reference-counted

> +     * stored.
> +     * May be NULL, then the packet data is not reference counted.

reference-counted

> @@ -3450,6 +3465,20 @@ void av_shrink_packet(AVPacket *pkt, int size);
>  int av_grow_packet(AVPacket *pkt, int grow_by);
>  
>  /**
> + * Initialize a reference counted packet from av_malloc()ed data.

reference-counted

> + * @param pkt packet to be initialized. This function will set the data, 
> size,
> + * buf and destruct fields, all other are left untouched.

others

> + * @param data data allocated by av_malloc() to be used as packet data. If 
> this

data Data

> --- a/libavdevice/v4l2.c
> +++ b/libavdevice/v4l2.c
> @@ -475,23 +483,53 @@ static int mmap_read_frame(AVFormatContext *ctx, 
> AVPacket *pkt)
> +
> +        buf_descriptor = av_malloc(sizeof(struct buff_data));
> +        if (buf_descriptor == NULL) {
> +            /* Something went wrong... Since av_malloc() failed, we cannot 
> even
> +             * allocate a buffer for memcopying into it

I'd say "memcpying".

> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1461,10 +1461,10 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
>   *
>   * @param s media file handle
> - * @param pkt The packet containing the data to be written. Libavformat takes
> - * ownership of the data and will free it when it sees fit using the packet's
> - * @ref AVPacket.destruct "destruct" field. The caller must not access the 
> data
> - * after this function returns, as it may already be freed.
> + * @param pkt The packet containing the data to be written. pkt->buf must be 
> set
> + * to a valid AVBufferRef describing the packet data. Libavformat takes
> + * ownership of this reference and will unref it when it see fit. The caller

it sees

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to