[06/12] movenc: Write the sample rate instead of time scale in the stsd atom

Message ID 1327065643-34065-6-git-send-email-martin@martin.st
State Committed
Commit 3b5d4428acf6eab60410358a5dbf931a17300ecf
Headers show

Commit Message

Martin Storsjö Jan. 20, 2012, 1:20 p.m.
For ismv/isma, the time scale might not be the same as the sample
rate.
---
 libavformat/movenc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Martin Storsjö Jan. 25, 2012, 9:35 a.m. | #1
On Fri, 20 Jan 2012, Martin Storsjö wrote:

> For ismv/isma, the time scale might not be the same as the sample
> rate.
> ---
> libavformat/movenc.c |    4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 2113b3f..4ff4b7e 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -478,7 +478,7 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
>         avio_wb16(pb, 0);
>         avio_wb32(pb, 0x00010000);
>         avio_wb32(pb, 72);
> -        avio_wb64(pb, av_double2int(track->timescale));
> +        avio_wb64(pb, av_double2int(track->enc->sample_rate));
>         avio_wb32(pb, track->enc->channels);
>         avio_wb32(pb, 0x7F000000);
>         avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id));
> @@ -492,7 +492,7 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
>         avio_wb16(pb, 0);
>
>         avio_wb16(pb, 0); /* packet size (= 0) */
> -        avio_wb16(pb, track->timescale); /* Time scale */
> +        avio_wb16(pb, track->enc->sample_rate);
>         avio_wb16(pb, 0); /* Reserved */
>     }
>
> -- 
> 1.7.3.1

This lacks review, should be straightforward.

// Martin
Ronald Bultje Jan. 25, 2012, 9:37 a.m. | #2
Hi,

On Wed, Jan 25, 2012 at 5:35 PM, Martin Storsjö <martin@martin.st> wrote:
> On Fri, 20 Jan 2012, Martin Storsjö wrote:
>
>> For ismv/isma, the time scale might not be the same as the sample
>> rate.
>> ---
>> libavformat/movenc.c |    4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
>> index 2113b3f..4ff4b7e 100644
>> --- a/libavformat/movenc.c
>> +++ b/libavformat/movenc.c
>> @@ -478,7 +478,7 @@ static int mov_write_audio_tag(AVIOContext *pb,
>> MOVTrack *track)
>>        avio_wb16(pb, 0);
>>        avio_wb32(pb, 0x00010000);
>>        avio_wb32(pb, 72);
>> -        avio_wb64(pb, av_double2int(track->timescale));
>> +        avio_wb64(pb, av_double2int(track->enc->sample_rate));
>>        avio_wb32(pb, track->enc->channels);
>>        avio_wb32(pb, 0x7F000000);
>>        avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id));
>> @@ -492,7 +492,7 @@ static int mov_write_audio_tag(AVIOContext *pb,
>> MOVTrack *track)
>>        avio_wb16(pb, 0);
>>
>>        avio_wb16(pb, 0); /* packet size (= 0) */
>> -        avio_wb16(pb, track->timescale); /* Time scale */
>> +        avio_wb16(pb, track->enc->sample_rate);
>>        avio_wb16(pb, 0); /* Reserved */
>>    }
>>
>> --
>> 1.7.3.1
>
>
> This lacks review, should be straightforward.

I actually checked this one, LGTM.

Ronald

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2113b3f..4ff4b7e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -478,7 +478,7 @@  static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
         avio_wb16(pb, 0);
         avio_wb32(pb, 0x00010000);
         avio_wb32(pb, 72);
-        avio_wb64(pb, av_double2int(track->timescale));
+        avio_wb64(pb, av_double2int(track->enc->sample_rate));
         avio_wb32(pb, track->enc->channels);
         avio_wb32(pb, 0x7F000000);
         avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id));
@@ -492,7 +492,7 @@  static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
         avio_wb16(pb, 0);
 
         avio_wb16(pb, 0); /* packet size (= 0) */
-        avio_wb16(pb, track->timescale); /* Time scale */
+        avio_wb16(pb, track->enc->sample_rate);
         avio_wb16(pb, 0); /* Reserved */
     }