Re: [libav-devel] [PATCH] avconv: Do not pass NULL to avio_tell

2017-01-09 Thread Luca Barbato
On 09/01/2017 12:38, Anton Khirnov wrote:
> Quoting Luca Barbato (2017-01-09 11:36:47)
>> On 09/01/2017 10:47, Anton Khirnov wrote:
>>> The patch is fine with me, but more generally I'd say that as long
>>> as the muxer is open, the AVIOContext belongs to it and the caller
>>> touching it in any way is invalid.
>>
>> Shall we add an avformat_report_progress() or similar?
> 
> Perhaps a field in AVFormatContext which stores the number of bytes
> written so far?
> 

Should be quite easy to implement, basically at the end of every
avformat write call we'd have to take the value from avio and store it
to avformat.

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

Re: [libav-devel] [PATCH] avconv: Do not pass NULL to avio_tell

2017-01-09 Thread Anton Khirnov
Quoting Luca Barbato (2017-01-09 11:36:47)
> On 09/01/2017 10:47, Anton Khirnov wrote:
> > The patch is fine with me, but more generally I'd say that as long
> > as the muxer is open, the AVIOContext belongs to it and the caller
> > touching it in any way is invalid.
> 
> Shall we add an avformat_report_progress() or similar?

Perhaps a field in AVFormatContext which stores the number of bytes
written so far?

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

Re: [libav-devel] [PATCH] avconv: Do not pass NULL to avio_tell

2017-01-09 Thread Luca Barbato
On 09/01/2017 10:47, Anton Khirnov wrote:
> The patch is fine with me, but more generally I'd say that as long
> as the muxer is open, the AVIOContext belongs to it and the caller
> touching it in any way is invalid.

Shall we add an avformat_report_progress() or similar?

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

Re: [libav-devel] [PATCH] avconv: Do not pass NULL to avio_tell

2017-01-09 Thread Anton Khirnov
Quoting Luca Barbato (2016-12-15 19:01:03)
> The null demuxer does not have a backing AVIOContext.
> ---
>  avconv.c | 23 ---
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/avconv.c b/avconv.c
> index 5c31332..fe60625 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -909,7 +909,7 @@ static void print_report(int is_last_report, int64_t 
> timer_start)
>  char buf[1024];
>  OutputStream *ost;
>  AVFormatContext *oc;
> -int64_t total_size;
> +int64_t total_size = 0;
>  AVCodecContext *enc;
>  int frame_number, vid, i;
>  double bitrate, ti1, pts;
> @@ -934,16 +934,17 @@ static void print_report(int is_last_report, int64_t 
> timer_start)
>  
>  
>  oc = output_files[0]->ctx;
> -
> -total_size = avio_size(oc->pb);
> -if (total_size <= 0) // FIXME improve avio_size() so it works with non 
> seekable output too
> -total_size = avio_tell(oc->pb);
> -if (total_size < 0) {
> -char errbuf[128];
> -av_strerror(total_size, errbuf, sizeof(errbuf));
> -av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
> -   "avio_tell() failed: %s\n", errbuf);
> -total_size = 0;
> +if (oc->pb) {
> +total_size = avio_size(oc->pb);
> +if (total_size <= 0) // FIXME improve avio_size() so it works with 
> non seekable output too
> +total_size = avio_tell(oc->pb);
> +if (total_size < 0) {
> +char errbuf[128];
> +av_strerror(total_size, errbuf, sizeof(errbuf));
> +av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
> +   "avio_tell() failed: %s\n", errbuf);
> +total_size = 0;
> +}
>  }
>  
>  buf[0] = '\0';
> -- 
> 2.9.2

The patch is fine with me, but more generally I'd say that as long as
the muxer is open, the AVIOContext belongs to it and the caller touching
it in any way is invalid.

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

Re: [libav-devel] [PATCH] avconv: Do not pass NULL to avio_tell

2017-01-03 Thread Vittorio Giovara
On Tue, Jan 3, 2017 at 1:41 PM, Vittorio Giovara
 wrote:
> On Tue, Jan 3, 2017 at 1:33 PM, Luca Barbato  wrote:
>> On 03/01/2017 11:51, Vittorio Giovara wrote:
>>> Should it? What happens here when you do pass NULL?
>>
>> It spams a pointless message on verbose.
>
> mention it in the commit log please
>
> total_size is used without being initialized below

I missed
+int64_t total_size = 0;

patch ok then (with message amended)
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avconv: Do not pass NULL to avio_tell

2017-01-03 Thread Vittorio Giovara
On Tue, Jan 3, 2017 at 1:33 PM, Luca Barbato  wrote:
> On 03/01/2017 11:51, Vittorio Giovara wrote:
>> Should it? What happens here when you do pass NULL?
>
> It spams a pointless message on verbose.

mention it in the commit log please

total_size is used without being initialized below
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avconv: Do not pass NULL to avio_tell

2017-01-03 Thread Luca Barbato
On 03/01/2017 11:51, Vittorio Giovara wrote:
> Should it? What happens here when you do pass NULL?

It spams a pointless message on verbose.

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


Re: [libav-devel] [PATCH] avconv: Do not pass NULL to avio_tell

2017-01-03 Thread Vittorio Giovara
On Thu, Dec 15, 2016 at 7:01 PM, Luca Barbato  wrote:
> The null demuxer does not have a backing AVIOContext.

Should it? What happens here when you do pass NULL?

> ---
>  avconv.c | 23 ---
>  1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/avconv.c b/avconv.c
> index 5c31332..fe60625 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -909,7 +909,7 @@ static void print_report(int is_last_report, int64_t 
> timer_start)
>  char buf[1024];
>  OutputStream *ost;
>  AVFormatContext *oc;
> -int64_t total_size;
> +int64_t total_size = 0;
>  AVCodecContext *enc;
>  int frame_number, vid, i;
>  double bitrate, ti1, pts;
> @@ -934,16 +934,17 @@ static void print_report(int is_last_report, int64_t 
> timer_start)
>
>
>  oc = output_files[0]->ctx;
> -
> -total_size = avio_size(oc->pb);
> -if (total_size <= 0) // FIXME improve avio_size() so it works with non 
> seekable output too
> -total_size = avio_tell(oc->pb);
> -if (total_size < 0) {
> -char errbuf[128];
> -av_strerror(total_size, errbuf, sizeof(errbuf));
> -av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
> -   "avio_tell() failed: %s\n", errbuf);
> -total_size = 0;
> +if (oc->pb) {
> +total_size = avio_size(oc->pb);
> +if (total_size <= 0) // FIXME improve avio_size() so it works with 
> non seekable output too
> +total_size = avio_tell(oc->pb);
> +if (total_size < 0) {
> +char errbuf[128];
> +av_strerror(total_size, errbuf, sizeof(errbuf));
> +av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
> +   "avio_tell() failed: %s\n", errbuf);
> +total_size = 0;
> +}
>  }
>
>  buf[0] = '\0';
> --
> 2.9.2
>
> ___
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel



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


Re: [libav-devel] [PATCH] avconv: Do not pass NULL to avio_tell

2017-01-01 Thread Luca Barbato
On 21/12/2016 06:12, Luca Barbato wrote:
> On 15/12/2016 19:01, Luca Barbato wrote:
>> The null demuxer does not have a backing AVIOContext.
>> ---
>>  avconv.c | 23 ---
>>  1 file changed, 12 insertions(+), 11 deletions(-)
>>
>> diff --git a/avconv.c b/avconv.c
>> index 5c31332..fe60625 100644
>> --- a/avconv.c
>> +++ b/avconv.c
>> @@ -909,7 +909,7 @@ static void print_report(int is_last_report, int64_t 
>> timer_start)
>>  char buf[1024];
>>  OutputStream *ost;
>>  AVFormatContext *oc;
>> -int64_t total_size;
>> +int64_t total_size = 0;
>>  AVCodecContext *enc;
>>  int frame_number, vid, i;
>>  double bitrate, ti1, pts;
>> @@ -934,16 +934,17 @@ static void print_report(int is_last_report, int64_t 
>> timer_start)
>>  
>>  
>>  oc = output_files[0]->ctx;
>> -
>> -total_size = avio_size(oc->pb);
>> -if (total_size <= 0) // FIXME improve avio_size() so it works with non 
>> seekable output too
>> -total_size = avio_tell(oc->pb);
>> -if (total_size < 0) {
>> -char errbuf[128];
>> -av_strerror(total_size, errbuf, sizeof(errbuf));
>> -av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
>> -   "avio_tell() failed: %s\n", errbuf);
>> -total_size = 0;
>> +if (oc->pb) {
>> +total_size = avio_size(oc->pb);
>> +if (total_size <= 0) // FIXME improve avio_size() so it works with 
>> non seekable output too
>> +total_size = avio_tell(oc->pb);
>> +if (total_size < 0) {
>> +char errbuf[128];
>> +av_strerror(total_size, errbuf, sizeof(errbuf));
>> +av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
>> +   "avio_tell() failed: %s\n", errbuf);
>> +total_size = 0;
>> +}
>>  }
>>  
>>  buf[0] = '\0';
>>
> 
> Ping.

Ping.

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


Re: [libav-devel] [PATCH] avconv: Do not pass NULL to avio_tell

2016-12-20 Thread Luca Barbato
On 15/12/2016 19:01, Luca Barbato wrote:
> The null demuxer does not have a backing AVIOContext.
> ---
>  avconv.c | 23 ---
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/avconv.c b/avconv.c
> index 5c31332..fe60625 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -909,7 +909,7 @@ static void print_report(int is_last_report, int64_t 
> timer_start)
>  char buf[1024];
>  OutputStream *ost;
>  AVFormatContext *oc;
> -int64_t total_size;
> +int64_t total_size = 0;
>  AVCodecContext *enc;
>  int frame_number, vid, i;
>  double bitrate, ti1, pts;
> @@ -934,16 +934,17 @@ static void print_report(int is_last_report, int64_t 
> timer_start)
>  
>  
>  oc = output_files[0]->ctx;
> -
> -total_size = avio_size(oc->pb);
> -if (total_size <= 0) // FIXME improve avio_size() so it works with non 
> seekable output too
> -total_size = avio_tell(oc->pb);
> -if (total_size < 0) {
> -char errbuf[128];
> -av_strerror(total_size, errbuf, sizeof(errbuf));
> -av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
> -   "avio_tell() failed: %s\n", errbuf);
> -total_size = 0;
> +if (oc->pb) {
> +total_size = avio_size(oc->pb);
> +if (total_size <= 0) // FIXME improve avio_size() so it works with 
> non seekable output too
> +total_size = avio_tell(oc->pb);
> +if (total_size < 0) {
> +char errbuf[128];
> +av_strerror(total_size, errbuf, sizeof(errbuf));
> +av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
> +   "avio_tell() failed: %s\n", errbuf);
> +total_size = 0;
> +}
>  }
>  
>  buf[0] = '\0';
> 

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


[libav-devel] [PATCH] avconv: Do not pass NULL to avio_tell

2016-12-15 Thread Luca Barbato
The null demuxer does not have a backing AVIOContext.
---
 avconv.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/avconv.c b/avconv.c
index 5c31332..fe60625 100644
--- a/avconv.c
+++ b/avconv.c
@@ -909,7 +909,7 @@ static void print_report(int is_last_report, int64_t 
timer_start)
 char buf[1024];
 OutputStream *ost;
 AVFormatContext *oc;
-int64_t total_size;
+int64_t total_size = 0;
 AVCodecContext *enc;
 int frame_number, vid, i;
 double bitrate, ti1, pts;
@@ -934,16 +934,17 @@ static void print_report(int is_last_report, int64_t 
timer_start)
 
 
 oc = output_files[0]->ctx;
-
-total_size = avio_size(oc->pb);
-if (total_size <= 0) // FIXME improve avio_size() so it works with non 
seekable output too
-total_size = avio_tell(oc->pb);
-if (total_size < 0) {
-char errbuf[128];
-av_strerror(total_size, errbuf, sizeof(errbuf));
-av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
-   "avio_tell() failed: %s\n", errbuf);
-total_size = 0;
+if (oc->pb) {
+total_size = avio_size(oc->pb);
+if (total_size <= 0) // FIXME improve avio_size() so it works with non 
seekable output too
+total_size = avio_tell(oc->pb);
+if (total_size < 0) {
+char errbuf[128];
+av_strerror(total_size, errbuf, sizeof(errbuf));
+av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
+   "avio_tell() failed: %s\n", errbuf);
+total_size = 0;
+}
 }
 
 buf[0] = '\0';
-- 
2.9.2

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