History

Add avsubtitle_free function.

Originally committed as revision 24185 to svn://svn.ffmpeg.org/ffmpeg/trunk

Reimar Döffinger committed 16 years ago

Commit e1d7c881 parent c4265624 files · +36 −14Browse files

Unified · Split

4 files
  1. doc/APIchanges +4 −0
  2. ffplay.c +1 −12
  3. libavcodec/avcodec.h +11 −2
  4. libavcodec/utils.c +20 −0
doc/APIchanges+4−0
@@ -12,6 +12,10 @@ libavutil: 2009-03-08 · 11 unmodified lines
12 12
13API changes, most recent first:13API changes, most recent first:
14 14
152010-07-11 - r24185 - lavc 52.82.0 - avsubtitle_free()
16 Add a function for free the contents of a AVSubtitle generated by
17 avcodec_decode_subtitle.
18
152010-07-08 - r24101 - lavu 50.21.0 - pixdesc.h192010-07-08 - r24101 - lavu 50.21.0 - pixdesc.h
16 Rename read/write_line() to av_read/write_image_line().20 Rename read/write_line() to av_read/write_image_line().
17 21
ffplay.c+1−12
@@ -677,18 +677,7 @@ static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect, int imgw, · 676 unmodified lines
677 677
678static void free_subpicture(SubPicture *sp)678static void free_subpicture(SubPicture *sp)
679{679{
680 int i;680 avsubtitle_free(&sp->sub);
681
682 for (i = 0; i < sp->sub.num_rects; i++)
683 {
684 av_freep(&sp->sub.rects[i]->pict.data[0]);
685 av_freep(&sp->sub.rects[i]->pict.data[1]);
686 av_freep(&sp->sub.rects[i]);
687 }
688
689 av_free(sp->sub.rects);
690
691 memset(&sp->sub, 0, sizeof(AVSubtitle));
692}681}
693 682
694static void video_image_display(VideoState *is)683static void video_image_display(VideoState *is)
libavcodec/avcodec.h+11−2
@@ -30,7 +30,7 @@ · 29 unmodified lines
30#include "libavutil/avutil.h"30#include "libavutil/avutil.h"
31 31
32#define LIBAVCODEC_VERSION_MAJOR 5232#define LIBAVCODEC_VERSION_MAJOR 52
33#define LIBAVCODEC_VERSION_MINOR 8133#define LIBAVCODEC_VERSION_MINOR 82
34#define LIBAVCODEC_VERSION_MICRO 034#define LIBAVCODEC_VERSION_MICRO 0
35 35
36#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \36#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -3548,13 +3548,22 @@ attribute_deprecated int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtit · 3511 unmodified lines
3548 * due to a potentially very different allocation pattern.3548 * due to a potentially very different allocation pattern.
3549 *3549 *
3550 * @param avctx the codec context3550 * @param avctx the codec context
3551 * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored.3551 * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be
3552 freed with avsubtitle_free if *got_sub_ptr is set.
3552 * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.3553 * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
3553 * @param[in] avpkt The input AVPacket containing the input buffer.3554 * @param[in] avpkt The input AVPacket containing the input buffer.
3554 */3555 */
3555int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,3556int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
3556 int *got_sub_ptr,3557 int *got_sub_ptr,
3557 AVPacket *avpkt);3558 AVPacket *avpkt);
3559
3560/**
3561 * Frees all allocated data in the given subtitle struct.
3562 *
3563 * @param sub AVSubtitle to free.
3564 */
3565void avsubtitle_free(AVSubtitle *sub);
3566
3558int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,3567int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
3559 int *data_size_ptr,3568 int *data_size_ptr,
3560 uint8_t *buf, int buf_size);3569 uint8_t *buf, int buf_size);
libavcodec/utils.c+20−0
@@ -689,6 +689,26 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, · 688 unmodified lines
689 return ret;689 return ret;
690}690}
691 691
692void avsubtitle_free(AVSubtitle *sub)
693{
694 int i;
695
696 for (i = 0; i < sub->num_rects; i++)
697 {
698 av_freep(sub->rects[i]->pict.data[0]);
699 av_freep(sub->rects[i]->pict.data[1]);
700 av_freep(sub->rects[i]->pict.data[2]);
701 av_freep(sub->rects[i]->pict.data[3]);
702 av_freep(sub->rects[i]->text);
703 av_freep(sub->rects[i]->ass);
704 av_freep(sub->rects[i]);
705 }
706
707 av_freep(sub->rects);
708
709 memset(sub, 0, sizeof(AVSubtitle));
710}
711
692av_cold int avcodec_close(AVCodecContext *avctx)712av_cold int avcodec_close(AVCodecContext *avctx)
693{713{
694 /* If there is a user-supplied mutex locking routine, call it. */714 /* If there is a user-supplied mutex locking routine, call it. */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t