Re: [libav-devel] [PATCH] avconv: Factorize combining auto vsync with format.

2011-08-18 Thread Anton Khirnov

On Wed, 17 Aug 2011 23:04:32 +0100, Måns Rullgård  wrote:
> Anton Khirnov  writes:
> 
> > On Tue, 16 Aug 2011 19:09:22 -0700, Alex Converse  
> > wrote:
> >> ---
> >>  avconv.c |   14 +++---
> >>  1 files changed, 11 insertions(+), 3 deletions(-)
> >> 
> >> diff --git a/avconv.c b/avconv.c
> >> index b3a4ab7..0751f19 100644
> >> --- a/avconv.c
> >> +++ b/avconv.c
> >> @@ -1098,7 +1098,7 @@ static void do_video_out(AVFormatContext *s,
> >>   AVFrame *in_picture,
> >>   int *frame_size, float quality)
> >>  {
> >> -int nb_frames, i, ret;
> >> +int nb_frames, i, ret, format_video_sync;
> >>  AVFrame *final_picture;
> >>  AVCodecContext *enc, *dec;
> >>  double sync_ipts;
> >> @@ -1113,12 +1113,20 @@ static void do_video_out(AVFormatContext *s,
> >>  
> >>  *frame_size = 0;
> >>  
> >> -if(video_sync_method){
> >> +format_video_sync = video_sync_method;
> >> +if (format_video_sync < 0) {
> >> +if (s->oformat->flags & AVFMT_VARIABLE_FPS)
> >> +format_video_sync = 2;
> >> +else
> >> +format_video_sync = 1;
> >
> > format_video_sync = s->oformat->flags & AVFMT_VARIABLE_FPS ? 2 : 1; ?
> >
> > Also note to self: video_sync_method looks like another abused global to
> > be rescued.
> 
> Why can't it just do the right thing without a magic "method" being
> specified?
> 

Because nobody fixed it yet. I hope I'll get to it some time, but
anyone else is welcome to beat me to it.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avconv: Factorize combining auto vsync with format.

2011-08-17 Thread Måns Rullgård
Anton Khirnov  writes:

> On Tue, 16 Aug 2011 19:09:22 -0700, Alex Converse  
> wrote:
>> ---
>>  avconv.c |   14 +++---
>>  1 files changed, 11 insertions(+), 3 deletions(-)
>> 
>> diff --git a/avconv.c b/avconv.c
>> index b3a4ab7..0751f19 100644
>> --- a/avconv.c
>> +++ b/avconv.c
>> @@ -1098,7 +1098,7 @@ static void do_video_out(AVFormatContext *s,
>>   AVFrame *in_picture,
>>   int *frame_size, float quality)
>>  {
>> -int nb_frames, i, ret;
>> +int nb_frames, i, ret, format_video_sync;
>>  AVFrame *final_picture;
>>  AVCodecContext *enc, *dec;
>>  double sync_ipts;
>> @@ -1113,12 +1113,20 @@ static void do_video_out(AVFormatContext *s,
>>  
>>  *frame_size = 0;
>>  
>> -if(video_sync_method){
>> +format_video_sync = video_sync_method;
>> +if (format_video_sync < 0) {
>> +if (s->oformat->flags & AVFMT_VARIABLE_FPS)
>> +format_video_sync = 2;
>> +else
>> +format_video_sync = 1;
>
> format_video_sync = s->oformat->flags & AVFMT_VARIABLE_FPS ? 2 : 1; ?
>
> Also note to self: video_sync_method looks like another abused global to
> be rescued.

Why can't it just do the right thing without a magic "method" being
specified?

-- 
Måns Rullgård
m...@mansr.com
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avconv: Factorize combining auto vsync with format.

2011-08-17 Thread Anton Khirnov

On Wed, 17 Aug 2011 10:24:37 -0700, Alex Converse  
wrote:
> ---
>  avconv.c |   10 +++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/avconv.c b/avconv.c
> index 6fa3e94..9017d48 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -1098,7 +1098,7 @@ static void do_video_out(AVFormatContext *s,
>   AVFrame *in_picture,
>   int *frame_size, float quality)
>  {
> -int nb_frames, i, ret;
> +int nb_frames, i, ret, format_video_sync;
>  AVFrame *final_picture;
>  AVCodecContext *enc, *dec;
>  double sync_ipts;
> @@ -1113,12 +1113,16 @@ static void do_video_out(AVFormatContext *s,
>  
>  *frame_size = 0;
>  
> -if(video_sync_method){
> +format_video_sync = video_sync_method;
> +if (format_video_sync < 0)
> +format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? 2 : 1;
> +
> +if (format_video_sync) {
>  double vdelta = sync_ipts - ost->sync_opts;
>  //FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
>  if (vdelta < -1.1)
>  nb_frames = 0;
> -else if (video_sync_method == 2 || (video_sync_method<0 && 
> (s->oformat->flags & AVFMT_VARIABLE_FPS))){
> +else if (format_video_sync == 2) {
>  if(vdelta<=-0.6){
>  nb_frames=0;
>  }else if(vdelta>0.6)
> -- 
> 1.7.3.1
> 

Ok.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] avconv: Factorize combining auto vsync with format.

2011-08-17 Thread Alex Converse
---
 avconv.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/avconv.c b/avconv.c
index 6fa3e94..9017d48 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1098,7 +1098,7 @@ static void do_video_out(AVFormatContext *s,
  AVFrame *in_picture,
  int *frame_size, float quality)
 {
-int nb_frames, i, ret;
+int nb_frames, i, ret, format_video_sync;
 AVFrame *final_picture;
 AVCodecContext *enc, *dec;
 double sync_ipts;
@@ -1113,12 +1113,16 @@ static void do_video_out(AVFormatContext *s,
 
 *frame_size = 0;
 
-if(video_sync_method){
+format_video_sync = video_sync_method;
+if (format_video_sync < 0)
+format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? 2 : 1;
+
+if (format_video_sync) {
 double vdelta = sync_ipts - ost->sync_opts;
 //FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
 if (vdelta < -1.1)
 nb_frames = 0;
-else if (video_sync_method == 2 || (video_sync_method<0 && 
(s->oformat->flags & AVFMT_VARIABLE_FPS))){
+else if (format_video_sync == 2) {
 if(vdelta<=-0.6){
 nb_frames=0;
 }else if(vdelta>0.6)
-- 
1.7.3.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avconv: Factorize combining auto vsync with format.

2011-08-16 Thread Anton Khirnov

On Tue, 16 Aug 2011 19:09:22 -0700, Alex Converse  
wrote:
> ---
>  avconv.c |   14 +++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/avconv.c b/avconv.c
> index b3a4ab7..0751f19 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -1098,7 +1098,7 @@ static void do_video_out(AVFormatContext *s,
>   AVFrame *in_picture,
>   int *frame_size, float quality)
>  {
> -int nb_frames, i, ret;
> +int nb_frames, i, ret, format_video_sync;
>  AVFrame *final_picture;
>  AVCodecContext *enc, *dec;
>  double sync_ipts;
> @@ -1113,12 +1113,20 @@ static void do_video_out(AVFormatContext *s,
>  
>  *frame_size = 0;
>  
> -if(video_sync_method){
> +format_video_sync = video_sync_method;
> +if (format_video_sync < 0) {
> +if (s->oformat->flags & AVFMT_VARIABLE_FPS)
> +format_video_sync = 2;
> +else
> +format_video_sync = 1;

format_video_sync = s->oformat->flags & AVFMT_VARIABLE_FPS ? 2 : 1; ?

Also note to self: video_sync_method looks like another abused global to
be rescued.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] avconv: Factorize combining auto vsync with format.

2011-08-16 Thread Alex Converse
---
 avconv.c |   14 +++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/avconv.c b/avconv.c
index b3a4ab7..0751f19 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1098,7 +1098,7 @@ static void do_video_out(AVFormatContext *s,
  AVFrame *in_picture,
  int *frame_size, float quality)
 {
-int nb_frames, i, ret;
+int nb_frames, i, ret, format_video_sync;
 AVFrame *final_picture;
 AVCodecContext *enc, *dec;
 double sync_ipts;
@@ -1113,12 +1113,20 @@ static void do_video_out(AVFormatContext *s,
 
 *frame_size = 0;
 
-if(video_sync_method){
+format_video_sync = video_sync_method;
+if (format_video_sync < 0) {
+if (s->oformat->flags & AVFMT_VARIABLE_FPS)
+format_video_sync = 2;
+else
+format_video_sync = 1;
+}
+
+if (format_video_sync) {
 double vdelta = sync_ipts - ost->sync_opts;
 //FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
 if (vdelta < -1.1)
 nb_frames = 0;
-else if (video_sync_method == 2 || (video_sync_method<0 && 
(s->oformat->flags & AVFMT_VARIABLE_FPS))){
+else if (format_video_sync == 2) {
 if(vdelta<=-0.6){
 nb_frames=0;
 }else if(vdelta>0.6)
-- 
1.7.3.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel