Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 907292 Details for
Bug 917591
media-video/handbrake-1.7.0 version bump
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
/etc/portage/patches/media-video/ffmpeg-6.1.2/ from handbrake-1.7.3
A15-avformat-mov-add-support-for-amve-ambient-viewing-en.patch (text/plain), 6.94 KB, created by
mehw
on 2024-10-29 23:51:59 UTC
(
hide
)
Description:
/etc/portage/patches/media-video/ffmpeg-6.1.2/ from handbrake-1.7.3
Filename:
MIME Type:
Creator:
mehw
Created:
2024-10-29 23:51:59 UTC
Size:
6.94 KB
patch
obsolete
>From db0cd1187ba72e2a140772e579e377f93575a418 Mon Sep 17 00:00:00 2001 >From: Damiano Galassi <damiog@gmail.com> >Date: Sat, 6 Jan 2024 15:17:20 +0100 >Subject: [PATCH] avformat/mov: add support for 'amve' ambient viewing > environment box. As defined in ISOBMFF (ISO/IEC 14496-12) document. > >--- > libavformat/dump.c | 15 +++++++++++++++ > libavformat/isom.h | 3 +++ > libavformat/mov.c | 35 +++++++++++++++++++++++++++++++++++ > libavformat/movenc.c | 26 ++++++++++++++++++++++++++ > 4 files changed, 79 insertions(+) > >diff --git a/libavformat/dump.c b/libavformat/dump.c >index c0868a1bb3..1058829cc7 100644 >--- a/libavformat/dump.c >+++ b/libavformat/dump.c >@@ -27,6 +27,7 @@ > #include "libavutil/intreadwrite.h" > #include "libavutil/log.h" > #include "libavutil/mastering_display_metadata.h" >+#include "libavutil/ambient_viewing_environment.h" > #include "libavutil/dovi_meta.h" > #include "libavutil/mathematics.h" > #include "libavutil/opt.h" >@@ -366,6 +367,17 @@ static void dump_content_light_metadata(void *ctx, const AVPacketSideData *sd) > metadata->MaxCLL, metadata->MaxFALL); > } > >+static void dump_ambient_viewing_environment_metadata(void *ctx, const AVPacketSideData *sd) >+{ >+ const AVAmbientViewingEnvironment *ambient = >+ (const AVAmbientViewingEnvironment *)sd->data; >+ av_log(ctx, AV_LOG_INFO, "Ambient Viewing Environment, " >+ "ambient_illuminance=%f, ambient_light_x=%f, ambient_light_y=%f", >+ av_q2d(ambient->ambient_illuminance), >+ av_q2d(ambient->ambient_light_x), >+ av_q2d(ambient->ambient_light_y)); >+} >+ > static void dump_spherical(void *ctx, const AVCodecParameters *par, > const AVPacketSideData *sd) > { >@@ -497,6 +509,9 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent) > av_log(ctx, AV_LOG_INFO, "SMPTE ST 12-1:2014: "); > dump_s12m_timecode(ctx, st, sd); > break; >+ case AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT: >+ dump_ambient_viewing_environment_metadata(ctx, sd); >+ break; > default: > av_log(ctx, AV_LOG_INFO, "unknown side data type %d " > "(%"SIZE_SPECIFIER" bytes)", sd->type, sd->size); >diff --git a/libavformat/isom.h b/libavformat/isom.h >index 3d375d7a46..46247b0ec7 100644 >--- a/libavformat/isom.h >+++ b/libavformat/isom.h >@@ -29,6 +29,7 @@ > > #include "libavutil/encryption_info.h" > #include "libavutil/mastering_display_metadata.h" >+#include "libavutil/ambient_viewing_environment.h" > #include "libavutil/spherical.h" > #include "libavutil/stereo3d.h" > >@@ -249,6 +250,8 @@ typedef struct MOVStreamContext { > AVMasteringDisplayMetadata *mastering; > AVContentLightMetadata *coll; > size_t coll_size; >+ AVAmbientViewingEnvironment *ambient; >+ size_t ambient_size; > > uint32_t format; > >diff --git a/libavformat/mov.c b/libavformat/mov.c >index 606fe22f71..a6dcaca2f4 100644 >--- a/libavformat/mov.c >+++ b/libavformat/mov.c >@@ -6046,6 +6046,31 @@ static int mov_read_clli(MOVContext *c, AVIOContext *pb, MOVAtom atom) > return 0; > } > >+static int mov_read_amve(MOVContext *c, AVIOContext *pb, MOVAtom atom) >+{ >+ MOVStreamContext *sc; >+ const int illuminance_den = 10000; >+ const int ambient_den = 50000; >+ if (c->fc->nb_streams < 1) >+ return AVERROR_INVALIDDATA; >+ sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; >+ if (atom.size < 6) { >+ av_log(c->fc, AV_LOG_ERROR, "Empty Ambient Viewing Environment Info box\n"); >+ return AVERROR_INVALIDDATA; >+ } >+ if (sc->ambient){ >+ av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate AMVE\n"); >+ return 0; >+ } >+ sc->ambient = av_ambient_viewing_environment_alloc(&sc->ambient_size); >+ if (!sc->ambient) >+ return AVERROR(ENOMEM); >+ sc->ambient->ambient_illuminance = av_make_q(avio_rb32(pb), illuminance_den); >+ sc->ambient->ambient_light_x = av_make_q(avio_rb16(pb), ambient_den); >+ sc->ambient->ambient_light_y = av_make_q(avio_rb16(pb), ambient_den); >+ return 0; >+} >+ > static int mov_read_st3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) > { > AVStream *st; >@@ -7966,6 +7991,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { > { MKTAG('p','c','m','C'), mov_read_pcmc }, /* PCM configuration box */ > { MKTAG('p','i','t','m'), mov_read_pitm }, > { MKTAG('e','v','c','C'), mov_read_glbl }, >+{ MKTAG('a','m','v','e'), mov_read_amve }, /* ambient viewing environment box */ > { 0, NULL } > }; > >@@ -8436,6 +8462,7 @@ static int mov_read_close(AVFormatContext *s) > av_freep(&sc->spherical); > av_freep(&sc->mastering); > av_freep(&sc->coll); >+ av_freep(&sc->ambient); > } > > av_freep(&mov->dv_demux); >@@ -8797,6 +8824,14 @@ static int mov_read_header(AVFormatContext *s) > > sc->coll = NULL; > } >+ if (sc->ambient) { >+ if (!av_packet_side_data_add(&st->codecpar->coded_side_data, &st->codecpar->nb_coded_side_data, >+ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT, >+ (uint8_t *)sc->ambient, sc->ambient_size, 0)) >+ return AVERROR(ENOMEM); >+ >+ sc->ambient = NULL; >+ } > break; > } > } >diff --git a/libavformat/movenc.c b/libavformat/movenc.c >index e39f1ac987..fca16c5475 100644 >--- a/libavformat/movenc.c >+++ b/libavformat/movenc.c >@@ -2226,6 +2226,31 @@ static int mov_write_mdcv_tag(AVIOContext *pb, MOVTrack *track) > return 32; > } > >+static int mov_write_amve_tag(AVIOContext *pb, MOVTrack *track) >+{ >+ const int illuminance_den = 10000; >+ const int ambient_den = 50000; >+ const AVPacketSideData *side_data; >+ const AVAmbientViewingEnvironment *ambient = NULL; >+ >+ side_data = av_packet_side_data_get(track->st->codecpar->coded_side_data, >+ track->st->codecpar->nb_coded_side_data, >+ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT); >+ >+ if (side_data) >+ ambient = (const AVAmbientViewingEnvironment*)side_data->data; >+ if (!ambient || !ambient->ambient_illuminance.num) { >+ return 0; >+ } >+ >+ avio_wb32(pb, 16); // size >+ ffio_wfourcc(pb, "amve"); >+ avio_wb32(pb, rescale_mdcv(ambient->ambient_illuminance, illuminance_den)); >+ avio_wb16(pb, rescale_mdcv(ambient->ambient_light_x, ambient_den)); >+ avio_wb16(pb, rescale_mdcv(ambient->ambient_light_y, ambient_den)); >+ return 16; >+} >+ > static void find_compressor(char * compressor_name, int len, MOVTrack *track) > { > AVDictionaryEntry *encoder; >@@ -2437,6 +2462,7 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex > if (track->mode == MODE_MOV || track->mode == MODE_MP4) { > mov_write_clli_tag(pb, track); > mov_write_mdcv_tag(pb, track); >+ mov_write_amve_tag(pb, track); > } > > if (track->mode == MODE_MP4 && mov->fc->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) { >-- >2.39.3 (Apple Git-145) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 917591
:
875262
|
875263
|
886545
|
887851
|
887852
|
887875
|
887876
|
887877
|
887878
|
887993
|
889164
|
907281
|
907282
|
907283
|
907284
|
907285
|
907286
|
907287
|
907288
|
907289
|
907290
|
907291
| 907292 |
907293
|
907294
|
907295
|
907296
|
907297
|
907298