Re: [libav-devel] [PATCH] lavf: add a format flag for separate carriers, and an event for detecting carrier presence.

2016-03-19 Thread Vittorio Giovara
On Mon, Jun 8, 2015 at 5:28 AM, John Högberg  wrote:
> Luca Barbato wrote:
>> Please do. I thought about the alternative to support your scenario (beside
>> having a callback API that I'll blog about soonish) and another way to do 
>> that
>> is to have an AVSTREAM_EVENT_FLAG_LOST to signal that the stream is gone and
>> an AVFMT_EVENT_FLAG_ACTIVE_STREAM_CHANGED to signal the fact the number of
>> active stream changed.
>>
>> The semantics compared to metadata update is changed slightly, since we want
>> to keep the AVSTREAM_EVENT_FLAG_LOST as they are until they change while
>> wiping the AVFMT_EVENT_FLAG_ACTIVE_STREAM_CHANGED.
>>
>> This should be enough to avoid to introduce a function to explicitly to check
>> and reset even if I'd consider adding it nonetheless.
>
> A general notification above stream level would be useful, yes. As an aside,
> the new semantics are "present" rather than "lost" as per Anton's feedback. It
> feels like I've submitted every possible way of implementing this right now. 
> :|
>
>> Another option is having a generic AVFMT_EVENT_FLAG_STREAM_EVENT to signal
>> that the stream event flags had been set (and spare some iterations over the
>> stream list).
>>
>> How does it sound?
>
> I'd prefer the generic solution. There's little to be gained by "inheriting" 
> the
> specific flags of the underlying streams since you'll need to check them all
> anyway.
>
>> lu

Is this patch still needed?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] lavf: add a format flag for separate carriers, and an event for detecting carrier presence.

2015-06-09 Thread Luca Barbato
On 08/06/15 11:28, John Högberg wrote:
 PS: The spring^Wsummer Sprint will be almost surely held in Stockholm, if you
 are close and you want to drop by would be great =)
 
 When? I'll see if I can make it.

26-29 June, some details [here](https://wiki.libav.org/Sprint/201506)

lu



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


Re: [libav-devel] [PATCH] lavf: add a format flag for separate carriers, and an event for detecting carrier presence.

2015-06-08 Thread Luca Barbato
On 08/06/15 06:09, John Högberg wrote:
 Luca Barbato wrote:
 I was waiting for Anton, I'm more and more convinced that the feature is
 important and I'm planning to fit it in the avformat API that will match
 the avcodec API I detailed here[1].

 I'm not sure about the name, but they can be changed later.

 lu


 [1]: https://blogs.gentoo.org/lu_zero/2015/03/23/decoupling-an-api/
 
 Cool, it looks like that might solve a few issues of mine. Aside from the 
 blog,
 is there a discussion thread for this somewhere?
 
 On topic, should I go ahead with submitting the patch for MPEG-TS?
 

Please do. I thought about the alternative to support your scenario
(beside having a callback API that I'll blog about soonish) and another
way to do that is to have an AVSTREAM_EVENT_FLAG_LOST to signal that the
stream is gone and an AVFMT_EVENT_FLAG_ACTIVE_STREAM_CHANGED to signal
the fact the number of active stream changed.


The semantics compared to metadata update is changed slightly, since we
want to keep the AVSTREAM_EVENT_FLAG_LOST as they are until they change
while wiping the AVFMT_EVENT_FLAG_ACTIVE_STREAM_CHANGED.

This should be enough to avoid to introduce a function to explicitly to
check and reset even if I'd consider adding it nonetheless.

Another option is having a generic AVFMT_EVENT_FLAG_STREAM_EVENT to
signal that the stream event flags had been set (and spare some
iterations over the stream list).

How does it sound?

lu

PS: The spring^Wsummer Sprint will be almost surely held in Stockholm,
if you are close and you want to drop by would be great =)

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


Re: [libav-devel] [PATCH] lavf: add a format flag for separate carriers, and an event for detecting carrier presence.

2015-06-08 Thread John Högberg
Luca Barbato wrote:
 Please do. I thought about the alternative to support your scenario (beside
 having a callback API that I'll blog about soonish) and another way to do that
 is to have an AVSTREAM_EVENT_FLAG_LOST to signal that the stream is gone and 
 an AVFMT_EVENT_FLAG_ACTIVE_STREAM_CHANGED to signal the fact the number of
 active stream changed.

 The semantics compared to metadata update is changed slightly, since we want
 to keep the AVSTREAM_EVENT_FLAG_LOST as they are until they change while
 wiping the AVFMT_EVENT_FLAG_ACTIVE_STREAM_CHANGED.

 This should be enough to avoid to introduce a function to explicitly to check
 and reset even if I'd consider adding it nonetheless.

A general notification above stream level would be useful, yes. As an aside, 
the new semantics are present rather than lost as per Anton's feedback. It
feels like I've submitted every possible way of implementing this right now. :|

 Another option is having a generic AVFMT_EVENT_FLAG_STREAM_EVENT to signal
 that the stream event flags had been set (and spare some iterations over the
 stream list).

 How does it sound?

I'd prefer the generic solution. There's little to be gained by inheriting the
specific flags of the underlying streams since you'll need to check them all
anyway.

 lu

 PS: The spring^Wsummer Sprint will be almost surely held in Stockholm, if you
 are close and you want to drop by would be great =)

When? I'll see if I can make it.

Regards,
John Högberg
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavf: add a format flag for separate carriers, and an event for detecting carrier presence.

2015-06-07 Thread John Högberg
Luca Barbato wrote:
 I was waiting for Anton, I'm more and more convinced that the feature is
 important and I'm planning to fit it in the avformat API that will match
 the avcodec API I detailed here[1].

 I'm not sure about the name, but they can be changed later.
 
 lu


 [1]: https://blogs.gentoo.org/lu_zero/2015/03/23/decoupling-an-api/

Cool, it looks like that might solve a few issues of mine. Aside from the blog,
is there a discussion thread for this somewhere?

On topic, should I go ahead with submitting the patch for MPEG-TS?

Regards,
John Högberg
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavf: add a format flag for separate carriers, and an event for detecting carrier presence.

2015-06-03 Thread Luca Barbato
On 25/05/15 10:30, John Högberg wrote:
 AVFMT_SEPCARRIERS is a new flag denoting that the format has a separate 
 carrier
 for each stream, e.g. a separate file, transport stream, or connection per
 stream.
 
 AVSTREAM_EVENT_FLAG_CARRIER_PRESENT is a new event indicating the presence of
 a given stream, and is relevant for formats with the above flag. Its operation
 is fairly simple; all it does is indicate that the stream was alive/present
 since the last time the event flags were cleared, and is distinct from there
 being actual data on the stream.
 
 --
 
 If accepted I'll submit an implementation for MPEG-TS since I figure it's
 pointless to clutter the mailing list with it before that.
 

I was waiting for Anton, I'm more and more convinced that the feature is
important and I'm planning to fit it in the avformat API that will match
the avcodec API I detailed here[1].

I'm not sure about the name, but they can be changed later.

lu


[1]: https://blogs.gentoo.org/lu_zero/2015/03/23/decoupling-an-api/

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


Re: [libav-devel] [PATCH] lavf: add a format flag for separate carriers, and an event for detecting carrier presence.

2015-06-02 Thread John Högberg
John Högberg wrote:
 Hi,
 
 libavformat currently doesn't provide any mechanism for detecting when a
 substream is no longer present but the stream as a whole is otherwise OK. Your
 best guess is to check when you last got any frames on it, which tends to work
 for video and audio but not for substreams that sometimes spend a long amount 
 of
 time without presenting anything, like subtitles.
 
 Why is this an issue? Formats like MPEG-TS and MSS in push/ingest mode have
 separate transports for each stream; audio, video, and subtitles come from
 separate sources. If one of these breaks you have a fairly big problem on your
 hands, but returning an error on av_read_frame would be a bad course of action
 -- it may just be that the broadcaster has switched to regional news or 
 similar
 which lacks subtitles or only runs one audio track, and things will return to
 normal once it's over.
 
 Put shortly, the API user needs to know that something is potentially broken,
 but without preventing further processing of the stream.
 
 This is my fourth proposal for a method of carrier loss detection. I've given 
 up
 the ideas of having it edge-triggered and trying to hide format-specifics from
 the API user, so it's now a level-triggered event denoting the presence of a
 carrier which can be queried if the format has the (new) AVFMT_SEPCARRIERS 
 flag.
 
 --
 
 AVFMT_SEPCARRIERS is a new flag denoting that the format has a separate 
 carrier
 for each stream, e.g. a separate file, transport stream, or connection per
 stream.
 
 AVSTREAM_EVENT_FLAG_CARRIER_PRESENT is a new event indicating the presence of
 a given stream, and is relevant for formats with the above flag. Its operation
 is fairly simple; all it does is indicate that the stream was alive/present
 since the last time the event flags were cleared, and is distinct from there
 being actual data on the stream.
 
 --
 
 If accepted I'll submit an implementation for MPEG-TS since I figure it's
 pointless to clutter the mailing list with it before that.
 
 Regards,
 John Högberg

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


[libav-devel] [PATCH] lavf: add a format flag for separate carriers, and an event for detecting carrier presence.

2015-05-25 Thread John Högberg
Hi,

libavformat currently doesn't provide any mechanism for detecting when a
substream is no longer present but the stream as a whole is otherwise OK. Your
best guess is to check when you last got any frames on it, which tends to work
for video and audio but not for substreams that sometimes spend a long amount of
time without presenting anything, like subtitles.

Why is this an issue? Formats like MPEG-TS and MSS in push/ingest mode have
separate transports for each stream; audio, video, and subtitles come from
separate sources. If one of these breaks you have a fairly big problem on your
hands, but returning an error on av_read_frame would be a bad course of action
-- it may just be that the broadcaster has switched to regional news or similar
which lacks subtitles or only runs one audio track, and things will return to
normal once it's over.

Put shortly, the API user needs to know that something is potentially broken,
but without preventing further processing of the stream.

This is my fourth proposal for a method of carrier loss detection. I've given up
the ideas of having it edge-triggered and trying to hide format-specifics from
the API user, so it's now a level-triggered event denoting the presence of a
carrier which can be queried if the format has the (new) AVFMT_SEPCARRIERS flag.

--

AVFMT_SEPCARRIERS is a new flag denoting that the format has a separate carrier
for each stream, e.g. a separate file, transport stream, or connection per
stream.

AVSTREAM_EVENT_FLAG_CARRIER_PRESENT is a new event indicating the presence of
a given stream, and is relevant for formats with the above flag. Its operation
is fairly simple; all it does is indicate that the stream was alive/present
since the last time the event flags were cleared, and is distinct from there
being actual data on the stream.

--

If accepted I'll submit an implementation for MPEG-TS since I figure it's
pointless to clutter the mailing list with it before that.

Regards,
John Högberg
From f96924fa78ac535b8cfc08fe26b3073edec48c90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?John=20H=C3=B6gberg?= john.hogb...@ericsson.com
Date: Mon, 25 May 2015 09:43:19 +0200
Subject: [PATCH] lavf: add a format flag for separate carriers, and an event
 for detecting carrier presence.

AVFMT_SEPCARRIERS is a new format flag denoting that the format has a separate
carrier for each stream, e.g. a separate file, transport stream, or connection
per stream.

AVSTREAM_EVENT_FLAG_CARRIER_PRESENT is a new event indicating the presence of
a given stream, and is relevant for formats with the above flag. Its operation
is fairly simple; all it does is indicate that the stream was alive/present
since the last time the event flags were cleared, and is distinct from there
being actual data on the stream.
---
 libavformat/avformat.h | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index aa11cff..e6b6a7a 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -434,6 +434,9 @@ typedef struct AVProbeData {
 will be shifted in av_write_frame and
 av_interleaved_write_frame so they
 start from 0. */
+#define AVFMT_SEPCARRIERS  0x8 /** Format has separate carriers for each
+stream, like separate connections, 
files,
+or similar. */
 
 /**
  * @addtogroup lavf_encoding
@@ -531,7 +534,7 @@ typedef struct AVInputFormat {
 /**
  * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
  * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
- * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK.
+ * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEPCARRIERS.
  */
 int flags;
 
@@ -814,6 +817,13 @@ typedef struct AVStream {
  */
 int event_flags;
 #define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001 /// The call resulted in 
updated metadata.
+#define AVSTREAM_EVENT_FLAG_CARRIER_PRESENT  0x0002 /** A carrier for this 
stream was present during the call.
+ This is distinct from 
there being data on the stream; it
+ simply means that the 
underlying carrier was present at
+ some point during the 
last call.
+ This event is only 
relevant for formats that have the
+ AVFMT_SEPCARRIERS 
flag, and should not be queried without
+ without a guard for 
that flag. */
 
 /*
  * All fields below this line are not part of the public API. They
-- 
2.1.0