* [FFmpeg-devel] [PATCH] avformat/mov: get the correct fragment stsd_id when decrypting the sample
@ 2022-09-01 13:29 1035567130
2022-09-16 9:27 ` Zhao Zhili
0 siblings, 1 reply; 3+ messages in thread
From: 1035567130 @ 2022-09-01 13:29 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Wang Yaqiang
From: Wang Yaqiang <wangyaqiang03@kuaishou.com>
When determining whether a packet should be decrypted,
should use the stsd_id of the fragment where the current packet is located.
Signed-off-by: Wang Yaqiang <wangyaqiang03@kuaishou.com>
---
libavformat/isom.h | 1 +
libavformat/mov.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/libavformat/isom.h b/libavformat/isom.h
index fd236b985f..64fb7065d5 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -139,6 +139,7 @@ typedef struct MOVFragmentStreamInfo {
int index_base;
int index_entry;
MOVEncryptionIndex *encryption_index;
+ int stsd_id; // current fragment stsd_id
} MOVFragmentStreamInfo;
typedef struct MOVFragmentIndexItem {
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 35e2271b14..a2c6a4f2a3 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4956,9 +4956,10 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_log(c->fc, AV_LOG_TRACE, "frag flags 0x%x\n", frag->flags);
frag_stream_info = get_current_frag_stream_info(&c->frag_index);
- if (frag_stream_info)
+ if (frag_stream_info) {
frag_stream_info->next_trun_dts = AV_NOPTS_VALUE;
-
+ frag_stream_info->stsd_id = frag->stsd_id;
+ }
return 0;
}
@@ -7223,7 +7224,7 @@ static int cenc_filter(MOVContext *mov, AVStream* st, MOVStreamContext *sc, AVPa
encryption_index = NULL;
if (frag_stream_info) {
// Note this only supports encryption info in the first sample descriptor.
- if (mov->fragment.stsd_id == 1) {
+ if (frag_stream_info->stsd_id == 1) {
if (frag_stream_info->encryption_index) {
encrypted_index = current_index - frag_stream_info->index_base;
encryption_index = frag_stream_info->encryption_index;
--
2.33.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mov: get the correct fragment stsd_id when decrypting the sample
2022-09-01 13:29 [FFmpeg-devel] [PATCH] avformat/mov: get the correct fragment stsd_id when decrypting the sample 1035567130
@ 2022-09-16 9:27 ` Zhao Zhili
2022-09-21 6:56 ` Steven Liu
0 siblings, 1 reply; 3+ messages in thread
From: Zhao Zhili @ 2022-09-16 9:27 UTC (permalink / raw)
To: 'FFmpeg development discussions and patches'
Cc: 'Wang Yaqiang'
> From: Wang Yaqiang <wangyaqiang03@kuaishou.com>
>
> When determining whether a packet should be decrypted,
> should use the stsd_id of the fragment where the current packet is located.
>
> Signed-off-by: Wang Yaqiang <wangyaqiang03@kuaishou.com>
> ---
> libavformat/isom.h | 1 +
> libavformat/mov.c | 7 ++++---
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/isom.h b/libavformat/isom.h
> index fd236b985f..64fb7065d5 100644
> --- a/libavformat/isom.h
> +++ b/libavformat/isom.h
> @@ -139,6 +139,7 @@ typedef struct MOVFragmentStreamInfo {
> int index_base;
> int index_entry;
> MOVEncryptionIndex *encryption_index;
> + int stsd_id; // current fragment stsd_id
> } MOVFragmentStreamInfo;
>
> typedef struct MOVFragmentIndexItem {
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 35e2271b14..a2c6a4f2a3 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -4956,9 +4956,10 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> av_log(c->fc, AV_LOG_TRACE, "frag flags 0x%x\n", frag->flags);
>
> frag_stream_info = get_current_frag_stream_info(&c->frag_index);
> - if (frag_stream_info)
> + if (frag_stream_info) {
> frag_stream_info->next_trun_dts = AV_NOPTS_VALUE;
> -
> + frag_stream_info->stsd_id = frag->stsd_id;
> + }
> return 0;
> }
>
> @@ -7223,7 +7224,7 @@ static int cenc_filter(MOVContext *mov, AVStream* st, MOVStreamContext *sc, AVPa
> encryption_index = NULL;
> if (frag_stream_info) {
> // Note this only supports encryption info in the first sample descriptor.
> - if (mov->fragment.stsd_id == 1) {
> + if (frag_stream_info->stsd_id == 1) {
> if (frag_stream_info->encryption_index) {
> encrypted_index = current_index - frag_stream_info->index_base;
> encryption_index = frag_stream_info->encryption_index;
LGTM.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mov: get the correct fragment stsd_id when decrypting the sample
2022-09-16 9:27 ` Zhao Zhili
@ 2022-09-21 6:56 ` Steven Liu
0 siblings, 0 replies; 3+ messages in thread
From: Steven Liu @ 2022-09-21 6:56 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Wang Yaqiang
Zhao Zhili <quinkblack@foxmail.com> 于2022年9月16日周五 17:28写道:
>
>
> > From: Wang Yaqiang <wangyaqiang03@kuaishou.com>
> >
> > When determining whether a packet should be decrypted,
> > should use the stsd_id of the fragment where the current packet is located.
> >
> > Signed-off-by: Wang Yaqiang <wangyaqiang03@kuaishou.com>
> > ---
> > libavformat/isom.h | 1 +
> > libavformat/mov.c | 7 ++++---
> > 2 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavformat/isom.h b/libavformat/isom.h
> > index fd236b985f..64fb7065d5 100644
> > --- a/libavformat/isom.h
> > +++ b/libavformat/isom.h
> > @@ -139,6 +139,7 @@ typedef struct MOVFragmentStreamInfo {
> > int index_base;
> > int index_entry;
> > MOVEncryptionIndex *encryption_index;
> > + int stsd_id; // current fragment stsd_id
> > } MOVFragmentStreamInfo;
> >
> > typedef struct MOVFragmentIndexItem {
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index 35e2271b14..a2c6a4f2a3 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -4956,9 +4956,10 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> > av_log(c->fc, AV_LOG_TRACE, "frag flags 0x%x\n", frag->flags);
> >
> > frag_stream_info = get_current_frag_stream_info(&c->frag_index);
> > - if (frag_stream_info)
> > + if (frag_stream_info) {
> > frag_stream_info->next_trun_dts = AV_NOPTS_VALUE;
> > -
> > + frag_stream_info->stsd_id = frag->stsd_id;
> > + }
> > return 0;
> > }
> >
> > @@ -7223,7 +7224,7 @@ static int cenc_filter(MOVContext *mov, AVStream* st, MOVStreamContext *sc, AVPa
> > encryption_index = NULL;
> > if (frag_stream_info) {
> > // Note this only supports encryption info in the first sample descriptor.
> > - if (mov->fragment.stsd_id == 1) {
> > + if (frag_stream_info->stsd_id == 1) {
> > if (frag_stream_info->encryption_index) {
> > encrypted_index = current_index - frag_stream_info->index_base;
> > encryption_index = frag_stream_info->encryption_index;
>
> LGTM.
Applied
Thanks
Steven
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-21 6:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-01 13:29 [FFmpeg-devel] [PATCH] avformat/mov: get the correct fragment stsd_id when decrypting the sample 1035567130
2022-09-16 9:27 ` Zhao Zhili
2022-09-21 6:56 ` Steven Liu
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git