Re: [FFmpeg-devel] [PATCH 2/2] avformat/hlsenc: Signal http end of chunk explicitly during hlsenc_io_close()
> On 22 Dec 2017, at 15:04, Karthick J wrote: > > From: Karthick Jeyapal > > Currently http end of chunk is called implicitly in hlsenc_io_open(). > This mean playlists http writes would have to wait upto a segment duration to > signal end of chunk causing delays. > This patch will fix that problem and improve performance. > --- > libavformat/hlsenc.c | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index 0095ca4..65182c5 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -268,8 +268,13 @@ static void hlsenc_io_close(AVFormatContext *s, > AVIOContext **pb, char *filename > > if (!http_base_proto || !hls->http_persistent || hls->key_info_file || > hls->encrypt) { > ff_format_io_close(s, pb); > +#if CONFIG_HTTP_PROTOCOL > } else { > +URLContext *http_url_context = ffio_geturlcontext(*pb); > +av_assert0(http_url_context); > avio_flush(*pb); > +ff_http_signal_end_of_chunk(http_url_context); > +#endif > } > } > > -- > 1.9.1 > LGTM, if the libavformat/http no problem. thanks Steven ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 1/2] avformat/http: Avoid calling http_shutdown() if end of chunk is signalled already
From: Karthick Jeyapal --- libavformat/http.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index cf86adc..4635a9a 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -307,9 +307,11 @@ int ff_http_do_new_request(URLContext *h, const char *uri) AVDictionary *options = NULL; int ret; -ret = http_shutdown(h, h->flags); -if (ret < 0) -return ret; +if (!s->end_chunked_post) { +ret = http_shutdown(h, h->flags); +if (ret < 0) +return ret; +} s->end_chunked_post = 0; s->chunkend = 0; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 2/2] avformat/hlsenc: Signal http end of chunk(http_shutdown) during hlsenc_io_close()
From: Karthick Jeyapal Currently http end of chunk is signalled implicitly in hlsenc_io_open(). This mean playlists http writes would have to wait upto a segment duration to signal end of chunk causing delays. This patch will fix that problem and improve performance. --- libavformat/hlsenc.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 0095ca4..7b9bbc0 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -268,8 +268,13 @@ static void hlsenc_io_close(AVFormatContext *s, AVIOContext **pb, char *filename if (!http_base_proto || !hls->http_persistent || hls->key_info_file || hls->encrypt) { ff_format_io_close(s, pb); +#if CONFIG_HTTP_PROTOCOL } else { +URLContext *http_url_context = ffio_geturlcontext(*pb); +av_assert0(http_url_context); avio_flush(*pb); +ffurl_shutdown(http_url_context, AVIO_FLAG_WRITE); +#endif } } -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avformat/http: Added a library-internal API for signalling end of chunk
On 12/22/17, 1:13 PM, "wm4" wrote: > >On Fri, 22 Dec 2017 12:34:41 +0530 >Karthick J wrote: > >> From: Karthick Jeyapal >> >> Right now there is no explicit way to signal end of chunk, when >> http_multiple is set. >> ff_http_do_new_request() function implicitly signals end of chunk. But that >> could be too late for certain applications. >> Hence added a new function ff_http_signal_end_of_chunk() which could be used >> internally within libavformat. >> --- >>[…] > >I'd really prefer if this HTTP stuff would be added in a much cleaner >way, such as making it part of the AVIO API, or at least the >URLContext API. (Why are there 2 APIs anyway...) Thanks for your comments. I am now using the ffurl* API as you suggested, in the new patch v2. Regards, Karthick ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avformat/hlsenc: Signal http end of chunk explicitly during hlsenc_io_close()
>On 12/22/17, 2:06 PM, "刘歧" wrote: > >> On 22 Dec 2017, at 15:04, Karthick J wrote: >> >> From: Karthick Jeyapal >> >> Currently http end of chunk is called implicitly in hlsenc_io_open(). >> This mean playlists http writes would have to wait upto a segment duration >> to signal end of chunk causing delays. >> This patch will fix that problem and improve performance. >> […] >LGTM, if the libavformat/http no problem. Thanks for the comments. I have sent a new patch v2 to address the http issue raised by wm4 Regards, Karthick > > >thanks > >Steven ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/vf_lut: add support for gray formats
Signed-off-by: Paul B Mahol --- libavfilter/vf_lut.c | 6 +- tests/ref/fate/filter-pixfmts-lut | 5 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index 11c039ead7..26f2945c84 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -135,9 +135,13 @@ static av_cold void uninit(AVFilterContext *ctx) AV_PIX_FMT_GBRP16LE, AV_PIX_FMT_GBRAP12LE,\ AV_PIX_FMT_GBRAP16LE +#define GRAY_FORMATS\ +AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9LE, AV_PIX_FMT_GRAY10LE, \ +AV_PIX_FMT_GRAY12LE, AV_PIX_FMT_GRAY16LE + static const enum AVPixelFormat yuv_pix_fmts[] = { YUV_FORMATS, AV_PIX_FMT_NONE }; static const enum AVPixelFormat rgb_pix_fmts[] = { RGB_FORMATS, AV_PIX_FMT_NONE }; -static const enum AVPixelFormat all_pix_fmts[] = { RGB_FORMATS, YUV_FORMATS, AV_PIX_FMT_NONE }; +static const enum AVPixelFormat all_pix_fmts[] = { RGB_FORMATS, YUV_FORMATS, GRAY_FORMATS, AV_PIX_FMT_NONE }; static int query_formats(AVFilterContext *ctx) { diff --git a/tests/ref/fate/filter-pixfmts-lut b/tests/ref/fate/filter-pixfmts-lut index db3fd417b7..6cf798ad77 100644 --- a/tests/ref/fate/filter-pixfmts-lut +++ b/tests/ref/fate/filter-pixfmts-lut @@ -12,6 +12,11 @@ gbrp12lec5a4b89571f7095eb737ad9fd6b1ee08 gbrp14lebdfdfd6f36c60497d1cdae791f3cc117 gbrp16ledf095ef3a20995935cfcaf144afc68b6 gbrp9le a8c4e29f4cb627db81ba053e0853e702 +gray20b14b5e26cd11300ed1249e04082170 +gray10le8f4140b55e847cc423002b89666db5ea +gray12leea89c02f6b3af49ddaf13364ed33d86d +gray16leaa10599924fb2440fa12b76e90f57dcb +gray9le 7d9cc9ad6118674c547a54281d10cf05 rgb24 a356171207723a580e7d277078072005 rgb48le 5c7dd8575836d18c91e09f1915cf9aa9 rgba7bc854c2698b78af3e9159a19c2d9d21 -- 2.11.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v8 1/3] avformat/hlsenc:addition of #EXT-X-MEDIA tag and AUDIO attribute
On 12/19/17 11:53 AM, 刘歧 wrote: > On 19 Dec 2017, at 14:09, vdi...@akamai.com wrote: >> From: Vishwanath Dixit >> >> --- >> doc/muxers.texi | 12 + >> libavformat/dashenc.c | 3 ++- >> libavformat/hlsenc.c | 64 >> --- >> libavformat/hlsplaylist.c | 4 ++- >> libavformat/hlsplaylist.h | 2 +- >> 5 files changed, 79 insertions(+), 6 deletions(-) >> >> diff --git a/doc/muxers.texi b/doc/muxers.texi >> index 3d0c7bf..93db549 100644 >> --- a/doc/muxers.texi >> +++ b/doc/muxers.texi >> @@ -834,6 +834,18 @@ be a video only stream with video bitrate 1000k, the >> second variant stream will >> be an audio only stream with bitrate 64k and the third variant stream will >> be a >> video only stream with bitrate 256k. Here, three media playlist with file >> names >> out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created. >> +@example >> +ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ >> + -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ >> + -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high >> v:0,agroup:aud_low v:1,agroup:aud_high" \ >> + -master_pl_name master.m3u8 \ >> + http://example.com/live/out.m3u8 >> +@end example >> +This example creates two audio only and two video only variant streams. In >> +addition to the #EXT-X-STREAM-INF tag for each variant stream in the master >> +playlist, #EXT-X-MEDIA tag is also added for the two audio only variant >> streams >> +and they are mapped to the two video only variant streams with audio group >> names >> +'aud_low' and 'aud_high'. >> >> By default, a single hls variant containing all the encoded streams is >> created. >> >> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c >> index 5687530..f363418 100644 >> --- a/libavformat/dashenc.c >> +++ b/libavformat/dashenc.c >> @@ -759,7 +759,8 @@ static int write_manifest(AVFormatContext *s, int final) >> char playlist_file[64]; >> AVStream *st = s->streams[i]; >> get_hls_playlist_name(playlist_file, sizeof(playlist_file), >> NULL, i); >> -ff_hls_write_stream_info(st, out, st->codecpar->bit_rate, >> playlist_file); >> +ff_hls_write_stream_info(st, out, st->codecpar->bit_rate, >> +playlist_file, NULL); >> } >> avio_close(out); >> if (use_rename) >> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c >> index e3442c3..53dc835 100644 >> --- a/libavformat/hlsenc.c >> +++ b/libavformat/hlsenc.c >> @@ -144,6 +144,7 @@ typedef struct VariantStream { >> AVStream **streams; >> unsigned int nb_streams; >> int m3u8_created; /* status of media play-list creation */ >> +char *agroup; /* audio group name */ >> char *baseurl; >> } VariantStream; >> >> @@ -1085,7 +1086,7 @@ static int create_master_playlist(AVFormatContext *s, >> VariantStream * const input_vs) >> { >> HLSContext *hls = s->priv_data; >> -VariantStream *vs; >> +VariantStream *vs, *temp_vs; >> AVStream *vid_st, *aud_st; >> AVDictionary *options = NULL; >> unsigned int i, j; >> @@ -1117,6 +1118,34 @@ static int create_master_playlist(AVFormatContext *s, >> >> ff_hls_write_playlist_version(hls->m3u8_out, hls->version); >> >> +/* For audio only variant streams add #EXT-X-MEDIA tag with attributes*/ >> +for (i = 0; i < hls->nb_varstreams; i++) { >> +vs = &(hls->var_streams[i]); >> + >> +if (vs->has_video || vs->has_subtitle || !vs->agroup) >> +continue; >> + >> +m3u8_name_size = strlen(vs->m3u8_name) + 1; >> +m3u8_rel_name = av_malloc(m3u8_name_size); >> +if (!m3u8_rel_name) { >> +ret = AVERROR(ENOMEM); >> +goto fail; >> +} >> +av_strlcpy(m3u8_rel_name, vs->m3u8_name, m3u8_name_size); >> +ret = get_relative_url(hls->master_m3u8_url, vs->m3u8_name, >> + m3u8_rel_name, m3u8_name_size); >> +if (ret < 0) { >> +av_log(s, AV_LOG_ERROR, "Unable to find relative URL\n"); >> +goto fail; >> +} >> + >> +avio_printf(hls->m3u8_out, >> "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", >> +vs->agroup); >> +avio_printf(hls->m3u8_out, >> ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n", >> +m3u8_rel_name); >> +av_freep(&m3u8_rel_name); >> +} >> + >> /* For variant streams with video add #EXT-X-STREAM-INF tag with >> attributes*/ >> for (i = 0; i < hls->nb_varstreams; i++) { >> vs = &(hls->var_streams[i]); >> @@ -1149,6 +1178,25 @@ static int create_master_playlist(AVFormatContext *s, >> continue; >> } >> >> +/** >> + * Traverse through the list of audio only rendition streams and >> find >> + * the rendition which has highest bitrate in the same audio group >> + */ >> +if (vs->agroup) { >
Re: [FFmpeg-devel] [PATCH v8 1/3] avformat/hlsenc:addition of #EXT-X-MEDIA tag and AUDIO attribute
> On 22 Dec 2017, at 19:05, Dixit, Vishwanath wrote: > > On 12/19/17 11:53 AM, 刘歧 wrote: >> On 19 Dec 2017, at 14:09, vdi...@akamai.com wrote: >>> From: Vishwanath Dixit >>> >>> --- >>> doc/muxers.texi | 12 + >>> libavformat/dashenc.c | 3 ++- >>> libavformat/hlsenc.c | 64 >>> --- >>> libavformat/hlsplaylist.c | 4 ++- >>> libavformat/hlsplaylist.h | 2 +- >>> 5 files changed, 79 insertions(+), 6 deletions(-) >>> >>> diff --git a/doc/muxers.texi b/doc/muxers.texi >>> index 3d0c7bf..93db549 100644 >>> --- a/doc/muxers.texi >>> +++ b/doc/muxers.texi >>> @@ -834,6 +834,18 @@ be a video only stream with video bitrate 1000k, the >>> second variant stream will >>> be an audio only stream with bitrate 64k and the third variant stream will >>> be a >>> video only stream with bitrate 256k. Here, three media playlist with file >>> names >>> out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created. >>> +@example >>> +ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ >>> + -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ >>> + -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high >>> v:0,agroup:aud_low v:1,agroup:aud_high" \ >>> + -master_pl_name master.m3u8 \ >>> + http://example.com/live/out.m3u8 >>> +@end example >>> +This example creates two audio only and two video only variant streams. In >>> +addition to the #EXT-X-STREAM-INF tag for each variant stream in the master >>> +playlist, #EXT-X-MEDIA tag is also added for the two audio only variant >>> streams >>> +and they are mapped to the two video only variant streams with audio group >>> names >>> +'aud_low' and 'aud_high'. >>> >>> By default, a single hls variant containing all the encoded streams is >>> created. >>> >>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c >>> index 5687530..f363418 100644 >>> --- a/libavformat/dashenc.c >>> +++ b/libavformat/dashenc.c >>> @@ -759,7 +759,8 @@ static int write_manifest(AVFormatContext *s, int final) >>>char playlist_file[64]; >>>AVStream *st = s->streams[i]; >>>get_hls_playlist_name(playlist_file, sizeof(playlist_file), >>> NULL, i); >>> -ff_hls_write_stream_info(st, out, st->codecpar->bit_rate, >>> playlist_file); >>> +ff_hls_write_stream_info(st, out, st->codecpar->bit_rate, >>> +playlist_file, NULL); >>>} >>>avio_close(out); >>>if (use_rename) >>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c >>> index e3442c3..53dc835 100644 >>> --- a/libavformat/hlsenc.c >>> +++ b/libavformat/hlsenc.c >>> @@ -144,6 +144,7 @@ typedef struct VariantStream { >>>AVStream **streams; >>>unsigned int nb_streams; >>>int m3u8_created; /* status of media play-list creation */ >>> +char *agroup; /* audio group name */ >>>char *baseurl; >>> } VariantStream; >>> >>> @@ -1085,7 +1086,7 @@ static int create_master_playlist(AVFormatContext *s, >>> VariantStream * const input_vs) >>> { >>>HLSContext *hls = s->priv_data; >>> -VariantStream *vs; >>> +VariantStream *vs, *temp_vs; >>>AVStream *vid_st, *aud_st; >>>AVDictionary *options = NULL; >>>unsigned int i, j; >>> @@ -1117,6 +1118,34 @@ static int create_master_playlist(AVFormatContext *s, >>> >>>ff_hls_write_playlist_version(hls->m3u8_out, hls->version); >>> >>> +/* For audio only variant streams add #EXT-X-MEDIA tag with >>> attributes*/ >>> +for (i = 0; i < hls->nb_varstreams; i++) { >>> +vs = &(hls->var_streams[i]); >>> + >>> +if (vs->has_video || vs->has_subtitle || !vs->agroup) >>> +continue; >>> + >>> +m3u8_name_size = strlen(vs->m3u8_name) + 1; >>> +m3u8_rel_name = av_malloc(m3u8_name_size); >>> +if (!m3u8_rel_name) { >>> +ret = AVERROR(ENOMEM); >>> +goto fail; >>> +} >>> +av_strlcpy(m3u8_rel_name, vs->m3u8_name, m3u8_name_size); >>> +ret = get_relative_url(hls->master_m3u8_url, vs->m3u8_name, >>> + m3u8_rel_name, m3u8_name_size); >>> +if (ret < 0) { >>> +av_log(s, AV_LOG_ERROR, "Unable to find relative URL\n"); >>> +goto fail; >>> +} >>> + >>> +avio_printf(hls->m3u8_out, >>> "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", >>> +vs->agroup); >>> +avio_printf(hls->m3u8_out, >>> ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n", >>> +m3u8_rel_name); >>> +av_freep(&m3u8_rel_name); >>> +} >>> + >>>/* For variant streams with video add #EXT-X-STREAM-INF tag with >>> attributes*/ >>>for (i = 0; i < hls->nb_varstreams; i++) { >>>vs = &(hls->var_streams[i]); >>> @@ -1149,6 +1178,25 @@ static int create_master_playlist(AVFormatContext *s, >>>continue; >>>} >>> >>> +/** >>> + * Traverse through the
Re: [FFmpeg-devel] [PATCH] avfilter/vf_lut: add support for gray formats
On 2017-12-22 10:57, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > libavfilter/vf_lut.c | 6 +- > tests/ref/fate/filter-pixfmts-lut | 5 + > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c > index 11c039ead7..26f2945c84 100644 > --- a/libavfilter/vf_lut.c > +++ b/libavfilter/vf_lut.c > @@ -135,9 +135,13 @@ static av_cold void uninit(AVFilterContext *ctx) > AV_PIX_FMT_GBRP16LE, AV_PIX_FMT_GBRAP12LE,\ > AV_PIX_FMT_GBRAP16LE > > +#define GRAY_FORMATS\ > +AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9LE, AV_PIX_FMT_GRAY10LE, \ > +AV_PIX_FMT_GRAY12LE, AV_PIX_FMT_GRAY16LE > + > static const enum AVPixelFormat yuv_pix_fmts[] = { YUV_FORMATS, > AV_PIX_FMT_NONE }; > static const enum AVPixelFormat rgb_pix_fmts[] = { RGB_FORMATS, > AV_PIX_FMT_NONE }; > -static const enum AVPixelFormat all_pix_fmts[] = { RGB_FORMATS, YUV_FORMATS, > AV_PIX_FMT_NONE }; > +static const enum AVPixelFormat all_pix_fmts[] = { RGB_FORMATS, YUV_FORMATS, > GRAY_FORMATS, AV_PIX_FMT_NONE }; > > static int query_formats(AVFilterContext *ctx) > { > diff --git a/tests/ref/fate/filter-pixfmts-lut > b/tests/ref/fate/filter-pixfmts-lut > index db3fd417b7..6cf798ad77 100644 > --- a/tests/ref/fate/filter-pixfmts-lut > +++ b/tests/ref/fate/filter-pixfmts-lut > @@ -12,6 +12,11 @@ gbrp12lec5a4b89571f7095eb737ad9fd6b1ee08 > gbrp14lebdfdfd6f36c60497d1cdae791f3cc117 > gbrp16ledf095ef3a20995935cfcaf144afc68b6 > gbrp9le a8c4e29f4cb627db81ba053e0853e702 > +gray20b14b5e26cd11300ed1249e04082170 > +gray10le8f4140b55e847cc423002b89666db5ea > +gray12leea89c02f6b3af49ddaf13364ed33d86d > +gray16leaa10599924fb2440fa12b76e90f57dcb > +gray9le 7d9cc9ad6118674c547a54281d10cf05 > rgb24 a356171207723a580e7d277078072005 > rgb48le 5c7dd8575836d18c91e09f1915cf9aa9 > rgba7bc854c2698b78af3e9159a19c2d9d21 > Yeah, LGTM. signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Add android_capture indev
Hello Michael, I fixed the things you mentioned. New patch attached. Felix ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [FFmpeg-cvslog] [ffmpeg-web] branch master updated. 979b3a6 web/contact: note that no discussions occur on cvslog and trac mailing lists
On Thu, 21 Dec 2017 10:32:50 -0900, Lou Logan wrote: > On Thu, Dec 21, 2017, at 4:07 AM, Carl Eugen Hoyos wrote: > > Where was this agreed upon? > > > > Carl Eugen > > I did not assume further discussion was required for this subject, but I am > confident that the vast majority of developers will support this, in my > opinion minor, decision. i think the argument that historically -cvslog was a place to discuss commits was true. presently no one discusses commits on -cvslog. this change seems to be common sense. i understand carls' argument but i also understand -cvslog mailing lists have evolved to make things easier and simpler for developers to not have to follow two lists for discussion. also possibly git log has replaced -cvslog for many developers. carl if you have a suggestion for better wording, please send patch ? -compn ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/5] oma: move some constants into libavcodec
From: Misty De Meo Most of the constants in libavcodec/oma aren't specific to libavformat; moving them into libavcodec makes them available to libavcodec as well as keeping them compatible with libavformat. ff_oma_codec_tags uses a libavformat-specific type, so it has been left in libavformat. --- Changelog | 1 + libavcodec/oma.c | 40 libavcodec/oma.h | 37 + libavcodec/version.h | 2 +- libavformat/oma.c | 18 -- libavformat/oma.h | 13 + libavformat/omadec.c | 1 + libavformat/omaenc.c | 1 + libavformat/version.h | 2 +- 9 files changed, 83 insertions(+), 32 deletions(-) create mode 100644 libavcodec/oma.c create mode 100644 libavcodec/oma.h diff --git a/Changelog b/Changelog index ee48876128..31e720091c 100644 --- a/Changelog +++ b/Changelog @@ -27,6 +27,7 @@ version : - video setrange filter - nsp demuxer - support LibreSSL (via libtls) +- Move some OMA constants from libavformat into libavcodec version 3.4: diff --git a/libavcodec/oma.c b/libavcodec/oma.c new file mode 100644 index 00..dbc763f291 --- /dev/null +++ b/libavcodec/oma.c @@ -0,0 +1,40 @@ +/* + * Sony OpenMG (OMA) common data + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "internal.h" +#include "oma.h" +#include "libavcodec/avcodec.h" +#include "libavutil/channel_layout.h" + +const uint16_t ff_oma_srate_tab[8] = { 320, 441, 480, 882, 960, 0 }; + +/** map ATRAC-X channel id to internal channel layout */ +const uint64_t ff_oma_chid_to_native_layout[7] = { +AV_CH_LAYOUT_MONO, +AV_CH_LAYOUT_STEREO, +AV_CH_LAYOUT_SURROUND, +AV_CH_LAYOUT_4POINT0, +AV_CH_LAYOUT_5POINT1_BACK, +AV_CH_LAYOUT_6POINT1_BACK, +AV_CH_LAYOUT_7POINT1 +}; + +/** map ATRAC-X channel id to total number of channels */ +const int ff_oma_chid_to_num_channels[7] = {1, 2, 3, 4, 6, 7, 8}; diff --git a/libavcodec/oma.h b/libavcodec/oma.h new file mode 100644 index 00..7f6731839d --- /dev/null +++ b/libavcodec/oma.h @@ -0,0 +1,37 @@ +/* + * Sony OpenMG (OMA) common data + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_OMA_H +#define AVCODEC_OMA_H + +#include + +#include "internal.h" + +#define EA3_HEADER_SIZE 96 +#define ID3v2_EA3_MAGIC "ea3" +#define OMA_ENC_HEADER_SIZE 16 + +extern const uint16_t ff_oma_srate_tab[8]; + +extern const uint64_t ff_oma_chid_to_native_layout[7]; +extern const int ff_oma_chid_to_num_channels[7]; + +#endif /* AVCODEC_OMA_H */ diff --git a/libavcodec/version.h b/libavcodec/version.h index d55de89797..d48857578d 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 8 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavformat/oma.c b/libavformat/oma.c index f7ae3c9948..86347e6062 100644 --- a/libavformat/oma.c +++ b/libavformat/oma.c @@ -20,10 +20,6 @@ #include "internal.h" #include "oma.h" -#include "libavcodec/avcodec.h" -#include "libavutil/channel_layout.h" - -const uint16_t ff_oma_srate_tab[8] = { 320, 441, 480, 882, 960, 0 }; const AVCodecTag ff_oma_codec_tags[] = { { AV_CODEC_ID_ATRAC3, OMA_CODECID_ATRAC3}, @@ -34,17 +30,3 @@ const AVCodecTag ff_oma_codec_tags[] = { {
[FFmpeg-devel] [PATCH 4/5] Fix detecting ATRAC3 audio from MPS files
From: Misty De Meo MPS files are MPEG files used on PSP Video discs. They lack the PSMF header used by .pms files, and so the special casing in the original patch fails to support their audio. This patch fixes this by unconditionally reading a new byte for the startcode for PRIVATE_STREAM_1 sections, and doing the comparison on that to find ATRAC-3 streams. In my testing, it works fine for both MPS and PSMF files. --- Changelog | 1 + libavformat/mpeg.c | 38 ++ libavformat/mpeg.h | 1 + 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Changelog b/Changelog index 31e720091c..65c437c247 100644 --- a/Changelog +++ b/Changelog @@ -28,6 +28,7 @@ version : - nsp demuxer - support LibreSSL (via libtls) - Move some OMA constants from libavformat into libavcodec +- ATRAC-3 support for Sony PSP MPEG files version 3.4: diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 895c6fb231..a366ece0ed 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -128,7 +128,6 @@ typedef struct MpegDemuxContext { int sofdec; int dvd; int imkh_cctv; -int sony_psmf; // true if Play Station Movie file signature is present #if CONFIG_VOBSUB_DEMUXER AVFormatContext *sub_ctx; FFDemuxSubtitlesQueue q[32]; @@ -148,8 +147,6 @@ static int mpegps_read_header(AVFormatContext *s) avio_get_str(s->pb, 6, buffer, sizeof(buffer)); if (!memcmp("IMKH", buffer, 4)) { m->imkh_cctv = 1; -} else if (!memcmp("PSMF00", buffer, 6)) { -m->sony_psmf = 1; } else if (!memcmp("Sofdec", buffer, 6)) { m->sofdec = 1; } else @@ -444,7 +441,7 @@ redo: goto redo; } -if (startcode == PRIVATE_STREAM_1 && !m->sony_psmf) { +if (startcode == PRIVATE_STREAM_1) { startcode = avio_r8(s->pb); len--; } @@ -544,28 +541,21 @@ redo: else request_probe= 1; type = AVMEDIA_TYPE_VIDEO; -} else if (startcode == PRIVATE_STREAM_1 && m->sony_psmf) { -uint8_t stream_id; - -if (len < 2) -goto skip; -stream_id = avio_r8(s->pb); +// Sony PSP video with ATRAC-3 audio +} else if (!(startcode & STREAM_TYPE_AUDIO_ATRAC3)) { avio_r8(s->pb); // skip padding -len -= 2; -if (!(stream_id & 0xF0)) { // seems like we got an ATRAC stream -/* check if an appropriate stream already exists */ -for (i = 0; i < s->nb_streams; i++) { -st = s->streams[i]; -if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && -st->codec->codec_id == AV_CODEC_ID_ATRAC3P && -st->id - 0x1BD0 == (stream_id & 0xF)) -goto found; -} - -startcode = 0x1BD0 + (stream_id & 0xF); -type = AVMEDIA_TYPE_AUDIO; -codec_id = AV_CODEC_ID_ATRAC3P; +len--; +for (i = 0; i < s->nb_streams; i++) { +st = s->streams[i]; +if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && +st->codec->codec_id == AV_CODEC_ID_ATRAC3P && +st->id - 0x1BD0 == (startcode & 0xF)) +goto found; } + +startcode = 0x1BD0 + (startcode & 0xF); +type = AVMEDIA_TYPE_AUDIO; +codec_id = AV_CODEC_ID_ATRAC3P; } else if (startcode == PRIVATE_STREAM_2) { type = AVMEDIA_TYPE_DATA; codec_id = AV_CODEC_ID_DVD_NAV; diff --git a/libavformat/mpeg.h b/libavformat/mpeg.h index 617e36cba8..efbadec8ba 100644 --- a/libavformat/mpeg.h +++ b/libavformat/mpeg.h @@ -58,6 +58,7 @@ #define STREAM_TYPE_VIDEO_CAVS 0x42 #define STREAM_TYPE_AUDIO_AC3 0x81 +#define STREAM_TYPE_AUDIO_ATRAC30xF0 static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 }; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/5] mpeg: fix use of deprecated struct
From: Misty De Meo --- libavformat/mpeg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index a366ece0ed..210424faf3 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -547,8 +547,8 @@ redo: len--; for (i = 0; i < s->nb_streams; i++) { st = s->streams[i]; -if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && -st->codec->codec_id == AV_CODEC_ID_ATRAC3P && +if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && +st->codecpar->codec_id == AV_CODEC_ID_ATRAC3P && st->id - 0x1BD0 == (startcode & 0xF)) goto found; } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 0/5] Sony MPEG with ATRAC-3 audio support, trac ticket #3233
From: Misty De Meo This is based on Maxim Poliakovski's patch from this 2014 email: https://ffmpeg.org/pipermail/ffmpeg-devel/2014-December/166169.html This patchset is updated based on Michael Niedermayer's feedback. I've also included an improvement which ensures support for Sony .MPS MPEG files from UMD video discs, which lack the `PSMF` header that identifies PSP media. There are a couple of small fixes which are in commits indepent of Maxim's original commit in order to retain proper credit. I'd be happy to squash them into Maxim's commit if wanted, however. I've tested with both .MPS and .PMF files with success. There are some sample PMF files included in TRAC ticket #3233. Maxim Poliakovski (1): mpeg: add experimental support for PSMF audio. Misty De Meo (4): oma: move some constants into libavcodec atrac3plus_parser: use libavcodec's oma Fix detecting ATRAC3 audio from MPS files mpeg: fix use of deprecated struct Changelog | 2 + libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/atrac3plus_parser.c | 153 + libavcodec/oma.c | 40 +++ libavcodec/oma.h | 37 ++ libavcodec/version.h | 2 +- libavformat/mpeg.c | 15 libavformat/mpeg.h | 1 + libavformat/oma.c | 18 - libavformat/oma.h | 13 +--- libavformat/omadec.c | 1 + libavformat/omaenc.c | 1 + libavformat/version.h | 2 +- 14 files changed, 255 insertions(+), 32 deletions(-) create mode 100644 libavcodec/atrac3plus_parser.c create mode 100644 libavcodec/oma.c create mode 100644 libavcodec/oma.h -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/5] mpeg: add experimental support for PSMF audio.
From: Maxim Poliakovski --- libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/atrac3plus_parser.c | 153 + libavformat/mpeg.c | 27 +++- 4 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 libavcodec/atrac3plus_parser.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ca72138c02..e0e3f1ebac 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -977,6 +977,7 @@ OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \ mpeg4audio.o OBJS-$(CONFIG_AC3_PARSER) += ac3tab.o aac_ac3_parser.o OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o +OBJS-$(CONFIG_ATRAC3P_PARSER) += atrac3plus_parser.o OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o OBJS-$(CONFIG_CAVSVIDEO_PARSER)+= cavs_parser.o OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index ed1e7ab06e..81d5d2814a 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -623,6 +623,7 @@ static void register_all(void) REGISTER_PARSER(AAC_LATM, aac_latm); REGISTER_PARSER(AC3,ac3); REGISTER_PARSER(ADX,adx); +REGISTER_PARSER(ATRAC3P,atrac3p); REGISTER_PARSER(BMP,bmp); REGISTER_PARSER(CAVSVIDEO, cavsvideo); REGISTER_PARSER(COOK, cook); diff --git a/libavcodec/atrac3plus_parser.c b/libavcodec/atrac3plus_parser.c new file mode 100644 index 00..01fcad4c45 --- /dev/null +++ b/libavcodec/atrac3plus_parser.c @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2014 Maxim Poliakovski + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "parser.h" +#include "get_bits.h" +#include "libavformat/oma.h" + +typedef struct Atrac3PlusParseContext { +ParseContext pc; +uint8_t hdr[8]; +int hdr_bytes_needed, got_bytes; +int sample_rate, channel_id, frame_size; +} Atrac3PlusParseContext; + +static int parse_sound_frame_header(Atrac3PlusParseContext *c, +const uint8_t *buf) +{ +uint16_t atrac_config; + +if (AV_RB16(buf) != 0x0FD0) +return AVERROR_INVALIDDATA; + +atrac_config = AV_RB16(&buf[2]); +c->sample_rate = ff_oma_srate_tab[(atrac_config >> 13) & 7] * 100; +c->channel_id = (atrac_config >> 10) & 7; +c->frame_size = ((atrac_config & 0x3FF) * 8) + 8; + +if (!c->channel_id || !c->sample_rate || !c->frame_size) +return AVERROR_INVALIDDATA; + +return 0; +} + +static int ff_atrac3p_parse(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size) +{ +Atrac3PlusParseContext *ctx = s->priv_data; +const uint8_t *hdr_buf = buf; +size_t bytes_remain; +int frame_size, hdr_bytes = 8; +int next = 0; + +if (s->flags & PARSER_FLAG_COMPLETE_FRAMES || !buf_size) { +next = buf_size; +} else { +if (buf_size >= 2) { +bytes_remain = AV_RB16(buf); + +if (bytes_remain != 0xFD0) { +next += 2; +buf += 2; +buf_size -= 2; +hdr_buf = buf; + +if (bytes_remain && !ctx->pc.index && !ctx->hdr_bytes_needed) { +av_log(avctx, AV_LOG_ERROR, + "2nd frame portion found but the 1st one is missing!\n"); +return AVERROR_INVALIDDATA; +} + +if (ctx->hdr_bytes_needed) { +if (buf_size >= ctx->hdr_bytes_needed) { +memcpy(&ctx->hdr[8 - ctx->hdr_bytes_needed], + buf, ctx->hdr_bytes_needed); +hdr_bytes = ctx->hdr_bytes_needed; +ctx->hdr_bytes_needed = 0; +hdr_buf = ctx->hdr; +} +} else if (bytes_remain) { +if (buf_size < bytes_remain) { +av_log(avctx, AV_LOG_ERROR, +
Re: [FFmpeg-devel] [PATCH] Add android_capture indev
On Fri, Dec 22, 2017, at 10:34 AM, Felix Matouschek wrote: > Hello Michael, > > I fixed the things you mentioned. New patch attached. > > Felix I think you forgot to attach the patch. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/5] atrac3plus_parser: use libavcodec's oma
From: Misty De Meo --- libavcodec/Makefile| 2 +- libavcodec/atrac3plus_parser.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index e0e3f1ebac..0e1c6d53ea 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -977,7 +977,7 @@ OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \ mpeg4audio.o OBJS-$(CONFIG_AC3_PARSER) += ac3tab.o aac_ac3_parser.o OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o -OBJS-$(CONFIG_ATRAC3P_PARSER) += atrac3plus_parser.o +OBJS-$(CONFIG_ATRAC3P_PARSER) += atrac3plus_parser.o oma.o OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o OBJS-$(CONFIG_CAVSVIDEO_PARSER)+= cavs_parser.o OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o diff --git a/libavcodec/atrac3plus_parser.c b/libavcodec/atrac3plus_parser.c index 01fcad4c45..11b236b0bf 100644 --- a/libavcodec/atrac3plus_parser.c +++ b/libavcodec/atrac3plus_parser.c @@ -20,7 +20,7 @@ #include "parser.h" #include "get_bits.h" -#include "libavformat/oma.h" +#include "oma.h" typedef struct Atrac3PlusParseContext { ParseContext pc; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] oma: move some constants into libavcodec
On Fri, 22 Dec 2017 22:35:08 +0800 mi...@brew.sh wrote: > From: Misty De Meo > > Most of the constants in libavcodec/oma aren't specific to > libavformat; moving them into libavcodec makes them available to > libavcodec as well as keeping them compatible with libavformat. > > ff_oma_codec_tags uses a libavformat-specific type, so it has been > left in libavformat. > --- > Changelog | 1 + > libavcodec/oma.c | 40 > libavcodec/oma.h | 37 + > libavcodec/version.h | 2 +- > libavformat/oma.c | 18 -- > libavformat/oma.h | 13 + > libavformat/omadec.c | 1 + > libavformat/omaenc.c | 1 + > libavformat/version.h | 2 +- > 9 files changed, 83 insertions(+), 32 deletions(-) > create mode 100644 libavcodec/oma.c > create mode 100644 libavcodec/oma.h > > diff --git a/Changelog b/Changelog > index ee48876128..31e720091c 100644 > --- a/Changelog > +++ b/Changelog > @@ -27,6 +27,7 @@ version : > - video setrange filter > - nsp demuxer > - support LibreSSL (via libtls) > +- Move some OMA constants from libavformat into libavcodec > > > version 3.4: > diff --git a/libavcodec/oma.c b/libavcodec/oma.c > new file mode 100644 > index 00..dbc763f291 > --- /dev/null > +++ b/libavcodec/oma.c > @@ -0,0 +1,40 @@ > +/* > + * Sony OpenMG (OMA) common data > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#include "internal.h" > +#include "oma.h" > +#include "libavcodec/avcodec.h" > +#include "libavutil/channel_layout.h" > + > +const uint16_t ff_oma_srate_tab[8] = { 320, 441, 480, 882, 960, 0 }; > + > +/** map ATRAC-X channel id to internal channel layout */ > +const uint64_t ff_oma_chid_to_native_layout[7] = { > +AV_CH_LAYOUT_MONO, > +AV_CH_LAYOUT_STEREO, > +AV_CH_LAYOUT_SURROUND, > +AV_CH_LAYOUT_4POINT0, > +AV_CH_LAYOUT_5POINT1_BACK, > +AV_CH_LAYOUT_6POINT1_BACK, > +AV_CH_LAYOUT_7POINT1 > +}; > + > +/** map ATRAC-X channel id to total number of channels */ > +const int ff_oma_chid_to_num_channels[7] = {1, 2, 3, 4, 6, 7, 8}; > diff --git a/libavcodec/oma.h b/libavcodec/oma.h > new file mode 100644 > index 00..7f6731839d > --- /dev/null > +++ b/libavcodec/oma.h > @@ -0,0 +1,37 @@ > +/* > + * Sony OpenMG (OMA) common data > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#ifndef AVCODEC_OMA_H > +#define AVCODEC_OMA_H > + > +#include > + > +#include "internal.h" > + > +#define EA3_HEADER_SIZE 96 > +#define ID3v2_EA3_MAGIC "ea3" > +#define OMA_ENC_HEADER_SIZE 16 > + > +extern const uint16_t ff_oma_srate_tab[8]; > + > +extern const uint64_t ff_oma_chid_to_native_layout[7]; > +extern const int ff_oma_chid_to_num_channels[7]; > + > +#endif /* AVCODEC_OMA_H */ > diff --git a/libavcodec/version.h b/libavcodec/version.h > index d55de89797..d48857578d 100644 > --- a/libavcodec/version.h > +++ b/libavcodec/version.h > @@ -29,7 +29,7 @@ > > #define LIBAVCODEC_VERSION_MAJOR 58 > #define LIBAVCODEC_VERSION_MINOR 8 > -#define LIBAVCODEC_VERSION_MICRO 100 > +#define LIBAVCODEC_VERSION_MICRO 101 > > #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ > LIBAVCODEC_VERSION_MINOR, \ > diff --git a/libavformat/oma.c b/libavformat/oma.c > index f7ae3c9948..86347e6062 100644 > --- a/libavformat/oma.c > +++ b/libavformat/oma.c > @@ -20,10 +20,6 @@ > > #i
Re: [FFmpeg-devel] [PATCH] Add android_capture indev
Am 22.12.2017 20:50, schrieb Lou Logan: I think you forgot to attach the patch. Sorry, flaky mail client... attached it again.From ba2ccca1200a55b0f1c0331ebd6d26324941fb2e Mon Sep 17 00:00:00 2001 From: Felix Matouschek Date: Fri, 22 Dec 2017 20:10:41 +0100 Subject: [PATCH] avdevice: add android_camera indev To: ffmpeg-devel@ffmpeg.org This commit adds an indev for Android devices on API level 24+ which uses the Android NDK Camera2 API to capture video from builtin cameras Signed-off-by: Felix Matouschek --- Changelog| 1 + MAINTAINERS | 1 + configure| 6 + doc/indevs.texi | 40 ++ libavdevice/Makefile | 1 + libavdevice/alldevices.c | 1 + libavdevice/android_camera.c | 871 +++ libavdevice/version.h| 2 +- 8 files changed, 922 insertions(+), 1 deletion(-) create mode 100644 libavdevice/android_camera.c diff --git a/Changelog b/Changelog index ee48876128..f5e6326d32 100644 --- a/Changelog +++ b/Changelog @@ -27,6 +27,7 @@ version : - video setrange filter - nsp demuxer - support LibreSSL (via libtls) +- Add android_camera indev version 3.4: diff --git a/MAINTAINERS b/MAINTAINERS index 6a92b5190d..bc6cbc51a6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -282,6 +282,7 @@ libavdevice avfoundation.mThilo Borgmann + android_camera.c Felix Matouschek decklink* Marton Balint dshow.c Roger Pack (CC rogerdp...@gmail.com) fbdev_enc.c Lukasz Marek diff --git a/configure b/configure index d09eec4155..b8a7d4bfed 100755 --- a/configure +++ b/configure @@ -3073,6 +3073,8 @@ xmv_demuxer_select="riffdec" xwma_demuxer_select="riffdec" # indevs / outdevs +android_camera_indev_deps="android camera2ndk mediandk pthreads" +android_camera_indev_extralibs="-landroid -lcamera2ndk -lmediandk" alsa_indev_deps="alsa" alsa_outdev_deps="alsa" avfoundation_indev_deps="avfoundation corevideo coremedia pthreads" @@ -5707,6 +5709,10 @@ check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32 check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom -ladvapi32 check_lib psapi"windows.h psapi.h"GetProcessMemoryInfo -lpsapi +check_lib android android/native_window.h ANativeWindow_acquire -landroid +check_lib mediandk "stdint.h media/NdkImage.h" AImage_delete -lmediandk +check_lib camera2ndk "stdbool.h stdint.h camera/NdkCameraManager.h" ACameraManager_create -lcamera2ndk + enabled appkit && check_apple_framework AppKit enabled audiotoolbox && check_apple_framework AudioToolbox enabled avfoundation && check_apple_framework AVFoundation diff --git a/doc/indevs.texi b/doc/indevs.texi index 56066bf23a..93a671dd42 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -63,6 +63,46 @@ Set the number of channels. Default is 2. @end table +@section android_camera + +Android camera input device. + +This input devices uses the Android Camera2 NDK API which is +available on devices with API level 24+. The availability of +android_camera is autodetected during configuration. + +This device allows capturing from all cameras on an Android device, +which are integrated into the Camera2 NDK API. + +The available cameras are enumerated internally and can be selected +with the @var{camera_index} parameter. The input file string is +discarded. + +Generally the back facing camera has index 0 while the front facing +camera has index 1. + +@subsection Options + +@table @option + +@item video_size +Set the video size given as a string such as 640x480 or hd720. +Falls back to the first available configuration reported by +Android if requested video size is not available or by default. + +@item framerate +Set the video framerate. +Falls back to the first available configuration reported by +Android if requested framerate is not available or by default (-1). + +@item camera_index +Set the index of the camera to use. Default is 0. + +@item input_queue_size +Set the maximum number of frames to buffer. Default is 5. + +@end table + @section avfoundation AVFoundation input device. diff --git a/libavdevice/Makefile b/libavdevice/Makefile index 8228d62147..f11a6f2a86 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -14,6 +14,7 @@ OBJS-$(CONFIG_SHARED)+= reverse.o # input/output devices OBJS-$(CONFIG_ALSA_INDEV)+= alsa_dec.o alsa.o timefilter.o OBJS-$(CONFIG_ALSA_OUTDEV) += alsa_enc.o alsa.o +OBJS-$(CONFIG_ANDROID_CAMERA_INDEV) += android_camera.o OBJS-$(CONFIG_AVFOUNDATION_INDEV)+= avfoundation.o OBJS-$(CONFIG_BKTR_INDEV)+= bktr.o OBJS-$(CONFIG_CACA_OUTDEV) += caca.o diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index b767b6a718..2c8d9035da 100644 --- a/libavdevice/alldevices.c +++
Re: [FFmpeg-devel] [FFmpeg-cvslog] [ffmpeg-web] branch master updated. 979b3a6 web/contact: note that no discussions occur on cvslog and trac mailing lists
On Fri, 22 Dec 2017 14:39:40 -0500, Compn wrote: > carl if you have a suggestion for better wording, please send patch ? also as the other ml admin, i agree with lou's commit and community agreed upon policy change. what discussions do you want to have on -cvslog that would not be better heard on -devel? -compn ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2] w32pthreads: always use Vista+ API, drop XP support
This removes the XP compatibility code, and switches entirely to SWR locks, which are available starting at Windows Vista. This removes CRITICAL_SECTION use, which allows us to add PTHREAD_MUTEX_INITIALIZER, which will be useful later. Windows XP is hereby not a supported build target anymore. It was decided in a project vote that this is OK. (Technically, it could still be built for Windows XP using an external pthread lib as of this commit.) Windows Vista adds WSAPoll(), and for some reason struct pollfd. Since we raise the Windows API level globally when enabling w32threads, we need to move it before configure checks for struct pollfd to avoid that the compatibility ifdef mess redefines it. --- Requested changes applied and tested with mingw-w64. --- Changelog | 2 + compat/w32pthreads.h | 269 ++--- configure | 13 ++- libavcodec/pthread_frame.c | 4 - libavcodec/pthread_slice.c | 4 - libavfilter/pthread.c | 4 - libavutil/slicethread.c| 4 - 7 files changed, 18 insertions(+), 282 deletions(-) diff --git a/Changelog b/Changelog index ee48876128..decd6c712a 100644 --- a/Changelog +++ b/Changelog @@ -27,6 +27,8 @@ version : - video setrange filter - nsp demuxer - support LibreSSL (via libtls) +- Dropped support for building for Windows XP. The minimum supported Windows + version is Windows Vista. version 3.4: diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h index eeead6051f..9c7e0f574d 100644 --- a/compat/w32pthreads.h +++ b/compat/w32pthreads.h @@ -56,24 +56,12 @@ typedef struct pthread_t { void *ret; } pthread_t; -/* the conditional variable api for windows 6.0+ uses critical sections and - * not mutexes */ -typedef CRITICAL_SECTION pthread_mutex_t; - -/* This is the CONDITION_VARIABLE typedef for using Windows' native - * conditional variables on kernels 6.0+. */ -#if HAVE_CONDITION_VARIABLE_PTR +/* use light weight mutex/condition variable API for Windows Vista and later */ +typedef SRWLOCK pthread_mutex_t; typedef CONDITION_VARIABLE pthread_cond_t; -#else -typedef struct pthread_cond_t { -void *Ptr; -} pthread_cond_t; -#endif -#if _WIN32_WINNT >= 0x0600 -#define InitializeCriticalSection(x) InitializeCriticalSectionEx(x, 0, 0) -#define WaitForSingleObject(a, b) WaitForSingleObjectEx(a, b, FALSE) -#endif +#define PTHREAD_MUTEX_INITIALIZER SRWLOCK_INIT +#define PTHREAD_COND_INITIALIZER CONDITION_VARIABLE_INIT static av_unused unsigned __stdcall attribute_align_arg win32thread_worker(void *arg) { @@ -114,26 +102,25 @@ static av_unused int pthread_join(pthread_t thread, void **value_ptr) static inline int pthread_mutex_init(pthread_mutex_t *m, void* attr) { -InitializeCriticalSection(m); +InitializeSRWLock(m); return 0; } static inline int pthread_mutex_destroy(pthread_mutex_t *m) { -DeleteCriticalSection(m); +/* Unlocked SWR locks use no resources */ return 0; } static inline int pthread_mutex_lock(pthread_mutex_t *m) { -EnterCriticalSection(m); +AcquireSRWLockExclusive(m); return 0; } static inline int pthread_mutex_unlock(pthread_mutex_t *m) { -LeaveCriticalSection(m); +ReleaseSRWLockExclusive(m); return 0; } -#if _WIN32_WINNT >= 0x0600 typedef INIT_ONCE pthread_once_t; #define PTHREAD_ONCE_INIT INIT_ONCE_STATIC_INIT @@ -167,7 +154,7 @@ static inline int pthread_cond_broadcast(pthread_cond_t *cond) static inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) { -SleepConditionVariableCS(cond, mutex, INFINITE); +SleepConditionVariableSRW(cond, mutex, INFINITE, 0); return 0; } @@ -177,242 +164,4 @@ static inline int pthread_cond_signal(pthread_cond_t *cond) return 0; } -#else // _WIN32_WINNT < 0x0600 - -/* atomic init state of dynamically loaded functions */ -static LONG w32thread_init_state = 0; -static av_unused void w32thread_init(void); - -/* for pre-Windows 6.0 platforms, define INIT_ONCE struct, - * compatible to the one used in the native API */ - -typedef union pthread_once_t { -void * Ptr;///< For the Windows 6.0+ native functions -LONG state;///< For the pre-Windows 6.0 compat code -} pthread_once_t; - -#define PTHREAD_ONCE_INIT {0} - -/* function pointers to init once API on windows 6.0+ kernels */ -static BOOL (WINAPI *initonce_begin)(pthread_once_t *lpInitOnce, DWORD dwFlags, BOOL *fPending, void **lpContext); -static BOOL (WINAPI *initonce_complete)(pthread_once_t *lpInitOnce, DWORD dwFlags, void *lpContext); - -/* pre-Windows 6.0 compat using a spin-lock */ -static inline void w32thread_once_fallback(LONG volatile *state, void (*init_routine)(void)) -{ -switch (InterlockedCompareExchange(state, 1, 0)) { -/* Initial run */ -case 0: -init_routine(); -InterlockedExchange(state, 2); -break; -/* Another thread is running init */ -case 1: -while (1) { -
Re: [FFmpeg-devel] [PATCH v2] w32pthreads: always use Vista+ API, drop XP support
On Fri, 22 Dec 2017 23:17:21 +0100 wm4 wrote: > This removes the XP compatibility code, and switches entirely to SWR > locks, which are available starting at Windows Vista. > > This removes CRITICAL_SECTION use, which allows us to add > PTHREAD_MUTEX_INITIALIZER, which will be useful later. > > Windows XP is hereby not a supported build target anymore. It was > decided in a project vote that this is OK. (Technically, it could still > be built for Windows XP using an external pthread lib as of this > commit.) > > Windows Vista adds WSAPoll(), and for some reason struct pollfd. Since > we raise the Windows API level globally when enabling w32threads, we > need to move it before configure checks for struct pollfd to avoid that > the compatibility ifdef mess redefines it. Whoops, and commit message updated locally by removing the last paragraph. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 3/5] avformat/hls: add http_persistent option
On Wed, Dec 20, 2017 at 11:36 AM, Aman Gupta wrote: > > > On Sun, Dec 17, 2017 at 1:13 PM, Anssi Hannula > wrote: > >> Aman Gupta kirjoitti 2017-12-17 22:41: >> >>> On Sun, Dec 17, 2017 at 12:34 PM Anssi Hannula >>> wrote: >>> >>> Hi! Aman Gupta kirjoitti 2017-12-13 02:35: > From: Aman Gupta > > This teaches the HLS demuxer to use the HTTP protocols > multiple_requests=1 option, to take advantage of "Connection: > Keep-Alive" when downloading playlists and segments from the HLS > server. > > With the new option, you can avoid TCP connection and TLS negotiation > overhead, which is particularly beneficial when streaming via a > high-latency internet connection. > > Similar to the http_persistent option recently implemented in hlsenc.c Why is this implemented as an option instead of simply being always used by the demuxer? >>> >>> >>> I have no strong feeling on this either way. I've tested the new option >>> against a few different HLS servers and would be comfortable enabling it >>> by >>> default. I do think it's worth keeping as an option in case someone wants >>> to turn it off for whatever reason. >>> >> >> OK. The only other demuxer that reuses HTTP connections seems to be >> rtmphttp, and it does not have an option. >> I think I'd prefer no option here as well unless a use case is known, but >> I'm not too strongly against it so I guess it could stay (but default to >> true). >> >> Does anyone else have any thoughts? >> > > If no one objects, I will push this patchset with the requested changed in > a few days. > Patchset applied. I ran some more tests before pushing to master, with: `-i https://bitdash-a.akamaihd.net/content/sintel/hls/video/4000kbit.m3u8 -t 30 -f null /dev/null` -http_persistent 0 -http_multiple 0 frame= 722 fps=296 q=-1.0 Lsize=N/A time=00:00:29.95 bitrate=N/A speed=12.3x frame= 722 fps=324 q=-1.0 Lsize=N/A time=00:00:29.95 bitrate=N/A speed=13.4x -http_persistent 0 -http_multiple 1 frame= 722 fps=304 q=-1.0 Lsize=N/A time=00:00:29.95 bitrate=N/A speed=12.6x frame= 722 fps=325 q=-1.0 Lsize=N/A time=00:00:29.95 bitrate=N/A speed=13.5x -http_persistent 1 -http_multiple 0 frame= 722 fps=682 q=-1.0 Lsize=N/A time=00:00:29.95 bitrate=N/A speed=28.3x frame= 722 fps=713 q=-1.0 Lsize=N/A time=00:00:29.95 bitrate=N/A speed=29.6x -http_persistent 1 -http_multiple 1 frame= 722 fps=0.0 q=-1.0 Lsize=N/A time=00:00:29.95 bitrate=N/A speed=39.4x frame= 722 fps=0.0 q=-1.0 Lsize=N/A time=00:00:29.95 bitrate=N/A speed=40.6x In this case, the new default settings achieve a 3x throughput increase as compared to the previous defaults. Aman > > Aman > > >> >> >> Also, what happens if the hostname in the URI varies, does it properly >> open a new connection then? >> >> >>> > --- > doc/demuxers.texi | 3 +++ > libavformat/hls.c | 68 > +++ > 2 files changed, 67 insertions(+), 4 deletions(-) > > diff --git a/doc/demuxers.texi b/doc/demuxers.texi > index 73dc0feec1..18ff7101ac 100644 > --- a/doc/demuxers.texi > +++ b/doc/demuxers.texi > @@ -316,6 +316,9 @@ segment index to start live streams at (negative > values are from the end). > @item max_reload > Maximum number of times a insufficient list is attempted to be > reloaded. > Default value is 1000. > + > +@item http_persistent > +Use persistent HTTP connections. Applicable only for HTTP streams. > @end table > > @section image2 > diff --git a/libavformat/hls.c b/libavformat/hls.c > index ab6ff187a6..5c1895c180 100644 > --- a/libavformat/hls.c > +++ b/libavformat/hls.c > @@ -26,6 +26,7 @@ > * http://tools.ietf.org/html/draft-pantos-http-live-streaming > */ > > +#include "libavformat/http.h" > #include "libavutil/avstring.h" > #include "libavutil/avassert.h" > #include "libavutil/intreadwrite.h" > @@ -94,6 +95,7 @@ struct playlist { > AVIOContext pb; > uint8_t* read_buffer; > AVIOContext *input; > +int input_read_done; > AVFormatContext *parent; > int index; > AVFormatContext *ctx; > @@ -206,6 +208,8 @@ typedef struct HLSContext { > int strict_std_compliance; > char *allowed_extensions; > int max_reload; > +int http_persistent; > +AVIOContext *playlist_pb; > } HLSContext; > > static int read_chomp_line(AVIOContext *s, char *buf, int maxlen) > @@ -256,6 +260,7 @@ static void free_playlist_list(HLSContext *c) > av_freep(&pls->pb.buffer); > if (pls->input) > ff_format_io_close(c->ctx, &pls->input); > +pls->input_read_done = 0; > if (pls->ctx) { > pls
[FFmpeg-devel] [PATCH] avformat/internal: log errno with ff_rename failure
From: Aman Gupta --- libavformat/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index 36a57214ce..aac566aace 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -542,7 +542,7 @@ static inline int ff_rename(const char *oldpath, const char *newpath, void *logc if (rename(oldpath, newpath) == -1) { ret = AVERROR(errno); if (logctx) -av_log(logctx, AV_LOG_ERROR, "failed to rename file %s to %s\n", oldpath, newpath); +av_log(logctx, AV_LOG_ERROR, "failed to rename file %s to %s: %s\n", oldpath, newpath, strerror(errno)); } return ret; } -- 2.14.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/hlsenc: improve compute target_duration way
just use lrint(lrint(duration * 10.0) / 10.0) fix ticket: 6915 Suggested-by: beloko Signed-off-by: Steven Liu --- libavformat/dashenc.c | 2 +- libavformat/hlsenc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 5368a2334c..102558d17e 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -358,7 +358,7 @@ static void output_segment_list(OutputStream *os, AVIOContext *out, DASHContext Segment *seg = os->segments[i]; double duration = (double) seg->duration / timescale; if (target_duration <= duration) -target_duration = lrint(duration); +target_duration = lrint(lrint(duration * 10.0) / 10.0); } ff_hls_write_playlist_header(out_hls, 6, -1, target_duration, diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 0095ca4339..bf6f1d9253 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1235,7 +1235,7 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs) for (en = vs->segments; en; en = en->next) { if (target_duration <= en->duration) -target_duration = lrint(en->duration); +target_duration = lrint(lrint(en->duration * 10.0) / 10.0); } vs->discontinuity_set = 0; -- 2.11.0 (Apple Git-81) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/internal: log errno with ff_rename failure
On Fri, 22 Dec 2017 15:17:33 -0800 Aman Gupta wrote: > From: Aman Gupta > > --- > libavformat/internal.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/internal.h b/libavformat/internal.h > index 36a57214ce..aac566aace 100644 > --- a/libavformat/internal.h > +++ b/libavformat/internal.h > @@ -542,7 +542,7 @@ static inline int ff_rename(const char *oldpath, const > char *newpath, void *logc > if (rename(oldpath, newpath) == -1) { > ret = AVERROR(errno); > if (logctx) > -av_log(logctx, AV_LOG_ERROR, "failed to rename file %s to %s\n", > oldpath, newpath); > +av_log(logctx, AV_LOG_ERROR, "failed to rename file %s to %s: > %s\n", oldpath, newpath, strerror(errno)); > } > return ret; > } strerror() is not thread-safe. you could use av_err2str() after wrapping the errno value as AVERROR. This would return the same as strerror(), but using a thread-safe alternative function if possible. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] avcodec/h264_cabac: Fix CABAC+8x8dct in 4:4:4
On Thu, 15 Jun 2017 15:50:31 -0400 "Ronald S. Bultje" wrote: > From: Anton Mitrofanov > > Use the correct ctxIdxInc calculation for coded_block_flag. > Keep old behavior for old versions of x264 for backward compatibility. > > Signed-off-by: Ronald S. Bultje > --- > libavcodec/h264_cabac.c | 47 +-- > 1 file changed, 33 insertions(+), 14 deletions(-) > > diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c > index 11ff3a0..28aacc5 100644 > --- a/libavcodec/h264_cabac.c > +++ b/libavcodec/h264_cabac.c > @@ -2347,21 +2347,40 @@ decode_intra_mb: > if (CHROMA444(h) && IS_8x8DCT(mb_type)){ > int i; > uint8_t *nnz_cache = sl->non_zero_count_cache; > -for (i = 0; i < 2; i++){ > -if (sl->left_type[LEFT(i)] && > !IS_8x8DCT(sl->left_type[LEFT(i)])) { > -nnz_cache[3+8* 1 + 2*8*i]= > -nnz_cache[3+8* 2 + 2*8*i]= > -nnz_cache[3+8* 6 + 2*8*i]= > -nnz_cache[3+8* 7 + 2*8*i]= > -nnz_cache[3+8*11 + 2*8*i]= > -nnz_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0; > +if (h->sei.unregistered.x264_build < 151U) { > +for (i = 0; i < 2; i++){ > +if (sl->left_type[LEFT(i)] && > !IS_8x8DCT(sl->left_type[LEFT(i)])) { > +nnz_cache[3+8* 1 + 2*8*i]= > +nnz_cache[3+8* 2 + 2*8*i]= > +nnz_cache[3+8* 6 + 2*8*i]= > +nnz_cache[3+8* 7 + 2*8*i]= > +nnz_cache[3+8*11 + 2*8*i]= > +nnz_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0; > +} > +} > +if (sl->top_type && !IS_8x8DCT(sl->top_type)){ > +uint32_t top_empty = !IS_INTRA(mb_type) ? 0 : 0x40404040; > +AV_WN32A(&nnz_cache[4+8* 0], top_empty); > +AV_WN32A(&nnz_cache[4+8* 5], top_empty); > +AV_WN32A(&nnz_cache[4+8*10], top_empty); > +} > +} else { > +for (i = 0; i < 2; i++){ > +if (sl->left_type[LEFT(i)] && > !IS_8x8DCT(sl->left_type[LEFT(i)])) { > +nnz_cache[3+8* 1 + 2*8*i]= > +nnz_cache[3+8* 2 + 2*8*i]= > +nnz_cache[3+8* 6 + 2*8*i]= > +nnz_cache[3+8* 7 + 2*8*i]= > +nnz_cache[3+8*11 + 2*8*i]= > +nnz_cache[3+8*12 + 2*8*i]= > !IS_INTRA_PCM(sl->left_type[LEFT(i)]) ? 0 : 64; > +} > +} > +if (sl->top_type && !IS_8x8DCT(sl->top_type)){ > +uint32_t top_empty = !IS_INTRA_PCM(sl->top_type) ? 0 : > 0x40404040; > +AV_WN32A(&nnz_cache[4+8* 0], top_empty); > +AV_WN32A(&nnz_cache[4+8* 5], top_empty); > +AV_WN32A(&nnz_cache[4+8*10], top_empty); > } > -} > -if (sl->top_type && !IS_8x8DCT(sl->top_type)){ > -uint32_t top_empty = !IS_INTRA(mb_type) ? 0 : 0x40404040; > -AV_WN32A(&nnz_cache[4+8* 0], top_empty); > -AV_WN32A(&nnz_cache[4+8* 5], top_empty); > -AV_WN32A(&nnz_cache[4+8*10], top_empty); > } > } > h->cur_pic.mb_type[mb_xy] = mb_type; There have been several user complaints about it. Apparently, there are a lot of these broken files around. The problem is that some files lack the SEI (or it has been wiped out by incompetents to hide encode settings, I guess). Usually, only the first video packet in a file contains this SEI, so starting at a position other than the start also causes problems. Would there be any way to detect this situation if x264_build is unset? Such as retrying decoding after obvious errors happen, or at least allowing frames after that to be decoded with the bug workaround enabled. Or would that be too crude to be considered? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/5] lavc: replace and deprecate the lock manager
On Thu, Dec 21, 2017 at 11:22:21PM +0100, wm4 wrote: > Use static mutexes instead of requiring a lock manager. The behavior > should be roughly the same before and after this change for API users > which did not set the lock manager at all (except that a minor memory > leak disappears). > --- > doc/APIchanges | 5 +++ > libavcodec/avcodec.h | 8 +++- > libavcodec/utils.c | 107 > +-- > libavcodec/version.h | 5 ++- > 4 files changed, 26 insertions(+), 99 deletions(-) This fails to build with: make distclean ; ./configure --disable-pthreads && make -j12 libavcodec/utils.c:72:38: error: ‘PTHREAD_MUTEX_INITIALIZER’ undeclared here (not in a function) static pthread_mutex_t codec_mutex = PTHREAD_MUTEX_INITIALIZER; [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/5] lavc: replace and deprecate the lock manager
On Sat, 23 Dec 2017 02:25:11 +0100 Michael Niedermayer wrote: > On Thu, Dec 21, 2017 at 11:22:21PM +0100, wm4 wrote: > > Use static mutexes instead of requiring a lock manager. The behavior > > should be roughly the same before and after this change for API users > > which did not set the lock manager at all (except that a minor memory > > leak disappears). > > --- > > doc/APIchanges | 5 +++ > > libavcodec/avcodec.h | 8 +++- > > libavcodec/utils.c | 107 > > +-- > > libavcodec/version.h | 5 ++- > > 4 files changed, 26 insertions(+), 99 deletions(-) > > This fails to build with: > make distclean ; ./configure --disable-pthreads && make -j12 > > libavcodec/utils.c:72:38: error: ‘PTHREAD_MUTEX_INITIALIZER’ undeclared here > (not in a function) > static pthread_mutex_t codec_mutex = PTHREAD_MUTEX_INITIALIZER; > > [...] Will fix locally by using our pthread aliases instead of pthread names directly (ff_mutex_lock() etc.), and I'll define PTHREAD_MUTEX_INITIALIZER as AV_MUTEX_INITIALIZER. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/5] lavc: replace and deprecate the lock manager
On 12/22/2017 10:25 PM, Michael Niedermayer wrote: > On Thu, Dec 21, 2017 at 11:22:21PM +0100, wm4 wrote: >> Use static mutexes instead of requiring a lock manager. The behavior >> should be roughly the same before and after this change for API users >> which did not set the lock manager at all (except that a minor memory >> leak disappears). >> --- >> doc/APIchanges | 5 +++ >> libavcodec/avcodec.h | 8 +++- >> libavcodec/utils.c | 107 >> +-- >> libavcodec/version.h | 5 ++- >> 4 files changed, 26 insertions(+), 99 deletions(-) > > This fails to build with: > make distclean ; ./configure --disable-pthreads && make -j12 > > libavcodec/utils.c:72:38: error: ‘PTHREAD_MUTEX_INITIALIZER’ undeclared here > (not in a function) > static pthread_mutex_t codec_mutex = PTHREAD_MUTEX_INITIALIZER; I guess the simplest way to fix this would be to wrap all this code in HAVE_THREADS checks (Much like it was pre patch), but ideally the libavutil/threads.h wrappers would be used instead, after being extended to also define PTHREAD_MUTEX_INITIALIZER for the no threads case. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/internal: log errno with ff_rename failure
On Fri, Dec 22, 2017 at 3:37 PM, wm4 wrote: > On Fri, 22 Dec 2017 15:17:33 -0800 > Aman Gupta wrote: > > > From: Aman Gupta > > > > --- > > libavformat/internal.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavformat/internal.h b/libavformat/internal.h > > index 36a57214ce..aac566aace 100644 > > --- a/libavformat/internal.h > > +++ b/libavformat/internal.h > > @@ -542,7 +542,7 @@ static inline int ff_rename(const char *oldpath, > const char *newpath, void *logc > > if (rename(oldpath, newpath) == -1) { > > ret = AVERROR(errno); > > if (logctx) > > -av_log(logctx, AV_LOG_ERROR, "failed to rename file %s to > %s\n", oldpath, newpath); > > +av_log(logctx, AV_LOG_ERROR, "failed to rename file %s to > %s: %s\n", oldpath, newpath, strerror(errno)); > > } > > return ret; > > } > > strerror() is not thread-safe. you could use av_err2str() after > wrapping the errno value as AVERROR. This would return the same as > strerror(), but using a thread-safe alternative function if possible. > Thanks. Fixed and applied to master. Aman > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] h264: add AVOption to set x264_build default
This provides a generic way to the API user to deal with files that either lack this SEI, or which have the SEI only in packets not passed to the decoder (such as the common case of the SEI being in the very firsat video packet, but decoding is started somewhere in the middle of the file). Bugs like 840b41b2a643fc8f0617c0370125a19c02c6b586 make this somewhat of a necessity. This intentionally uses the version in the SEI instead, if any is found. --- A bit crappy. Better than other workarounds I've thought of. And at least it doesn't require the API user to guess which x264 versions trigger which bugs. --- libavcodec/h264dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 1e98765439..8c9c6d9f3b 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -315,7 +315,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h) h->flags = avctx->flags; h->poc.prev_poc_msb = 1 << 16; h->recovery_frame= -1; -h->x264_build= -1; h->frame_recovered = 0; h->poc.prev_frame_num= -1; h->sei.frame_packing.arrangement_cancel_flag = -1; @@ -1037,6 +1036,7 @@ static const AVOption h264_options[] = { { "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 }, { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0 }, { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD }, +{ "x264_build", "Assume this x264 version if no x264 version found in any SEI", OFFSET(x264_build), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VD }, { NULL }, }; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/1] oma: move some constants into libavcodec
From: Misty De Meo Most of the constants in libavcodec/oma aren't specific to libavformat; moving them into libavcodec makes them available to libavcodec as well as keeping them compatible with libavformat. ff_oma_codec_tags uses a libavformat-specific type, so it has been left in libavformat. --- Changelog | 1 + libavformat/oma.c => libavcodec/oma.h | 27 +-- libavcodec/version.h | 2 +- libavformat/Makefile | 4 ++-- libavformat/oma.h | 21 + libavformat/omadec.c | 1 + libavformat/omaenc.c | 1 + libavformat/version.h | 2 +- 8 files changed, 29 insertions(+), 30 deletions(-) rename libavformat/oma.c => libavcodec/oma.h (65%) diff --git a/Changelog b/Changelog index ee48876128..31e720091c 100644 --- a/Changelog +++ b/Changelog @@ -27,6 +27,7 @@ version : - video setrange filter - nsp demuxer - support LibreSSL (via libtls) +- Move some OMA constants from libavformat into libavcodec version 3.4: diff --git a/libavformat/oma.c b/libavcodec/oma.h similarity index 65% rename from libavformat/oma.c rename to libavcodec/oma.h index f7ae3c9948..176f93ed22 100644 --- a/libavformat/oma.c +++ b/libavcodec/oma.h @@ -18,25 +18,22 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef AVCODEC_OMA_H +#define AVCODEC_OMA_H + +#include + #include "internal.h" -#include "oma.h" -#include "libavcodec/avcodec.h" #include "libavutil/channel_layout.h" -const uint16_t ff_oma_srate_tab[8] = { 320, 441, 480, 882, 960, 0 }; +#define EA3_HEADER_SIZE 96 +#define ID3v2_EA3_MAGIC "ea3" +#define OMA_ENC_HEADER_SIZE 16 -const AVCodecTag ff_oma_codec_tags[] = { -{ AV_CODEC_ID_ATRAC3, OMA_CODECID_ATRAC3}, -{ AV_CODEC_ID_ATRAC3P, OMA_CODECID_ATRAC3P }, -{ AV_CODEC_ID_MP3, OMA_CODECID_MP3 }, -{ AV_CODEC_ID_PCM_S16BE, OMA_CODECID_LPCM }, -{ AV_CODEC_ID_ATRAC3PAL, OMA_CODECID_ATRAC3PAL }, -{ AV_CODEC_ID_ATRAC3AL,OMA_CODECID_ATRAC3AL }, -{ 0 }, -}; +static const uint16_t ff_oma_srate_tab[8] = { 320, 441, 480, 882, 960, 0 }; /** map ATRAC-X channel id to internal channel layout */ -const uint64_t ff_oma_chid_to_native_layout[7] = { +static const uint64_t ff_oma_chid_to_native_layout[7] = { AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_SURROUND, @@ -47,4 +44,6 @@ const uint64_t ff_oma_chid_to_native_layout[7] = { }; /** map ATRAC-X channel id to total number of channels */ -const int ff_oma_chid_to_num_channels[7] = {1, 2, 3, 4, 6, 7, 8}; +static const int ff_oma_chid_to_num_channels[7] = {1, 2, 3, 4, 6, 7, 8}; + +#endif /* AVCODEC_OMA_H */ diff --git a/libavcodec/version.h b/libavcodec/version.h index d55de89797..d48857578d 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 8 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavformat/Makefile b/libavformat/Makefile index cb70eac920..ef0365e6e2 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -358,8 +358,8 @@ OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \ vorbiscomment.o OBJS-$(CONFIG_OGV_MUXER) += oggenc.o \ vorbiscomment.o -OBJS-$(CONFIG_OMA_DEMUXER) += omadec.o pcm.o oma.o -OBJS-$(CONFIG_OMA_MUXER) += omaenc.o rawenc.o oma.o id3v2enc.o +OBJS-$(CONFIG_OMA_DEMUXER) += omadec.o pcm.o +OBJS-$(CONFIG_OMA_MUXER) += omaenc.o rawenc.o id3v2enc.o OBJS-$(CONFIG_OPUS_MUXER)+= oggenc.o \ vorbiscomment.o OBJS-$(CONFIG_PAF_DEMUXER) += paf.o diff --git a/libavformat/oma.h b/libavformat/oma.h index 36fd0125e4..ccd57d779e 100644 --- a/libavformat/oma.h +++ b/libavformat/oma.h @@ -21,14 +21,8 @@ #ifndef AVFORMAT_OMA_H #define AVFORMAT_OMA_H -#include - #include "internal.h" -#define EA3_HEADER_SIZE 96 -#define ID3v2_EA3_MAGIC "ea3" -#define OMA_ENC_HEADER_SIZE 16 - enum { OMA_CODECID_ATRAC3 = 0, OMA_CODECID_ATRAC3P = 1, @@ -39,11 +33,14 @@ enum { OMA_CODECID_ATRAC3AL = 34, }; -extern const uint16_t ff_oma_srate_tab[8]; - -extern const AVCodecTag ff_oma_codec_tags[]; - -extern const uint64_t ff_oma_chid_to_native_layout[7]; -extern const int ff_oma_chid_to_num_channels[7]; +static const AVCodecTag ff_oma_codec_tags[] = { +{ AV_CODEC_ID_ATRAC3, OMA_CODECID_ATRAC3}, +{ AV_CODEC_ID_ATRAC3P, OMA_CODECID_ATRAC3P }, +{ AV_CODEC_ID_MP3, OMA_CODECID_MP3
[FFmpeg-devel] [PATCH 0/1] oma: move some constants into libavcodec
From: Misty De Meo Thanks for the feedback! I checked in with #ffmpeg-devel on IRC, and they suggested simply making them static consts in the headers since they're small enough. Updated patch is included. Misty De Meo (1): oma: move some constants into libavcodec Changelog | 1 + libavformat/oma.c => libavcodec/oma.h | 27 +-- libavcodec/version.h | 2 +- libavformat/Makefile | 4 ++-- libavformat/oma.h | 21 + libavformat/omadec.c | 1 + libavformat/omaenc.c | 1 + libavformat/version.h | 2 +- 8 files changed, 29 insertions(+), 30 deletions(-) rename libavformat/oma.c => libavcodec/oma.h (65%) -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v8 1/3] avformat/hlsenc:addition of #EXT-X-MEDIA tag and AUDIO attribute
2017-12-22 19:30 GMT+08:00 刘歧 : > > >> On 22 Dec 2017, at 19:05, Dixit, Vishwanath wrote: >> >> On 12/19/17 11:53 AM, 刘歧 wrote: >>> On 19 Dec 2017, at 14:09, vdi...@akamai.com wrote: From: Vishwanath Dixit --- doc/muxers.texi | 12 + libavformat/dashenc.c | 3 ++- libavformat/hlsenc.c | 64 --- libavformat/hlsplaylist.c | 4 ++- libavformat/hlsplaylist.h | 2 +- 5 files changed, 79 insertions(+), 6 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 3d0c7bf..93db549 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -834,6 +834,18 @@ be a video only stream with video bitrate 1000k, the second variant stream will be an audio only stream with bitrate 64k and the third variant stream will be a video only stream with bitrate 256k. Here, three media playlist with file names out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created. +@example +ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ + -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ + -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low v:1,agroup:aud_high" \ + -master_pl_name master.m3u8 \ + http://example.com/live/out.m3u8 +@end example +This example creates two audio only and two video only variant streams. In +addition to the #EXT-X-STREAM-INF tag for each variant stream in the master +playlist, #EXT-X-MEDIA tag is also added for the two audio only variant streams +and they are mapped to the two video only variant streams with audio group names +'aud_low' and 'aud_high'. By default, a single hls variant containing all the encoded streams is created. diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 5687530..f363418 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -759,7 +759,8 @@ static int write_manifest(AVFormatContext *s, int final) char playlist_file[64]; AVStream *st = s->streams[i]; get_hls_playlist_name(playlist_file, sizeof(playlist_file), NULL, i); -ff_hls_write_stream_info(st, out, st->codecpar->bit_rate, playlist_file); +ff_hls_write_stream_info(st, out, st->codecpar->bit_rate, +playlist_file, NULL); } avio_close(out); if (use_rename) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index e3442c3..53dc835 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -144,6 +144,7 @@ typedef struct VariantStream { AVStream **streams; unsigned int nb_streams; int m3u8_created; /* status of media play-list creation */ +char *agroup; /* audio group name */ char *baseurl; } VariantStream; @@ -1085,7 +1086,7 @@ static int create_master_playlist(AVFormatContext *s, VariantStream * const input_vs) { HLSContext *hls = s->priv_data; -VariantStream *vs; +VariantStream *vs, *temp_vs; AVStream *vid_st, *aud_st; AVDictionary *options = NULL; unsigned int i, j; @@ -1117,6 +1118,34 @@ static int create_master_playlist(AVFormatContext *s, ff_hls_write_playlist_version(hls->m3u8_out, hls->version); +/* For audio only variant streams add #EXT-X-MEDIA tag with attributes*/ +for (i = 0; i < hls->nb_varstreams; i++) { +vs = &(hls->var_streams[i]); + +if (vs->has_video || vs->has_subtitle || !vs->agroup) +continue; + +m3u8_name_size = strlen(vs->m3u8_name) + 1; +m3u8_rel_name = av_malloc(m3u8_name_size); +if (!m3u8_rel_name) { +ret = AVERROR(ENOMEM); +goto fail; +} +av_strlcpy(m3u8_rel_name, vs->m3u8_name, m3u8_name_size); +ret = get_relative_url(hls->master_m3u8_url, vs->m3u8_name, + m3u8_rel_name, m3u8_name_size); +if (ret < 0) { +av_log(s, AV_LOG_ERROR, "Unable to find relative URL\n"); +goto fail; +} + +avio_printf(hls->m3u8_out, "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", +vs->agroup); +avio_printf(hls->m3u8_out, ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n", +m3u8_rel_name); +av_freep(&m3u8_rel_name); +} + /* For variant streams with video add #EXT-X-STREAM-INF tag with attributes*/ for (i = 0; i < hls->nb_varstreams; i++) { vs = &(hls->var_streams[i]); @@ -1149