On Sun, Aug 04, 2013 at 06:20:50PM +0200, Luca Barbato wrote:
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3229,6 +3229,67 @@ uint8_t* av_packet_get_side_data(AVPacket *pkt, enum 
> AVPacketSideDataType type,
>                                   int *size);
>  /**
> + * Convenience function to free all the side data stored.

stored side data

> +/**
> + * Setup a new reference to the data described by an given packet

Set up, a given

Please try to remember the noun vs. verb difference.

> +/**
> + * Copy only "properties" fields from src to dst.
> + *
> + * Properties for the purpose of this function are all the fields
> + * beside those related to the packet data (buf, data, size)
> + *
> + * @param dst Destination packet
> + * @param src Source packet
> + *
> + */
> +int av_packet_copy_props(AVPacket *dst, const AVPacket *src);

stray empty line

> --- a/libavcodec/avpacket.c
> +++ b/libavcodec/avpacket.c
> @@ -26,8 +26,8 @@
>  #include "libavutil/internal.h"
>  #include "libavutil/mem.h"
>  #include "avcodec.h"
> -
>  #if FF_API_DESTRUCT_PACKET
> +
>  void av_destruct_packet(AVPacket *pkt)
>  {

stray change

> @@ -300,3 +312,71 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum 
> AVPacketSideDataType type,
> +int av_packet_ref(AVPacket *dst, AVPacket *src)
> +{
> +    int ret;
> +
> +    ret = av_packet_copy_props(dst, src);
> +    if (ret < 0)
> +        return ret;
> +
> +    if (!src->buf) {
> +        ret = packet_buffer(&dst->buf, src->size);
> +        if (ret < 0)
> +            goto fail;
> +        memcpy(dst->buf->data, src->data, src->size);
> +    } else
> +        dst->buf = av_buffer_ref(src->buf);
> +
> +    dst->size = src->size;
> +    dst->data = dst->buf->data;
> +    return 0;
> +fail:
> +    av_packet_free_side_data(dst);
> +    return ret;
> +}

Please add an empty line before the goto label.

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

Reply via email to