[FFmpeg-devel] Support for generating avm2 compatible swf files
Baptiste Coudurier
baptiste.coudurier
Sun Jan 20 16:47:39 CET 2008
Hi,
Paul Egan wrote:
> As suggested, I've changed the tag name and documented
> the tag value with the explicit setting of each bit.
>
> There didn't seem to be any conclusion as to how best
> to support specifying format versions, so I've left the
> use of a "dummy" format as is.
>
> Hope that's acceptable.
>
>
> ----- Original Message ----
> From: Baptiste Coudurier <baptiste.coudurier at smartjog.com>
> To: FFmpeg development discussions and patches <ffmpeg-devel at mplayerhq.hu>
> Sent: Tuesday, January 15, 2008 7:08:34 PM
> Subject: Re: [FFmpeg-devel] Support for generating avm2 compatible swf files
>
>
> Hi,
>
> Paul Egan wrote:
>>> [...]
>>>
>> I wasn't sure of the convention for adding a new version of a
>> file format. What would be acceptable?
>>
>>> why is the version not always set to the newest, does it fail with
> old
>>> programs?
>>>
>> Users of older versions of the Flash player can happily
>> interact with older version swf files - this issue effects
>> only those developers/users using an AVM2 based application.
>> If a version 9 swf file was generated by default, it wouldn't
>> be usable by older players.
>>
>>> what does the newly added chunk mean and why is it not always added?
>> When loading a swf, AVM2 looks at both the version number
>> and the file attribute tag to determine if the movie clip is
>> AVM2 [3]. The attribute tag should probably be added to v8
>> swf files as well, but I didn't want to change existing
>> functionality.
>>
>
> If tag is FILEATTRIBUTE, better naming it that way, and use
> put_swf_tag.
> Can you document (in comments) which feature your are setting with this
> tag ?
>
>
>
>
>
> ------------------------------------------------------------------------
>
> Index: libavformat/swf.c
> ===================================================================
> --- libavformat/swf.c (revision 11573)
> +++ libavformat/swf.c (working copy)
> @@ -40,6 +40,7 @@
> #define TAG_STREAMHEAD2 45
> #define TAG_VIDEOSTREAM 60
> #define TAG_VIDEOFRAME 61
> +#define TAG_FILEATTRIBUTES 69
Im nitpicking, only one space.
> [...]
>
> + /* avm2/swf v9 (also v8?) files require a file attribute tag */
> + if (is_avm2) {
> + put_swf_tag(s, TAG_FILEATTRIBUTES);
> + init_put_bits(&p, buf1, sizeof(buf1));
> + put_bits(&p, 3, 0); /* reserved */
> + put_bits(&p, 1, 0); /* has metadata */
> + put_bits(&p, 1, 1); /* is ActionScript v3/AVM2 */
> + put_bits(&p, 1, 0); /* cross-domain file caching */
> + put_bits(&p, 1, 0); /* relative urls */
> + put_bits(&p, 1, 0); /* use network */
> + put_bits(&p, 24, 0); /* reserved */
> + flush_put_bits(&p);
> + put_buffer(pb, buf1, pbBufPtr(&p) - p.buf);
> + put_swf_end_tag(s);
> + }
> +
Well, sorry if I was unclear, no need to use put_bits here:
Just do something like:
put_swf_tag(s, TAG_FILEATTRIBUTES);
put_le32(pb, 1<<3); /* set ActionScript v3/AVM2 flag */
put_swf_end_tag(s);
> [...]
>
> +#endif
> Index: libavformat/allformats.c
> ===================================================================
> --- libavformat/allformats.c (revision 11573)
> +++ libavformat/allformats.c (working copy)
> @@ -148,6 +148,7 @@
> REGISTER_DEMUXER (SOL, sol);
> REGISTER_DEMUXER (STR, str);
> REGISTER_MUXDEMUX (SWF, swf);
> + REGISTER_MUXER (AVM2, avm2);
> REGISTER_MUXER (TG2, tg2);
> REGISTER_MUXER (TGP, tgp);
> REGISTER_DEMUXER (THP, thp);
>
You must increase minor version in avformat.h since you are adding a new
muxer.
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A. http://www.smartjog.com
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312
More information about the ffmpeg-devel
mailing list