Use mov->is_unaligned_raw_rgb instead of including every possible RGB
pixel format.
--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 4cb1b16e26751a0f33ed1d86ed38b0f505eb66f0 Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Mon, 22 Feb 2016 17:06:37 +0100
Subject: [PATCH v16] lavf/movenc: Add palette to video sample description
---
libavformat/movenc.c | 29 +++++++++++------------------
libavformat/movenc.h | 2 +-
2 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 773f0aa..60a9318 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1715,7 +1715,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
else
avio_wb16(pb, 0x18); /* Reserved */
- if (mov->is_raw_rgb &&
+ if (mov->is_unaligned_raw_rgb &&
track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) {
int i;
int pal_size = 1 << track->enc->bits_per_coded_sample;
@@ -4763,23 +4763,16 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
}
if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
- mov->is_raw_rgb = trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO &&
- (trk->enc->pix_fmt == AV_PIX_FMT_RGB24 ||
- trk->enc->pix_fmt == AV_PIX_FMT_BGR24 ||
- trk->enc->pix_fmt == AV_PIX_FMT_ARGB ||
- trk->enc->pix_fmt == AV_PIX_FMT_ABGR ||
- trk->enc->pix_fmt == AV_PIX_FMT_RGBA ||
- trk->enc->pix_fmt == AV_PIX_FMT_BGRA ||
- trk->enc->pix_fmt == AV_PIX_FMT_RGB555BE ||
- trk->enc->pix_fmt == AV_PIX_FMT_RGB555LE ||
- trk->enc->pix_fmt == AV_PIX_FMT_RGB565BE ||
- trk->enc->pix_fmt == AV_PIX_FMT_RGB565LE ||
- trk->enc->pix_fmt == AV_PIX_FMT_PAL8 ||
- trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 ||
- trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE ||
- trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK);
-
- if (mov->is_raw_rgb) {
+ mov->is_unaligned_raw_rgb =
+ trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO &&
+ (trk->enc->pix_fmt == AV_PIX_FMT_RGB24 ||
+ trk->enc->pix_fmt == AV_PIX_FMT_BGR24 ||
+ trk->enc->pix_fmt == AV_PIX_FMT_PAL8 ||
+ trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 ||
+ trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE ||
+ trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK);
+
+ if (mov->is_unaligned_raw_rgb) {
const uint8_t *data = pkt->data;
int size = pkt->size;
int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16;
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index 9170ade..daaef53 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -212,7 +212,7 @@ typedef struct MOVMuxContext {
uint32_t palette[AVPALETTE_COUNT];
int pal_done;
- int is_raw_rgb;
+ int is_unaligned_raw_rgb;
} MOVMuxContext;
--
1.7.10.4
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel