Re: [FFmpeg-devel] [PATCH 3/5] concatdec: move duration calculating code to open_file

2015-11-01 Thread Marton Balint


On Mon, 2 Nov 2015, Nicolas George wrote:


Le primidi 11 brumaire, an CCXXIV, Marton Balint a écrit :

Because I add it to the metadata store here in the next patch, which
metadata will be set for every file packet, so calculating it at the end of
file is not an option.


I see. But do you really need the duration metadata when it is not
authoritative?


I use it in the select filter at the end of the patch series...

If duration is inaccurate, there is not much I can think of other 
than documenting it as a possible problem.


Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/5] concatdec: move duration calculating code to open_file

2015-11-01 Thread Nicolas George
Le primidi 11 brumaire, an CCXXIV, Marton Balint a écrit :
> Because I add it to the metadata store here in the next patch, which
> metadata will be set for every file packet, so calculating it at the end of
> file is not an option.

I see. But do you really need the duration metadata when it is not
authoritative?

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/5] concatdec: move duration calculating code to open_file

2015-11-01 Thread Marton Balint

On Fri, 30 Oct 2015, Nicolas George wrote:


Le quartidi 4 brumaire, an CCXXIV, Marton Balint a écrit :

Hmm. I need this computed here for the next patch. Maybe we could calcualate
the duration here and then update it in open_next_file as well?


That is probably possible somehow but a bit tricky. Can you explain why you
need the duration at this point?


Because I add it to the metadata store here in the next patch, which 
metadata will be set for every file packet, so calculating it at the end 
of file is not an option.


I will rework the patch series and drop this change, so only the metadata 
will be affected by the unknown duration, and not the file->duration which 
is used to calculate the packet timestamps.


Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/5] concatdec: move duration calculating code to open_file

2015-10-30 Thread Nicolas George
Le quartidi 4 brumaire, an CCXXIV, Marton Balint a écrit :
> Hmm. I need this computed here for the next patch. Maybe we could calcualate
> the duration here and then update it in open_next_file as well?

That is probably possible somehow but a bit tricky. Can you explain why you
need the duration at this point?

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/5] concatdec: move duration calculating code to open_file

2015-10-25 Thread Marton Balint


On Sun, 25 Oct 2015, Nicolas George wrote:


Le tridi 3 brumaire, an CCXXIV, Marton Balint a écrit :

Signed-off-by: Marton Balint 
---
 libavformat/concatdec.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 7686f28..f262d44 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -316,6 +316,14 @@ static int open_file(AVFormatContext *avf, unsigned fileno)
cat->files[fileno - 1].duration;
 file->file_start_time = (cat->avf->start_time == AV_NOPTS_VALUE) ? 0 : 
cat->avf->start_time;
 file->file_inpoint = (file->inpoint == AV_NOPTS_VALUE) ? 
file->file_start_time : file->inpoint;



+if (file->duration == AV_NOPTS_VALUE) {
+file->duration = cat->avf->duration;
+if (file->inpoint != AV_NOPTS_VALUE)
+file->duration -= (file->inpoint - file->file_start_time);
+if (file->outpoint != AV_NOPTS_VALUE)
+file->duration -= cat->avf->duration - (file->outpoint - 
file->file_start_time);
+}


At this point, the file duration is not reliable, so unless I am mistaken
this change would produce wrong timestamps when stitching, for example, MP3
files without extra headers.



Hmm. I need this computed here for the next patch. Maybe we could 
calcualate the duration here and then update it in open_next_file as well?


Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/5] concatdec: move duration calculating code to open_file

2015-10-25 Thread Nicolas George
Le tridi 3 brumaire, an CCXXIV, Marton Balint a écrit :
> Signed-off-by: Marton Balint 
> ---
>  libavformat/concatdec.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> index 7686f28..f262d44 100644
> --- a/libavformat/concatdec.c
> +++ b/libavformat/concatdec.c
> @@ -316,6 +316,14 @@ static int open_file(AVFormatContext *avf, unsigned 
> fileno)
> cat->files[fileno - 1].duration;
>  file->file_start_time = (cat->avf->start_time == AV_NOPTS_VALUE) ? 0 : 
> cat->avf->start_time;
>  file->file_inpoint = (file->inpoint == AV_NOPTS_VALUE) ? 
> file->file_start_time : file->inpoint;

> +if (file->duration == AV_NOPTS_VALUE) {
> +file->duration = cat->avf->duration;
> +if (file->inpoint != AV_NOPTS_VALUE)
> +file->duration -= (file->inpoint - file->file_start_time);
> +if (file->outpoint != AV_NOPTS_VALUE)
> +file->duration -= cat->avf->duration - (file->outpoint - 
> file->file_start_time);
> +}

At this point, the file duration is not reliable, so unless I am mistaken
this change would produce wrong timestamps when stitching, for example, MP3
files without extra headers.

> +
>  if ((ret = match_streams(avf)) < 0)
>  return ret;
>  if (file->inpoint != AV_NOPTS_VALUE) {
> @@ -469,14 +477,6 @@ static int open_next_file(AVFormatContext *avf)
>  ConcatContext *cat = avf->priv_data;
>  unsigned fileno = cat->cur_file - cat->files;
>  
> -if (cat->cur_file->duration == AV_NOPTS_VALUE) {
> -cat->cur_file->duration = cat->avf->duration;
> -if (cat->cur_file->inpoint != AV_NOPTS_VALUE)
> -cat->cur_file->duration -= (cat->cur_file->inpoint - 
> cat->cur_file->file_start_time);
> -if (cat->cur_file->outpoint != AV_NOPTS_VALUE)
> -cat->cur_file->duration -= cat->avf->duration - 
> (cat->cur_file->outpoint - cat->cur_file->file_start_time);
> -}
> -
>  if (++fileno >= cat->nb_files) {
>  cat->eof = 1;
>  return AVERROR_EOF;

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/5] concatdec: move duration calculating code to open_file

2015-10-24 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavformat/concatdec.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 7686f28..f262d44 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -316,6 +316,14 @@ static int open_file(AVFormatContext *avf, unsigned fileno)
cat->files[fileno - 1].duration;
 file->file_start_time = (cat->avf->start_time == AV_NOPTS_VALUE) ? 0 : 
cat->avf->start_time;
 file->file_inpoint = (file->inpoint == AV_NOPTS_VALUE) ? 
file->file_start_time : file->inpoint;
+if (file->duration == AV_NOPTS_VALUE) {
+file->duration = cat->avf->duration;
+if (file->inpoint != AV_NOPTS_VALUE)
+file->duration -= (file->inpoint - file->file_start_time);
+if (file->outpoint != AV_NOPTS_VALUE)
+file->duration -= cat->avf->duration - (file->outpoint - 
file->file_start_time);
+}
+
 if ((ret = match_streams(avf)) < 0)
 return ret;
 if (file->inpoint != AV_NOPTS_VALUE) {
@@ -469,14 +477,6 @@ static int open_next_file(AVFormatContext *avf)
 ConcatContext *cat = avf->priv_data;
 unsigned fileno = cat->cur_file - cat->files;
 
-if (cat->cur_file->duration == AV_NOPTS_VALUE) {
-cat->cur_file->duration = cat->avf->duration;
-if (cat->cur_file->inpoint != AV_NOPTS_VALUE)
-cat->cur_file->duration -= (cat->cur_file->inpoint - 
cat->cur_file->file_start_time);
-if (cat->cur_file->outpoint != AV_NOPTS_VALUE)
-cat->cur_file->duration -= cat->avf->duration - 
(cat->cur_file->outpoint - cat->cur_file->file_start_time);
-}
-
 if (++fileno >= cat->nb_files) {
 cat->eof = 1;
 return AVERROR_EOF;
-- 
2.1.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel