[Libav-user] SIde data allocate space

Davood Falahati falahati.davood at gmail.com
Thu Jan 11 22:02:58 EET 2018


Dear all,

I read this description in avformat.h

/**

 * Wrap an existing array as stream side data.

 *

 * @param st stream

 * @param type side information type

 * @param data the side data array. It must be allocated with the av_malloc()

 *             family of functions. The ownership of the data is transferred to

 *             st.

 * @param size side information size

 * @return zero on success, a negative AVERROR code on failure. On failure,

 *         the stream is unchanged and the data remains owned by the caller.

 */

int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,

                            uint8_t *data, size_t size);


I have two AVStream variables, say in_stream and out_stream.

I want to copy in_stream side data to out_stream. As suggested in

the comments, out_stream->side_data should be allocated with
av_malloc() family of functions.

I want to know how should I allocate *out_stream->side_data->data* ?

When I try

out_stream->side_data->data = (uint8_t*)
av_mallocz(in_stream->side_data->size*sizeof(uint8_t*));


it leads to an unexpected error. Can anyone suggest how should I allocate this?


Regards,

Davood Falahati
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180111/7f01c6ce/attachment.html>


More information about the Libav-user mailing list