diff mbox

[FFmpeg-devel] avcodec/truehd_core: reset state when flushing

Message ID 20190505011211.2391-1-jamrial@gmail.com
State Accepted
Commit fcc01ba36a7a35d4e962f0e2a2a4739e890ba5cf
Headers show

Commit Message

James Almer May 5, 2019, 1:12 a.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/truehd_core_bsf.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Paul B Mahol May 5, 2019, 8:36 a.m. UTC | #1
On 5/5/19, James Almer <jamrial@gmail.com> wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/truehd_core_bsf.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/libavcodec/truehd_core_bsf.c b/libavcodec/truehd_core_bsf.c
> index 409e570eec..9e3ee07eed 100644
> --- a/libavcodec/truehd_core_bsf.c
> +++ b/libavcodec/truehd_core_bsf.c
> @@ -174,6 +174,12 @@ fail:
>      return ret;
>  }
>
> +static void truehd_core_flush(AVBSFContext *ctx)
> +{
> +    TrueHDCoreContext *s = ctx->priv_data;
> +    memset(&s->hdr, 0, sizeof(s->hdr));
> +}
> +
>  static const enum AVCodecID codec_ids[] = {
>      AV_CODEC_ID_TRUEHD, AV_CODEC_ID_NONE,
>  };
> @@ -182,5 +188,6 @@ const AVBitStreamFilter ff_truehd_core_bsf = {
>      .name           = "truehd_core",
>      .priv_data_size = sizeof(TrueHDCoreContext),
>      .filter         = truehd_core_filter,
> +    .flush          = truehd_core_flush,
>      .codec_ids      = codec_ids,
>  };
> --
> 2.21.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".

lgtm
James Almer May 5, 2019, 3:32 p.m. UTC | #2
On 5/5/2019 5:36 AM, Paul B Mahol wrote:
> On 5/5/19, James Almer <jamrial@gmail.com> wrote:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavcodec/truehd_core_bsf.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/libavcodec/truehd_core_bsf.c b/libavcodec/truehd_core_bsf.c
>> index 409e570eec..9e3ee07eed 100644
>> --- a/libavcodec/truehd_core_bsf.c
>> +++ b/libavcodec/truehd_core_bsf.c
>> @@ -174,6 +174,12 @@ fail:
>>      return ret;
>>  }
>>
>> +static void truehd_core_flush(AVBSFContext *ctx)
>> +{
>> +    TrueHDCoreContext *s = ctx->priv_data;
>> +    memset(&s->hdr, 0, sizeof(s->hdr));
>> +}
>> +
>>  static const enum AVCodecID codec_ids[] = {
>>      AV_CODEC_ID_TRUEHD, AV_CODEC_ID_NONE,
>>  };
>> @@ -182,5 +188,6 @@ const AVBitStreamFilter ff_truehd_core_bsf = {
>>      .name           = "truehd_core",
>>      .priv_data_size = sizeof(TrueHDCoreContext),
>>      .filter         = truehd_core_filter,
>> +    .flush          = truehd_core_flush,
>>      .codec_ids      = codec_ids,
>>  };
>> --
>> 2.21.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".
> 
> lgtm

Pushed, thanks.
diff mbox

Patch

diff --git a/libavcodec/truehd_core_bsf.c b/libavcodec/truehd_core_bsf.c
index 409e570eec..9e3ee07eed 100644
--- a/libavcodec/truehd_core_bsf.c
+++ b/libavcodec/truehd_core_bsf.c
@@ -174,6 +174,12 @@  fail:
     return ret;
 }
 
+static void truehd_core_flush(AVBSFContext *ctx)
+{
+    TrueHDCoreContext *s = ctx->priv_data;
+    memset(&s->hdr, 0, sizeof(s->hdr));
+}
+
 static const enum AVCodecID codec_ids[] = {
     AV_CODEC_ID_TRUEHD, AV_CODEC_ID_NONE,
 };
@@ -182,5 +188,6 @@  const AVBitStreamFilter ff_truehd_core_bsf = {
     .name           = "truehd_core",
     .priv_data_size = sizeof(TrueHDCoreContext),
     .filter         = truehd_core_filter,
+    .flush          = truehd_core_flush,
     .codec_ids      = codec_ids,
 };