[FFmpeg-devel] [PATCH] avformat/mov: read stream bitrates from isml manifest

Michael Niedermayer michaelni at gmx.at
Thu Jun 27 10:36:11 CEST 2013


On Thu, Jun 20, 2013 at 11:38:20AM +0200, Alexandre Sicard wrote:
> Updated patch with minor fixes.
> 
> -- 
> Alexandre SICARD - Intern, Research & Engineering
> SmartJog | www.smartjog.com | a TDF Group company

>  isom.h |    2 +
>  mov.c  |   78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 80 insertions(+)
> ceae46a81af292a0818d758cd11ca7066917a565  0001-avformat-mov-read-stream-bitrates-from-isml-manifest.patch
> From fee9b12ca954ced40031950a023fb73e0780c14b Mon Sep 17 00:00:00 2001
> From: Alexandre Sicard <alexandre.sicard at smartjog.com>
> Date: Wed, 19 Jun 2013 15:52:04 +0200
> Subject: [PATCH] avformat/mov: read stream bitrates from isml manifest
> 
> This allows to read a live isml movie and segment it using the smoothstreaming
> muxer, which requires the bitrates to be known for each stream.
> 
> Signed-off-by: Alexandre Sicard <alexandre.sicard at smartjog.com>
> ---
>  libavformat/isom.h |  2 ++
>  libavformat/mov.c  | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 80 insertions(+)
> 
> diff --git a/libavformat/isom.h b/libavformat/isom.h
> index 220b2df..b0fa453 100644
> --- a/libavformat/isom.h
> +++ b/libavformat/isom.h
> @@ -162,6 +162,8 @@ typedef struct MOVContext {
>      int use_absolute_path;
>      int ignore_editlist;
>      int64_t next_root_atom; ///< offset of the next root atom
> +    int *bitrates;          ///< bitrates read before streams creation
> +    int bitrates_count;
>  } MOVContext;
>  
>  int ff_mp4_read_descr_len(AVIOContext *pb);
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 5c61f6c..bb7067c 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c

> @@ -24,6 +24,7 @@
>   */
>  
>  #include <limits.h>
> +#include <regex.h>

This is unavaliable on at least windows AFAIK


>  
>  //#define MOV_EXPORT_ALL_METADATA
>  
> @@ -2730,6 +2731,75 @@ static int mov_read_tmcd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>      return 0;
>  }
>  
> +static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> +{
> +    int ret;
> +    uint8_t uuid[16];

> +    const uint8_t uuid_isml_manifest[] = {

static const


> +        0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
> +        0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
> +    };
> +
> +    if (atom.size < sizeof(uuid) || atom.size == INT64_MAX)
> +        return AVERROR_INVALIDDATA;
> +

> +    ret = avio_read(pb, uuid, sizeof(uuid));
> +    if (ret < 0) {
> +        return ret;
> +    }

ret should be checked for being equal to the size read


[...]
> @@ -3221,6 +3293,12 @@ static int mov_read_header(AVFormatContext *s)
>          }
>      }
>  
> +    for (i = 0; i < mov->bitrates_count && i < s->nb_streams; i++) {
> +        if (mov->bitrates[i] > 0) {
> +            s->streams[i]->codec->bit_rate = mov->bitrates[i];
> +        }
> +    }

Is this indirection neccessary (compared to directly writing into
s->streams[i]->codec->bit_rate)
?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130627/0f336e34/attachment.asc>


More information about the ffmpeg-devel mailing list