Originally committed as revision 24185 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -12,6 +12,10 @@ libavutil: 2009-03-08 · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | API changes, most recent first: | 13 | API changes, most recent first: |
| 14 | 14 | ||
| 15 | 2010-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 | |||
| 15 | 2010-07-08 - r24101 - lavu 50.21.0 - pixdesc.h | 19 | 2010-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 | ||
| @@ -677,18 +677,7 @@ static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect, int imgw, · 676 unmodified lines | |||
| 677 | 677 | ||
| 678 | static void free_subpicture(SubPicture *sp) | 678 | static 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 | ||
| 694 | static void video_image_display(VideoState *is) | 683 | static void video_image_display(VideoState *is) |
| @@ -30,7 +30,7 @@ · 29 unmodified lines | |||
| 30 | #include "libavutil/avutil.h" | 30 | #include "libavutil/avutil.h" |
| 31 | 31 | ||
| 32 | #define LIBAVCODEC_VERSION_MAJOR 52 | 32 | #define LIBAVCODEC_VERSION_MAJOR 52 |
| 33 | #define LIBAVCODEC_VERSION_MINOR 81 | 33 | #define LIBAVCODEC_VERSION_MINOR 82 |
| 34 | #define LIBAVCODEC_VERSION_MICRO 0 | 34 | #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 context | 3550 | * @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 | */ |
| 3555 | int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, | 3556 | int 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 | */ | ||
| 3565 | void avsubtitle_free(AVSubtitle *sub); | ||
| 3566 | |||
| 3558 | int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, | 3567 | int 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); |
| @@ -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 | ||
| 692 | void 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 | |||
| 692 | av_cold int avcodec_close(AVCodecContext *avctx) | 712 | av_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. */ |