On 15 Feb 2014, at 19:02, Vittorio Giovara <[email protected]> wrote:
> On Sat, Feb 15, 2014 at 3:24 PM, Tim Walker <[email protected]> wrote: >> On 12 Feb 2014, at 00:13, Vittorio Giovara <[email protected]> >> wrote: >> >>> @@ -2964,6 +2983,15 @@ static int mov_read_packet(AVFormatContext *s, >>> AVPacket *pkt) >>> sc->has_palette = 0; >>> } >>> } >>> + if (sc->rotation != 0) { >>> + uint8_t *rotation; >>> + rotation = av_packet_new_side_data(pkt, AV_PKT_DATA_ROTATION, >>> sizeof(uint32_t)); >>> + if (rotation) { >>> + AV_WL32(rotation, sc->rotation); >>> + sc->rotation = 0; >>> + } else >>> + av_log(mov->fc, AV_LOG_ERROR, "Cannot append rotation >>> angle to packet\n"); >>> + } >>> #if CONFIG_DV_DEMUXER >>> if (mov->dv_demux && sc->dv_audio_container) { >>> avpriv_dv_produce_packet(mov->dv_demux, pkt, pkt->data, >>> pkt->size); >>> -- >>> 1.8.4 >> >> Is there a chance that the packet has been used before and already contains >> side data? Or is it necessarily a new packet with no side data to begin with? > > Well you have an array of side data in avpacket and > av_packet_new_side_data takes care of (re)allocation. > Side data is also correctly passed during copy_props so all should be fine. > Vittorio But: - av_packet_new_side_data always adds side data - av_packet_new_side_data always adds it to the end of the array - av_packet_get_side_data always returns the first side data of a given type So if you add side data of type T to an AVPacket which already has side data of type T, you'll get the correct pointer back in libavcodec, but libavcodec users will never be able to get that side data, since there will be another side data of the same type earlier in the side data array. This is only an issue if the AVPacket may already contain side data of the same type, hence my question. Tim _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
