Re: [FFmpeg-devel] [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson

On 02/29/2016 02:27 PM, Mats Peterson wrote:

New patch set.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel




Sorry, Michael, but this won't be the last version. There are other 
codecs than rawvideo that use a palette, so I'm working on a new version.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson

On 02/29/2016 09:42 PM, Michael Niedermayer wrote:

On Mon, Feb 29, 2016 at 04:12:56PM +0100, Mats Peterson wrote:

Mats Peterson  skrev: (29 februari 2016 
14:27:13 CET)

New patch set.


It seems that you, Michael, don't care much about adding support for palette 
side data packets, while Reimar advocates for it. Is the situation correctly 
understood?


no, iam waiting for the patch series to stabilize, you post a
new one every few hours
when that slows down then ill look (when ive time)



Hehe... OK. Sorry. Well, it's pretty much settled by now. Please go 
ahead and have a look at it.


Mats

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Michael Niedermayer
On Mon, Feb 29, 2016 at 04:12:56PM +0100, Mats Peterson wrote:
> Mats Peterson  skrev: (29 februari 2016 
> 14:27:13 CET)
> >New patch set.
> 
> It seems that you, Michael, don't care much about adding support for palette 
> side data packets, while Reimar advocates for it. Is the situation correctly 
> understood?

no, iam waiting for the patch series to stabilize, you post a
new one every few hours
when that slows down then ill look (when ive time)

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson
Mats Peterson  skrev: (29 februari 2016 
14:27:13 CET)
>New patch set.

It seems that you, Michael, don't care much about adding support for palette 
side data packets, while Reimar advocates for it. Is the situation correctly 
understood?
-- 
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

2016-02-29 Thread Mats Peterson

New patch set.

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 46b854f4b872d67b3aed118c929250f983dbab7b Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Mon, 29 Feb 2016 14:23:50 +0100
Subject: [PATCH v2 1/4] lavf/avienc: Add support for palette side data packets

---
 libavformat/avienc.c |   61 --
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index ca505f4..2d22940 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -362,7 +362,8 @@ static int avi_write_header(AVFormatContext *s)
 && enc->pix_fmt == AV_PIX_FMT_RGB555LE
 && enc->bits_per_coded_sample == 15)
 enc->bits_per_coded_sample = 16;
-avist->pal_offset = avio_tell(pb) + 40;
+if (pb->seekable)
+avist->pal_offset = avio_tell(pb) + 40;
 ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 0, 0);
 pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
   enc->bits_per_coded_sample);
@@ -652,8 +653,6 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
 unsigned char tag[5];
 const int stream_index = pkt->stream_index;
-const uint8_t *data= pkt->data;
-int size   = pkt->size;
 AVIOContext *pb = s->pb;
 AVCodecContext *enc = s->streams[stream_index]->codec;
 AVIStream *avist= s->streams[stream_index]->priv_data;
@@ -668,39 +667,47 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
 if ((ret = write_skip_frames(s, stream_index, pkt->dts)) < 0)
 return ret;
 
+if (!pkt->size)
+return avi_write_packet_internal(s, pkt); /* Passthrough */
+
 if (enc->codec_id == AV_CODEC_ID_RAWVIDEO && enc->codec_tag == 0) {
 int64_t bpc = enc->bits_per_coded_sample != 15 ? enc->bits_per_coded_sample : 16;
 int expected_stride = ((enc->width * bpc + 31) >> 5)*4;
-
+AVPacket *opkt = pkt;
+const uint8_t *pal;
+int ret2;
 ret = ff_reshuffle_raw_rgb(s, , enc, expected_stride);
 if (ret < 0)
 return ret;
-if (ret) {
-if (ret == CONTAINS_PAL) {
-int pc_tag, i;
-int pal_size = 1 << enc->bits_per_coded_sample;
-if (!avist->hdr_pal_done) {
-int64_t cur_offset = avio_tell(pb);
-avio_seek(pb, avist->pal_offset, SEEK_SET);
-for (i = 0; i < pal_size; i++) {
-uint32_t v = AV_RL32(data + size - 4*pal_size + 4*i);
-avio_wl32(pb, v & 0xff);
-}
-avio_seek(pb, cur_offset, SEEK_SET);
-avist->hdr_pal_done++;
-}
-avi_stream2fourcc(tag, stream_index, enc->codec_type);
-tag[2] = 'p'; tag[3] = 'c';
-pc_tag = ff_start_tag(pb, tag);
-avio_w8(pb, 0);
-avio_w8(pb, pal_size & 0xFF);
-avio_wl16(pb, 0); // reserved
+ret2 = ff_get_raw_palette(s, opkt, ret, );
+if (ret2 < 0)
+return ret2;
+if (pal) {
+int pal_size = 1 << enc->bits_per_coded_sample;
+int pc_tag, i;
+if (pb->seekable && !avist->hdr_pal_done) {
+int64_t cur_offset = avio_tell(pb);
+avio_seek(pb, avist->pal_offset, SEEK_SET);
 for (i = 0; i < pal_size; i++) {
-uint32_t v = AV_RL32(data + size - 4*pal_size + 4*i);
-avio_wb32(pb, v<<8);
+uint32_t v = AV_RL32(pal + 4*i);
+avio_wl32(pb, v & 0xff);
 }
-ff_end_tag(pb, pc_tag);
+avio_seek(pb, cur_offset, SEEK_SET);
+avist->hdr_pal_done++;
+}
+avi_stream2fourcc(tag, stream_index, enc->codec_type);
+tag[2] = 'p'; tag[3] = 'c';
+pc_tag = ff_start_tag(pb, tag);
+avio_w8(pb, 0);
+avio_w8(pb, pal_size & 0xFF);
+avio_wl16(pb, 0); // reserved
+for (i = 0; i < pal_size; i++) {
+uint32_t v = AV_RL32(pal + 4*i);
+avio_wb32(pb, v<<8);
 }
+ff_end_tag(pb, pc_tag);
+}
+if (ret) {
 ret = avi_write_packet_internal(s, pkt);
 av_packet_free();
 return ret;
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel