| 832 | } |
| 833 | |
| 834 | static void dvbsub_parse_object_segment(AVCodecContext *avctx, |
| 835 | const uint8_t *buf, int buf_size) |
| 836 | { |
| 837 | DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data; |
| 838 | |
| 839 | const uint8_t *buf_end = buf + buf_size; |
| 840 | const uint8_t *block; |
| 841 | int object_id; |
| 842 | DVBSubObject *object; |
| 843 | DVBSubObjectDisplay *display; |
| 844 | int top_field_len, bottom_field_len; |
| 845 | |
| 846 | int coding_method, non_modifying_color; |
| 847 | |
| 848 | object_id = AV_RB16(buf); |
| 849 | buf += 2; |
| 850 | |
| 851 | object = get_object(ctx, object_id); |
| 852 | |
| 853 | if (!object) |
| 854 | return; |
| 855 | |
| 856 | coding_method = ((*buf) >> 2) & 3; |
| 857 | non_modifying_color = ((*buf++) >> 1) & 1; |
| 858 | |
| 859 | if (coding_method == 0) { |
| 860 | top_field_len = AV_RB16(buf); |
| 861 | buf += 2; |
| 862 | bottom_field_len = AV_RB16(buf); |
| 863 | buf += 2; |
| 864 | |
| 865 | if (buf + top_field_len + bottom_field_len > buf_end) { |
| 866 | av_log(avctx, AV_LOG_ERROR, "Field data size too large\n"); |
| 867 | return; |
| 868 | } |
| 869 | |
| 870 | for (display = object->display_list; display; display = display->object_list_next) { |
| 871 | block = buf; |
| 872 | |
| 873 | dvbsub_parse_pixel_data_block(avctx, display, block, top_field_len, 0, |
| 874 | non_modifying_color); |
| 875 | |
| 876 | if (bottom_field_len > 0) |
| 877 | block = buf + top_field_len; |
| 878 | else |
| 879 | bottom_field_len = top_field_len; |
| 880 | |
| 881 | dvbsub_parse_pixel_data_block(avctx, display, block, bottom_field_len, 1, |
| 882 | non_modifying_color); |
| 883 | } |
| 884 | |
| 885 | /* } else if (coding_method == 1) {*/ |
| 886 | |
| 887 | } else { |
| 888 | av_log(avctx, AV_LOG_ERROR, "Unknown object coding %d\n", coding_method); |
| 889 | } |
| 890 | |
| 891 | } |
no test coverage detected