[FFmpeg-devel] [PATCH]Basic XSUB encoder (take 5)
Reimar Döffinger
Reimar.Doeffinger
Fri Jun 19 12:21:55 CEST 2009
On Thu, Jun 18, 2009 at 03:56:49PM +0200, Michael Niedermayer wrote:
> now the avi changes ...
>
> [...]
> > Index: libavformat/avienc.c
> > ===================================================================
> > --- libavformat/avienc.c (revision 18911)
> > +++ libavformat/avienc.c (working copy)
> > @@ -81,6 +81,9 @@
> > if (type == CODEC_TYPE_VIDEO) {
> > tag[2] = 'd';
> > tag[3] = 'c';
> > + } else if (type == CODEC_TYPE_SUBTITLE) {
> > + tag[2] = 's';
> > + tag[3] = 'b';
> > } else {
> > tag[2] = 'w';
> > tag[3] = 'b';
> > @@ -212,8 +215,10 @@
> > case CODEC_TYPE_AUDIO: put_tag(pb, "auds"); break;
> > // case CODEC_TYPE_TEXT : put_tag(pb, "txts"); break;
> > case CODEC_TYPE_DATA : put_tag(pb, "dats"); break;
> > + case CODEC_TYPE_SUBTITLE: put_tag(pb, "vids"); break;
>
> can you quote some spec that requires these?
>
>
> [...]
> > @@ -253,6 +258,7 @@
> > strf = start_tag(pb, "strf");
> > switch(stream->codec_type) {
> > case CODEC_TYPE_VIDEO:
> > + case CODEC_TYPE_SUBTITLE:
> > put_bmp_header(pb, stream, codec_bmp_tags, 0);
> > break;
> > case CODEC_TYPE_AUDIO:
>
> same question
>
> if its just xsub then there should be a check for that not just the
> codec_type IMHO
I don't have a device to actually test the result, but how does attached
patch look to you?
-------------- next part --------------
Index: libavformat/avienc.c
===================================================================
--- libavformat/avienc.c (revision 19221)
+++ libavformat/avienc.c (working copy)
@@ -81,6 +81,9 @@
if (type == CODEC_TYPE_VIDEO) {
tag[2] = 'd';
tag[3] = 'c';
+ } else if (type == CODEC_TYPE_SUBTITLE) {
+ tag[2] = 's';
+ tag[3] = 'b';
} else {
tag[2] = 'w';
tag[3] = 'b';
@@ -208,12 +211,17 @@
/* stream generic header */
strh = start_tag(pb, "strh");
switch(stream->codec_type) {
+ case CODEC_TYPE_SUBTITLE:
+ // XSUB subtitles behave like video tracks, other subtitles
+ // are not (yet) supported.
+ if (stream->codec_id != CODEC_ID_XSUB) break;
case CODEC_TYPE_VIDEO: put_tag(pb, "vids"); break;
case CODEC_TYPE_AUDIO: put_tag(pb, "auds"); break;
// case CODEC_TYPE_TEXT : put_tag(pb, "txts"); break;
case CODEC_TYPE_DATA : put_tag(pb, "dats"); break;
}
- if(stream->codec_type == CODEC_TYPE_VIDEO)
+ if(stream->codec_type == CODEC_TYPE_VIDEO ||
+ stream->codec_id == CODEC_ID_XSUB)
put_le32(pb, stream->codec_tag);
else
put_le32(pb, 1);
@@ -252,6 +260,10 @@
if(stream->codec_type != CODEC_TYPE_DATA){
strf = start_tag(pb, "strf");
switch(stream->codec_type) {
+ case CODEC_TYPE_SUBTITLE:
+ // XSUB subtitles behave like video tracks, other subtitles
+ // are not (yet) supported.
+ if (stream->codec_id != CODEC_ID_XSUB) break;
case CODEC_TYPE_VIDEO:
put_bmp_header(pb, stream, codec_bmp_tags, 0);
break;
More information about the ffmpeg-devel
mailing list