On 06/17/2014 11:00 PM, Anton Khirnov wrote: > On Tue, 17 Jun 2014 13:30:49 -0700, John Stebbins <[email protected]> > wrote: >> Add ability to handle multiple palettes and objects simultaneously. >> Each simultaneous object is given its own AVSubtitleRect. >> Note that there can be up to 64 currently valid objects, but only >> 2 at any one time can be "presented". >> --- >> libavcodec/pgssubdec.c | 352 >> +++++++++++++++++++++++++++++++++++-------------- >> 1 file changed, 252 insertions(+), 100 deletions(-) >> >> diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c >> index 4f175a3..ffb0f72 100644 >> --- a/libavcodec/pgssubdec.c >> +++ b/libavcodec/pgssubdec.c >> @@ -33,38 +33,107 @@ >> #include "libavutil/imgutils.h" >>
...
>>
>> +static void close_objects(PGSSubObjects *objects)
>> +{
>> + int i;
>> +
>> + for (i = 0; i < objects->count; i++) {
>> + av_freep(&objects->object[i].rle);
>> + objects->object[i].rle_buffer_size = 0;
>> + objects->object[i].rle_remaining_len = 0;
>> + }
>> + objects->count = 0;
>> +}
>> +
>> +static void close_palettes(PGSSubPalettes *palettes)
>> +{
>> + palettes->count = 0;
>> +}
> Does it make much sense for those two to be separate functions?
> I see they are always called together.
Ok, I'll combine into one function.
> + sub->rects[i] = av_mallocz(sizeof(*sub->rects[0]));
> + if (!sub->rects[i]) {
> + sub->num_rects = i;
> + return 1;
> Shouldn't you return 1 only if i > 0?
>
> Otherwise looks mostly fine, except for some cosmetics.
No. The end of the previous PGS is marked by the beginning of the next. A PGS
with 0 rects flags the point where you
should erase the previous subtitle. So in the case of an error, you still want
to indicate that the previous PGS should
be erased. But I think I will change the error handling for this out of memory
condition anyway. I'll just delete the
subtitle and return an error.
--
John GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01 83F0 49F1 D7B2 60D4 D0F7
signature.asc
Description: OpenPGP digital signature
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
