[FFmpeg-devel] [PATCH 2/3] electronicarts: demux alpha stream
Peter Ross
pross at xvid.org
Thu Jun 25 07:05:07 CEST 2015
Electronic Arts VP6 files may contain two video streams: one for the
primary video stream and another for the alpha mask. The file format
uses identical data structures for both streams.
Signed-off-by: Peter Ross <pross at xvid.org>
---
libavformat/electronicarts.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 6e53ae7..5d21d49 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -59,6 +59,9 @@
#define MVhd_TAG MKTAG('M', 'V', 'h', 'd')
#define MV0K_TAG MKTAG('M', 'V', '0', 'K')
#define MV0F_TAG MKTAG('M', 'V', '0', 'F')
+#define AVhd_TAG MKTAG('A', 'V', 'h', 'd')
+#define AV0K_TAG MKTAG('A', 'V', '0', 'K')
+#define AV0F_TAG MKTAG('A', 'V', '0', 'F')
#define MVIh_TAG MKTAG('M', 'V', 'I', 'h') /* CMV header */
#define MVIf_TAG MKTAG('M', 'V', 'I', 'f') /* CMV I-frame */
#define AVP6_TAG MKTAG('A', 'V', 'P', '6')
@@ -74,7 +77,7 @@ typedef struct VideoProperties {
typedef struct EaDemuxContext {
int big_endian;
- VideoProperties video;
+ VideoProperties video, alpha;
enum AVCodecID audio_codec;
int audio_stream_index;
@@ -431,6 +434,10 @@ static int process_ea_header(AVFormatContext *s)
case MVhd_TAG:
err = process_video_header_vp6(s, &ea->video);
break;
+
+ case AVhd_TAG:
+ err = process_video_header_vp6(s, &ea->alpha);
+ break;
}
if (err < 0) {
@@ -511,7 +518,7 @@ static int ea_read_header(AVFormatContext *s)
if (process_ea_header(s)<=0)
return AVERROR(EIO);
- if (init_video_stream(s, &ea->video))
+ if (init_video_stream(s, &ea->video) || init_video_stream(s, &ea->alpha))
return AVERROR(ENOMEM);
if (ea->audio_codec) {
@@ -672,10 +679,12 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
goto get_video_packet;
case MV0K_TAG:
+ case AV0K_TAG:
case MPCh_TAG:
case pIQT_TAG:
key = AV_PKT_FLAG_KEY;
case MV0F_TAG:
+ case AV0F_TAG:
get_video_packet:
if (!chunk_size)
continue;
@@ -689,7 +698,10 @@ get_video_packet:
break;
}
partial_packet = chunk_type == MVIh_TAG;
- pkt->stream_index = ea->video.stream_index;
+ if (chunk_type == AV0K_TAG || chunk_type == AV0F_TAG)
+ pkt->stream_index = ea->alpha.stream_index;
+ else
+ pkt->stream_index = ea->video.stream_index;
pkt->flags |= key;
packet_read = 1;
break;
--
2.1.4
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150625/376b49c7/attachment.asc>
More information about the ffmpeg-devel
mailing list