Re: [FFmpeg-devel] [PATCH v5 4/4 v2] lavf/utils: Normalize AVPacket.data to native endian in ff_get_packet_palette()
On 03/04/2016 04:41 AM, Michael Niedermayer wrote: On Thu, Mar 03, 2016 at 08:29:20AM +0100, Mats Peterson wrote: Due to Morton Balint's recent addition of ff_standardize_creation_time(), the previous patch would fail. Please add this one before any more changes occur. Mats -- Mats Peterson http://matsp888.no-ip.org/~mats/ internal.h |7 +-- utils.c| 23 --- 2 files changed, 21 insertions(+), 9 deletions(-) ac3e78aa6b8d067e75004b99d52c5a5f1a2a831e 0004-lavf-utils-Normalize-AVPacket.data-to-native-endian-.patch From 08b75292ed7ede8de32bdecf5ec72fedc18b1aa9 Mon Sep 17 00:00:00 2001 From: Mats PetersonDate: Thu, 3 Mar 2016 08:25:58 +0100 Subject: [PATCH v5 4/4 v2] lavf/utils: Normalize AVPacket.data to native endian in ff_get_packet_palette() applied thanks [...] Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v5 4/4 v2] lavf/utils: Normalize AVPacket.data to native endian in ff_get_packet_palette()
On Thu, Mar 03, 2016 at 08:29:20AM +0100, Mats Peterson wrote: > Due to Morton Balint's recent addition of > ff_standardize_creation_time(), the previous patch would fail. > Please add this one before any more changes occur. > > Mats > > -- > Mats Peterson > http://matsp888.no-ip.org/~mats/ > internal.h |7 +-- > utils.c| 23 --- > 2 files changed, 21 insertions(+), 9 deletions(-) > ac3e78aa6b8d067e75004b99d52c5a5f1a2a831e > 0004-lavf-utils-Normalize-AVPacket.data-to-native-endian-.patch > From 08b75292ed7ede8de32bdecf5ec72fedc18b1aa9 Mon Sep 17 00:00:00 2001 > From: Mats Peterson> Date: Thu, 3 Mar 2016 08:25:58 +0100 > Subject: [PATCH v5 4/4 v2] lavf/utils: Normalize AVPacket.data to native > endian in ff_get_packet_palette() applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v5 4/4 v2] lavf/utils: Normalize AVPacket.data to native endian in ff_get_packet_palette()
On 03/03/2016 08:49 AM, Mats Peterson wrote: On 03/03/2016 08:29 AM, Mats Peterson wrote: Due to Morton Balint's recent addition of ff_standardize_creation_time(), the previous patch would fail. Please add this one before any more changes occur. In my book, using native uint32_t when dealing with the palette on muxing is clearly the most logical and cleanest way. The most obvious reason for normalizing AVPacket.data to native endian is that we can't easily determine the endianness of the palette side data (as far as I know) due to its being stored in native endian. AVPacket.data will always be little endian. Mats ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v5 4/4 v2] lavf/utils: Normalize AVPacket.data to native endian in ff_get_packet_palette()
On 03/03/2016 08:29 AM, Mats Peterson wrote: Due to Morton Balint's recent addition of ff_standardize_creation_time(), the previous patch would fail. Please add this one before any more changes occur. In my book, using native uint32_t when dealing with the palette on muxing is clearly the most logical and cleanest way. Mats ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v5 4/4 v2] lavf/utils: Normalize AVPacket.data to native endian in ff_get_packet_palette()
Due to Morton Balint's recent addition of ff_standardize_creation_time(), the previous patch would fail. Please add this one before any more changes occur. Mats -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From 08b75292ed7ede8de32bdecf5ec72fedc18b1aa9 Mon Sep 17 00:00:00 2001 From: Mats PetersonDate: Thu, 3 Mar 2016 08:25:58 +0100 Subject: [PATCH v5 4/4 v2] lavf/utils: Normalize AVPacket.data to native endian in ff_get_packet_palette() --- libavformat/internal.h |7 +-- libavformat/utils.c| 23 --- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index 63e0632..37a8591 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -588,9 +588,12 @@ int ff_reshuffle_raw_rgb(AVFormatContext *s, AVPacket **ppkt, AVCodecContext *en * * Use 0 for the ret parameter to check for side data only. * - * @param pkt pointer to the packet before calling ff_reshuffle_raw_rgb() + * @param pkt pointer to packet before calling ff_reshuffle_raw_rgb() * @param ret return value from ff_reshuffle_raw_rgb(), or 0 + * @param palette pointer to palette buffer + * @return negative error code or + * 1 if the packet has a palette, else 0 */ -int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, const uint8_t **palette); +int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette); #endif /* AVFORMAT_INTERNAL_H */ diff --git a/libavformat/utils.c b/libavformat/utils.c index 85702dd..7c14725 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4782,18 +4782,27 @@ int ff_standardize_creation_time(AVFormatContext *s) return ret; } -int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, const uint8_t **palette) +int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette) { +uint8_t *side_data; int size; -*palette = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, ); -if (*palette && size != AVPALETTE_SIZE) { -av_log(s, AV_LOG_ERROR, "Invalid palette side data\n"); -return AVERROR_INVALIDDATA; +side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, ); +if (side_data) { +if (size != AVPALETTE_SIZE) { +av_log(s, AV_LOG_ERROR, "Invalid palette side data\n"); +return AVERROR_INVALIDDATA; +} +memcpy(palette, side_data, AVPALETTE_SIZE); +return 1; } -if (!*palette && ret == CONTAINS_PAL) -*palette = pkt->data + pkt->size - AVPALETTE_SIZE; +if (ret == CONTAINS_PAL) { +int i; +for (i = 0; i < AVPALETTE_COUNT; i++) +palette[i] = AV_RL32(pkt->data + pkt->size - AVPALETTE_SIZE + i*4); +return 1; +} return 0; } -- 1.7.10.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel