Advertisement
Guest User

Untitled

a guest
Sep 21st, 2016
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.35 KB | None | 0 0
  1. diff --git a/ffmpeg.c b/ffmpeg.c
  2. index b962d5e..c60b330 100644
  3. --- a/ffmpeg.c
  4. +++ b/ffmpeg.c
  5. @@ -750,6 +750,7 @@ static void close_output_stream(OutputStream *ost)
  6.  static void output_packet(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
  7.  {
  8.      int ret = 0;
  9. +    static int done = 0;
  10.  
  11.      /* apply the output bitstream filters, if any */
  12.      if (ost->nb_bitstream_filters) {
  13. @@ -782,6 +783,19 @@ static void output_packet(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
  14.      } else
  15.          write_packet(s, pkt, ost);
  16.  
  17. +    if (!done) {
  18. +        if(ost->nb_bitstream_filters && ost->bsf_ctx[0]->par_out->extradata_size) {
  19. +            av_freep(&ost->st->codecpar->extradata);
  20. +            ost->st->codecpar->extradata_size = 0;
  21. +            ost->st->codecpar->extradata = av_mallocz(ost->bsf_ctx[0]->par_out->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
  22. +            if (!ost->st->codecpar->extradata)
  23. +                goto finish;
  24. +            memcpy(ost->st->codecpar->extradata, ost->bsf_ctx[0]->par_out->extradata, ost->bsf_ctx[0]->par_out->extradata_size);
  25. +            ost->st->codecpar->extradata_size = ost->bsf_ctx[0]->par_out->extradata_size;
  26. +        }
  27. +        done = 1;
  28. +    }
  29. +
  30.  finish:
  31.      if (ret < 0 && ret != AVERROR_EOF) {
  32.          av_log(NULL, AV_LOG_FATAL, "Error applying bitstream filters to an output "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement