Commit 0a4250bc authored by Joakim Plate's avatar Joakim Plate Committed by Guillaume Poirier

add support for all framerates specified by the standard

Patch by Joakim elupus A ecce P se
Original thread:
Date: Oct 28, 2006 7:56 PM
Subject: [Ffmpeg-devel] [PATCH] Support for all official framerates in nsv demuxer

Originally committed as revision 6828 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b5c5a86b
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
* seems someone came to the same conclusions as me, and updated it: * seems someone came to the same conclusions as me, and updated it:
* (2) http://www.stud.ktu.lt/~vitslav/nsv/nsv-format.txt * (2) http://www.stud.ktu.lt/~vitslav/nsv/nsv-format.txt
* http://www.stud.ktu.lt/~vitslav/nsv/ * http://www.stud.ktu.lt/~vitslav/nsv/
* official docs
* (3) http://ultravox.aol.com/NSVFormat.rtf
* Sample files: * Sample files:
* (S1) http://www.nullsoft.com/nsv/samples/ * (S1) http://www.nullsoft.com/nsv/samples/
* http://www.nullsoft.com/nsv/samples/faster.nsv * http://www.nullsoft.com/nsv/samples/faster.nsv
...@@ -208,15 +210,6 @@ static const CodecTag nsv_codec_audio_tags[] = { ...@@ -208,15 +210,6 @@ static const CodecTag nsv_codec_audio_tags[] = {
{ 0, 0 }, { 0, 0 },
}; };
static const AVRational nsv_framerate_table[] = {
{30,1},
{30000,1001},
{25,1},
{24000,1001},
{30,1},
{15000,1001},
};
//static int nsv_load_index(AVFormatContext *s); //static int nsv_load_index(AVFormatContext *s);
static int nsv_read_chunk(AVFormatContext *s, int fill_header); static int nsv_read_chunk(AVFormatContext *s, int fill_header);
...@@ -415,11 +408,25 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -415,11 +408,25 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
vwidth = get_le16(pb); vwidth = get_le16(pb);
vheight = get_le16(pb); vheight = get_le16(pb);
i = get_byte(pb); i = get_byte(pb);
/* XXX how big must the table be ? */
/* seems there is more to that... */
PRINT(("NSV NSVs framerate code %2x\n", i)); PRINT(("NSV NSVs framerate code %2x\n", i));
if(i&0x80) framerate= nsv_framerate_table[i & 0x7F]; if(i&0x80) { /* odd way of giving native framerates from docs */
else framerate= (AVRational){i, 1}; int t=(i & 0x7F)>>2;
if(t<16) framerate = (AVRational){1, t+1};
else framerate = (AVRational){t-15, 1};
if(i&1){
framerate.num *= 1000;
framerate.den *= 1001;
}
if((i&3)==3) framerate.num *= 24;
else if((i&3)==2) framerate.num *= 25;
else framerate.num *= 30;
}
else
framerate= (AVRational){i, 1};
nsv->avsync = get_le16(pb); nsv->avsync = get_le16(pb);
#ifdef DEBUG #ifdef DEBUG
print_tag("NSV NSVs vtag", vtag, 0); print_tag("NSV NSVs vtag", vtag, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment