1 /* 2 * copyright (c) 2001 Fabrice Bellard 3 * 4 * This file is part of FFmpeg. 5 * 6 * FFmpeg is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * FFmpeg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with FFmpeg; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef AVFORMAT_RAWUTILS_H 22 #define AVFORMAT_RAWUTILS_H 23 24 #include <stdint.h> 25 #include "libavcodec/codec_par.h" 26 #include "libavcodec/packet.h" 27 #include "avformat.h" 28 29 #define CONTAINS_PAL 2 30 /** 31 * Reshuffles the lines to use the user specified stride. 32 * 33 * @param ppkt input and output packet 34 * @return negative error code or 35 * 0 if no new packet was allocated 36 * non-zero if a new packet was allocated and ppkt has to be freed 37 * CONTAINS_PAL if in addition to a new packet the old contained a palette 38 */ 39 int ff_reshuffle_raw_rgb(AVFormatContext *s, AVPacket **ppkt, AVCodecParameters *par, int expected_stride); 40 41 /** 42 * Retrieves the palette from a packet, either from side data, or 43 * appended to the video data in the packet itself (raw video only). 44 * It is commonly used after a call to ff_reshuffle_raw_rgb(). 45 * 46 * Use 0 for the ret parameter to check for side data only. 47 * 48 * @param pkt pointer to packet before calling ff_reshuffle_raw_rgb() 49 * @param ret return value from ff_reshuffle_raw_rgb(), or 0 50 * @param palette pointer to palette buffer 51 * @return negative error code or 52 * 1 if the packet has a palette, else 0 53 */ 54 int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette); 55 56 #endif /* AVFORMAT_RAWUTILS_H */ 57