[04/10] movenc: Include empty tracks in iods when writing fragmented mp4

Message ID 1415365019-26521-4-git-send-email-martin@martin.st
State Committed
Headers show

Commit Message

Martin Storsjö Nov. 7, 2014, 12:56 p.m.
When writing fragmented streams with an empty initial moov,
we won't have any samples in any tracks when writing the
moov atom, thus trust that any tracks that are added actually
will be present.
---
This is not directly related to this patchset, I only noticed
that this would differ when using empty_moov.
---
 libavformat/movenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Luca Barbato Nov. 7, 2014, 1:55 p.m. | #1
On 07/11/14 13:56, Martin Storsjö wrote:
> When writing fragmented streams with an empty initial moov,
> we won't have any samples in any tracks when writing the
> moov atom, thus trust that any tracks that are added actually
> will be present.
> ---
> This is not directly related to this patchset, I only noticed
> that this would differ when using empty_moov.
> ---
>   libavformat/movenc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index fa5fdad..359716d 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -1809,7 +1809,7 @@ static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)
>       int audio_profile = mov->iods_audio_profile;
>       int video_profile = mov->iods_video_profile;
>       for (i = 0; i < mov->nb_streams; i++) {
> -        if (mov->tracks[i].entry > 0) {
> +        if (mov->tracks[i].entry > 0 || mov->flags & FF_MOV_FLAG_EMPTY_MOOV) {
>               has_audio |= mov->tracks[i].enc->codec_type == AVMEDIA_TYPE_AUDIO;
>               has_video |= mov->tracks[i].enc->codec_type == AVMEDIA_TYPE_VIDEO;
>           }
>

Possibly ok.

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index fa5fdad..359716d 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1809,7 +1809,7 @@  static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)
     int audio_profile = mov->iods_audio_profile;
     int video_profile = mov->iods_video_profile;
     for (i = 0; i < mov->nb_streams; i++) {
-        if (mov->tracks[i].entry > 0) {
+        if (mov->tracks[i].entry > 0 || mov->flags & FF_MOV_FLAG_EMPTY_MOOV) {
             has_audio |= mov->tracks[i].enc->codec_type == AVMEDIA_TYPE_AUDIO;
             has_video |= mov->tracks[i].enc->codec_type == AVMEDIA_TYPE_VIDEO;
         }